~ubuntu-branches/ubuntu/oneiric/nautilus/oneiric

« back to all changes in this revision

Viewing changes to debian/patches/git_handle_missing_icon.patch

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Jeremy Bicha, Sebastien Bacher
  • Date: 2011-09-30 12:23:46 UTC
  • Revision ID: package-import@ubuntu.com-20110930122346-1ta7yqhz30g6fv9d
Tags: 1:3.2.0-0ubuntu5
[ Jeremy Bicha ]
* debian/patches/05_desktop_menu_export.patch:
  - Disable a few more items that don't work right in desktop mode

[ Sebastien Bacher ]
* git_handle_missing_icon.patch:
  - don't segfault on missing icon (lp: #860659)
* git_gsettings_signals.patch:
  - don't segfault on preferences changes (lp: #807234)
* git_no_typeahead_timeout_segfault.patch:
  - better handle the flush timeout, should avoid segfaults (lp: #804133) 
* git_dont_preview_empty_selection.patch:
  - check that the selection is non empty to avoid a segfault (lp: #812015)  
* git_correct_signal_handling.patch,
  git_no_signal_order_assert.patch,
  git_slot_closing.patch:
  - clean some signal handling issues leading to segfaults (lp: #795708)
* git_close_pane_cleaning.patch:
  - needed changes for the previous patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 82a39de7a3c1265ba1a46d1140a084a12b310e32 Mon Sep 17 00:00:00 2001
 
2
From: Cosimo Cecchi <cosimoc@gnome.org>
 
3
Date: Wed, 28 Sep 2011 18:18:40 +0000
 
4
Subject: places-sidebar: don't crash when not finding the eject symbolic icon
 
5
 
 
6
If a theme doesn't have media-eject-symbolic, icon_info can be NULL, and
 
7
we would crash trying to load a pixbuf from it anyway.
 
8
Fix this and show the stock 'missing image' pixbuf when the theme
 
9
doesn't have the specified icons.
 
10
 
 
11
https://bugzilla.gnome.org/show_bug.cgi?id=660277
 
12
---
 
13
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
 
14
index 5970c4e..4ebe023 100644
 
15
--- a/src/nautilus-places-sidebar.c
 
16
+++ b/src/nautilus-places-sidebar.c
 
17
@@ -229,26 +229,34 @@ get_eject_icon (NautilusPlacesSidebar *sidebar,
 
18
        icon_info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, icon_size, 0);
 
19
 
 
20
        style = gtk_widget_get_style_context (GTK_WIDGET (sidebar));
 
21
-       state = gtk_widget_get_state_flags (GTK_WIDGET (sidebar));
 
22
-
 
23
        gtk_style_context_save (style);
 
24
-       gtk_style_context_add_class (style, GTK_STYLE_CLASS_IMAGE);
 
25
 
 
26
-       if (highlighted) {
 
27
-               state |= GTK_STATE_FLAG_PRELIGHT;
 
28
-       }
 
29
+       if (icon_info != NULL) {
 
30
+               state = gtk_widget_get_state_flags (GTK_WIDGET (sidebar));
 
31
+               gtk_style_context_add_class (style, GTK_STYLE_CLASS_IMAGE);
 
32
 
 
33
-       gtk_style_context_set_state (style, state);
 
34
+               if (highlighted) {
 
35
+                       state |= GTK_STATE_FLAG_PRELIGHT;
 
36
+               }
 
37
 
 
38
-       eject = gtk_icon_info_load_symbolic_for_context (icon_info,
 
39
-                                                        style,
 
40
-                                                        NULL,
 
41
-                                                        NULL);
 
42
+               gtk_style_context_set_state (style, state);
 
43
 
 
44
-       gtk_style_context_restore (style);
 
45
+               eject = gtk_icon_info_load_symbolic_for_context (icon_info,
 
46
+                                                                style,
 
47
+                                                                NULL,
 
48
+                                                                NULL);
 
49
 
 
50
+               gtk_icon_info_free (icon_info);
 
51
+       } else {
 
52
+               GtkIconSet *icon_set;
 
53
+
 
54
+               gtk_style_context_set_state (style, GTK_STATE_FLAG_NORMAL);
 
55
+               icon_set = gtk_style_context_lookup_icon_set (style, GTK_STOCK_MISSING_IMAGE);
 
56
+               eject = gtk_icon_set_render_icon_pixbuf (icon_set, style, GTK_ICON_SIZE_MENU);
 
57
+       }
 
58
+
 
59
+       gtk_style_context_restore (style);
 
60
        g_object_unref (icon);
 
61
-       gtk_icon_info_free (icon_info);
 
62
 
 
63
        return eject;
 
64
 }