diff options
author | Benjamin Otte <otte@redhat.com> | 2017-01-23 01:19:07 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-01-27 04:43:36 +0100 |
commit | 2a3ef9e2564ae5ba8337a0da93404949055a3b40 (patch) | |
tree | 91a5c2b24b368ed618b3de11886ea7f4375125d8 | |
parent | 1683230afabcce1707307d0c66af416bdb109bb9 (diff) | |
download | gtk+-2a3ef9e2564ae5ba8337a0da93404949055a3b40.tar.gz |
image: Remove icon-size argument from icon setters
Instead, add a function gtk_image_set_icon_size() for the cases where
overriding the icon size is necessary.
Treat icon sizes the same way as pixel sizes, too. So gtk_image_clear()
no longer unsets the icon size.
57 files changed, 178 insertions, 242 deletions
diff --git a/demos/gtk-demo/clipboard.c b/demos/gtk-demo/clipboard.c index 39d159f298..04d80c29d1 100644 --- a/demos/gtk-demo/clipboard.c +++ b/demos/gtk-demo/clipboard.c @@ -265,8 +265,7 @@ do_clipboard (GtkWidget *do_widget) gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE); /* Create the first image */ - image = gtk_image_new_from_icon_name ("dialog-warning", - GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_icon_name ("dialog-warning"); ebox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (ebox), image); gtk_container_add (GTK_CONTAINER (hbox), ebox); @@ -291,8 +290,7 @@ do_clipboard (GtkWidget *do_widget) G_CALLBACK (button_press), image); /* Create the second image */ - image = gtk_image_new_from_icon_name ("process-stop", - GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_icon_name ("process-stop"); ebox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (ebox), image); gtk_container_add (GTK_CONTAINER (hbox), ebox); diff --git a/demos/gtk-demo/cursors.c b/demos/gtk-demo/cursors.c index cab6333347..3a5da7e7ff 100644 --- a/demos/gtk-demo/cursors.c +++ b/demos/gtk-demo/cursors.c @@ -49,7 +49,7 @@ add_button (GtkWidget *section, display = gtk_widget_get_display (section); cursor = gdk_cursor_new_from_name (display, css_name); if (cursor == NULL) - image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("image-missing"); else { gchar *path; diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c index b89156db4e..f28805a1aa 100644 --- a/demos/gtk-demo/dialog.c +++ b/demos/gtk-demo/dialog.c @@ -58,7 +58,8 @@ interactive_dialog_clicked (GtkButton *button, hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE); - image = gtk_image_new_from_icon_name ("dialog-question", GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name ("dialog-question"); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE); table = gtk_grid_new (); diff --git a/demos/gtk-demo/gtkfishbowl.c b/demos/gtk-demo/gtkfishbowl.c index 3e5a7e9d70..5ba6f86cd5 100644 --- a/demos/gtk-demo/gtkfishbowl.c +++ b/demos/gtk-demo/gtkfishbowl.c @@ -404,8 +404,8 @@ gtk_fishbowl_set_count (GtkFishbowl *fishbowl, { GtkWidget *new_widget; - new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()), - GTK_ICON_SIZE_DIALOG); + new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ())); + gtk_image_set_icon_size (GTK_IMAGE (new_widget), GTK_ICON_SIZE_DIALOG); gtk_widget_show (new_widget); gtk_container_add (GTK_CONTAINER (fishbowl), new_widget); } diff --git a/demos/gtk-demo/headerbar.c b/demos/gtk-demo/headerbar.c index 2bf99a2f9c..6b0820a71b 100644 --- a/demos/gtk-demo/headerbar.c +++ b/demos/gtk-demo/headerbar.c @@ -36,7 +36,7 @@ do_headerbar (GtkWidget *do_widget) button = gtk_button_new (); icon = g_themed_icon_new ("mail-send-receive-symbolic"); - image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_gicon (icon); g_object_unref (icon); gtk_container_add (GTK_CONTAINER (button), image); gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button); @@ -44,10 +44,10 @@ do_headerbar (GtkWidget *do_widget) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked"); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic", GTK_ICON_SIZE_BUTTON)); + gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic")); gtk_container_add (GTK_CONTAINER (box), button); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-end-symbolic", GTK_ICON_SIZE_BUTTON)); + gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-end-symbolic")); gtk_container_add (GTK_CONTAINER (box), button); gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box); diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c index 4397647482..eec90a9ea1 100644 --- a/demos/gtk-demo/images.c +++ b/demos/gtk-demo/images.c @@ -362,7 +362,8 @@ do_images (GtkWidget *do_widget) gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE); - image = gtk_image_new_from_icon_name ("gtk3-demo", GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name ("gtk3-demo"); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_container_add (GTK_CONTAINER (frame), image); @@ -398,7 +399,8 @@ do_images (GtkWidget *do_widget) gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE); gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic"); - image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_gicon (gicon); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_container_add (GTK_CONTAINER (frame), image); diff --git a/demos/gtk-demo/listbox.c b/demos/gtk-demo/listbox.c index 798be03e95..a67dac7589 100644 --- a/demos/gtk-demo/listbox.c +++ b/demos/gtk-demo/listbox.c @@ -197,7 +197,10 @@ gtk_message_row_update (GtkMessageRow *row) gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by); if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0) - gtk_image_set_from_icon_name (priv->avatar_image, "gtk3-demo", GTK_ICON_SIZE_DND); + { + gtk_image_set_from_icon_name (priv->avatar_image, "gtk3-demo"); + gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_DND); + } else gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other); diff --git a/demos/gtk-demo/sidebar.c b/demos/gtk-demo/sidebar.c index b7061adf38..0e847c3f58 100644 --- a/demos/gtk-demo/sidebar.c +++ b/demos/gtk-demo/sidebar.c @@ -65,7 +65,7 @@ do_sidebar (GtkWidget *do_widget) { if (i == 0) { - widget = gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_MENU); + widget = gtk_image_new_from_icon_name ("help-about"); gtk_image_set_pixel_size (GTK_IMAGE (widget), 256); } else diff --git a/demos/icon-browser/iconbrowserwin.c b/demos/icon-browser/iconbrowserwin.c index c59fd48611..0e31452ac2 100644 --- a/demos/icon-browser/iconbrowserwin.c +++ b/demos/icon-browser/iconbrowserwin.c @@ -78,7 +78,7 @@ set_image (GtkWidget *image, const gchar *name, gint size) { GdkPixbuf *pixbuf; - gtk_image_set_from_icon_name (GTK_IMAGE (image), name, 1); + gtk_image_set_from_icon_name (GTK_IMAGE (image), name); gtk_image_set_pixel_size (GTK_IMAGE (image), size); pixbuf = get_icon (image, name, size); gtk_drag_source_set_icon_pixbuf (gtk_widget_get_parent (image), pixbuf); diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c index 5c08c493c7..b8d999834a 100644 --- a/docs/tools/widgets.c +++ b/docs/tools/widgets.c @@ -144,7 +144,7 @@ create_menu_button (void) widget = gtk_menu_button_new (); image = gtk_image_new (); - gtk_image_set_from_icon_name (GTK_IMAGE (image), "emblem-system-symbolic", GTK_ICON_SIZE_MENU); + gtk_image_set_from_icon_name (GTK_IMAGE (image), "emblem-system-symbolic"); gtk_container_add (GTK_CONTAINER (widget), image); menu = gtk_menu_new (); gtk_menu_button_set_popup (GTK_MENU_BUTTON (widget), menu); @@ -1094,8 +1094,8 @@ create_image (void) GtkWidget *widget; GtkWidget *vbox; - widget = gtk_image_new_from_icon_name ("applications-graphics", - GTK_ICON_SIZE_DIALOG); + widget = gtk_image_new_from_icon_name ("applications-graphics"); + gtk_image_set_icon_size (GTK_IMAGE (widget), GTK_ICON_SIZE_DIALOG); gtk_widget_set_halign (widget, GTK_ALIGN_CENTER); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); @@ -1260,7 +1260,7 @@ create_headerbar (void) gtk_header_bar_set_subtitle (GTK_HEADER_BAR (bar), "(subtitle)"); gtk_window_set_titlebar (GTK_WINDOW (window), bar); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic", GTK_ICON_SIZE_BUTTON)); + gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic")); gtk_header_bar_pack_end (GTK_HEADER_BAR (bar), button); gtk_widget_show_all (bar); diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index 0683004e1b..22f2e8b51f 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -1951,8 +1951,7 @@ gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about, } g_free (sizes); - gtk_image_set_from_icon_name (GTK_IMAGE (priv->logo_image), icon_name, - GTK_ICON_SIZE_DIALOG); + gtk_image_set_from_icon_name (GTK_IMAGE (priv->logo_image), icon_name); gtk_image_set_pixel_size (GTK_IMAGE (priv->logo_image), best_size); } else if ((icons = gtk_window_get_default_icon_list ())) diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c index 556525d121..ec34c5c7ac 100644 --- a/gtk/gtkappchooserdialog.c +++ b/gtk/gtkappchooserdialog.c @@ -488,7 +488,7 @@ setup_search (GtkAppChooserDialog *self) button = gtk_toggle_button_new (); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); - image = gtk_image_new_from_icon_name ("edit-find-symbolic", GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("edit-find-symbolic"); gtk_widget_show (image); gtk_container_add (GTK_CONTAINER (button), image); gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button"); diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 75fa520f80..6b594f7c8e 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -1356,7 +1356,7 @@ gtk_button_set_icon_name (GtkButton *button, if (child != NULL) gtk_container_remove (GTK_CONTAINER (button), child); - child = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON); + child = gtk_image_new_from_icon_name (icon_name); gtk_widget_show (child); gtk_container_add (GTK_CONTAINER (button), child); gtk_style_context_remove_class (context, "text-button"); @@ -1364,7 +1364,7 @@ gtk_button_set_icon_name (GtkButton *button, } else { - gtk_image_set_from_icon_name (GTK_IMAGE (child), icon_name, GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (GTK_IMAGE (child), icon_name); } gtk_button_set_child_type (button, ICON_CHILD); diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index 7a4c5e36ca..42e2837faa 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -563,9 +563,9 @@ update_icon (GtkColorSwatch *swatch) GtkIconHelper *icon_helper = GTK_ICON_HELPER (swatch->priv->overlay_gadget); if (swatch->priv->icon) - _gtk_icon_helper_set_icon_name (icon_helper, swatch->priv->icon, GTK_ICON_SIZE_BUTTON); + _gtk_icon_helper_set_icon_name (icon_helper, swatch->priv->icon); else if (gtk_widget_get_state_flags (GTK_WIDGET (swatch)) & GTK_STATE_FLAG_SELECTED) - _gtk_icon_helper_set_icon_name (icon_helper, "object-select-symbolic", GTK_ICON_SIZE_BUTTON); + _gtk_icon_helper_set_icon_name (icon_helper, "object-select-symbolic"); else _gtk_icon_helper_clear (icon_helper); } diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/gtkcustompaperunixdialog.c index 77d2ab0e64..bb548d4e7a 100644 --- a/gtk/gtkcustompaperunixdialog.c +++ b/gtk/gtkcustompaperunixdialog.c @@ -1003,7 +1003,7 @@ toolbutton_new (GtkCustomPaperUnixDialog *dialog, GtkWidget *image; item = gtk_tool_button_new (NULL, NULL); - image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_SMALL_TOOLBAR); + image = gtk_image_new_from_gicon (icon); gtk_widget_show (image); gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image); diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index ab698ff120..222cf2864d 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -8002,7 +8002,7 @@ gtk_entry_set_icon_from_icon_name (GtkEntry *entry, if (icon_name != NULL) { - _gtk_icon_helper_set_icon_name (GTK_ICON_HELPER (icon_info->gadget), icon_name, GTK_ICON_SIZE_MENU); + _gtk_icon_helper_set_icon_name (GTK_ICON_HELPER (icon_info->gadget), icon_name); if (icon_pos == GTK_ENTRY_ICON_PRIMARY) { @@ -8062,7 +8062,7 @@ gtk_entry_set_icon_from_gicon (GtkEntry *entry, if (icon) { - _gtk_icon_helper_set_gicon (GTK_ICON_HELPER (icon_info->gadget), icon, GTK_ICON_SIZE_MENU); + _gtk_icon_helper_set_gicon (GTK_ICON_HELPER (icon_info->gadget), icon); if (icon_pos == GTK_ENTRY_ICON_PRIMARY) { @@ -9029,7 +9029,7 @@ append_bubble_action (GtkEntry *entry, item = gtk_button_new (); gtk_widget_set_focus_on_click (item, FALSE); - image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name (icon_name); gtk_widget_show (image); gtk_container_add (GTK_CONTAINER (item), image); gtk_widget_set_tooltip_text (item, label); diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index 985a6f9e29..6f2c5df09a 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -385,7 +385,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar) atk_object_set_name (accessible, _("Application menu")); priv->titlebar_icon = image; if (!_gtk_header_bar_update_window_icon (bar, window)) - gtk_image_set_from_icon_name (GTK_IMAGE (priv->titlebar_icon), "process-stop-symbolic", GTK_ICON_SIZE_MENU); + gtk_image_set_from_icon_name (GTK_IMAGE (priv->titlebar_icon), "process-stop-symbolic"); priv->shows_app_menu = TRUE; } else if (strcmp (t[j], "minimize") == 0 && @@ -395,7 +395,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar) gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton"); gtk_style_context_add_class (gtk_widget_get_style_context (button), "minimize"); - image = gtk_image_new_from_icon_name ("window-minimize-symbolic", GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("window-minimize-symbolic"); g_object_set (image, "use-fallback", TRUE, NULL); gtk_container_add (GTK_CONTAINER (button), image); gtk_widget_set_can_focus (button, FALSE); @@ -418,7 +418,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar) gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton"); gtk_style_context_add_class (gtk_widget_get_style_context (button), "maximize"); - image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name (icon_name); g_object_set (image, "use-fallback", TRUE, NULL); gtk_container_add (GTK_CONTAINER (button), image); gtk_widget_set_can_focus (button, FALSE); @@ -434,7 +434,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar) { button = gtk_button_new (); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); - image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("window-close-symbolic"); gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton"); gtk_style_context_add_class (gtk_widget_get_style_context (button), "close"); g_object_set (image, "use-fallback", TRUE, NULL); diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index 048dfac238..47407438ef 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -106,8 +106,6 @@ _gtk_icon_helper_clear (GtkIconHelper *self) gtk_image_definition_unref (self->priv->def); self->priv->def = gtk_image_definition_new_empty (); - self->priv->icon_size = GTK_ICON_SIZE_INVALID; - gtk_icon_helper_invalidate (self); } @@ -670,20 +668,16 @@ _gtk_icon_helper_set_definition (GtkIconHelper *self, void _gtk_icon_helper_set_gicon (GtkIconHelper *self, - GIcon *gicon, - GtkIconSize icon_size) + GIcon *gicon) { gtk_icon_helper_take_definition (self, gtk_image_definition_new_gicon (gicon)); - _gtk_icon_helper_set_icon_size (self, icon_size); } void _gtk_icon_helper_set_icon_name (GtkIconHelper *self, - const gchar *icon_name, - GtkIconSize icon_size) + const gchar *icon_name) { gtk_icon_helper_take_definition (self, gtk_image_definition_new_icon_name (icon_name)); - _gtk_icon_helper_set_icon_size (self, icon_size); } void diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h index 63aa826c84..7dabecaeb9 100644 --- a/gtk/gtkiconhelperprivate.h +++ b/gtk/gtkiconhelperprivate.h @@ -80,8 +80,7 @@ gboolean _gtk_icon_helper_get_is_empty (GtkIconHelper *self); void _gtk_icon_helper_set_definition (GtkIconHelper *self, GtkImageDefinition *def); void _gtk_icon_helper_set_gicon (GtkIconHelper *self, - GIcon *gicon, - GtkIconSize icon_size); + GIcon *gicon); void _gtk_icon_helper_set_pixbuf (GtkIconHelper *self, GdkPixbuf *pixbuf); void _gtk_icon_helper_set_pixbuf_scale (GtkIconHelper *self, @@ -90,8 +89,7 @@ void _gtk_icon_helper_set_animation (GtkIconHelper *self, GdkPixbufAnimation *animation); void _gtk_icon_helper_set_icon_name (GtkIconHelper *self, - const gchar *icon_name, - GtkIconSize icon_size); + const gchar *icon_name); void _gtk_icon_helper_set_surface (GtkIconHelper *self, cairo_surface_t *surface); diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 63f33f2bd8..4dd4f41133 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -400,10 +400,6 @@ gtk_image_set_property (GObject *object, { GtkImage *image = GTK_IMAGE (object); GtkImagePrivate *priv = image->priv; - GtkIconSize icon_size = _gtk_icon_helper_get_icon_size (priv->icon_helper); - - if (icon_size == GTK_ICON_SIZE_INVALID) - icon_size = DEFAULT_ICON_SIZE; switch (prop_id) { @@ -417,11 +413,7 @@ gtk_image_set_property (GObject *object, gtk_image_set_from_file (image, g_value_get_string (value)); break; case PROP_ICON_SIZE: - if (_gtk_icon_helper_set_icon_size (priv->icon_helper, g_value_get_int (value))) - { - g_object_notify_by_pspec (object, pspec); - gtk_widget_queue_resize (GTK_WIDGET (image)); - } + gtk_image_set_icon_size (image, g_value_get_int (value)); break; case PROP_PIXEL_SIZE: gtk_image_set_pixel_size (image, g_value_get_int (value)); @@ -430,10 +422,10 @@ gtk_image_set_property (GObject *object, gtk_image_set_from_animation (image, g_value_get_object (value)); break; case PROP_ICON_NAME: - gtk_image_set_from_icon_name (image, g_value_get_string (value), icon_size); + gtk_image_set_from_icon_name (image, g_value_get_string (value)); break; case PROP_GICON: - gtk_image_set_from_gicon (image, g_value_get_object (value), icon_size); + gtk_image_set_from_gicon (image, g_value_get_object (value)); break; case PROP_RESOURCE: gtk_image_set_from_resource (image, g_value_get_string (value)); @@ -658,7 +650,6 @@ gtk_image_new_from_animation (GdkPixbufAnimation *animation) /** * gtk_image_new_from_icon_name: * @icon_name: an icon name - * @size: (type int): a stock icon size (#GtkIconSize) * * Creates a #GtkImage displaying an icon from the current icon theme. * If the icon name isn’t known, a “broken image” icon will be @@ -670,14 +661,13 @@ gtk_image_new_from_animation (GdkPixbufAnimation *animation) * Since: 2.6 **/ GtkWidget* -gtk_image_new_from_icon_name (const gchar *icon_name, - GtkIconSize size) +gtk_image_new_from_icon_name (const gchar *icon_name) { GtkImage *image; image = g_object_new (GTK_TYPE_IMAGE, NULL); - gtk_image_set_from_icon_name (image, icon_name, size); + gtk_image_set_from_icon_name (image, icon_name); return GTK_WIDGET (image); } @@ -685,7 +675,6 @@ gtk_image_new_from_icon_name (const gchar *icon_name, /** * gtk_image_new_from_gicon: * @icon: an icon - * @size: (type int): a stock icon size (#GtkIconSize) * * Creates a #GtkImage displaying an icon from the current icon theme. * If the icon name isn’t known, a “broken image” icon will be @@ -697,14 +686,13 @@ gtk_image_new_from_icon_name (const gchar *icon_name, * Since: 2.14 **/ GtkWidget* -gtk_image_new_from_gicon (GIcon *icon, - GtkIconSize size) +gtk_image_new_from_gicon (GIcon *icon) { GtkImage *image; image = g_object_new (GTK_TYPE_IMAGE, NULL); - gtk_image_set_from_gicon (image, icon, size); + gtk_image_set_from_gicon (image, icon); return GTK_WIDGET (image); } @@ -833,9 +821,7 @@ gtk_image_set_from_file (GtkImage *image, if (anim == NULL) { - gtk_image_set_from_icon_name (image, - "image-missing", - DEFAULT_ICON_SIZE); + gtk_image_set_from_icon_name (image, "image-missing"); g_object_thaw_notify (G_OBJECT (image)); return; } @@ -893,9 +879,7 @@ gtk_image_set_from_resource (GtkImage *image, if (animation == NULL) { - gtk_image_set_from_icon_name (image, - "image-missing", - DEFAULT_ICON_SIZE); + gtk_image_set_from_icon_name (image, "image-missing"); g_object_thaw_notify (G_OBJECT (image)); return; } @@ -990,16 +974,14 @@ gtk_image_set_from_animation (GtkImage *image, * gtk_image_set_from_icon_name: * @image: a #GtkImage * @icon_name: an icon name - * @size: (type int): an icon size (#GtkIconSize) * * See gtk_image_new_from_icon_name() for details. * * Since: 2.6 **/ void -gtk_image_set_from_icon_name (GtkImage *image, - const gchar *icon_name, - GtkIconSize size) +gtk_image_set_from_icon_name (GtkImage *image, + const gchar *icon_name) { GtkImagePrivate *priv; @@ -1012,10 +994,9 @@ gtk_image_set_from_icon_name (GtkImage *image, gtk_image_clear (image); if (icon_name) - _gtk_icon_helper_set_icon_name (priv->icon_helper, icon_name, size); + _gtk_icon_helper_set_icon_name (priv->icon_helper, icon_name); g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_NAME]); - g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]); g_object_thaw_notify (G_OBJECT (image)); } @@ -1024,16 +1005,14 @@ gtk_image_set_from_icon_name (GtkImage *image, * gtk_image_set_from_gicon: * @image: a #GtkImage * @icon: an icon - * @size: (type int): an icon size (#GtkIconSize) * * See gtk_image_new_from_gicon() for details. * * Since: 2.14 **/ void -gtk_image_set_from_gicon (GtkImage *image, - GIcon *icon, - GtkIconSize size) +gtk_image_set_from_gicon (GtkImage *image, + GIcon *icon) { GtkImagePrivate *priv; @@ -1050,12 +1029,11 @@ gtk_image_set_from_gicon (GtkImage *image, if (icon) { - _gtk_icon_helper_set_gicon (priv->icon_helper, icon, size); + _gtk_icon_helper_set_gicon (priv->icon_helper, icon); g_object_unref (icon); } g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_GICON]); - g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]); g_object_thaw_notify (G_OBJECT (image)); } @@ -1518,8 +1496,6 @@ gtk_image_reset (GtkImage *image) if (storage_type != GTK_IMAGE_EMPTY) g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_STORAGE_TYPE]); - g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]); - gtk_image_reset_anim_iter (image); gtk_image_notify_for_storage_type (image, storage_type); @@ -1635,6 +1611,28 @@ gtk_image_get_pixel_size (GtkImage *image) } /** + * gtk_image_set_icon_size: + * @image: a #GtkImage + * @icon_size: the new icon size + * + * Suggests an icon size to the theme for named icons. + * + * Since: 3.90 + */ +void +gtk_image_set_icon_size (GtkImage *image, + GtkIconSize icon_size) +{ + g_return_if_fail (GTK_IS_IMAGE (image)); + + if (_gtk_icon_helper_set_icon_size (image->priv->icon_helper, icon_size)) + { + gtk_widget_queue_resize (GTK_WIDGET (image)); + g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]); + } +} + +/** * gtk_image_get_icon_size: * @image: a #GtkImage * diff --git a/gtk/gtkimage.h b/gtk/gtkimage.h index e5a20d91e0..2a99d9aa11 100644 --- a/gtk/gtkimage.h +++ b/gtk/gtkimage.h @@ -117,11 +117,9 @@ GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf); GDK_AVAILABLE_IN_ALL GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation); GDK_AVAILABLE_IN_ALL -GtkWidget* gtk_image_new_from_icon_name (const gchar *icon_name, - GtkIconSize size); +GtkWidget* gtk_image_new_from_icon_name (const gchar *icon_name); GDK_AVAILABLE_IN_ALL -GtkWidget* gtk_image_new_from_gicon (GIcon *icon, - GtkIconSize size); +GtkWidget* gtk_image_new_from_gicon (GIcon *icon); GDK_AVAILABLE_IN_3_10 GtkWidget* gtk_image_new_from_surface (cairo_surface_t *surface); @@ -141,18 +139,19 @@ void gtk_image_set_from_animation (GtkImage *image, GdkPixbufAnimation *animation); GDK_AVAILABLE_IN_ALL void gtk_image_set_from_icon_name (GtkImage *image, - const gchar *icon_name, - GtkIconSize size); + const gchar *icon_name); GDK_AVAILABLE_IN_ALL void gtk_image_set_from_gicon (GtkImage *image, - GIcon *icon, - GtkIconSize size); + GIcon *icon); GDK_AVAILABLE_IN_3_10 void gtk_image_set_from_surface (GtkImage *image, cairo_surface_t *surface); GDK_AVAILABLE_IN_ALL void gtk_image_set_pixel_size (GtkImage *image, gint pixel_size); +GDK_AVAILABLE_IN_3_90 +void gtk_image_set_icon_size (GtkImage *image, + GtkIconSize icon_size); GDK_AVAILABLE_IN_ALL GtkImageType gtk_image_get_storage_type (GtkImage *image); diff --git a/gtk/gtklockbutton.c b/gtk/gtklockbutton.c index 424fbee047..39e897479a 100644 --- a/gtk/gtklockbutton.c +++ b/gtk/gtklockbutton.c @@ -384,7 +384,7 @@ update_state (GtkLockButton *button) g_assert_not_reached (); } - gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon, GTK_ICON_SIZE_MENU); + gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon); gtk_stack_set_visible_child (GTK_STACK (priv->stack), allowed ? priv->label_lock : priv->label_unlock); _gtk_lock_button_accessible_name_changed (button); diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c index 4534b4de5a..cfe1a03956 100644 --- a/gtk/gtkmenubutton.c +++ b/gtk/gtkmenubutton.c @@ -579,19 +579,19 @@ set_arrow_type (GtkImage *image, switch (arrow_type) { case GTK_ARROW_NONE: - gtk_image_set_from_icon_name (image, "open-menu-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (image, "open-menu-symbolic"); break; case GTK_ARROW_DOWN: - gtk_image_set_from_icon_name (image, "pan-down-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (image, "pan-down-symbolic"); break; case GTK_ARROW_UP: - gtk_image_set_from_icon_name (image, "pan-up-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (image, "pan-up-symbolic"); break; case GTK_ARROW_LEFT: - gtk_image_set_from_icon_name (image, "pan-start-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (image, "pan-start-symbolic"); break; case GTK_ARROW_RIGHT: - gtk_image_set_from_icon_name (image, "pan-end-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (image, "pan-end-symbolic"); break; } } diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c index 1d1f839a67..f030fd31f1 100644 --- a/gtk/gtkmodelbutton.c +++ b/gtk/gtkmodelbutton.c @@ -382,7 +382,7 @@ static void gtk_model_button_set_icon (GtkModelButton *button, GIcon *icon) { - gtk_image_set_from_gicon (GTK_IMAGE (button->image), icon, GTK_ICON_SIZE_MENU); + gtk_image_set_from_gicon (GTK_IMAGE (button->image), icon); update_visibility (button); g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_ICON]); } diff --git a/gtk/gtkmodelmenuitem.c b/gtk/gtkmodelmenuitem.c index 92fbaeae68..0f15a5e62c 100644 --- a/gtk/gtkmodelmenuitem.c +++ b/gtk/gtkmodelmenuitem.c @@ -199,7 +199,7 @@ gtk_model_menu_item_set_icon (GtkModelMenuItem *item, { GtkWidget *image; - image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_gicon (icon); gtk_image_set_pixel_size (GTK_IMAGE (image), 16); gtk_box_pack_start (GTK_BOX (child), image, FALSE, FALSE); gtk_widget_show (image); diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index d4f55d9478..c200213cd7 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -549,8 +549,8 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE); - icon = gtk_image_new_from_icon_name ("dialog-password", - GTK_ICON_SIZE_DIALOG); + icon = gtk_image_new_from_icon_name ("dialog-password"); + gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_DIALOG); gtk_widget_set_halign (icon, GTK_ALIGN_CENTER); gtk_widget_set_valign (icon, GTK_ALIGN_START); diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index fdb422351e..65a3cd5f87 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -1252,7 +1252,7 @@ set_button_image_get_info_cb (GCancellable *cancellable, goto out; icon = g_file_info_get_symbolic_icon (info); - gtk_image_set_from_gicon (GTK_IMAGE (data->button_data->image), icon, GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_gicon (GTK_IMAGE (data->button_data->image), icon); switch (data->button_data->type) { @@ -1286,7 +1286,7 @@ set_button_image (GtkPathBar *path_bar, if (path_bar->priv->root_icon != NULL) { - gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->root_icon, GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->root_icon); break; } @@ -1296,14 +1296,14 @@ set_button_image (GtkPathBar *path_bar, path_bar->priv->root_icon = _gtk_file_system_volume_get_symbolic_icon (volume); _gtk_file_system_volume_unref (volume); - gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->root_icon, GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->root_icon); break; case HOME_BUTTON: if (path_bar->priv->home_icon != NULL) { - gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->home_icon, GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->home_icon); break; } @@ -1325,7 +1325,7 @@ set_button_image (GtkPathBar *path_bar, case DESKTOP_BUTTON: if (path_bar->priv->desktop_icon != NULL) { - gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->desktop_icon, GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->desktop_icon); break; } diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c index 2275809fba..3df20907b5 100644 --- a/gtk/gtkplacesview.c +++ b/gtk/gtkplacesview.c @@ -595,7 +595,7 @@ populate_servers (GtkPlacesView *view) gtk_style_context_add_class (gtk_widget_get_style_context (button), "sidebar-button"); gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 2); gtk_container_add (GTK_CONTAINER (button), - gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_BUTTON)); + gtk_image_new_from_icon_name ("window-close-symbolic")); gtk_container_add (GTK_CONTAINER (row), grid); gtk_container_add (GTK_CONTAINER (priv->recent_servers_listbox), row); diff --git a/gtk/gtkplacesviewrow.c b/gtk/gtkplacesviewrow.c index b9306a7be9..efae5c3adb 100644 --- a/gtk/gtkplacesviewrow.c +++ b/gtk/gtkplacesviewrow.c @@ -265,9 +265,7 @@ gtk_places_view_row_set_property (GObject *object, switch (prop_id) { case PROP_ICON: - gtk_image_set_from_gicon (self->icon_image, - g_value_get_object (value), - GTK_ICON_SIZE_LARGE_TOOLBAR); + gtk_image_set_from_gicon (self->icon_image, g_value_get_object (value)); break; case PROP_NAME: @@ -474,7 +472,7 @@ gtk_places_view_row_set_is_network (GtkPlacesViewRow *row, { row->is_network = is_network; - gtk_image_set_from_icon_name (row->eject_icon, "media-eject-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (row->eject_icon, "media-eject-symbolic"); gtk_widget_set_tooltip_text (GTK_WIDGET (row->eject_button), is_network ? _("Disconnect") : _("Unmount")); } } diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c index 79581ac3ba..10a27825ca 100644 --- a/gtk/gtkprintbackend.c +++ b/gtk/gtkprintbackend.c @@ -769,7 +769,8 @@ request_password (GtkPrintBackend *backend, main_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); /* Left */ - icon = gtk_image_new_from_icon_name ("dialog-password-symbolic", GTK_ICON_SIZE_DIALOG); + icon = gtk_image_new_from_icon_name ("dialog-password-symbolic"); + gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_DIALOG); gtk_widget_set_halign (icon, GTK_ALIGN_CENTER); gtk_widget_set_valign (icon, GTK_ALIGN_START); g_object_set (icon, "margin", 12, NULL); diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c index e270dfabe2..ab03dee5a6 100644 --- a/gtk/gtkprinteroptionwidget.c +++ b/gtk/gtkprinteroptionwidget.c @@ -890,7 +890,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) break; } - priv->image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_MENU); + priv->image = gtk_image_new_from_icon_name ("dialog-warning"); gtk_box_pack_start (GTK_BOX (widget), priv->image, FALSE, FALSE); } diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c index 82f59be4d8..bec1c67fdb 100644 --- a/gtk/gtkrecentchoosermenu.c +++ b/gtk/gtkrecentchoosermenu.c @@ -819,7 +819,7 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu, { icon = gtk_recent_info_get_gicon (info); - image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_gicon (icon); if (icon) g_object_unref (icon); diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index de2d93c602..4e76eea718 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -962,8 +962,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button) if (!priv->icon_list || priv->icon_list[0] == '\0') { gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), - "image-missing", - GTK_ICON_SIZE_SMALL_TOOLBAR); + "image-missing"); return; } @@ -973,8 +972,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button) if (num_icons == 1) { gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), - priv->icon_list[0], - GTK_ICON_SIZE_SMALL_TOOLBAR); + priv->icon_list[0]); return; } @@ -993,8 +991,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button) name = priv->icon_list[1]; gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), - name, - GTK_ICON_SIZE_SMALL_TOOLBAR); + name); return; } @@ -1018,8 +1015,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button) } gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), - name, - GTK_ICON_SIZE_SMALL_TOOLBAR); + name); } static void diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c index 8e7e9335ee..e1b12e7e3f 100644 --- a/gtk/gtkshortcutsshortcut.c +++ b/gtk/gtkshortcutsshortcut.c @@ -246,7 +246,7 @@ update_icon_from_type (GtkShortcutsShortcut *self) if (icon) { - gtk_image_set_from_gicon (self->image, icon, GTK_ICON_SIZE_DIALOG); + gtk_image_set_from_gicon (self->image, icon); gtk_image_set_pixel_size (self->image, 64); g_object_unref (icon); } @@ -268,7 +268,7 @@ static void gtk_shortcuts_shortcut_set_icon (GtkShortcutsShortcut *self, GIcon *gicon) { - gtk_image_set_from_gicon (self->image, gicon, GTK_ICON_SIZE_DIALOG); + gtk_image_set_from_gicon (self->image, gicon); gtk_shortcuts_shortcut_set_icon_set (self, gicon != NULL); g_object_notify (G_OBJECT (self), "icon"); } diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c index 86d9532773..ec7490e2cf 100644 --- a/gtk/gtkshortcutswindow.c +++ b/gtk/gtkshortcutswindow.c @@ -890,7 +890,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) NULL); gtk_window_set_titlebar (GTK_WINDOW (self), GTK_WIDGET (priv->header_bar)); - search_icon = gtk_image_new_from_icon_name ("edit-find-symbolic", GTK_ICON_SIZE_BUTTON); + search_icon = gtk_image_new_from_icon_name ("edit-find-symbolic"); gtk_widget_show (search_icon); search_button = gtk_toggle_button_new (); @@ -955,8 +955,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) NULL); gtk_container_add (GTK_CONTAINER (menu_box), GTK_WIDGET (priv->menu_label)); - arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", - GTK_ICON_SIZE_BUTTON); + arrow = gtk_image_new_from_icon_name ("pan-down-symbolic"); gtk_widget_show (arrow); gtk_container_add (GTK_CONTAINER (menu_box), GTK_WIDGET (arrow)); diff --git a/gtk/gtksidebarrow.c b/gtk/gtksidebarrow.c index f8e25b44ab..fc0797bd2a 100644 --- a/gtk/gtksidebarrow.c +++ b/gtk/gtksidebarrow.c @@ -290,8 +290,7 @@ gtk_sidebar_row_set_icon (GtkSidebarRow *self, { g_set_object (&self->icon, icon); if (self->icon != NULL) - gtk_image_set_from_gicon (GTK_IMAGE (self->icon_widget), self->icon, - GTK_ICON_SIZE_MENU); + gtk_image_set_from_gicon (GTK_IMAGE (self->icon_widget), self->icon); else gtk_image_clear (GTK_IMAGE (self->icon_widget)); diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c index fb8a9a95d6..4d87d610ff 100644 --- a/gtk/gtkstackswitcher.c +++ b/gtk/gtkstackswitcher.c @@ -62,7 +62,6 @@ struct _GtkStackSwitcherPrivate { GtkStack *stack; GHashTable *buttons; - gint icon_size; gboolean in_child_changed; GtkWidget *switch_button; guint switch_timer; @@ -70,7 +69,6 @@ struct _GtkStackSwitcherPrivate enum { PROP_0, - PROP_ICON_SIZE, PROP_STACK }; @@ -86,7 +84,6 @@ gtk_stack_switcher_init (GtkStackSwitcher *switcher) priv = gtk_stack_switcher_get_instance_private (switcher); - priv->icon_size = GTK_ICON_SIZE_MENU; priv->stack = NULL; priv->buttons = g_hash_table_new (g_direct_hash, g_direct_equal); @@ -119,8 +116,7 @@ on_button_clicked (GtkWidget *widget, static void rebuild_child (GtkWidget *self, const gchar *icon_name, - const gchar *title, - gint icon_size) + const gchar *title) { GtkStyleContext *context; GtkWidget *button_child; @@ -134,7 +130,7 @@ rebuild_child (GtkWidget *self, if (icon_name != NULL) { - button_child = gtk_image_new_from_icon_name (icon_name, icon_size); + button_child = gtk_image_new_from_icon_name (icon_name); if (title != NULL) gtk_widget_set_tooltip_text (GTK_WIDGET (self), title); @@ -194,7 +190,7 @@ update_button (GtkStackSwitcher *self, "icon-name", &icon_name, NULL); - rebuild_child (button, icon_name, title, priv->icon_size); + rebuild_child (button, icon_name, title); gtk_widget_set_visible (button, gtk_widget_get_visible (widget) && (title != NULL || icon_name != NULL)); @@ -560,30 +556,6 @@ gtk_stack_switcher_get_stack (GtkStackSwitcher *switcher) } static void -gtk_stack_switcher_set_icon_size (GtkStackSwitcher *switcher, - gint icon_size) -{ - GtkStackSwitcherPrivate *priv; - - g_return_if_fail (GTK_IS_STACK_SWITCHER (switcher)); - - priv = gtk_stack_switcher_get_instance_private (switcher); - - if (icon_size != priv->icon_size) - { - priv->icon_size = icon_size; - - if (priv->stack != NULL) - { - clear_switcher (switcher); - populate_switcher (switcher); - } - - g_object_notify (G_OBJECT (switcher), "icon-size"); - } -} - -static void gtk_stack_switcher_get_property (GObject *object, guint prop_id, GValue *value, @@ -595,10 +567,6 @@ gtk_stack_switcher_get_property (GObject *object, priv = gtk_stack_switcher_get_instance_private (switcher); switch (prop_id) { - case PROP_ICON_SIZE: - g_value_set_int (value, priv->icon_size); - break; - case PROP_STACK: g_value_set_object (value, priv->stack); break; @@ -619,10 +587,6 @@ gtk_stack_switcher_set_property (GObject *object, switch (prop_id) { - case PROP_ICON_SIZE: - gtk_stack_switcher_set_icon_size (switcher, g_value_get_int (value)); - break; - case PROP_STACK: gtk_stack_switcher_set_stack (switcher, g_value_get_object (value)); break; @@ -670,22 +634,6 @@ gtk_stack_switcher_class_init (GtkStackSwitcherClass *class) widget_class->drag_motion = gtk_stack_switcher_drag_motion; widget_class->drag_leave = gtk_stack_switcher_drag_leave; - /** - * GtkStackSwitcher:icon-size: - * - * Use the "icon-size" property to change the size of the image displayed - * when a #GtkStackSwitcher is displaying icons. - * - * Since: 3.20 - */ - g_object_class_install_property (object_class, - PROP_ICON_SIZE, - g_param_spec_int ("icon-size", - P_("Icon Size"), - P_("Symbolic size to use for named icon"), - 0, G_MAXINT, - GTK_ICON_SIZE_MENU, - G_PARAM_EXPLICIT_NOTIFY | GTK_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_STACK, diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 7f4f79a19c..bf41734e8e 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -9470,7 +9470,7 @@ append_bubble_action (GtkTextView *text_view, item = gtk_button_new (); gtk_widget_set_focus_on_click (item, FALSE); - image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name (icon_name); gtk_widget_show (image); gtk_container_add (GTK_CONTAINER (item), image); gtk_widget_set_tooltip_text (item, label); diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 4000f54b07..e3a1ced9e8 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -619,7 +619,7 @@ gtk_toolbar_init (GtkToolbar *toolbar) gtk_widget_set_focus_on_click (priv->arrow_button, FALSE); - priv->arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); + priv->arrow = gtk_image_new_from_icon_name ("pan-down-symbolic"); gtk_widget_set_name (priv->arrow, "gtk-toolbar-arrow"); gtk_widget_show (priv->arrow); gtk_container_add (GTK_CONTAINER (priv->arrow_button), priv->arrow); @@ -2394,9 +2394,9 @@ gtk_toolbar_orientation_changed (GtkToolbar *toolbar, priv->orientation = orientation; if (orientation == GTK_ORIENTATION_HORIZONTAL) - gtk_image_set_from_icon_name (GTK_IMAGE (priv->arrow), "pan-down-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (GTK_IMAGE (priv->arrow), "pan-down-symbolic"); else - gtk_image_set_from_icon_name (GTK_IMAGE (priv->arrow), "pan-end-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (GTK_IMAGE (priv->arrow), "pan-end-symbolic"); gtk_toolbar_reconfigured (toolbar); diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c index 74d4c250d5..384ef236fa 100644 --- a/gtk/gtktoolbutton.c +++ b/gtk/gtktoolbutton.c @@ -468,7 +468,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item) } else if (button->priv->icon_name) { - icon = gtk_image_new_from_icon_name (button->priv->icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR); + icon = gtk_image_new_from_icon_name (button->priv->icon_name); gtk_widget_show (icon); } @@ -721,13 +721,13 @@ clone_image_menu_size (GtkImage *image) { const gchar *icon_name = gtk_image_get_icon_name (image); - return gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); + return gtk_image_new_from_icon_name (icon_name); } else if (storage_type == GTK_IMAGE_GICON) { GIcon *icon = gtk_image_get_gicon (image); - return gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); + return gtk_image_new_from_gicon (icon); } else if (storage_type == GTK_IMAGE_PIXBUF) { diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c index 0b536b4c3a..6409767eec 100644 --- a/gtk/gtktooltipwindow.c +++ b/gtk/gtktooltipwindow.c @@ -143,7 +143,7 @@ gtk_tooltip_window_set_image_icon_from_name (GtkTooltipWindow *window, { if (icon_name) { - gtk_image_set_from_icon_name (GTK_IMAGE (window->image), icon_name, GTK_ICON_SIZE_MENU); + gtk_image_set_from_icon_name (GTK_IMAGE (window->image), icon_name); gtk_widget_show (window->image); } else @@ -158,7 +158,7 @@ gtk_tooltip_window_set_image_icon_from_gicon (GtkTooltipWindow *window, { if (gicon != NULL) { - gtk_image_set_from_gicon (GTK_IMAGE (window->image), gicon, GTK_ICON_SIZE_MENU); + gtk_image_set_from_gicon (GTK_IMAGE (window->image), gicon); gtk_widget_show (window->image); } else diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index 9b72d2d653..0da78d5c1b 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -835,7 +835,7 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column) gtk_widget_set_halign (priv->frame, GTK_ALIGN_START); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); - priv->arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); + priv->arrow = gtk_image_new_from_icon_name ("pan-down-symbolic"); if (priv->child) child = priv->child; @@ -952,7 +952,7 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column) } } - gtk_image_set_from_icon_name (GTK_IMAGE (arrow), icon_name, GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (GTK_IMAGE (arrow), icon_name); /* Put arrow on the right if the text is left-or-center justified, and on the * left otherwise; do this by packing boxes, so flipping text direction will diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c index 04df6500e6..e3e3455242 100644 --- a/gtk/inspector/general.c +++ b/gtk/inspector/general.c @@ -140,7 +140,7 @@ add_check_row (GtkInspectorGeneral *gen, gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE); - check = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU); + check = gtk_image_new_from_icon_name ("object-select-symbolic"); gtk_widget_set_halign (check, GTK_ALIGN_END); gtk_widget_set_valign (check, GTK_ALIGN_BASELINE); gtk_widget_set_opacity (check, value ? 1.0 : 0.0); diff --git a/tests/testadjustsize.c b/tests/testadjustsize.c index ac4fddbe6e..32f02fa779 100644 --- a/tests/testadjustsize.c +++ b/tests/testadjustsize.c @@ -36,8 +36,7 @@ static GtkWidget *test_widgets[TEST_WIDGET_LAST]; static GtkWidget* create_image (void) { - return gtk_image_new_from_icon_name ("document-open", - GTK_ICON_SIZE_BUTTON); + return gtk_image_new_from_icon_name ("document-open"); } static GtkWidget* diff --git a/tests/testappchooserbutton.c b/tests/testappchooserbutton.c index 6ff01d11f8..77986d0ca0 100644 --- a/tests/testappchooserbutton.c +++ b/tests/testappchooserbutton.c @@ -37,8 +37,7 @@ combo_changed_cb (GtkComboBox *cb, if (app_info == NULL) return; - gtk_image_set_from_gicon (GTK_IMAGE (sel_image), g_app_info_get_icon (app_info), - GTK_ICON_SIZE_DIALOG); + gtk_image_set_from_gicon (GTK_IMAGE (sel_image), g_app_info_get_icon (app_info)); gtk_label_set_text (GTK_LABEL (sel_name), g_app_info_get_display_name (app_info)); g_object_unref (app_info); @@ -49,8 +48,7 @@ special_item_activated_cb (GtkAppChooserButton *b, const gchar *item_name, gpointer user_data) { - gtk_image_set_from_gicon (GTK_IMAGE (sel_image), g_themed_icon_new ("face-smile"), - GTK_ICON_SIZE_DIALOG); + gtk_image_set_from_gicon (GTK_IMAGE (sel_image), g_themed_icon_new ("face-smile")); gtk_label_set_text (GTK_LABEL (sel_name), "Special Item"); } diff --git a/tests/testbaseline.c b/tests/testbaseline.c index d402665b7c..bdba4f01e1 100644 --- a/tests/testbaseline.c +++ b/tests/testbaseline.c @@ -178,7 +178,7 @@ main (int argc, gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("│Xyj,Ö")); gtk_container_add (GTK_CONTAINER (box), - gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON)); + gtk_image_new_from_icon_name ("face-sad")); gtk_container_add (GTK_CONTAINER (button), box); set_font_size (button, i); @@ -194,7 +194,7 @@ main (int argc, gtk_widget_set_valign (ebox, GTK_ALIGN_BASELINE); gtk_container_add (GTK_CONTAINER (hbox), ebox); - image = gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_icon_name ("face-sad"); gtk_image_set_pixel_size (GTK_IMAGE (image), 34); if (j == 0) gtk_widget_set_valign (image, GTK_ALIGN_BASELINE); @@ -277,7 +277,7 @@ main (int argc, gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("│Xyj,Ö")); gtk_container_add (GTK_CONTAINER (box), - gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON)); + gtk_image_new_from_icon_name ("face-sad")); gtk_container_add (GTK_CONTAINER (button), box); set_font_size (button, i); @@ -342,7 +342,7 @@ main (int argc, gtk_container_add (GTK_CONTAINER (hbox), label); gtk_widget_set_vexpand (label, TRUE); - image = gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_icon_name ("face-sad"); gtk_image_set_pixel_size (GTK_IMAGE (image), 34); gtk_container_add (GTK_CONTAINER (hbox), image); @@ -366,7 +366,7 @@ main (int argc, button = gtk_button_new (); gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("│Xyj,Ö")); - image = gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_icon_name ("face-sad"); gtk_image_set_pixel_size (GTK_IMAGE (image), 16); gtk_container_add (GTK_CONTAINER (box), image); gtk_container_add (GTK_CONTAINER (button), box); diff --git a/tests/testdialog.c b/tests/testdialog.c index 941acfdba1..5350b472e9 100644 --- a/tests/testdialog.c +++ b/tests/testdialog.c @@ -33,7 +33,8 @@ show_message_dialog1a (GtkWindow *parent) GTK_BUTTONS_OK, "The system network services are not compatible with this version.")); - image = gtk_image_new_from_icon_name ("computer-fail", GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name ("computer-fail"); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_widget_show (image); gtk_dialog_run (GTK_DIALOG (dialog)); diff --git a/tests/testdnd2.c b/tests/testdnd2.c index 7b7c508d4f..1a892dd38c 100644 --- a/tests/testdnd2.c +++ b/tests/testdnd2.c @@ -207,7 +207,7 @@ image_drag_data_received (GtkWidget *widget, break; case TARGET_TEXT: text = (gchar *)gtk_selection_data_get_text (selection_data); - gtk_image_set_from_icon_name (GTK_IMAGE (data), text, GTK_ICON_SIZE_DIALOG); + gtk_image_set_from_icon_name (GTK_IMAGE (data), text); g_free (text); break; default: @@ -221,7 +221,8 @@ make_image (const gchar *icon_name, int hotspot) { GtkWidget *image, *ebox; - image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name (icon_name); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); ebox = gtk_event_box_new (); gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY); @@ -246,7 +247,8 @@ make_image2 (const gchar *icon_name, int hotspot) { GtkWidget *image, *ebox; - image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name (icon_name); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); ebox = gtk_event_box_new (); gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY); diff --git a/tests/testemblems.c b/tests/testemblems.c index 171d2a7f3a..7ab8a5bfe2 100644 --- a/tests/testemblems.c +++ b/tests/testemblems.c @@ -18,19 +18,19 @@ int main (int argc, char **argv) gtk_container_add (GTK_CONTAINER (window), grid); icon = g_themed_icon_new ("folder"); - button = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); + button = gtk_image_new_from_gicon (icon); gtk_grid_attach (GTK_GRID (grid), button, 1, 1, 1, 1); icon2 = g_themed_icon_new ("folder-symbolic"); - button = gtk_image_new_from_gicon (icon2, GTK_ICON_SIZE_MENU); + button = gtk_image_new_from_gicon (icon2); gtk_grid_attach (GTK_GRID (grid), button, 2, 1, 1, 1); icon = g_emblemed_icon_new (icon, g_emblem_new (g_themed_icon_new ("emblem-new"))); - button = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); + button = gtk_image_new_from_gicon (icon); gtk_grid_attach (GTK_GRID (grid), button, 1, 2, 1, 1); icon2 = g_emblemed_icon_new (icon2, g_emblem_new (g_themed_icon_new ("emblem-new"))); - button = gtk_image_new_from_gicon (icon2, GTK_ICON_SIZE_MENU); + button = gtk_image_new_from_gicon (icon2); gtk_grid_attach (GTK_GRID (grid), button, 2, 2, 1, 1); gtk_widget_show_all (window); diff --git a/tests/testflowbox.c b/tests/testflowbox.c index 156a933d00..53a6c5fb0b 100644 --- a/tests/testflowbox.c +++ b/tests/testflowbox.c @@ -177,7 +177,8 @@ populate_flowbox_images (GtkFlowBox *flowbox) widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_widget_set_hexpand (widget, TRUE); - image = gtk_image_new_from_icon_name ("face-wink", GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name ("face-wink"); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_widget_set_hexpand (image, TRUE); gtk_image_set_pixel_size (GTK_IMAGE (image), 256); diff --git a/tests/testgiconpixbuf.c b/tests/testgiconpixbuf.c index 5c406aac66..6d7f840d85 100644 --- a/tests/testgiconpixbuf.c +++ b/tests/testgiconpixbuf.c @@ -38,7 +38,8 @@ main (int argc, vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE); - image = gtk_image_new_from_gicon (G_ICON (pixbuf), GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_gicon (G_ICON (pixbuf)); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE); label = gtk_label_new (NULL); @@ -53,7 +54,8 @@ main (int argc, vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE); - image2 = gtk_image_new_from_gicon (emblemed, GTK_ICON_SIZE_DIALOG); + image2 = gtk_image_new_from_gicon (emblemed); + gtk_image_set_icon_size (GTK_IMAGE (image2), GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (vbox), image2, FALSE, FALSE); label = gtk_label_new (NULL); diff --git a/tests/testgtk.c b/tests/testgtk.c index 7e08e27dcb..524f52f3a0 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2069,8 +2069,7 @@ create_image (GtkWidget *widget) gtk_container_add (GTK_CONTAINER (window), vbox); pack_image (vbox, "Stock Warning Dialog", - gtk_image_new_from_icon_name ("dialog-warning", - GTK_ICON_SIZE_DIALOG)); + gtk_image_new_from_icon_name ("dialog-warning")); pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile); @@ -2279,8 +2278,7 @@ create_menu (GdkScreen *screen, gint depth, gint length) group = NULL; - image = gtk_image_new_from_icon_name ("document-open", - GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("document-open"); gtk_widget_show (image); menuitem = gtk_menu_item_new (); label = gtk_label_new ("Image Item"); @@ -2342,8 +2340,7 @@ create_table_menu (GdkScreen *screen, gint cols, gint rows) j++; /* now fill the items submenu */ - image = gtk_image_new_from_icon_name ("help-broswer", - GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("help-browser"); gtk_widget_show (image); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; menuitem = gtk_menu_item_new (); @@ -2363,8 +2360,7 @@ create_table_menu (GdkScreen *screen, gint cols, gint rows) gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 1, 2); gtk_widget_show (menuitem); - image = gtk_image_new_from_icon_name ("help-browser", - GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("help-browser"); gtk_widget_show (image); menuitem = gtk_menu_item_new (); label = gtk_label_new ("Image"); @@ -2573,8 +2569,7 @@ create_menus (GtkWidget *widget) gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_widget_show (menuitem); - image = gtk_image_new_from_icon_name ("help-browser", - GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("help-browser"); gtk_widget_show (image); menuitem = gtk_menu_item_new (); label = gtk_label_new ("Help"); diff --git a/tests/testheaderbar.c b/tests/testheaderbar.c index 57ed406503..dbd7ce61d6 100644 --- a/tests/testheaderbar.c +++ b/tests/testheaderbar.c @@ -112,7 +112,7 @@ change_header (GtkButton *button, gpointer data) gtk_header_bar_pack_end (GTK_HEADER_BAR (header), widget); widget= gtk_button_new (); - image = gtk_image_new_from_icon_name ("bookmark-new-symbolic", GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_icon_name ("bookmark-new-symbolic"); g_signal_connect (widget, "clicked", G_CALLBACK (on_bookmark_clicked), window); gtk_container_add (GTK_CONTAINER (widget), image); @@ -163,7 +163,7 @@ main (int argc, char *argv[]) g_signal_connect (button, "clicked", G_CALLBACK (toggle_fullscreen), window); gtk_box_pack_end (GTK_BOX (box), footer, FALSE, FALSE); - content = gtk_image_new_from_icon_name ("start-here-symbolic", GTK_ICON_SIZE_DIALOG); + content = gtk_image_new_from_icon_name ("start-here-symbolic"); gtk_image_set_pixel_size (GTK_IMAGE (content), 512); gtk_box_pack_start (GTK_BOX (box), content, FALSE, TRUE); diff --git a/tests/testimage.c b/tests/testimage.c index 7f61f7588b..03336f6b1e 100644 --- a/tests/testimage.c +++ b/tests/testimage.c @@ -133,21 +133,25 @@ main (int argc, char **argv) label = gtk_label_new ("GTK_IMAGE_ICON_NAME"); gtk_grid_attach (GTK_GRID (grid), label, 0, 4, 1, 1); - image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name (icon_name); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_grid_attach (GTK_GRID (grid), image, 1, 4, 1, 1); - image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name (icon_name); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); gtk_image_set_pixel_size (GTK_IMAGE (image), 30); gtk_grid_attach (GTK_GRID (grid), image, 2, 4, 1, 1); label = gtk_label_new ("GTK_IMAGE_GICON"); gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 1, 1); icon = g_themed_icon_new_with_default_fallbacks ("folder-remote"); - image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_gicon (icon); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); g_object_unref (icon); gtk_grid_attach (GTK_GRID (grid), image, 1, 5, 1, 1); file = g_file_new_for_path ("apple-red.png"); icon = g_file_icon_new (file); - image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_gicon (icon); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); g_object_unref (icon); gtk_image_set_pixel_size (GTK_IMAGE (image), 30); gtk_grid_attach (GTK_GRID (grid), image, 2, 5, 1, 1); diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c index 15b88c74bc..2dcf8fabc8 100644 --- a/tests/testtoolbar.c +++ b/tests/testtoolbar.c @@ -556,7 +556,8 @@ main (gint argc, gchar **argv) add_item_to_list (store, item, "-----"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); - image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name ("dialog-warning"); + gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_DIALOG); item = gtk_tool_item_new (); gtk_widget_show (image); gtk_container_add (GTK_CONTAINER (item), image); @@ -621,13 +622,13 @@ main (gint argc, gchar **argv) gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (item), TRUE); gicon = g_content_type_get_icon ("video/ogg"); - image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_LARGE_TOOLBAR); + image = gtk_image_new_from_gicon (gicon); g_object_unref (gicon); item = gtk_tool_button_new (image, "Video"); add_item_to_list (store, item, "Video"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); - image = gtk_image_new_from_icon_name ("utilities-terminal", GTK_ICON_SIZE_LARGE_TOOLBAR); + image = gtk_image_new_from_icon_name ("utilities-terminal"); item = gtk_tool_button_new (image, "Terminal"); add_item_to_list (store, item, "Terminal"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); diff --git a/tests/testtoplevelembed.c b/tests/testtoplevelembed.c index 4df5aec021..521ad9381e 100644 --- a/tests/testtoplevelembed.c +++ b/tests/testtoplevelembed.c @@ -18,7 +18,7 @@ create_tab_label (GtkWidget *toplevel) GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); GtkWidget *label = gtk_label_new (G_OBJECT_TYPE_NAME (toplevel)); GtkWidget *button = gtk_button_new (); - GtkWidget *image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU); + GtkWidget *image = gtk_image_new_from_icon_name ("window-close"); gtk_container_add (GTK_CONTAINER (button), image); gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE); diff --git a/testsuite/reftests/set-default-direction.c b/testsuite/reftests/set-default-direction.c index 638045db1d..468d3dc922 100644 --- a/testsuite/reftests/set-default-direction.c +++ b/testsuite/reftests/set-default-direction.c @@ -82,7 +82,7 @@ swap_child (GtkWidget *window) gtk_container_remove (GTK_CONTAINER (window), gtk_bin_get_child (GTK_BIN (window))); - image = gtk_image_new_from_icon_name ("go-next", GTK_ICON_SIZE_BUTTON); + image = gtk_image_new_from_icon_name ("go-next"); gtk_widget_show (image); gtk_container_add (GTK_CONTAINER (window), image); } |