static void event_box_realize (GtkWidget *widget, GtkImage *image) { GtkImageType type; GdkPixbuf *pixbuf; const gchar *icon_name; _exo_toolbars_set_drag_cursor (widget); type = gtk_image_get_storage_type (image); if (type == GTK_IMAGE_ICON_NAME) { gtk_image_get_icon_name (image, &icon_name, NULL); if (icon_name != NULL) gtk_drag_source_set_icon_name (widget, icon_name); } else if (type == GTK_IMAGE_PIXBUF) { pixbuf = gtk_image_get_pixbuf (image); if (G_LIKELY (pixbuf != NULL)) gtk_drag_source_set_icon_pixbuf (widget, pixbuf); } }
static void serializer_append_icon_attribute (Serializer* self, GtkImage* image) { char* _tmp1_; char* _tmp0_ = NULL; gboolean _tmp2_; g_return_if_fail (self != NULL); g_return_if_fail (image != NULL); if ((_tmp2_ = (_tmp1_ = (g_object_get (image, "file", &_tmp0_, NULL), _tmp0_)) != NULL, _g_free0 (_tmp1_), _tmp2_)) { char* _tmp5_; char* _tmp4_; char* _tmp3_ = NULL; g_string_append (self->priv->sb, _tmp5_ = g_markup_printf_escaped (" icon=\"file:%s\"", _tmp4_ = (g_object_get (image, "file", &_tmp3_, NULL), _tmp3_))); _g_free0 (_tmp5_); _g_free0 (_tmp4_); } else { if (gtk_image_get_storage_type (image) == GTK_IMAGE_STOCK) { char* _tmp6_ = NULL; char* stock; stock = (g_object_get (image, "stock", &_tmp6_, NULL), _tmp6_); if (g_str_has_prefix (stock, "gtk")) { char* _tmp7_; g_string_append (self->priv->sb, _tmp7_ = g_markup_printf_escaped (" icon=\"%s\"", stock)); _g_free0 (_tmp7_); } else { if (!self->disable_pixbuf) { char* _tmp9_; char* _tmp8_ = NULL; GdkPixbuf* _tmp10_; GdkPixbuf* pixbuf; pixbuf = (_tmp10_ = gtk_widget_render_icon ((GtkWidget*) image, _tmp9_ = (g_object_get (image, "stock", &_tmp8_, NULL), _tmp8_), GTK_ICON_SIZE_MENU, NULL), _g_free0 (_tmp9_), _tmp10_); if (pixbuf != NULL) { char* _tmp12_; char* _tmp11_; g_string_append (self->priv->sb, _tmp12_ = g_markup_printf_escaped (" icon=\"pixbuf:%s\"", _tmp11_ = serializer_pixbuf_encode_b64 (self, pixbuf))); _g_free0 (_tmp12_); _g_free0 (_tmp11_); } _g_object_unref0 (pixbuf); } } _g_free0 (stock); } if (gtk_image_get_storage_type (image) == GTK_IMAGE_ICON_NAME) { char* _tmp15_; char* _tmp14_; char* _tmp13_ = NULL; g_string_append (self->priv->sb, _tmp15_ = g_markup_printf_escaped (" icon=\"theme:%s\"", _tmp14_ = (g_object_get (image, "icon-name", &_tmp13_, NULL), _tmp13_))); _g_free0 (_tmp15_); _g_free0 (_tmp14_); } if (gtk_image_get_storage_type (image) == GTK_IMAGE_PIXBUF) { if (!self->disable_pixbuf) { GdkPixbuf* _tmp17_; GdkPixbuf* _tmp16_ = NULL; gboolean _tmp18_; if ((_tmp18_ = (_tmp17_ = (g_object_get (image, "pixbuf", &_tmp16_, NULL), _tmp16_)) != NULL, _g_object_unref0 (_tmp17_), _tmp18_)) { char* _tmp22_; char* _tmp21_; GdkPixbuf* _tmp20_; GdkPixbuf* _tmp19_ = NULL; g_string_append (self->priv->sb, _tmp22_ = g_markup_printf_escaped (" icon=\"pixbuf:%s\"", _tmp21_ = serializer_pixbuf_encode_b64 (self, _tmp20_ = (g_object_get (image, "pixbuf", &_tmp19_, NULL), _tmp19_)))); _g_free0 (_tmp22_); _g_free0 (_tmp21_); _g_object_unref0 (_tmp20_); } } } if (gtk_image_get_storage_type (image) == GTK_IMAGE_PIXMAP) { gulong pixmap_xid; gulong mask_xid; GdkPixmap* _tmp24_; GdkPixmap* _tmp23_ = NULL; gboolean _tmp25_; GdkPixmap* _tmp29_; GdkPixmap* _tmp28_ = NULL; gboolean _tmp30_; char* _tmp33_; pixmap_xid = (gulong) 0; mask_xid = (gulong) 0; if ((_tmp25_ = (_tmp24_ = (g_object_get (image, "pixmap", &_tmp23_, NULL), _tmp23_)) != NULL, _g_object_unref0 (_tmp24_), _tmp25_)) { GdkPixmap* _tmp27_; GdkPixmap* _tmp26_ = NULL; pixmap_xid = (gulong) gdk_x11_drawable_get_xid ((GdkDrawable*) (_tmp27_ = (g_object_get (image, "pixmap", &_tmp26_, NULL), _tmp26_))); _g_object_unref0 (_tmp27_); } if ((_tmp30_ = (_tmp29_ = (g_object_get (image, "mask", &_tmp28_, NULL), _tmp28_)) != NULL, _g_object_unref0 (_tmp29_), _tmp30_)) { GdkPixmap* _tmp32_; GdkPixmap* _tmp31_ = NULL; mask_xid = (gulong) gdk_x11_drawable_get_xid ((GdkDrawable*) (_tmp32_ = (g_object_get (image, "mask", &_tmp31_, NULL), _tmp31_))); _g_object_unref0 (_tmp32_); } g_string_append (self->priv->sb, _tmp33_ = g_markup_printf_escaped (" icon=\"pixmap:%lu,%lu\"", pixmap_xid, mask_xid)); _g_free0 (_tmp33_); } } }
/* * Writes the source code needed to create this widget. * You have to output everything necessary to create the widget here, though * there are some convenience functions to help. */ static void gb_image_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data) { /* For GNOME projects menuitem images are handled by the GnomeUIInfo structs, so we don't create source code here. */ if (widget->parent && GTK_IS_IMAGE_MENU_ITEM (widget->parent) && glade_project_get_gnome_support (data->project)) return; if (data->create_widget) { gchar *icon = gtk_object_get_data (GTK_OBJECT (widget), GladeIconKey); const gchar *icon_size = "GTK_ICON_SIZE_BUTTON"; GtkImageType storage_type; gint i; for (i = 0; i < GladeIconSizeChoicesSize; i++) { if (GladeIconSizeValues[i] == GTK_IMAGE (widget)->icon_size) { icon_size = GladeIconSizeSymbols[i]; } } storage_type = gtk_image_get_storage_type (GTK_IMAGE (widget)); if (storage_type == GTK_IMAGE_ICON_NAME) { gint pixel_size = gtk_image_get_pixel_size (GTK_IMAGE (widget)); gchar *icon_name; g_object_get (widget, "icon_name", &icon_name, NULL); source_add (data, " %s = gtk_image_new_from_icon_name (\"%s\", %s);\n", data->wname, icon_name ? icon_name : "gtk-missing-image", icon_size); if (pixel_size > 0) { source_add (data, " gtk_image_set_pixel_size (%s, %i);\n", data->wname, pixel_size); } } else if (glade_util_check_is_stock_id (icon)) { source_add (data, " %s = gtk_image_new_from_stock (\"%s\", %s);\n", data->wname, icon, icon_size); } else { source_create_pixmap (data, data->wname, icon); } } gb_widget_write_standard_source (widget, data); if (fabs (GTK_MISC (widget)->xalign - 0.5) > 0.0001 || fabs (GTK_MISC (widget)->yalign - 0.5) > 0.0001) source_add (data, " gtk_misc_set_alignment (GTK_MISC (%s), %g, %g);\n", data->wname, GTK_MISC (widget)->xalign, GTK_MISC (widget)->yalign); if (GTK_MISC (widget)->xpad != 0 || GTK_MISC (widget)->ypad != 0) source_add (data, " gtk_misc_set_padding (GTK_MISC (%s), %i, %i);\n", data->wname, GTK_MISC (widget)->xpad, GTK_MISC (widget)->ypad); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_image_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { gchar *icon = gtk_object_get_data (GTK_OBJECT (widget), GladeIconKey); gchar *icon_name = NULL; gboolean is_stock_icon, is_named_icon = FALSE; gint i, pixel_size; GtkImageType storage_type; storage_type = gtk_image_get_storage_type (GTK_IMAGE (widget)); pixel_size = gtk_image_get_pixel_size (GTK_IMAGE (widget)); is_stock_icon = glade_util_check_is_stock_id (icon); if (storage_type == GTK_IMAGE_ICON_NAME) { g_object_get (widget, "icon_name", &icon_name, NULL); if (icon_name && *icon_name) is_named_icon = TRUE; } if (data->action == GB_SAVING) { /* When saving we want to use "stock" or "pixbuf", depending on whether it is a stock icon or an oridinary pixmap file. */ if (is_stock_icon) gb_widget_output_icon (data, "stock", icon); else gb_widget_output_icon (data, "pixbuf", icon); } else { gb_widget_output_icon (data, Icon, icon); } if (is_stock_icon || is_named_icon) { if (data->action == GB_SHOWING) { for (i = 0; i < GladeIconSizeChoicesSize; i++) { if (GladeIconSizeValues[i] == GTK_IMAGE (widget)->icon_size) gb_widget_output_choice (data, IconSize, i, GladeIconSizeSymbols[i]); } check_visible_sizes (icon, is_named_icon); } else { /* We have to save the size as an integer, which sucks a bit. The integer is the GtkIconSize enum value, not the actual size.*/ if (is_stock_icon || pixel_size == -1) gb_widget_output_int (data, IconSize, GTK_IMAGE (widget)->icon_size); } } gb_widget_output_named_icon (data, IconName, icon_name); /* The icon size only applies to stock icons or named icons. The pixel size only applies to named icons. */ if (data->action == GB_SHOWING) { property_set_sensitive (IconSize, is_stock_icon || is_named_icon); property_set_sensitive (PixelSize, is_named_icon); } /* We only want to save the pixel size for named icons, and only if it is not -1. */ if (data->action == GB_SHOWING || (storage_type == GTK_IMAGE_ICON_NAME && pixel_size != -1)) gb_widget_output_int (data, PixelSize, pixel_size); gb_widget_output_float (data, XAlign, GTK_MISC (widget)->xalign); gb_widget_output_float (data, YAlign, GTK_MISC (widget)->yalign); gb_widget_output_int (data, XPad, GTK_MISC (widget)->xpad); gb_widget_output_int (data, YPad, GTK_MISC (widget)->ypad); }
/** * \brief Get a widget showing one icon with another overlaid on top of it. * * The base icon is always centralised, the other icon can be positioned. * The overlay icon is ignored if pos=OVERLAY_NONE is used * * \param window top-level window widget * \param icon the base icon * \param overlay the icon to overlay * \param pos how to align the overlay widget, or OVERLAY_NONE for no overlay * \param border_x size of the border around the base icon (left and right) * \param border_y size of the border around the base icon (top and bottom) */ GtkWidget *stock_pixmap_widget_with_overlay(StockPixmap icon, StockPixmap overlay, OverlayPosition pos, gint border_x, gint border_y) { cairo_surface_t *stock_pixmap = NULL; GdkPixbuf *stock_pixbuf = NULL; GtkWidget *widget = NULL; GtkWidget *stock_wid = NULL; GtkRequisition requisition; OverlayData *data = NULL; data = g_new0(OverlayData, 1); stock_wid = stock_pixmap_widget(icon); gtk_widget_get_requisition(stock_wid, &requisition); #if !GTK_CHECK_VERSION(3, 0, 0) if (gtk_image_get_storage_type(GTK_IMAGE(stock_wid)) == GTK_IMAGE_PIXMAP) data->is_pixmap = TRUE; else #endif data->is_pixmap = FALSE; if (data->is_pixmap) { cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(stock_wid)); stock_pixmap = cairo_get_target(cr); cairo_surface_reference(stock_pixmap); cairo_destroy(cr); data->base_pixmap = stock_pixmap; data->base_height = requisition.height; data->base_width = requisition.width; gtk_widget_destroy(stock_wid); if (pos == OVERLAY_NONE) { data->overlay_pixmap = NULL; } else { stock_wid = stock_pixmap_widget(overlay); cr = gdk_cairo_create(gtk_widget_get_window(stock_wid)); stock_pixmap = cairo_get_target(cr); cairo_surface_reference(stock_pixmap); cairo_destroy(cr); data->overlay_pixmap = stock_pixmap; data->overlay_height = requisition.height; data->overlay_width = requisition.width; gtk_widget_destroy(stock_wid); } } else { data->is_pixmap = FALSE; stock_pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(stock_wid)); g_object_ref(stock_pixbuf); data->base_pixbuf = stock_pixbuf; data->base_height = requisition.height; data->base_width = requisition.width; gtk_widget_destroy(stock_wid); if (pos == OVERLAY_NONE) { data->overlay_pixmap = NULL; } else { stock_wid = stock_pixmap_widget(overlay); stock_pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(stock_wid)); g_object_ref(stock_pixbuf); data->overlay_pixbuf = stock_pixbuf; data->overlay_height = requisition.height; data->overlay_width = requisition.width; gtk_widget_destroy(stock_wid); } } data->position = pos; data->border_x = border_x; data->border_y = border_y; data->highlight = FALSE; widget = gtk_drawing_area_new(); gtk_widget_set_size_request(widget, data->base_width + border_x * 2, data->base_height + border_y * 2); #if !GTK_CHECK_VERSION(3, 0, 0) g_signal_connect(G_OBJECT(widget), "expose_event", G_CALLBACK(pixmap_with_overlay_expose_event_cb), data); #else g_signal_connect(G_OBJECT(widget), "draw", G_CALLBACK(pixmap_with_overlay_expose_event_cb), data); #endif g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(pixmap_with_overlay_destroy_cb), data); g_object_set_data(G_OBJECT(widget), "highlight", &(data->highlight)); return widget; }
static gboolean gmpc_mpd_data_treeview_tooltip_query_tooltip_callback (GmpcMpdDataTreeviewTooltip* self, gint x, gint y, gboolean keyboard_tip, GtkTooltip* tooltip) { gboolean result = FALSE; gchar* tag; gint row_type; GtkTreePath* path; GtkTreeIter iter = {0}; GtkTreeModel* _tmp0_ = NULL; GtkTreeModel* _tmp1_; GtkTreeModel* model; gint _tmp2_; gboolean _tmp3_ = FALSE; gint _tmp4_; gint _tmp5_; GtkTreeModel* _tmp6_ = NULL; GtkTreePath* _tmp7_ = NULL; GtkTreeIter _tmp8_ = {0}; gboolean _tmp9_; GtkTreeModel* _tmp10_; GtkTreePath* _tmp11_; mpd_Song* _tmp12_ = NULL; mpd_Song* song; gchar* _tmp18_ = NULL; gchar* new_check; gboolean _tmp19_ = FALSE; GtkImageType _tmp23_; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (tooltip != NULL, FALSE); tag = NULL; row_type = 0; path = NULL; _tmp0_ = gtk_tree_view_get_model (self->priv->par_widget); _tmp1_ = _g_object_ref0 (_tmp0_); model = _tmp1_; _tmp2_ = cfg_get_single_value_as_int_with_default (config, "GmpcTreeView", "show-tooltip", 1); if (_tmp2_ != 1) { result = FALSE; _g_object_unref0 (model); _gtk_tree_path_free0 (path); _g_free0 (tag); return result; } if (self->mtype != META_ARTIST_ART) { _tmp3_ = self->mtype != META_ALBUM_ART; } else { _tmp3_ = FALSE; } if (_tmp3_) { _g_free0 (self->priv->checksum); self->priv->checksum = NULL; result = FALSE; _g_object_unref0 (model); _gtk_tree_path_free0 (path); _g_free0 (tag); return result; } _tmp9_ = gtk_tree_view_get_tooltip_context (self->priv->par_widget, &_tmp4_, &_tmp5_, keyboard_tip, &_tmp6_, &_tmp7_, &_tmp8_); x = _tmp4_; y = _tmp5_; _g_object_unref0 (model); _tmp10_ = _g_object_ref0 (_tmp6_); model = _tmp10_; _gtk_tree_path_free0 (path); _tmp11_ = _gtk_tree_path_copy0 (_tmp7_); path = _tmp11_; iter = _tmp8_; if (!_tmp9_) { _g_free0 (self->priv->checksum); self->priv->checksum = NULL; result = FALSE; _g_object_unref0 (model); _gtk_tree_path_free0 (path); _g_free0 (tag); return result; } _tmp12_ = mpd_newSong (); song = _tmp12_; gtk_tree_model_get (model, &iter, 26, &row_type, -1); if (row_type == MPD_DATA_TYPE_SONG) { gchar* album; gchar* _tmp13_; gchar* _tmp14_; album = NULL; gtk_tree_model_get (model, &iter, 5, &tag, 6, &album, -1); _tmp13_ = g_strdup (tag); _g_free0 (song->artist); song->artist = _tmp13_; _tmp14_ = g_strdup (album); _g_free0 (song->album); song->album = _tmp14_; _g_free0 (album); } else { if (row_type == MPD_DATA_TYPE_TAG) { if (self->mtype == META_ARTIST_ART) { gchar* _tmp15_; gtk_tree_model_get (model, &iter, 7, &tag, -1); _tmp15_ = g_strdup (tag); _g_free0 (song->artist); song->artist = _tmp15_; } else { if (self->mtype == META_ALBUM_ART) { gchar* _tmp16_; gchar* _tmp17_; gtk_tree_model_get (model, &iter, 7, &tag, -1); _tmp16_ = g_strdup (self->request_artist); _g_free0 (song->artist); song->artist = _tmp16_; _tmp17_ = g_strdup (tag); _g_free0 (song->album); song->album = _tmp17_; } } } } _tmp18_ = mpd_song_checksum (song); new_check = _tmp18_; if (g_strcmp0 (new_check, self->priv->checksum) != 0) { _tmp19_ = self->priv->checksum != NULL; } else { _tmp19_ = FALSE; } if (_tmp19_) { _g_free0 (self->priv->checksum); self->priv->checksum = NULL; result = FALSE; _g_free0 (new_check); _mpd_freeSong0 (song); _g_object_unref0 (model); _gtk_tree_path_free0 (path); _g_free0 (tag); return result; } if (g_strcmp0 (new_check, self->priv->checksum) != 0) { gchar* _tmp20_; MetaData* met; MetaData* _tmp21_ = NULL; MetaDataResult _tmp22_; MetaDataResult _result_; _tmp20_ = g_strdup (new_check); _g_free0 (self->priv->checksum); self->priv->checksum = _tmp20_; met = NULL; _tmp22_ = gmpc_meta_watcher_get_meta_path (gmw, song, self->mtype, &_tmp21_); _meta_data_free0 (met); met = _tmp21_; _result_ = _tmp22_; gmpc_mpd_data_treeview_tooltip_metadata_changed (self, gmw, song, self->mtype, _result_, met); _meta_data_free0 (met); } _tmp23_ = gtk_image_get_storage_type (self->priv->image); if (_tmp23_ == GTK_IMAGE_EMPTY) { result = FALSE; _g_free0 (new_check); _mpd_freeSong0 (song); _g_object_unref0 (model); _gtk_tree_path_free0 (path); _g_free0 (tag); return result; } result = TRUE; _g_free0 (new_check); _mpd_freeSong0 (song); _g_object_unref0 (model); _gtk_tree_path_free0 (path); _g_free0 (tag); return result; }
static void create_win_message(char *icon, char *text, int duration) { GtkWidget *gwin_message = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_has_resize_grip(GTK_WINDOW(gwin_message), FALSE); gtk_container_set_border_width (GTK_CONTAINER (gwin_message), 0); gtk_widget_realize (gwin_message); GdkWindow *gdkwin = gtk_widget_get_window(gwin_message); set_no_focus(gwin_message); GtkWidget *hbox = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (gwin_message), hbox); if (icon[0] != '-') { GtkWidget *image = gtk_image_new_from_file(icon); if (text[0] == '-') { #if GTK_CHECK_VERSION(2,91,0) GdkPixbuf *pixbuf = NULL; GdkPixbufAnimation *anime = NULL; switch(gtk_image_get_storage_type(GTK_IMAGE(image))) { case GTK_IMAGE_PIXBUF: pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); break; case GTK_IMAGE_ANIMATION: anime = gtk_image_get_animation(GTK_IMAGE(image)); pixbuf = gdk_pixbuf_animation_get_static_image(anime); break; default: break; } cairo_surface_t *img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf)); cairo_t *cr = cairo_create(img); gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); cairo_paint(cr); cairo_region_t *mask = gdk_cairo_region_create_from_surface(img); gtk_widget_shape_combine_region(gwin_message, mask); cairo_region_destroy(mask); cairo_destroy(cr); cairo_surface_destroy(img); #else GdkBitmap *bitmap = NULL; gdk_pixbuf_render_pixmap_and_mask(gdk_pixbuf_new_from_file(icon, NULL), NULL, &bitmap, 128); gtk_widget_shape_combine_mask(gwin_message, bitmap, 0, 0); #endif } gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); } if (text[0] != '-') { GtkWidget *label = gtk_label_new(text); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); } gtk_widget_show_all(gwin_message); int width, height; get_win_size(gwin_message, &width, &height); int ox=-1, oy; int szx, szy; if (tray_da_win) { gdk_window_get_origin (tray_da_win, &ox, &oy); #if !GTK_CHECK_VERSION(2,91,0) gdk_drawable_get_size(tray_da_win, &szx, &szy); #else szx = gdk_window_get_width(tray_da_win); szy = gdk_window_get_height(tray_da_win); #endif if (oy<height) { oy = szy; } else { oy -= height; if (oy + height > dpy_yl) oy = dpy_yl - height; if (oy < 0) oy = 0; } if (ox + width > dpy_xl) ox = dpy_xl - width; if (ox < 0) ox = 0; } else if (icon_main) { GdkRectangle rect; GtkOrientation ori; if (gtk_status_icon_get_geometry(icon_main, NULL, &rect, &ori)) { dbg("rect %d,%d\n", rect.x, rect.y, rect.width, rect.height); if (ori==GTK_ORIENTATION_HORIZONTAL) { ox=rect.x; if (rect.y > 100) oy=rect.y - height; else oy=rect.y + rect.height; } else { oy=rect.y; if (rect.x > 100) ox=rect.x - width; else ox=rect.x + rect.width; } } } if (ox < 0) { ox = dpy_xl - width; oy = dpy_yl - height; } gtk_window_move(GTK_WINDOW(gwin_message), ox, oy); g_timeout_add(duration, (GSourceFunc)timeout_destroy_window, gwin_message); }
static void gtk_image_accessible_get_image_size (AtkImage *image, gint *width, gint *height) { GtkWidget* widget; GtkImage *gtk_image; GtkImageType image_type; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); if (widget == NULL) { *height = -1; *width = -1; return; } gtk_image = GTK_IMAGE (widget); image_type = gtk_image_get_storage_type (gtk_image); switch (image_type) { case GTK_IMAGE_PIXBUF: { GdkPixbuf *pixbuf; pixbuf = gtk_image_get_pixbuf (gtk_image); *height = gdk_pixbuf_get_height (pixbuf); *width = gdk_pixbuf_get_width (pixbuf); break; } case GTK_IMAGE_STOCK: case GTK_IMAGE_ICON_SET: case GTK_IMAGE_ICON_NAME: case GTK_IMAGE_GICON: { GtkIconSize size; GtkSettings *settings; settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget)); g_object_get (gtk_image, "icon-size", &size, NULL); gtk_icon_size_lookup_for_settings (settings, size, width, height); break; } case GTK_IMAGE_ANIMATION: { GdkPixbufAnimation *animation; animation = gtk_image_get_animation (gtk_image); *height = gdk_pixbuf_animation_get_height (animation); *width = gdk_pixbuf_animation_get_width (animation); break; } default: { *height = -1; *width = -1; break; } } }