]> spindle.queued.net Git - midori/commitdiff
Update location icon even if it's not in the history
authorChristian Dywan <christian@twotoasts.de>
Mon, 10 Nov 2008 23:51:28 +0000 (00:51 +0100)
committerChristian Dywan <christian@twotoasts.de>
Mon, 10 Nov 2008 23:51:28 +0000 (00:51 +0100)
midori/midori-browser.c
midori/midori-locationaction.c
midori/midori-locationaction.h

index 7a4bc98679b7614a81011eb8cbced0534521920f..e0a7e7ed6ed28a6985f940c1971eb0fddf2c1b30 100644 (file)
@@ -2910,6 +2910,8 @@ gtk_notebook_switch_page_cb (GtkWidget*       notebook,
     uri = midori_view_get_display_uri (MIDORI_VIEW (view));
     action = _action_by_name (browser, "Location");
     midori_location_action_set_uri (MIDORI_LOCATION_ACTION (action), uri);
+    midori_location_action_set_icon (MIDORI_LOCATION_ACTION (action),
+        midori_view_get_icon (MIDORI_VIEW (view)));
 
     title = midori_view_get_display_title (MIDORI_VIEW (view));
     window_title = g_strconcat (title, " - ",
index 766414971553a496a64e59e006ffad65cec259e4..5722074061ce96f6db4821e6ed3d2fe42651a200 100644 (file)
@@ -611,7 +611,7 @@ midori_location_action_item_iter (MidoriLocationAction* location_action,
     g_return_val_if_fail (uri != NULL, FALSE);
 
     found = FALSE;
-    model = location_action->model; // filter_model
+    model = location_action->model;
     if (gtk_tree_model_get_iter_first (model, iter))
     {
         tmpuri = NULL;
@@ -860,6 +860,7 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
     GdkPixbuf* icon;
 
     g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
+    g_return_if_fail (text != NULL);
 
     proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
     if (!proxies)
@@ -875,7 +876,7 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
         gtk_entry_set_text (GTK_ENTRY (entry), text);
         if (midori_location_action_item_iter (location_action, text, &iter))
         {
-            model = location_action->model; // filter_model
+            model = location_action->model;
             gtk_tree_model_get (model, &iter, FAVICON_COL, &icon, -1);
             gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
                 GTK_ICON_ENTRY_PRIMARY, icon);
@@ -900,6 +901,35 @@ midori_location_action_set_uri (MidoriLocationAction* location_action,
     midori_location_action_set_text (location_action, uri);
 }
 
+void
+midori_location_action_set_icon (MidoriLocationAction* location_action,
+                                 GdkPixbuf*            icon)
+{
+    GSList* proxies;
+    GtkWidget* alignment;
+    GtkWidget* location_entry;
+    GtkWidget* entry;
+
+    g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
+    g_return_if_fail (icon && GDK_IS_PIXBUF (icon));
+
+    proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
+    if (!proxies)
+        return;
+
+    do
+    if (GTK_IS_TOOL_ITEM (proxies->data))
+    {
+        alignment = gtk_bin_get_child (GTK_BIN (proxies->data));
+        location_entry = gtk_bin_get_child (GTK_BIN (alignment));
+        entry = gtk_bin_get_child (GTK_BIN (location_entry));
+
+        gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
+            GTK_ICON_ENTRY_PRIMARY, icon);
+    }
+    while ((proxies = g_slist_next (proxies)));
+}
+
 /**
  * midori_location_action_prepend_item:
  * @location_action: a #MidoriLocationAction
index a95301c9f23675f1b5fdc1c8937c63b827dccd84..5d2d1d239649719ed6c520baf9f40fa6bdd9ead6 100644 (file)
@@ -51,6 +51,10 @@ void
 midori_location_action_set_uri              (MidoriLocationAction* location_action,
                                              const gchar*          uri);
 
+void
+midori_location_action_set_icon             (MidoriLocationAction* location_action,
+                                             GdkPixbuf*            icon);
+
 void
 midori_location_action_add_uri              (MidoriLocationAction* location_action,
                                              const gchar*          uri);