[Xfce4-commits] <midori:master> Lookup icon size in relation to the according screen or widget
Christian Dywan
noreply at xfce.org
Sat Jan 30 01:58:01 CET 2010
Updating branch refs/heads/master
to cc6bb8fddb6ad5447f07953fc58d9dc74851511c (commit)
from 37d89d0986c65218536d81db81bcac5d130fc190 (commit)
commit cc6bb8fddb6ad5447f07953fc58d9dc74851511c
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Jan 29 22:30:23 2010 +0100
Lookup icon size in relation to the according screen or widget
katze/katze-net.c | 20 ++++++++++++++++++--
katze/katze-utils.c | 10 ++++++++--
midori/midori-browser.c | 23 +++++++++++++++++------
midori/midori-searchaction.c | 3 ++-
4 files changed, 45 insertions(+), 11 deletions(-)
diff --git a/katze/katze-net.c b/katze/katze-net.c
index 5374478..c4cdbae 100644
--- a/katze/katze-net.c
+++ b/katze/katze-net.c
@@ -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);
diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index 58bcadd..63c69e4 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -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);
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 0e46061..539b1f0 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -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 (),
diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c
index 0b5f681..2608517 100644
--- a/midori/midori-searchaction.c
+++ b/midori/midori-searchaction.c
@@ -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);
More information about the Xfce4-commits
mailing list