1
Description: Fix icons for new glib url handlers
2
Author: Michael Terry <michael.terry@canonical.com>
3
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=638775
5
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.c
6
===================================================================
7
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-capplet.c 2011-01-05 16:05:40.623854462 -0500
8
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.c 2011-01-05 16:12:03.030460004 -0500
19
gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active);
23
-refresh_combo_box_icons (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list)
27
- GtkTreeModel *model;
31
- for (entry = app_list; entry != NULL; entry = g_list_next (entry)) {
32
- item = (GnomeDAItem *) entry->data;
34
- model = gtk_combo_box_get_model (combo_box);
36
- if (item->icon_path && gtk_tree_model_get_iter_from_string (model, &iter, item->icon_path)) {
37
- pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL);
39
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
44
- g_object_unref (pixbuf);
53
icon = gtk_builder_get_object (capplet->builder, icons[i].name);
54
set_icon (GTK_IMAGE (icon), theme, icons[i].icon);
57
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers);
58
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers);
59
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players);
60
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals);
61
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats);
62
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats);
70
-fill_combo_box (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list, gboolean add_custom)
71
+fill_combo_box (GtkComboBox *combo_box, GList *app_list, gboolean add_custom)
75
GtkCellRenderer *renderer;
79
- if (theme == NULL) {
80
- theme = gtk_icon_theme_get_default ();
84
gtk_combo_box_set_row_separator_func (combo_box, is_separator,
85
GINT_TO_POINTER (g_list_length (app_list)), NULL);
88
- model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING));
89
+ model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_ICON, G_TYPE_STRING));
90
gtk_combo_box_set_model (combo_box, model);
92
renderer = gtk_cell_renderer_pixbuf_new ();
94
/* not all cells have a pixbuf, this prevents the combo box to shrink */
95
- gtk_cell_renderer_set_fixed_size (renderer, -1, 22);
96
+ gtk_cell_renderer_set_fixed_size (renderer, -1, 24);
97
+ g_object_set (G_OBJECT (renderer),
98
+ "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR,
100
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
101
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
102
- "pixbuf", PIXBUF_COL,
106
renderer = gtk_cell_renderer_text_new ();
107
@@ -436,18 +400,11 @@
109
item = (GnomeDAItem *) entry->data;
111
- pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL);
113
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
114
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
115
- PIXBUF_COL, pixbuf,
116
+ ICON_COL, item->icon,
117
TEXT_COL, item->name,
120
- item->icon_path = gtk_tree_model_get_string_from_iter (model, &iter);
123
- g_object_unref (pixbuf);
128
gtk_list_store_set (GTK_LIST_STORE (model), &iter, -1);
129
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
130
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
133
TEXT_COL, _("Custom"),
136
@@ -528,12 +485,12 @@
137
g_signal_connect (capplet->window, "screen-changed", G_CALLBACK (screen_changed_cb), capplet);
138
screen_changed_cb (capplet->window, gdk_screen_get_default (), capplet);
140
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, FALSE);
141
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, FALSE);
142
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals, TRUE);
143
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players, TRUE);
144
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats, TRUE);
145
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats, TRUE);
146
+ fill_combo_box (GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, FALSE);
147
+ fill_combo_box (GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, FALSE);
148
+ fill_combo_box (GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals, TRUE);
149
+ fill_combo_box (GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players, TRUE);
150
+ fill_combo_box (GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats, TRUE);
151
+ fill_combo_box (GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats, TRUE);
153
set_combo_to_default_for_scheme (GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, "http");
154
set_combo_to_default_for_scheme (GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, "mailto");
155
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.c
156
===================================================================
157
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-item.c 2011-01-05 16:04:48.644316418 -0500
158
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.c 2011-01-05 16:05:40.653854197 -0500
160
g_free (item->generic.name);
161
g_free (item->generic.executable);
162
g_free (item->generic.command);
163
- g_free (item->generic.icon_name);
164
- g_free (item->generic.icon_path);
165
+ if (item->generic.icon)
166
+ g_object_unref (item->generic.icon);
168
g_object_unref (item->app_info);
171
g_free (item->generic.name);
172
g_free (item->generic.executable);
173
g_free (item->generic.command);
174
- g_free (item->generic.icon_name);
175
- g_free (item->generic.icon_path);
176
+ if (item->generic.icon)
177
+ g_object_unref (item->generic.icon);
182
g_free (item->generic.name);
183
g_free (item->generic.executable);
184
g_free (item->generic.command);
185
- g_free (item->generic.icon_name);
186
- g_free (item->generic.icon_path);
187
+ if (item->generic.icon)
188
+ g_object_unref (item->generic.icon);
190
g_free (item->exec_flag);
193
g_free (item->generic.name);
194
g_free (item->generic.executable);
195
g_free (item->generic.command);
196
- g_free (item->generic.icon_name);
197
- g_free (item->generic.icon_path);
198
+ if (item->generic.icon)
199
+ g_object_unref (item->generic.icon);
204
g_free (item->generic.name);
205
g_free (item->generic.executable);
206
g_free (item->generic.command);
207
- g_free (item->generic.icon_name);
208
- g_free (item->generic.icon_path);
209
+ if (item->generic.icon)
210
+ g_object_unref (item->generic.icon);
214
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.h
215
===================================================================
216
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-item.h 2011-01-05 16:04:48.684316062 -0500
217
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.h 2011-01-05 16:05:40.653854197 -0500
227
struct _GnomeDASimpleItem {
228
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-xml.c
229
===================================================================
230
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-xml.c 2011-01-05 16:04:48.624316596 -0500
231
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-xml.c 2011-01-05 16:05:40.653854197 -0500
233
term_item->generic.name = gnome_da_xml_get_string (element, "name");
234
term_item->generic.executable = executable;
235
term_item->generic.command = gnome_da_xml_get_string (element, "command");
236
- term_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
237
+ term_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name"));
239
term_item->exec_flag = gnome_da_xml_get_string (element, "exec-flag");
242
media_item->generic.name = gnome_da_xml_get_string (element, "name");
243
media_item->generic.executable = executable;
244
media_item->generic.command = gnome_da_xml_get_string (element, "command");
245
- media_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
246
+ media_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name"));
248
media_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
251
visual_item->generic.name = gnome_da_xml_get_string (element, "name");
252
visual_item->generic.executable = executable;
253
visual_item->generic.command = gnome_da_xml_get_string (element, "command");
254
- visual_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
255
+ visual_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name"));
257
visual_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup");
260
mobility_item->generic.name = gnome_da_xml_get_string (element, "name");
261
mobility_item->generic.executable = executable;
262
mobility_item->generic.command = gnome_da_xml_get_string (element, "command");
263
- mobility_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
264
+ mobility_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name"));
266
mobility_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup");
268
@@ -246,12 +246,18 @@
269
executable = g_app_info_get_executable (app_info);
270
if (is_executable_valid (executable)) {
271
GnomeDAURLItem *url_item;
274
url_item = gnome_da_url_item_new ();
275
url_item->generic.name = g_strdup (g_app_info_get_display_name (app_info));
276
url_item->generic.executable = g_strdup (executable);
277
url_item->generic.command = g_strdup (g_app_info_get_commandline (app_info));
278
- url_item->generic.icon_name = g_strdup (g_app_info_get_name (app_info));
280
+ icon = g_app_info_get_icon (app_info);
281
+ if (icon != NULL) {
282
+ url_item->generic.icon = g_object_ref (icon);
285
/* Steal the reference */
286
url_item->app_info = app_info;