]> spindle.queued.net Git - midori/commitdiff
Do not display any icon if there's no news feed available
authorEnrico Tröger <enrico.troeger@uvena.de>
Sun, 26 Apr 2009 23:11:58 +0000 (01:11 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 26 Apr 2009 23:11:58 +0000 (01:11 +0200)
Work around a bug that made unsetting the secondary icon in the
location entry impossible and do not set an icon if there is
no news feed instead of an 'information' icon.

midori/gtkiconentry.c
midori/gtkiconentry.h
midori/midori-browser.c
midori/midori-locationaction.c

index 51740ab021f2955e54230606a62e02a5727e92fa..bda44ca4d817541f5baf35b37a4d6c39dd6af9df 100644 (file)
@@ -28,12 +28,20 @@ gtk_icon_entry_set_icon_from_pixbuf (GtkEntry*            entry,
                                      GdkPixbuf*           pixbuf)
 {
     /* Without this ugly hack pixbuf icons don't work */
-    if (pixbuf)
-    {
-        gtk_widget_hide (GTK_WIDGET (entry));
-        gtk_entry_set_icon_from_pixbuf (entry, position, pixbuf);
-        gtk_widget_show (GTK_WIDGET (entry));
-    }
+    gtk_widget_hide (GTK_WIDGET (entry));
+    gtk_entry_set_icon_from_pixbuf (entry, position, pixbuf);
+    gtk_widget_show (GTK_WIDGET (entry));
+}
+
+void
+gtk_icon_entry_set_icon_from_stock  (GtkEntry*            entry,
+                                    GtkEntryIconPosition position,
+                                    const gchar*         stock_id)
+{
+    if (stock_id)
+       gtk_entry_set_icon_from_stock(entry, position, stock_id);
+    else
+       gtk_icon_entry_set_icon_from_pixbuf(entry, position, NULL);
 }
 
 #else
@@ -1266,6 +1274,10 @@ gtk_icon_entry_set_icon_from_stock (GtkIconEntry *entry,
 {
   GdkPixbuf *pixbuf;
 
+  /* FIXME: Due to a bug in GtkIconEntry we need to set a non-NULL icon */
+  if (! stock_id)
+    stock_id = GTK_STOCK_INFO;
+
   pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
                                   stock_id,
                                   GTK_ICON_SIZE_MENU,
index 61f8075bbb11bc79415b5440d6eb8f35058922ef..8f910cff460684bff47b5c96e8191171977655ea 100644 (file)
@@ -38,11 +38,15 @@ G_BEGIN_DECLS
     #define GTK_ICON_ENTRY GTK_ENTRY
     #define GTK_TYPE_ICON_ENTRY GTK_TYPE_ENTRY
     #define gtk_icon_entry_new gtk_entry_new
-    #define gtk_icon_entry_set_icon_from_stock gtk_entry_set_icon_from_stock
     void
     gtk_icon_entry_set_icon_from_pixbuf (GtkEntry*            entry,
                                          GtkEntryIconPosition position,
                                          GdkPixbuf*           pixbuf);
+    void
+    gtk_icon_entry_set_icon_from_stock  (GtkEntry*            entry,
+                                         GtkEntryIconPosition position,
+                                         const gchar*         stock_id);
+
     #define gtk_icon_entry_set_icon_highlight gtk_entry_set_icon_activatable
 #else
 
index bee9839769f4c9608b375f8f62e77c3ac4049f05..cb04bb3cae0841c89353608c189ed17061884280 100644 (file)
@@ -312,7 +312,7 @@ _midori_browser_update_interface (MidoriBrowser* browser)
             MIDORI_LOCATION_ACTION (action), STOCK_NEWS_FEED);
     else
         midori_location_action_set_secondary_icon (
-            MIDORI_LOCATION_ACTION (action), GTK_STOCK_INFO);
+            MIDORI_LOCATION_ACTION (action), NULL);
 }
 
 static void
@@ -420,7 +420,7 @@ midori_view_notify_load_status_cb (GtkWidget*      view,
             midori_location_action_set_uri (
                 MIDORI_LOCATION_ACTION (action), uri);
             midori_location_action_set_secondary_icon (
-                MIDORI_LOCATION_ACTION (action), GTK_STOCK_INFO);
+                MIDORI_LOCATION_ACTION (action), NULL);
             g_object_notify (G_OBJECT (browser), "uri");
         }
 
@@ -4003,8 +4003,6 @@ midori_browser_init (MidoriBrowser* browser)
         "label", _("_Location..."),
         "stock-id", GTK_STOCK_JUMP_TO,
         "tooltip", _("Open a particular location"),
-        /* FIXME: Due to a bug in GtkIconEntry we need to set an initial icon */
-        "secondary-icon", STOCK_NEWS_FEED,
         NULL);
     g_object_connect (action,
                       "signal::activate",
index 54cdaedaee059b53e27af53c96e965214d4cd95b..a24ec9728ac910236d6b88ac8432f53deebef989 100644 (file)
@@ -1311,12 +1311,8 @@ midori_location_action_set_secondary_icon (MidoriLocationAction* location_action
         entry = gtk_bin_get_child (GTK_BIN (alignment));
         child = gtk_bin_get_child (GTK_BIN (entry));
 
-        if (stock_id)
-            gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
-                GTK_ICON_ENTRY_SECONDARY, stock_id);
-        else
-            gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (child),
-                GTK_ICON_ENTRY_SECONDARY, NULL);
+        gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
+            GTK_ICON_ENTRY_SECONDARY, stock_id);
     }
 }