diff options
author | Christian Persch <chpe@gnome.org> | 2010-04-29 15:23:44 +0200 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-10-22 12:20:55 +0100 |
commit | 95610f2a1485fb5e2ceb5d44c73c09fd4773dbad (patch) | |
tree | 8a025302271480f990aaf5bf20c4e26341f0e1eb /gtk/gtkrecentchoosermenu.c | |
parent | b0fe3e49bbf788c9dd81d8c2f236666cc78d972d (diff) | |
download | gtk+-95610f2a1485fb5e2ceb5d44c73c09fd4773dbad.tar.gz |
recent-chooser: Use gtk_recent_info_get_gicon()
https://bugzilla.gnome.org/show_bug.cgi?id=617174
Diffstat (limited to 'gtk/gtkrecentchoosermenu.c')
-rw-r--r-- | gtk/gtkrecentchoosermenu.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c index 3a11e83786..9e37703ac3 100644 --- a/gtk/gtkrecentchoosermenu.c +++ b/gtk/gtkrecentchoosermenu.c @@ -78,9 +78,6 @@ struct _GtkRecentChooserMenuPrivate /* the recent manager object */ GtkRecentManager *manager; - /* size of the icons of the menu items */ - gint icon_size; - /* max size of the menu item label */ gint label_width; @@ -121,7 +118,6 @@ enum { }; -#define FALLBACK_ICON_SIZE 32 #define FALLBACK_ITEM_LIMIT 10 #define DEFAULT_LABEL_WIDTH 30 @@ -178,8 +174,6 @@ static void set_recent_manager (GtkRecentChooserMenu *menu, static void chooser_set_sort_type (GtkRecentChooserMenu *menu, GtkRecentSortType sort_type); -static gint get_icon_size_for_widget (GtkWidget *widget); - static void item_activate_cb (GtkWidget *widget, gpointer user_data); static void manager_changed_cb (GtkRecentManager *manager, @@ -281,7 +275,6 @@ gtk_recent_chooser_menu_init (GtkRecentChooserMenu *menu) priv->limit = FALLBACK_ITEM_LIMIT; priv->sort_type = GTK_RECENT_SORT_NONE; - priv->icon_size = FALLBACK_ICON_SIZE; priv->label_width = DEFAULT_LABEL_WIDTH; priv->first_recent_item_pos = -1; @@ -817,7 +810,7 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu, GtkRecentChooserMenuPrivate *priv; gchar *text; GtkWidget *item, *image, *label; - GdkPixbuf *icon; + GIcon *icon; g_assert (info != NULL); @@ -875,11 +868,13 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu, if (priv->show_icons) { - icon = gtk_recent_info_get_icon (info, priv->icon_size); - - image = gtk_image_new_from_pixbuf (icon); + icon = gtk_recent_info_get_gicon (info); + + image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); - g_object_unref (icon); + gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE); + if (icon) + g_object_unref (icon); } g_signal_connect (item, "activate", @@ -1085,8 +1080,6 @@ gtk_recent_chooser_menu_populate (GtkRecentChooserMenu *menu) pdata->menu = menu; pdata->placeholder = g_object_ref (priv->placeholder); - priv->icon_size = get_icon_size_for_widget (GTK_WIDGET (menu)); - /* remove our menu items first */ gtk_recent_chooser_menu_dispose_items (menu); @@ -1152,24 +1145,6 @@ set_recent_manager (GtkRecentChooserMenu *menu, menu); } -static gint -get_icon_size_for_widget (GtkWidget *widget) -{ - GtkSettings *settings; - gint width, height; - - if (gtk_widget_has_screen (widget)) - settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget)); - else - settings = gtk_settings_get_default (); - - if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, - &width, &height)) - return MAX (width, height); - - return FALLBACK_ICON_SIZE; -} - static void foreach_set_shot_tips (GtkWidget *widget, gpointer user_data) |