| 1 |
pacho |
1.1 |
|
| 2 |
|
|
++ gnome-control-center-2.32.1/debian/patches/142_fix_icons_for_default_apps.patch |
| 3 |
|
|
|
| 4 |
|
|
Description: Fix icons for new glib url handlers |
| 5 |
|
|
Author: Michael Terry <michael.terry@canonical.com> |
| 6 |
|
|
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=638775 |
| 7 |
|
|
|
| 8 |
|
|
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.c |
| 9 |
|
|
=================================================================== |
| 10 |
|
|
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-capplet.c 2011-01-05 16:05:40.623854462 -0500 |
| 11 |
|
|
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.c 2011-01-05 16:12:03.030460004 -0500 |
| 12 |
|
|
@@ -35,7 +35,7 @@ |
| 13 |
|
|
|
| 14 |
|
|
enum |
| 15 |
|
|
{ |
| 16 |
|
|
- PIXBUF_COL, |
| 17 |
|
|
+ ICON_COL, |
| 18 |
|
|
TEXT_COL, |
| 19 |
|
|
N_COLUMNS |
| 20 |
|
|
}; |
| 21 |
|
|
@@ -193,33 +193,6 @@ |
| 22 |
|
|
gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active); |
| 23 |
|
|
} |
| 24 |
|
|
|
| 25 |
|
|
-static void |
| 26 |
|
|
-refresh_combo_box_icons (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list) |
| 27 |
|
|
-{ |
| 28 |
|
|
- GList *entry; |
| 29 |
|
|
- GnomeDAItem *item; |
| 30 |
|
|
- GtkTreeModel *model; |
| 31 |
|
|
- GtkTreeIter iter; |
| 32 |
|
|
- GdkPixbuf *pixbuf; |
| 33 |
|
|
- |
| 34 |
|
|
- for (entry = app_list; entry != NULL; entry = g_list_next (entry)) { |
| 35 |
|
|
- item = (GnomeDAItem *) entry->data; |
| 36 |
|
|
- |
| 37 |
|
|
- model = gtk_combo_box_get_model (combo_box); |
| 38 |
|
|
- |
| 39 |
|
|
- if (item->icon_path && gtk_tree_model_get_iter_from_string (model, &iter, item->icon_path)) { |
| 40 |
|
|
- pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL); |
| 41 |
|
|
- |
| 42 |
|
|
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, |
| 43 |
|
|
- PIXBUF_COL, pixbuf, |
| 44 |
|
|
- -1); |
| 45 |
|
|
- |
| 46 |
|
|
- if (pixbuf) |
| 47 |
|
|
- g_object_unref (pixbuf); |
| 48 |
|
|
- } |
| 49 |
|
|
- } |
| 50 |
|
|
-} |
| 51 |
|
|
- |
| 52 |
|
|
static struct { |
| 53 |
|
|
const gchar *name; |
| 54 |
|
|
const gchar *icon; |
| 55 |
|
|
@@ -246,13 +219,6 @@ |
| 56 |
|
|
icon = gtk_builder_get_object (capplet->builder, icons[i].name); |
| 57 |
|
|
set_icon (GTK_IMAGE (icon), theme, icons[i].icon); |
| 58 |
|
|
} |
| 59 |
|
|
- |
| 60 |
|
|
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers); |
| 61 |
|
|
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers); |
| 62 |
|
|
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players); |
| 63 |
|
|
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals); |
| 64 |
|
|
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats); |
| 65 |
|
|
- refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats); |
| 66 |
|
|
} |
| 67 |
|
|
|
| 68 |
|
|
static void |
| 69 |
|
|
@@ -397,33 +363,31 @@ |
| 70 |
|
|
} |
| 71 |
|
|
|
| 72 |
|
|
static void |
| 73 |
|
|
-fill_combo_box (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list, gboolean add_custom) |
| 74 |
|
|
+fill_combo_box (GtkComboBox *combo_box, GList *app_list, gboolean add_custom) |
| 75 |
|
|
{ |
| 76 |
|
|
GList *entry; |
| 77 |
|
|
GtkTreeModel *model; |
| 78 |
|
|
GtkCellRenderer *renderer; |
| 79 |
|
|
GtkTreeIter iter; |
| 80 |
|
|
- GdkPixbuf *pixbuf; |
| 81 |
|
|
- |
| 82 |
|
|
- if (theme == NULL) { |
| 83 |
|
|
- theme = gtk_icon_theme_get_default (); |
| 84 |
|
|
- } |
| 85 |
|
|
|
| 86 |
|
|
if (add_custom) { |
| 87 |
|
|
gtk_combo_box_set_row_separator_func (combo_box, is_separator, |
| 88 |
|
|
GINT_TO_POINTER (g_list_length (app_list)), NULL); |
| 89 |
|
|
} |
| 90 |
|
|
|
| 91 |
|
|
- model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING)); |
| 92 |
|
|
+ model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_ICON, G_TYPE_STRING)); |
| 93 |
|
|
gtk_combo_box_set_model (combo_box, model); |
| 94 |
|
|
|
| 95 |
|
|
renderer = gtk_cell_renderer_pixbuf_new (); |
| 96 |
|
|
|
| 97 |
|
|
/* not all cells have a pixbuf, this prevents the combo box to shrink */ |
| 98 |
|
|
- gtk_cell_renderer_set_fixed_size (renderer, -1, 22); |
| 99 |
|
|
+ gtk_cell_renderer_set_fixed_size (renderer, -1, 24); |
| 100 |
|
|
+ g_object_set (G_OBJECT (renderer), |
| 101 |
|
|
+ "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR, |
| 102 |
|
|
+ NULL); |
| 103 |
|
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE); |
| 104 |
|
|
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer, |
| 105 |
|
|
- "pixbuf", PIXBUF_COL, |
| 106 |
|
|
+ "gicon", ICON_COL, |
| 107 |
|
|
NULL); |
| 108 |
|
|
|
| 109 |
|
|
renderer = gtk_cell_renderer_text_new (); |
| 110 |
|
|
@@ -436,18 +400,11 @@ |
| 111 |
|
|
GnomeDAItem *item; |
| 112 |
|
|
item = (GnomeDAItem *) entry->data; |
| 113 |
|
|
|
| 114 |
|
|
- pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL); |
| 115 |
|
|
- |
| 116 |
|
|
gtk_list_store_append (GTK_LIST_STORE (model), &iter); |
| 117 |
|
|
gtk_list_store_set (GTK_LIST_STORE (model), &iter, |
| 118 |
|
|
- PIXBUF_COL, pixbuf, |
| 119 |
|
|
+ ICON_COL, item->icon, |
| 120 |
|
|
TEXT_COL, item->name, |
| 121 |
|
|
-1); |
| 122 |
|
|
- |
| 123 |
|
|
- item->icon_path = gtk_tree_model_get_string_from_iter (model, &iter); |
| 124 |
|
|
- |
| 125 |
|
|
- if (pixbuf) |
| 126 |
|
|
- g_object_unref (pixbuf); |
| 127 |
|
|
} |
| 128 |
|
|
|
| 129 |
|
|
if (add_custom) { |
| 130 |
|
|
@@ -455,7 +412,7 @@ |
| 131 |
|
|
gtk_list_store_set (GTK_LIST_STORE (model), &iter, -1); |
| 132 |
|
|
gtk_list_store_append (GTK_LIST_STORE (model), &iter); |
| 133 |
|
|
gtk_list_store_set (GTK_LIST_STORE (model), &iter, |
| 134 |
|
|
- PIXBUF_COL, NULL, |
| 135 |
|
|
+ ICON_COL, NULL, |
| 136 |
|
|
TEXT_COL, _("Custom"), |
| 137 |
|
|
-1); |
| 138 |
|
|
} |
| 139 |
|
|
@@ -528,12 +485,12 @@ |
| 140 |
|
|
g_signal_connect (capplet->window, "screen-changed", G_CALLBACK (screen_changed_cb), capplet); |
| 141 |
|
|
screen_changed_cb (capplet->window, gdk_screen_get_default (), capplet); |
| 142 |
|
|
|
| 143 |
|
|
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, FALSE); |
| 144 |
|
|
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, FALSE); |
| 145 |
|
|
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals, TRUE); |
| 146 |
|
|
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players, TRUE); |
| 147 |
|
|
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats, TRUE); |
| 148 |
|
|
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats, TRUE); |
| 149 |
|
|
+ fill_combo_box (GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, FALSE); |
| 150 |
|
|
+ fill_combo_box (GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, FALSE); |
| 151 |
|
|
+ fill_combo_box (GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals, TRUE); |
| 152 |
|
|
+ fill_combo_box (GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players, TRUE); |
| 153 |
|
|
+ fill_combo_box (GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats, TRUE); |
| 154 |
|
|
+ fill_combo_box (GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats, TRUE); |
| 155 |
|
|
|
| 156 |
|
|
set_combo_to_default_for_scheme (GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, "http"); |
| 157 |
|
|
set_combo_to_default_for_scheme (GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, "mailto"); |
| 158 |
|
|
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.c |
| 159 |
|
|
=================================================================== |
| 160 |
|
|
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-item.c 2011-01-05 16:04:48.644316418 -0500 |
| 161 |
|
|
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.c 2011-01-05 16:05:40.653854197 -0500 |
| 162 |
|
|
@@ -79,8 +79,8 @@ |
| 163 |
|
|
g_free (item->generic.name); |
| 164 |
|
|
g_free (item->generic.executable); |
| 165 |
|
|
g_free (item->generic.command); |
| 166 |
|
|
- g_free (item->generic.icon_name); |
| 167 |
|
|
- g_free (item->generic.icon_path); |
| 168 |
|
|
+ if (item->generic.icon) |
| 169 |
|
|
+ g_object_unref (item->generic.icon); |
| 170 |
|
|
|
| 171 |
|
|
g_object_unref (item->app_info); |
| 172 |
|
|
|
| 173 |
|
|
@@ -95,8 +95,8 @@ |
| 174 |
|
|
g_free (item->generic.name); |
| 175 |
|
|
g_free (item->generic.executable); |
| 176 |
|
|
g_free (item->generic.command); |
| 177 |
|
|
- g_free (item->generic.icon_name); |
| 178 |
|
|
- g_free (item->generic.icon_path); |
| 179 |
|
|
+ if (item->generic.icon) |
| 180 |
|
|
+ g_object_unref (item->generic.icon); |
| 181 |
|
|
|
| 182 |
|
|
g_free (item); |
| 183 |
|
|
} |
| 184 |
|
|
@@ -109,8 +109,8 @@ |
| 185 |
|
|
g_free (item->generic.name); |
| 186 |
|
|
g_free (item->generic.executable); |
| 187 |
|
|
g_free (item->generic.command); |
| 188 |
|
|
- g_free (item->generic.icon_name); |
| 189 |
|
|
- g_free (item->generic.icon_path); |
| 190 |
|
|
+ if (item->generic.icon) |
| 191 |
|
|
+ g_object_unref (item->generic.icon); |
| 192 |
|
|
|
| 193 |
|
|
g_free (item->exec_flag); |
| 194 |
|
|
|
| 195 |
|
|
@@ -125,8 +125,8 @@ |
| 196 |
|
|
g_free (item->generic.name); |
| 197 |
|
|
g_free (item->generic.executable); |
| 198 |
|
|
g_free (item->generic.command); |
| 199 |
|
|
- g_free (item->generic.icon_name); |
| 200 |
|
|
- g_free (item->generic.icon_path); |
| 201 |
|
|
+ if (item->generic.icon) |
| 202 |
|
|
+ g_object_unref (item->generic.icon); |
| 203 |
|
|
|
| 204 |
|
|
g_free (item); |
| 205 |
|
|
} |
| 206 |
|
|
@@ -139,8 +139,8 @@ |
| 207 |
|
|
g_free (item->generic.name); |
| 208 |
|
|
g_free (item->generic.executable); |
| 209 |
|
|
g_free (item->generic.command); |
| 210 |
|
|
- g_free (item->generic.icon_name); |
| 211 |
|
|
- g_free (item->generic.icon_path); |
| 212 |
|
|
+ if (item->generic.icon) |
| 213 |
|
|
+ g_object_unref (item->generic.icon); |
| 214 |
|
|
|
| 215 |
|
|
g_free (item); |
| 216 |
|
|
} |
| 217 |
|
|
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.h |
| 218 |
|
|
=================================================================== |
| 219 |
|
|
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-item.h 2011-01-05 16:04:48.684316062 -0500 |
| 220 |
|
|
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.h 2011-01-05 16:05:40.653854197 -0500 |
| 221 |
|
|
@@ -35,8 +35,7 @@ |
| 222 |
|
|
gchar *name; |
| 223 |
|
|
gchar *executable; |
| 224 |
|
|
gchar *command; |
| 225 |
|
|
- gchar *icon_name; |
| 226 |
|
|
- gchar *icon_path; |
| 227 |
|
|
+ GIcon *icon; |
| 228 |
|
|
}; |
| 229 |
|
|
|
| 230 |
|
|
struct _GnomeDASimpleItem { |
| 231 |
|
|
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-xml.c |
| 232 |
|
|
=================================================================== |
| 233 |
|
|
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-xml.c 2011-01-05 16:04:48.624316596 -0500 |
| 234 |
|
|
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-xml.c 2011-01-05 16:05:40.653854197 -0500 |
| 235 |
|
|
@@ -152,7 +152,7 @@ |
| 236 |
|
|
term_item->generic.name = gnome_da_xml_get_string (element, "name"); |
| 237 |
|
|
term_item->generic.executable = executable; |
| 238 |
|
|
term_item->generic.command = gnome_da_xml_get_string (element, "command"); |
| 239 |
|
|
- term_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name"); |
| 240 |
|
|
+ term_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name")); |
| 241 |
|
|
|
| 242 |
|
|
term_item->exec_flag = gnome_da_xml_get_string (element, "exec-flag"); |
| 243 |
|
|
|
| 244 |
|
|
@@ -173,7 +173,7 @@ |
| 245 |
|
|
media_item->generic.name = gnome_da_xml_get_string (element, "name"); |
| 246 |
|
|
media_item->generic.executable = executable; |
| 247 |
|
|
media_item->generic.command = gnome_da_xml_get_string (element, "command"); |
| 248 |
|
|
- media_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name"); |
| 249 |
|
|
+ media_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name")); |
| 250 |
|
|
|
| 251 |
|
|
media_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal"); |
| 252 |
|
|
|
| 253 |
|
|
@@ -194,7 +194,7 @@ |
| 254 |
|
|
visual_item->generic.name = gnome_da_xml_get_string (element, "name"); |
| 255 |
|
|
visual_item->generic.executable = executable; |
| 256 |
|
|
visual_item->generic.command = gnome_da_xml_get_string (element, "command"); |
| 257 |
|
|
- visual_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name"); |
| 258 |
|
|
+ visual_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name")); |
| 259 |
|
|
|
| 260 |
|
|
visual_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup"); |
| 261 |
|
|
|
| 262 |
|
|
@@ -215,7 +215,7 @@ |
| 263 |
|
|
mobility_item->generic.name = gnome_da_xml_get_string (element, "name"); |
| 264 |
|
|
mobility_item->generic.executable = executable; |
| 265 |
|
|
mobility_item->generic.command = gnome_da_xml_get_string (element, "command"); |
| 266 |
|
|
- mobility_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name"); |
| 267 |
|
|
+ mobility_item->generic.icon = g_themed_icon_new (gnome_da_xml_get_string (element, "icon-name")); |
| 268 |
|
|
|
| 269 |
|
|
mobility_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup"); |
| 270 |
|
|
|
| 271 |
|
|
@@ -246,12 +246,18 @@ |
| 272 |
|
|
executable = g_app_info_get_executable (app_info); |
| 273 |
|
|
if (is_executable_valid (executable)) { |
| 274 |
|
|
GnomeDAURLItem *url_item; |
| 275 |
|
|
+ GIcon *icon; |
| 276 |
|
|
|
| 277 |
|
|
url_item = gnome_da_url_item_new (); |
| 278 |
|
|
url_item->generic.name = g_strdup (g_app_info_get_display_name (app_info)); |
| 279 |
|
|
url_item->generic.executable = g_strdup (executable); |
| 280 |
|
|
url_item->generic.command = g_strdup (g_app_info_get_commandline (app_info)); |
| 281 |
|
|
- url_item->generic.icon_name = g_strdup (g_app_info_get_name (app_info)); |
| 282 |
|
|
+ |
| 283 |
|
|
+ icon = g_app_info_get_icon (app_info); |
| 284 |
|
|
+ if (icon != NULL) { |
| 285 |
|
|
+ url_item->generic.icon = g_object_ref (icon); |
| 286 |
|
|
+ } |
| 287 |
|
|
+ |
| 288 |
|
|
/* Steal the reference */ |
| 289 |
|
|
url_item->app_info = app_info; |
| 290 |
|
|
|