The "window" and "style" arguments for replace_button_icon() are now unused. Remove them and refactor the function accordingly.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -1100,21 +1100,17 @@ static void fixup_rootmenu(struct menu *menu) · 1099 unmodified lines | |||
| 1100 | } | 1100 | } |
| 1101 | 1101 | ||
| 1102 | /* Main Window Initialization */ | 1102 | /* Main Window Initialization */ |
| 1103 | static void replace_button_icon(GladeXML *xml, GdkDrawable *window, | 1103 | static void replace_button_icon(GtkWidget *widget, const char * const xpm[]) |
| 1104 | GtkStyle *style, gchar *btn_name, gchar **xpm) | ||
| 1105 | { | 1104 | { |
| 1106 | GdkPixbuf *pixbuf; | 1105 | GdkPixbuf *pixbuf; |
| 1107 | GtkWidget *image; | 1106 | GtkWidget *image; |
| 1108 | GtkToolButton *button; | ||
| 1109 | 1107 | ||
| 1110 | pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)xpm); | 1108 | pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)xpm); |
| 1111 | image = gtk_image_new_from_pixbuf(pixbuf); | 1109 | image = gtk_image_new_from_pixbuf(pixbuf); |
| 1112 | g_object_unref(pixbuf); | 1110 | g_object_unref(pixbuf); |
| 1113 | 1111 | ||
| 1114 | button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, btn_name)); | ||
| 1115 | |||
| 1116 | gtk_widget_show(image); | 1112 | gtk_widget_show(image); |
| 1117 | gtk_tool_button_set_icon_widget(button, image); | 1113 | gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(widget), image); |
| 1118 | } | 1114 | } |
| 1119 | 1115 | ||
| 1120 | static void init_main_window(const gchar *glade_file) | 1116 | static void init_main_window(const gchar *glade_file) |
| @@ -1122,7 +1118,6 @@ static void init_main_window(const gchar *glade_file) · 1 unmodified line | |||
| 1122 | GladeXML *xml; | 1118 | GladeXML *xml; |
| 1123 | GtkWidget *widget; | 1119 | GtkWidget *widget; |
| 1124 | GtkTextBuffer *txtbuf; | 1120 | GtkTextBuffer *txtbuf; |
| 1125 | GtkStyle *style; | ||
| 1126 | 1121 | ||
| 1127 | xml = glade_xml_new(glade_file, "window1", NULL); | 1122 | xml = glade_xml_new(glade_file, "window1", NULL); |
| 1128 | if (!xml) | 1123 | if (!xml) |
| @@ -1229,25 +1224,20 @@ static void init_main_window(const gchar *glade_file) · 100 unmodified lines | |||
| 1229 | g_signal_connect(save_btn, "clicked", | 1224 | g_signal_connect(save_btn, "clicked", |
| 1230 | G_CALLBACK(on_save_clicked), NULL); | 1225 | G_CALLBACK(on_save_clicked), NULL); |
| 1231 | 1226 | ||
| 1232 | style = gtk_widget_get_style(main_wnd); | ||
| 1233 | |||
| 1234 | single_btn = glade_xml_get_widget(xml, "button4"); | 1227 | single_btn = glade_xml_get_widget(xml, "button4"); |
| 1235 | g_signal_connect(single_btn, "clicked", | 1228 | g_signal_connect(single_btn, "clicked", |
| 1236 | G_CALLBACK(on_single_clicked), NULL); | 1229 | G_CALLBACK(on_single_clicked), NULL); |
| 1237 | replace_button_icon(xml, main_wnd->window, style, | 1230 | replace_button_icon(single_btn, xpm_single_view); |
| 1238 | "button4", (gchar **) xpm_single_view); | ||
| 1239 | 1231 | ||
| 1240 | split_btn = glade_xml_get_widget(xml, "button5"); | 1232 | split_btn = glade_xml_get_widget(xml, "button5"); |
| 1241 | g_signal_connect(split_btn, "clicked", | 1233 | g_signal_connect(split_btn, "clicked", |
| 1242 | G_CALLBACK(on_split_clicked), NULL); | 1234 | G_CALLBACK(on_split_clicked), NULL); |
| 1243 | replace_button_icon(xml, main_wnd->window, style, | 1235 | replace_button_icon(split_btn, xpm_split_view); |
| 1244 | "button5", (gchar **) xpm_split_view); | ||
| 1245 | 1236 | ||
| 1246 | full_btn = glade_xml_get_widget(xml, "button6"); | 1237 | full_btn = glade_xml_get_widget(xml, "button6"); |
| 1247 | g_signal_connect(full_btn, "clicked", | 1238 | g_signal_connect(full_btn, "clicked", |
| 1248 | G_CALLBACK(on_full_clicked), NULL); | 1239 | G_CALLBACK(on_full_clicked), NULL); |
| 1249 | replace_button_icon(xml, main_wnd->window, style, | 1240 | replace_button_icon(full_btn, xpm_tree_view); |
| 1250 | "button6", (gchar **) xpm_tree_view); | ||
| 1251 | 1241 | ||
| 1252 | widget = glade_xml_get_widget(xml, "button7"); | 1242 | widget = glade_xml_get_widget(xml, "button7"); |
| 1253 | g_signal_connect(widget, "clicked", | 1243 | g_signal_connect(widget, "clicked", |