Lines 132-149
Link Here
|
132 |
static void load_options(xmlDoc *doc); |
132 |
static void load_options(xmlDoc *doc); |
133 |
static gboolean check_anything_changed(void); |
133 |
static gboolean check_anything_changed(void); |
134 |
|
134 |
|
135 |
static GList *build_label(Option *option, xmlNode *node, guchar *label); |
135 |
static GList *build_label(Option *option, xmlNode *node, gchar *label); |
136 |
static GList *build_spacer(Option *option, xmlNode *node, guchar *label); |
136 |
static GList *build_spacer(Option *option, xmlNode *node, gchar *label); |
137 |
static GList *build_frame(Option *option, xmlNode *node, guchar *label); |
137 |
static GList *build_frame(Option *option, xmlNode *node, gchar *label); |
138 |
|
138 |
|
139 |
static GList *build_toggle(Option *option, xmlNode *node, guchar *label); |
139 |
static GList *build_toggle(Option *option, xmlNode *node, gchar *label); |
140 |
static GList *build_slider(Option *option, xmlNode *node, guchar *label); |
140 |
static GList *build_slider(Option *option, xmlNode *node, gchar *label); |
141 |
static GList *build_entry(Option *option, xmlNode *node, guchar *label); |
141 |
static GList *build_entry(Option *option, xmlNode *node, gchar *label); |
142 |
static GList *build_numentry(Option *option, xmlNode *node, guchar *label); |
142 |
static GList *build_numentry(Option *option, xmlNode *node, gchar *label); |
143 |
static GList *build_radio_group(Option *option, xmlNode *node, guchar *label); |
143 |
static GList *build_radio_group(Option *option, xmlNode *node, gchar *label); |
144 |
static GList *build_colour(Option *option, xmlNode *node, guchar *label); |
144 |
static GList *build_colour(Option *option, xmlNode *node, gchar *label); |
145 |
static GList *build_menu(Option *option, xmlNode *node, guchar *label); |
145 |
static GList *build_menu(Option *option, xmlNode *node, gchar *label); |
146 |
static GList *build_font(Option *option, xmlNode *node, guchar *label); |
146 |
static GList *build_font(Option *option, xmlNode *node, gchar *label); |
147 |
|
147 |
|
148 |
/**************************************************************** |
148 |
/**************************************************************** |
149 |
* EXTERNAL INTERFACE * |
149 |
* EXTERNAL INTERFACE * |
Lines 210-216
Link Here
|
210 |
*/ |
210 |
*/ |
211 |
void option_check_widget(Option *option) |
211 |
void option_check_widget(Option *option) |
212 |
{ |
212 |
{ |
213 |
guchar *new = NULL; |
213 |
gchar *new = NULL; |
214 |
|
214 |
|
215 |
if (updating_widgets) |
215 |
if (updating_widgets) |
216 |
return; /* Not caused by the user... */ |
216 |
return; /* Not caused by the user... */ |
Lines 493-503
Link Here
|
493 |
/* These are used during parsing... */ |
493 |
/* These are used during parsing... */ |
494 |
static xmlDocPtr options_doc = NULL; |
494 |
static xmlDocPtr options_doc = NULL; |
495 |
|
495 |
|
496 |
#define DATA(node) (xmlNodeListGetString(options_doc, node->xmlChildrenNode, 1)) |
496 |
#define DATA(node) (gchar*)(xmlNodeListGetString(options_doc, node->xmlChildrenNode, 1)) |
497 |
|
497 |
|
498 |
static void may_add_tip(GtkWidget *widget, xmlNode *element) |
498 |
static void may_add_tip(GtkWidget *widget, xmlNode *element) |
499 |
{ |
499 |
{ |
500 |
guchar *data, *tip; |
500 |
gchar *data, *tip; |
501 |
|
501 |
|
502 |
data = DATA(element); |
502 |
data = DATA(element); |
503 |
if (!data) |
503 |
if (!data) |
Lines 511-522
Link Here
|
511 |
} |
511 |
} |
512 |
|
512 |
|
513 |
/* Returns zero if attribute is not present */ |
513 |
/* Returns zero if attribute is not present */ |
514 |
static int get_int(xmlNode *node, guchar *attr) |
514 |
static int get_int(xmlNode *node, gchar *attr) |
515 |
{ |
515 |
{ |
516 |
guchar *txt; |
516 |
gchar *txt; |
517 |
int retval; |
517 |
int retval; |
|
|
518 |
guchar* my_attr = (guchar *)attr; |
518 |
|
519 |
|
519 |
txt = xmlGetProp(node, attr); |
520 |
txt = (gchar*)xmlGetProp(node, my_attr); |
520 |
if (!txt) |
521 |
if (!txt) |
521 |
return 0; |
522 |
return 0; |
522 |
|
523 |
|
Lines 541-547
Link Here
|
541 |
g_return_if_fail(node != NULL); |
542 |
g_return_if_fail(node != NULL); |
542 |
g_return_if_fail(widget != NULL); |
543 |
g_return_if_fail(widget != NULL); |
543 |
|
544 |
|
544 |
name = xmlGetProp(node, "sizegroup"); |
545 |
name = xmlGetProp(node, (xmlChar*)"sizegroup"); |
545 |
if (!name) |
546 |
if (!name) |
546 |
return; |
547 |
return; |
547 |
|
548 |
|
Lines 570-578
Link Here
|
570 |
{ |
571 |
{ |
571 |
GtkWidget *button; |
572 |
GtkWidget *button; |
572 |
GtkRadioButton *prev_button = (GtkRadioButton *) prev; |
573 |
GtkRadioButton *prev_button = (GtkRadioButton *) prev; |
573 |
guchar *label; |
574 |
gchar *label; |
574 |
|
575 |
|
575 |
label = xmlGetProp(radio, "label"); |
576 |
label = (gchar*)xmlGetProp(radio, (xmlChar*)"label"); |
576 |
|
577 |
|
577 |
button = gtk_radio_button_new_with_label( |
578 |
button = gtk_radio_button_new_with_label( |
578 |
prev_button ? gtk_radio_button_get_group(prev_button) |
579 |
prev_button ? gtk_radio_button_get_group(prev_button) |
Lines 583-589
Link Here
|
583 |
may_add_tip(button, radio); |
584 |
may_add_tip(button, radio); |
584 |
|
585 |
|
585 |
g_object_set_data(G_OBJECT(button), "value", |
586 |
g_object_set_data(G_OBJECT(button), "value", |
586 |
xmlGetProp(radio, "value")); |
587 |
xmlGetProp(radio, (xmlChar*)"value")); |
587 |
|
588 |
|
588 |
return button; |
589 |
return button; |
589 |
} |
590 |
} |
Lines 591-601
Link Here
|
591 |
static void build_menu_item(xmlNode *node, GtkWidget *option_menu) |
592 |
static void build_menu_item(xmlNode *node, GtkWidget *option_menu) |
592 |
{ |
593 |
{ |
593 |
GtkWidget *item, *menu; |
594 |
GtkWidget *item, *menu; |
594 |
guchar *label; |
595 |
gchar *label; |
595 |
|
596 |
|
596 |
g_return_if_fail(strcmp(node->name, "item") == 0); |
597 |
g_return_if_fail(strcmp((gchar*)node->name, "item") == 0); |
597 |
|
598 |
|
598 |
label = xmlGetProp(node, "label"); |
599 |
label = (gchar*)xmlGetProp(node, (xmlChar*)"label"); |
599 |
item = gtk_menu_item_new_with_label(_(label)); |
600 |
item = gtk_menu_item_new_with_label(_(label)); |
600 |
g_free(label); |
601 |
g_free(label); |
601 |
|
602 |
|
Lines 603-620
Link Here
|
603 |
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
604 |
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
604 |
gtk_widget_show_all(menu); |
605 |
gtk_widget_show_all(menu); |
605 |
|
606 |
|
606 |
g_object_set_data(G_OBJECT(item), "value", xmlGetProp(node, "value")); |
607 |
g_object_set_data(G_OBJECT(item), "value", xmlGetProp(node, (xmlChar*)"value")); |
607 |
} |
608 |
} |
608 |
|
609 |
|
609 |
static void build_widget(xmlNode *widget, GtkWidget *box) |
610 |
static void build_widget(xmlNode *widget, GtkWidget *box) |
610 |
{ |
611 |
{ |
611 |
const char *name = widget->name; |
612 |
const char *name = (gchar*)widget->name; |
612 |
OptionBuildFn builder; |
613 |
OptionBuildFn builder; |
613 |
guchar *oname; |
614 |
gchar *oname; |
614 |
Option *option; |
615 |
Option *option; |
615 |
guchar *label; |
616 |
gchar *label; |
616 |
|
617 |
|
617 |
label = xmlGetProp(widget, "label"); |
618 |
label = (gchar*)xmlGetProp(widget, (xmlChar*)"label"); |
618 |
|
619 |
|
619 |
if (strcmp(name, "hbox") == 0 || strcmp(name, "vbox") == 0) |
620 |
if (strcmp(name, "hbox") == 0 || strcmp(name, "vbox") == 0) |
620 |
{ |
621 |
{ |
Lines 641-647
Link Here
|
641 |
return; |
642 |
return; |
642 |
} |
643 |
} |
643 |
|
644 |
|
644 |
oname = xmlGetProp(widget, "name"); |
645 |
oname = (gchar*)xmlGetProp(widget, (xmlChar*)"name"); |
645 |
|
646 |
|
646 |
if (oname) |
647 |
if (oname) |
647 |
{ |
648 |
{ |
Lines 685-696
Link Here
|
685 |
static void build_section(xmlNode *section, GtkWidget *notebook, |
686 |
static void build_section(xmlNode *section, GtkWidget *notebook, |
686 |
GtkTreeStore *tree_store, GtkTreeIter *parent) |
687 |
GtkTreeStore *tree_store, GtkTreeIter *parent) |
687 |
{ |
688 |
{ |
688 |
guchar *title = NULL; |
689 |
gchar *title = NULL; |
689 |
GtkWidget *page; |
690 |
GtkWidget *page; |
690 |
GtkTreeIter iter; |
691 |
GtkTreeIter iter; |
691 |
xmlNode *widget; |
692 |
xmlNode *widget; |
692 |
|
693 |
|
693 |
title = xmlGetProp(section, "title"); |
694 |
title = (gchar*)xmlGetProp(section, (xmlChar*)"title"); |
694 |
page = gtk_vbox_new(FALSE, 4); |
695 |
page = gtk_vbox_new(FALSE, 4); |
695 |
gtk_container_set_border_width(GTK_CONTAINER(page), 4); |
696 |
gtk_container_set_border_width(GTK_CONTAINER(page), 4); |
696 |
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, NULL); |
697 |
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, NULL); |
Lines 704-710
Link Here
|
704 |
{ |
705 |
{ |
705 |
if (widget->type == XML_ELEMENT_NODE) |
706 |
if (widget->type == XML_ELEMENT_NODE) |
706 |
{ |
707 |
{ |
707 |
if (strcmp(widget->name, "section") == 0) |
708 |
if (strcmp((gchar*)widget->name, "section") == 0) |
708 |
build_section(widget, notebook, |
709 |
build_section(widget, notebook, |
709 |
tree_store, &iter); |
710 |
tree_store, &iter); |
710 |
else |
711 |
else |
Lines 740-746
Link Here
|
740 |
g_free(path); |
741 |
g_free(path); |
741 |
|
742 |
|
742 |
options = xmlDocGetRootElement(options_doc); |
743 |
options = xmlDocGetRootElement(options_doc); |
743 |
if (strcmp(options->name, "options") == 0) |
744 |
if (strcmp((gchar*)options->name, "options") == 0) |
744 |
{ |
745 |
{ |
745 |
GtkTreePath *treepath; |
746 |
GtkTreePath *treepath; |
746 |
|
747 |
|
Lines 928-941
Link Here
|
928 |
/* Given the last radio button in the group, select whichever |
929 |
/* Given the last radio button in the group, select whichever |
929 |
* radio button matches the given value. |
930 |
* radio button matches the given value. |
930 |
*/ |
931 |
*/ |
931 |
static void radio_group_set_value(GtkRadioButton *last, guchar *value) |
932 |
static void radio_group_set_value(GtkRadioButton *last, gchar *value) |
932 |
{ |
933 |
{ |
933 |
GSList *next; |
934 |
GSList *next; |
934 |
|
935 |
|
935 |
for (next = gtk_radio_button_get_group(last); next; next = next->next) |
936 |
for (next = gtk_radio_button_get_group(last); next; next = next->next) |
936 |
{ |
937 |
{ |
937 |
GtkToggleButton *button = (GtkToggleButton *) next->data; |
938 |
GtkToggleButton *button = (GtkToggleButton *) next->data; |
938 |
guchar *val; |
939 |
gchar *val; |
939 |
|
940 |
|
940 |
val = g_object_get_data(G_OBJECT(button), "value"); |
941 |
val = g_object_get_data(G_OBJECT(button), "value"); |
941 |
g_return_if_fail(val != NULL); |
942 |
g_return_if_fail(val != NULL); |
Lines 953-959
Link Here
|
953 |
/* Given the last radio button in the group, return a copy of the |
954 |
/* Given the last radio button in the group, return a copy of the |
954 |
* value for the selected radio item. |
955 |
* value for the selected radio item. |
955 |
*/ |
956 |
*/ |
956 |
static guchar *radio_group_get_value(GtkRadioButton *last) |
957 |
static gchar *radio_group_get_value(GtkRadioButton *last) |
957 |
{ |
958 |
{ |
958 |
GSList *next; |
959 |
GSList *next; |
959 |
|
960 |
|
Lines 963-969
Link Here
|
963 |
|
964 |
|
964 |
if (gtk_toggle_button_get_active(button)) |
965 |
if (gtk_toggle_button_get_active(button)) |
965 |
{ |
966 |
{ |
966 |
guchar *val; |
967 |
gchar *val; |
967 |
|
968 |
|
968 |
val = g_object_get_data(G_OBJECT(button), "value"); |
969 |
val = g_object_get_data(G_OBJECT(button), "value"); |
969 |
g_return_val_if_fail(val != NULL, NULL); |
970 |
g_return_val_if_fail(val != NULL, NULL); |
Lines 976-982
Link Here
|
976 |
} |
977 |
} |
977 |
|
978 |
|
978 |
/* Select this item with this value */ |
979 |
/* Select this item with this value */ |
979 |
static void option_menu_set(GtkOptionMenu *om, guchar *value) |
980 |
static void option_menu_set(GtkOptionMenu *om, gchar *value) |
980 |
{ |
981 |
{ |
981 |
GtkWidget *menu; |
982 |
GtkWidget *menu; |
982 |
GList *list, *next; |
983 |
GList *list, *next; |
Lines 988-994
Link Here
|
988 |
for (next = list; next; next = next->next) |
989 |
for (next = list; next; next = next->next) |
989 |
{ |
990 |
{ |
990 |
GObject *item = (GObject *) next->data; |
991 |
GObject *item = (GObject *) next->data; |
991 |
guchar *data; |
992 |
gchar *data; |
992 |
|
993 |
|
993 |
data = g_object_get_data(item, "value"); |
994 |
data = g_object_get_data(item, "value"); |
994 |
g_return_if_fail(data != NULL); |
995 |
g_return_if_fail(data != NULL); |
Lines 1006-1012
Link Here
|
1006 |
} |
1007 |
} |
1007 |
|
1008 |
|
1008 |
/* Get the value (static) of the selected item */ |
1009 |
/* Get the value (static) of the selected item */ |
1009 |
static guchar *option_menu_get(GtkOptionMenu *om) |
1010 |
static gchar *option_menu_get(GtkOptionMenu *om) |
1010 |
{ |
1011 |
{ |
1011 |
GtkWidget *menu, *item; |
1012 |
GtkWidget *menu, *item; |
1012 |
|
1013 |
|
Lines 1067-1081
Link Here
|
1067 |
Option *option = (Option *) value; |
1068 |
Option *option = (Option *) value; |
1068 |
xmlNodePtr tree; |
1069 |
xmlNodePtr tree; |
1069 |
|
1070 |
|
1070 |
tree = xmlNewTextChild(doc, NULL, "Option", option->value); |
1071 |
tree = xmlNewTextChild(doc, NULL, (xmlChar*)"Option", (xmlChar*)option->value); |
1071 |
xmlSetProp(tree, "name", (gchar *) key); |
1072 |
xmlSetProp(tree, (xmlChar*)"name", (guchar *) key); |
1072 |
} |
1073 |
} |
1073 |
|
1074 |
|
1074 |
static void save_options(void) |
1075 |
static void save_options(void) |
1075 |
{ |
1076 |
{ |
1076 |
xmlDoc *doc; |
1077 |
xmlDoc *doc; |
1077 |
GList *next; |
1078 |
GList *next; |
1078 |
guchar *save, *save_new; |
1079 |
gchar *save, *save_new; |
1079 |
|
1080 |
|
1080 |
save = choices_find_path_save("Options", PROJECT, TRUE); |
1081 |
save = choices_find_path_save("Options", PROJECT, TRUE); |
1081 |
if (!save) |
1082 |
if (!save) |
Lines 1083-1090
Link Here
|
1083 |
|
1084 |
|
1084 |
save_new = g_strconcat(save, ".new", NULL); |
1085 |
save_new = g_strconcat(save, ".new", NULL); |
1085 |
|
1086 |
|
1086 |
doc = xmlNewDoc("1.0"); |
1087 |
doc = xmlNewDoc((xmlChar*)"1.0"); |
1087 |
xmlDocSetRootElement(doc, xmlNewDocNode(doc, NULL, "Options", NULL)); |
1088 |
xmlDocSetRootElement(doc, xmlNewDocNode(doc, NULL, (xmlChar*)"Options", NULL)); |
1088 |
|
1089 |
|
1089 |
g_hash_table_foreach(option_hash, write_option, |
1090 |
g_hash_table_foreach(option_hash, write_option, |
1090 |
xmlDocGetRootElement(doc)); |
1091 |
xmlDocGetRootElement(doc)); |
Lines 1184-1190
Link Here
|
1184 |
|
1185 |
|
1185 |
gtk_label_set_text(GTK_LABEL(option->widget), |
1186 |
gtk_label_set_text(GTK_LABEL(option->widget), |
1186 |
have_font ? option->value |
1187 |
have_font ? option->value |
1187 |
: (guchar *) _("(use default)")); |
1188 |
: _("(use default)")); |
1188 |
} |
1189 |
} |
1189 |
|
1190 |
|
1190 |
static void update_colour(Option *option) |
1191 |
static void update_colour(Option *option) |
Lines 1199-1239
Link Here
|
1199 |
* from the widget. |
1200 |
* from the widget. |
1200 |
*/ |
1201 |
*/ |
1201 |
|
1202 |
|
1202 |
static guchar *read_toggle(Option *option) |
1203 |
static gchar *read_toggle(Option *option) |
1203 |
{ |
1204 |
{ |
1204 |
GtkToggleButton *toggle = GTK_TOGGLE_BUTTON(option->widget); |
1205 |
GtkToggleButton *toggle = GTK_TOGGLE_BUTTON(option->widget); |
1205 |
|
1206 |
|
1206 |
return g_strdup_printf("%d", gtk_toggle_button_get_active(toggle)); |
1207 |
return g_strdup_printf("%d", gtk_toggle_button_get_active(toggle)); |
1207 |
} |
1208 |
} |
1208 |
|
1209 |
|
1209 |
static guchar *read_entry(Option *option) |
1210 |
static gchar *read_entry(Option *option) |
1210 |
{ |
1211 |
{ |
1211 |
return gtk_editable_get_chars(GTK_EDITABLE(option->widget), 0, -1); |
1212 |
return gtk_editable_get_chars(GTK_EDITABLE(option->widget), 0, -1); |
1212 |
} |
1213 |
} |
1213 |
|
1214 |
|
1214 |
static guchar *read_numentry(Option *option) |
1215 |
static gchar *read_numentry(Option *option) |
1215 |
{ |
1216 |
{ |
1216 |
return g_strdup_printf("%d", (int) |
1217 |
return g_strdup_printf("%d", (int) |
1217 |
gtk_spin_button_get_value(GTK_SPIN_BUTTON(option->widget))); |
1218 |
gtk_spin_button_get_value(GTK_SPIN_BUTTON(option->widget))); |
1218 |
} |
1219 |
} |
1219 |
|
1220 |
|
1220 |
static guchar *read_slider(Option *option) |
1221 |
static gchar *read_slider(Option *option) |
1221 |
{ |
1222 |
{ |
1222 |
return g_strdup_printf("%d", (int) |
1223 |
return g_strdup_printf("%d", (int) |
1223 |
gtk_range_get_adjustment(GTK_RANGE(option->widget))->value); |
1224 |
gtk_range_get_adjustment(GTK_RANGE(option->widget))->value); |
1224 |
} |
1225 |
} |
1225 |
|
1226 |
|
1226 |
static guchar *read_radio_group(Option *option) |
1227 |
static gchar *read_radio_group(Option *option) |
1227 |
{ |
1228 |
{ |
1228 |
return radio_group_get_value(GTK_RADIO_BUTTON(option->widget)); |
1229 |
return radio_group_get_value(GTK_RADIO_BUTTON(option->widget)); |
1229 |
} |
1230 |
} |
1230 |
|
1231 |
|
1231 |
static guchar *read_menu(Option *option) |
1232 |
static gchar *read_menu(Option *option) |
1232 |
{ |
1233 |
{ |
1233 |
return g_strdup(option_menu_get(GTK_OPTION_MENU(option->widget))); |
1234 |
return g_strdup(option_menu_get(GTK_OPTION_MENU(option->widget))); |
1234 |
} |
1235 |
} |
1235 |
|
1236 |
|
1236 |
static guchar *read_font(Option *option) |
1237 |
static gchar *read_font(Option *option) |
1237 |
{ |
1238 |
{ |
1238 |
GtkToggleButton *active; |
1239 |
GtkToggleButton *active; |
1239 |
|
1240 |
|
Lines 1244-1250
Link Here
|
1244 |
return g_strdup(gtk_label_get_text(GTK_LABEL(option->widget))); |
1245 |
return g_strdup(gtk_label_get_text(GTK_LABEL(option->widget))); |
1245 |
} |
1246 |
} |
1246 |
|
1247 |
|
1247 |
static guchar *read_colour(Option *option) |
1248 |
static gchar *read_colour(Option *option) |
1248 |
{ |
1249 |
{ |
1249 |
GtkStyle *style = GTK_BIN(option->widget)->child->style; |
1250 |
GtkStyle *style = GTK_BIN(option->widget)->child->style; |
1250 |
|
1251 |
|
Lines 1263-1272
Link Here
|
1263 |
|
1264 |
|
1264 |
/* Builders for decorations (no corresponding option) */ |
1265 |
/* Builders for decorations (no corresponding option) */ |
1265 |
|
1266 |
|
1266 |
static GList *build_label(Option *option, xmlNode *node, guchar *label) |
1267 |
static GList *build_label(Option *option, xmlNode *node, gchar *label) |
1267 |
{ |
1268 |
{ |
1268 |
GtkWidget *widget; |
1269 |
GtkWidget *widget; |
1269 |
guchar *text; |
1270 |
gchar *text; |
1270 |
int help; |
1271 |
int help; |
1271 |
|
1272 |
|
1272 |
g_return_val_if_fail(option == NULL, NULL); |
1273 |
g_return_val_if_fail(option == NULL, NULL); |
Lines 1304-1310
Link Here
|
1304 |
return g_list_append(NULL, widget); |
1305 |
return g_list_append(NULL, widget); |
1305 |
} |
1306 |
} |
1306 |
|
1307 |
|
1307 |
static GList *build_spacer(Option *option, xmlNode *node, guchar *label) |
1308 |
static GList *build_spacer(Option *option, xmlNode *node, gchar *label) |
1308 |
{ |
1309 |
{ |
1309 |
GtkWidget *eb; |
1310 |
GtkWidget *eb; |
1310 |
|
1311 |
|
Lines 1317-1323
Link Here
|
1317 |
return g_list_append(NULL, eb); |
1318 |
return g_list_append(NULL, eb); |
1318 |
} |
1319 |
} |
1319 |
|
1320 |
|
1320 |
static GList *build_frame(Option *option, xmlNode *node, guchar *label) |
1321 |
static GList *build_frame(Option *option, xmlNode *node, gchar *label) |
1321 |
{ |
1322 |
{ |
1322 |
GtkWidget *nbox, *frame, *label_widget; |
1323 |
GtkWidget *nbox, *frame, *label_widget; |
1323 |
xmlNode *hw; |
1324 |
xmlNode *hw; |
Lines 1355-1361
Link Here
|
1355 |
* callbacks. |
1356 |
* callbacks. |
1356 |
*/ |
1357 |
*/ |
1357 |
|
1358 |
|
1358 |
static GList *build_toggle(Option *option, xmlNode *node, guchar *label) |
1359 |
static GList *build_toggle(Option *option, xmlNode *node, gchar *label) |
1359 |
{ |
1360 |
{ |
1360 |
GtkWidget *toggle; |
1361 |
GtkWidget *toggle; |
1361 |
|
1362 |
|
Lines 1375-1388
Link Here
|
1375 |
return g_list_append(NULL, toggle); |
1376 |
return g_list_append(NULL, toggle); |
1376 |
} |
1377 |
} |
1377 |
|
1378 |
|
1378 |
static GList *build_slider(Option *option, xmlNode *node, guchar *label) |
1379 |
static GList *build_slider(Option *option, xmlNode *node, gchar *label) |
1379 |
{ |
1380 |
{ |
1380 |
GtkAdjustment *adj; |
1381 |
GtkAdjustment *adj; |
1381 |
GtkWidget *hbox, *slide, *label_wid; |
1382 |
GtkWidget *hbox, *slide, *label_wid; |
1382 |
int min, max; |
1383 |
int min, max; |
1383 |
int fixed; |
1384 |
int fixed; |
1384 |
int showvalue; |
1385 |
int showvalue; |
1385 |
guchar *end; |
1386 |
gchar *end; |
1386 |
|
1387 |
|
1387 |
g_return_val_if_fail(option != NULL, NULL); |
1388 |
g_return_val_if_fail(option != NULL, NULL); |
1388 |
|
1389 |
|
Lines 1404-1410
Link Here
|
1404 |
add_to_size_group(node, label_wid); |
1405 |
add_to_size_group(node, label_wid); |
1405 |
} |
1406 |
} |
1406 |
|
1407 |
|
1407 |
end = xmlGetProp(node, "end"); |
1408 |
end = (gchar*)xmlGetProp(node, (xmlChar*)"end"); |
1408 |
if (end) |
1409 |
if (end) |
1409 |
{ |
1410 |
{ |
1410 |
gtk_box_pack_end(GTK_BOX(hbox), gtk_label_new(_(end)), |
1411 |
gtk_box_pack_end(GTK_BOX(hbox), gtk_label_new(_(end)), |
Lines 1441-1447
Link Here
|
1441 |
return g_list_append(NULL, hbox); |
1442 |
return g_list_append(NULL, hbox); |
1442 |
} |
1443 |
} |
1443 |
|
1444 |
|
1444 |
static GList *build_entry(Option *option, xmlNode *node, guchar *label) |
1445 |
static GList *build_entry(Option *option, xmlNode *node, gchar *label) |
1445 |
{ |
1446 |
{ |
1446 |
GtkWidget *hbox; |
1447 |
GtkWidget *hbox; |
1447 |
GtkWidget *entry; |
1448 |
GtkWidget *entry; |
Lines 1474-1485
Link Here
|
1474 |
return g_list_append(NULL, hbox); |
1475 |
return g_list_append(NULL, hbox); |
1475 |
} |
1476 |
} |
1476 |
|
1477 |
|
1477 |
static GList *build_numentry(Option *option, xmlNode *node, guchar *label) |
1478 |
static GList *build_numentry(Option *option, xmlNode *node, gchar *label) |
1478 |
{ |
1479 |
{ |
1479 |
GtkWidget *hbox; |
1480 |
GtkWidget *hbox; |
1480 |
GtkWidget *spin; |
1481 |
GtkWidget *spin; |
1481 |
GtkWidget *label_wid; |
1482 |
GtkWidget *label_wid; |
1482 |
guchar *unit; |
1483 |
gchar *unit; |
1483 |
int min, max, step, width; |
1484 |
int min, max, step, width; |
1484 |
|
1485 |
|
1485 |
g_return_val_if_fail(option != NULL, NULL); |
1486 |
g_return_val_if_fail(option != NULL, NULL); |
Lines 1488-1494
Link Here
|
1488 |
max = get_int(node, "max"); |
1489 |
max = get_int(node, "max"); |
1489 |
step = get_int(node, "step"); |
1490 |
step = get_int(node, "step"); |
1490 |
width = get_int(node, "width"); |
1491 |
width = get_int(node, "width"); |
1491 |
unit = xmlGetProp(node, "unit"); |
1492 |
unit = (gchar*)xmlGetProp(node, (xmlChar*)"unit"); |
1492 |
|
1493 |
|
1493 |
hbox = gtk_hbox_new(FALSE, 4); |
1494 |
hbox = gtk_hbox_new(FALSE, 4); |
1494 |
|
1495 |
|
Lines 1522-1528
Link Here
|
1522 |
return g_list_append(NULL, hbox); |
1523 |
return g_list_append(NULL, hbox); |
1523 |
} |
1524 |
} |
1524 |
|
1525 |
|
1525 |
static GList *build_radio_group(Option *option, xmlNode *node, guchar *label) |
1526 |
static GList *build_radio_group(Option *option, xmlNode *node, gchar *label) |
1526 |
{ |
1527 |
{ |
1527 |
GList *list = NULL; |
1528 |
GList *list = NULL; |
1528 |
GtkWidget *button = NULL; |
1529 |
GtkWidget *button = NULL; |
Lines 1579-1585
Link Here
|
1579 |
return list; |
1580 |
return list; |
1580 |
} |
1581 |
} |
1581 |
|
1582 |
|
1582 |
static GList *build_colour(Option *option, xmlNode *node, guchar *label) |
1583 |
static GList *build_colour(Option *option, xmlNode *node, gchar *label) |
1583 |
{ |
1584 |
{ |
1584 |
GtkWidget *hbox, *da, *button, *label_wid; |
1585 |
GtkWidget *hbox, *da, *button, *label_wid; |
1585 |
|
1586 |
|
Lines 1611-1617
Link Here
|
1611 |
return g_list_append(NULL, hbox); |
1612 |
return g_list_append(NULL, hbox); |
1612 |
} |
1613 |
} |
1613 |
|
1614 |
|
1614 |
static GList *build_menu(Option *option, xmlNode *node, guchar *label) |
1615 |
static GList *build_menu(Option *option, xmlNode *node, gchar *label) |
1615 |
{ |
1616 |
{ |
1616 |
GtkWidget *hbox, *om, *option_menu, *label_wid; |
1617 |
GtkWidget *hbox, *om, *option_menu, *label_wid; |
1617 |
xmlNode *item; |
1618 |
xmlNode *item; |
Lines 1649-1655
Link Here
|
1649 |
return g_list_append(NULL, hbox); |
1650 |
return g_list_append(NULL, hbox); |
1650 |
} |
1651 |
} |
1651 |
|
1652 |
|
1652 |
static GList *build_font(Option *option, xmlNode *node, guchar *label) |
1653 |
static GList *build_font(Option *option, xmlNode *node, gchar *label) |
1653 |
{ |
1654 |
{ |
1654 |
GtkWidget *hbox, *button; |
1655 |
GtkWidget *hbox, *button; |
1655 |
GtkWidget *active = NULL; |
1656 |
GtkWidget *active = NULL; |
Lines 1714-1734
Link Here
|
1714 |
|
1715 |
|
1715 |
root = xmlDocGetRootElement(doc); |
1716 |
root = xmlDocGetRootElement(doc); |
1716 |
|
1717 |
|
1717 |
g_return_if_fail(strcmp(root->name, "Options") == 0); |
1718 |
g_return_if_fail(strcmp((const gchar*)root->name, "Options") == 0); |
1718 |
|
1719 |
|
1719 |
for (node = root->xmlChildrenNode; node; node = node->next) |
1720 |
for (node = root->xmlChildrenNode; node; node = node->next) |
1720 |
{ |
1721 |
{ |
1721 |
gchar *value, *name; |
1722 |
gchar *name; |
|
|
1723 |
gchar *value; |
1722 |
|
1724 |
|
1723 |
if (node->type != XML_ELEMENT_NODE) |
1725 |
if (node->type != XML_ELEMENT_NODE) |
1724 |
continue; |
1726 |
continue; |
1725 |
if (strcmp(node->name, "Option") != 0) |
1727 |
if (strcmp((gchar*)node->name, "Option") != 0) |
1726 |
continue; |
1728 |
continue; |
1727 |
name = xmlGetProp(node, "name"); |
1729 |
name = (gchar*)xmlGetProp(node, (xmlChar*)"name"); |
1728 |
if (!name) |
1730 |
if (!name) |
1729 |
continue; |
1731 |
continue; |
1730 |
|
1732 |
|
1731 |
value = xmlNodeGetContent(node); |
1733 |
value = (gchar*)xmlNodeGetContent(node); |
1732 |
|
1734 |
|
1733 |
if (g_hash_table_lookup(loading, name)) |
1735 |
if (g_hash_table_lookup(loading, name)) |
1734 |
g_warning("Duplicate option found!"); |
1736 |
g_warning("Duplicate option found!"); |