]> spindle.queued.net Git - midori/commitdiff
Lookup icon size in relation to the according screen or widget
authorChristian Dywan <christian@twotoasts.de>
Fri, 29 Jan 2010 21:30:23 +0000 (22:30 +0100)
committerChristian Dywan <christian@twotoasts.de>
Fri, 29 Jan 2010 21:43:39 +0000 (22:43 +0100)
katze/katze-net.c
katze/katze-utils.c
midori/midori-browser.c
midori/midori-searchaction.c

index 5374478a49051ead8a5db605a4140df8118fdcd4..c4cdbaeaa9c749e6b81f83312f595ad02890a8e3 100644 (file)
@@ -434,6 +434,7 @@ katze_net_icon_transfer_cb (KatzeNetRequest*  request,
     GdkPixbuf* pixbuf_scaled;
     gint icon_width, icon_height;
     size_t ret;
+    GtkSettings* settings;
 
     if (request->status == KATZE_NET_MOVED)
         return;
@@ -479,7 +480,14 @@ katze_net_icon_transfer_cb (KatzeNetRequest*  request,
             return;
         }
     }
-    gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, &icon_height);
+
+    if (priv->widget)
+        settings = gtk_widget_get_settings (priv->widget);
+    else
+        settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
+
+    gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
+                                       &icon_width, &icon_height);
     pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height,
                                              GDK_INTERP_BILINEAR);
     g_object_unref (pixbuf);
@@ -536,6 +544,7 @@ katze_net_load_icon (KatzeNet*      net,
     GdkPixbuf* pixbuf;
     gint icon_width, icon_height;
     GdkPixbuf* pixbuf_scaled;
+    GtkSettings* settings;
 
     g_return_val_if_fail (KATZE_IS_NET (net), NULL);
     g_return_val_if_fail (!widget || GTK_IS_WIDGET (widget), NULL);
@@ -599,7 +608,14 @@ katze_net_load_icon (KatzeNet*      net,
         else
             return NULL;
     }
-    gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, &icon_height);
+
+    if (widget)
+        settings = gtk_widget_get_settings (widget);
+    else
+        settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
+
+    gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
+                                       &icon_width, &icon_height);
     pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height,
                                              GDK_INTERP_BILINEAR);
     g_object_unref (pixbuf);
index 58bcadd8560bfffaf476211075d51c0c94cad2f4..63c69e48c322196870a2f76dd04ef53de040737c 100644 (file)
@@ -34,13 +34,15 @@ proxy_toggle_button_toggled_cb (GtkToggleButton* button,
                                 GObject*         object)
 {
     gboolean toggled;
+    const gchar* property;
+
     #ifdef HAVE_HILDON_2_2
     if (HILDON_IS_CHECK_BUTTON (button))
         toggled = hildon_check_button_get_active (HILDON_CHECK_BUTTON (button));
     #else
     toggled = gtk_toggle_button_get_active (button);
     #endif
-    const gchar* property = g_object_get_data (G_OBJECT (button), "property");
+    property = g_object_get_data (G_OBJECT (button), "property");
     g_object_set (object, property, toggled, NULL);
 }
 
@@ -620,8 +622,12 @@ katze_property_proxy (gpointer     object,
         GtkComboBox* combo;
         GList* apps;
         const gchar* app_type = &hint[12];
+        GtkSettings* settings;
         gint icon_width = 16;
-        gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
+
+        settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
+        gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
+                                           &icon_width, NULL);
 
         model = gtk_list_store_new (4, G_TYPE_APP_INFO, G_TYPE_STRING,
                                        G_TYPE_STRING, G_TYPE_INT);
index 0e460619a30e704c8ba19bff0ca4716c3ae86ec6..539b1f000a0eb213662cbcd9aeaa94beb5fab48f 100644 (file)
@@ -3512,10 +3512,12 @@ static void
 _action_fullscreen_activate (GtkAction*     action,
                              MidoriBrowser* browser)
 {
+    GdkWindowState state;
+
     if (!GTK_WIDGET (browser)->window)
         return;
 
-    GdkWindowState state = gdk_window_get_state (GTK_WIDGET (browser)->window);
+    state = gdk_window_get_state (GTK_WIDGET (browser)->window);
     if (state & GDK_WINDOW_STATE_FULLSCREEN)
         gtk_window_unfullscreen (GTK_WINDOW (browser));
     else
@@ -3526,13 +3528,15 @@ static void
 _action_back_activate (GtkAction*     action,
                        MidoriBrowser* browser)
 {
+    GtkWidget* view;
+
     if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
     {
         g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
         return;
     }
 
-    GtkWidget* view = midori_browser_get_current_tab (browser);
+    view = midori_browser_get_current_tab (browser);
     if (view)
         midori_view_go_back (MIDORI_VIEW (view));
 }
@@ -3541,13 +3545,15 @@ static void
 _action_forward_activate (GtkAction*     action,
                           MidoriBrowser* browser)
 {
+    GtkWidget* view;
+
     if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
     {
         g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
         return;
     }
 
-    GtkWidget* view = midori_browser_get_current_tab (browser);
+    view = midori_browser_get_current_tab (browser);
     if (view)
         midori_view_go_forward (MIDORI_VIEW (view));
 }
@@ -3556,13 +3562,15 @@ static void
 _action_previous_activate (GtkAction*     action,
                            MidoriBrowser* browser)
 {
+    GtkWidget* view;
+
     if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
     {
         g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
         return;
     }
 
-    GtkWidget* view = midori_browser_get_current_tab (browser);
+    view = midori_browser_get_current_tab (browser);
     if (view)
     {
         gchar* uri = g_strdup (midori_view_get_previous_page (MIDORI_VIEW (view)));
@@ -3575,13 +3583,15 @@ static void
 _action_next_activate (GtkAction*     action,
                        MidoriBrowser* browser)
 {
+    GtkWidget* view;
+
     if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
     {
         g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
         return;
     }
 
-    GtkWidget* view = midori_browser_get_current_tab (browser);
+    view = midori_browser_get_current_tab (browser);
     if (view)
     {
         gchar* uri = g_strdup (midori_view_get_next_page (MIDORI_VIEW (view)));
@@ -4341,7 +4351,8 @@ _action_bookmarks_import_activate (GtkAction*     action,
     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
     gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", 0);
     combobox = GTK_COMBO_BOX (combo);
-    gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
+    gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (browser)),
+                                       GTK_ICON_SIZE_MENU, &icon_width, NULL);
     for (i = 0; i < G_N_ELEMENTS (bookmark_clients); i++)
     {
         gchar* path = g_build_filename (g_get_home_dir (),
index 0b5f68105d3a7b2d7ae2a8984066239ca82833c3..26085175f76af38e1291288c676ded91b1599ce0 100644 (file)
@@ -811,7 +811,8 @@ midori_search_action_dialog_render_tick_cb (GtkTreeViewColumn* column,
     gtk_tree_model_get (model, iter, 0, &item, -1);
 
     search_action = g_object_get_data (G_OBJECT (treeview), "search-action");
-    gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL);
+    gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (treeview),
+                                       GTK_ICON_SIZE_MENU, &width, NULL);
     g_object_set (renderer, "stock-id",
         search_action->default_item == item ? GTK_STOCK_YES : NULL,
         "width", width + 4, NULL);