~kroq-gar78/ubuntu/precise/gnome-control-center/fix-885947

« back to all changes in this revision

Viewing changes to debian/patches/142_fix_icons_for_default_apps.patch

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Moya
  • Date: 2011-05-17 10:47:27 UTC
  • mfrom: (0.1.11 experimental) (1.1.45 upstream)
  • Revision ID: james.westby@ubuntu.com-20110517104727-lqel6m8vhfw5jby1
Tags: 1:3.0.1.1-1ubuntu1
* Rebase on Debian, remaining Ubuntu changes:
* debian/control:
  - Build-Depend on hardening-wrapper, dpkg-dev and dh-autoreconf
  - Add dependency on ubuntu-system-service
  - Remove dependency on gnome-icon-theme-symbolic
  - Move dependency on apg, gnome-icon-theme-symbolic and accountsservice to
    be a Recommends: until we get them in main
* debian/rules:
  - Use autoreconf
  - Add binary-post-install rule for gnome-control-center-data
  - Run dh-autoreconf
* debian/gnome-control-center.dirs:
* debian/gnome-control-center.links:
  - Add a link to the control center shell for indicators
* debian/patches/00_disable-nm.patch:
  - Temporary patch to disable building with NetworkManager until we get
    the new one in the archive
* debian/patches/01_git_remove_gettext_calls.patch:
  - Remove calls to AM_GNU_GETTEXT, IT_PROG_INTLTOOL should be enough
* debian/patches/01_git_kill_warning.patch:
  - Kill warning
* debian/patches/50_ubuntu_systemwide_prefs.patch:
  - Ubuntu specific proxy preferences
* debian/patches/51_ubuntu_system_keyboard.patch:
  - Implement the global keyboard spec at https://wiki.ubuntu.com/DefaultKeyboardSettings

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
 
 
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
9
 
@@ -35,7 +35,7 @@
10
 
 
11
 
 enum
12
 
 {
13
 
-    PIXBUF_COL,
14
 
+    ICON_COL,
15
 
     TEXT_COL,
16
 
     N_COLUMNS
17
 
 };
18
 
@@ -193,33 +193,6 @@
19
 
     gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active);
20
 
 }
21
 
 
22
 
-static void
23
 
-refresh_combo_box_icons (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list)
24
 
-{
25
 
-    GList *entry;
26
 
-    GnomeDAItem *item;
27
 
-    GtkTreeModel *model;
28
 
-    GtkTreeIter iter;
29
 
-    GdkPixbuf *pixbuf;
30
 
-
31
 
-    for (entry = app_list; entry != NULL; entry = g_list_next (entry)) {
32
 
-       item = (GnomeDAItem *) entry->data;
33
 
-
34
 
-       model = gtk_combo_box_get_model (combo_box);
35
 
-
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);
38
 
-
39
 
-           gtk_list_store_set (GTK_LIST_STORE (model), &iter,
40
 
-                               PIXBUF_COL, pixbuf,
41
 
-                               -1);
42
 
-
43
 
-           if (pixbuf)
44
 
-               g_object_unref (pixbuf);
45
 
-       }
46
 
-    }
47
 
-}
48
 
-
49
 
 static struct {
50
 
     const gchar *name;
51
 
     const gchar *icon;
52
 
@@ -246,13 +219,6 @@
53
 
        icon = gtk_builder_get_object (capplet->builder, icons[i].name);
54
 
        set_icon (GTK_IMAGE (icon), theme, icons[i].icon);
55
 
     }
56
 
-
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);
63
 
 }
64
 
 
65
 
 static void
66
 
@@ -397,33 +363,31 @@
67
 
 }
68
 
 
69
 
 static void
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)
72
 
 {
73
 
     GList *entry;
74
 
     GtkTreeModel *model;
75
 
     GtkCellRenderer *renderer;
76
 
     GtkTreeIter iter;
77
 
-    GdkPixbuf *pixbuf;
78
 
-
79
 
-    if (theme == NULL) {
80
 
-       theme = gtk_icon_theme_get_default ();
81
 
-    }
82
 
 
83
 
     if (add_custom) {
84
 
        gtk_combo_box_set_row_separator_func (combo_box, is_separator,
85
 
                                              GINT_TO_POINTER (g_list_length (app_list)), NULL);
86
 
     }
87
 
 
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);
91
 
 
92
 
     renderer = gtk_cell_renderer_pixbuf_new ();
93
 
 
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,
99
 
+                  NULL);
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,
103
 
+                                   "gicon", ICON_COL,
104
 
                                    NULL);
105
 
 
106
 
     renderer = gtk_cell_renderer_text_new ();
107
 
@@ -436,18 +400,11 @@
108
 
        GnomeDAItem *item;
109
 
        item = (GnomeDAItem *) entry->data;
110
 
 
111
 
-       pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL);
112
 
-
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,
118
 
                            -1);
119
 
-
120
 
-       item->icon_path = gtk_tree_model_get_string_from_iter (model, &iter);
121
 
-
122
 
-       if (pixbuf)
123
 
-           g_object_unref (pixbuf);
124
 
     }
125
 
 
126
 
     if (add_custom) {
127
 
@@ -455,7 +412,7 @@
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,
131
 
-                           PIXBUF_COL, NULL,
132
 
+                           ICON_COL, NULL,
133
 
                            TEXT_COL, _("Custom"),
134
 
                            -1);
135
 
     }
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);
139
 
 
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);
152
 
 
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
159
 
@@ -79,8 +79,8 @@
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);
167
 
 
168
 
     g_object_unref (item->app_info);
169
 
 
170
 
@@ -95,8 +95,8 @@
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);
178
 
 
179
 
     g_free (item);
180
 
 }
181
 
@@ -109,8 +109,8 @@
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);
189
 
 
190
 
     g_free (item->exec_flag);
191
 
 
192
 
@@ -125,8 +125,8 @@
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);
200
 
 
201
 
     g_free (item);
202
 
 }
203
 
@@ -139,8 +139,8 @@
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);
211
 
 
212
 
     g_free (item);
213
 
 }
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
218
 
@@ -35,8 +35,7 @@
219
 
     gchar *name;
220
 
     gchar *executable;
221
 
     gchar *command;
222
 
-    gchar *icon_name;
223
 
-    gchar *icon_path;
224
 
+    GIcon *icon;
225
 
 };
226
 
 
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
232
 
@@ -152,7 +152,7 @@
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"));
238
 
 
239
 
                        term_item->exec_flag = gnome_da_xml_get_string (element, "exec-flag");
240
 
 
241
 
@@ -173,7 +173,7 @@
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"));
247
 
 
248
 
                        media_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
249
 
 
250
 
@@ -194,7 +194,7 @@
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"));
256
 
 
257
 
                        visual_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup");
258
 
 
259
 
@@ -215,7 +215,7 @@
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"));
265
 
 
266
 
                        mobility_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup");
267
 
 
268
 
@@ -246,12 +246,18 @@
269
 
        executable = g_app_info_get_executable (app_info);
270
 
        if (is_executable_valid (executable)) {
271
 
             GnomeDAURLItem *url_item;
272
 
+            GIcon *icon;
273
 
 
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));
279
 
+
280
 
+           icon = g_app_info_get_icon (app_info);
281
 
+           if (icon != NULL) {
282
 
+               url_item->generic.icon = g_object_ref (icon);
283
 
+           }
284
 
+
285
 
            /* Steal the reference */
286
 
            url_item->app_info = app_info;
287