/** * gtk_image_menu_item_get_always_show_image: * @image_menu_item: a #GtkImageMenuItem * * Returns whether the menu item will ignore the #GtkSettings:gtk-menu-images * setting and always show the image, if available. * * Returns: %TRUE if the menu item will always show the image * * Since: 2.16 * * Deprecated: 3.10 */ gboolean gtk_image_menu_item_get_always_show_image (GtkImageMenuItem *image_menu_item) { g_return_val_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item), FALSE); return image_menu_item->priv->always_show_image; }
/** * gtk_image_menu_item_set_always_show_image: * @image_menu_item: a #GtkImageMenuItem * @always_show: %TRUE if the menuitem should always show the image * * If %TRUE, the menu item will ignore the #GtkSettings:gtk-menu-images * setting and always show the image, if available. * * Use this property if the menuitem would be useless or hard to use * without the image. * * Since: 2.16 * * Deprecated: 3.10 */ void gtk_image_menu_item_set_always_show_image (GtkImageMenuItem *image_menu_item, gboolean always_show) { GtkImageMenuItemPrivate *priv; g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item)); priv = image_menu_item->priv; if (priv->always_show_image != always_show) { priv->always_show_image = always_show; if (priv->image) { if (show_image (image_menu_item)) gtk_widget_show (priv->image); else gtk_widget_hide (priv->image); } g_object_notify (G_OBJECT (image_menu_item), "always-show-image"); } }
/** * gtk_image_menu_item_set_image: * @image_menu_item: a #GtkImageMenuItem. * @image: (allow-none): a widget to set as the image for the menu item. * * Sets the image of @image_menu_item to the given widget. * Note that it depends on the show-menu-images setting whether * the image will be displayed or not. * * Deprecated: 3.10 */ void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item, GtkWidget *image) { GtkImageMenuItemPrivate *priv; g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item)); priv = image_menu_item->priv; if (image == priv->image) return; if (priv->image) gtk_container_remove (GTK_CONTAINER (image_menu_item), priv->image); priv->image = image; if (image == NULL) return; gtk_widget_set_parent (image, GTK_WIDGET (image_menu_item)); g_object_set (image, "visible", show_image (image_menu_item), "no-show-all", TRUE, NULL); gtk_image_set_pixel_size (GTK_IMAGE (image), 16); g_object_notify (G_OBJECT (image_menu_item), "image"); }
/** * gtk_image_menu_item_set_accel_group: * @image_menu_item: a #GtkImageMenuItem * @accel_group: the #GtkAccelGroup * * Specifies an @accel_group to add the menu items accelerator to * (this only applies to stock items so a stock item must already * be set, make sure to call gtk_image_menu_item_set_use_stock() * and gtk_menu_item_set_label() with a valid stock item first). * * If you want this menu item to have changeable accelerators then * you shouldnt need this (see gtk_image_menu_item_new_from_stock()). * * Since: 2.16 * * Deprecated: 3.10 */ void gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item, GtkAccelGroup *accel_group) { GtkImageMenuItemPrivate *priv; GtkStockItem stock_item; /* Silent return for the constructor */ if (!accel_group) return; g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item)); g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group)); priv = image_menu_item->priv; G_GNUC_BEGIN_IGNORE_DEPRECATIONS; if (priv->use_stock && priv->label && gtk_stock_lookup (priv->label, &stock_item)) if (stock_item.keyval) { gtk_widget_add_accelerator (GTK_WIDGET (image_menu_item), "activate", accel_group, stock_item.keyval, stock_item.modifier, GTK_ACCEL_VISIBLE); g_object_notify (G_OBJECT (image_menu_item), "accel-group"); } G_GNUC_END_IGNORE_DEPRECATIONS; }
static void gtkItemActivate(GtkWidget *widget, Ihandle* ih) { Icallback cb; if (GTK_IS_CHECK_MENU_ITEM(ih->handle) && !iupAttribGetBoolean(ih, "AUTOTOGGLE") && !iupAttribGetBoolean(ih->parent, "RADIO")) { /* GTK by default will do autotoggle */ g_signal_handlers_block_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkItemActivate), ih); gtk_check_menu_item_set_active((GtkCheckMenuItem*)ih->handle, !gtk_check_menu_item_get_active((GtkCheckMenuItem*)ih->handle)); g_signal_handlers_unblock_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkItemActivate), ih); } if (GTK_IS_IMAGE_MENU_ITEM(ih->handle)) { if (iupAttribGetBoolean(ih, "AUTOTOGGLE")) { if (iupAttribGetBoolean(ih, "VALUE")) iupAttribSetStr(ih, "VALUE", "OFF"); else iupAttribSetStr(ih, "VALUE", "ON"); gtkItemUpdateImage(ih, iupAttribGet(ih, "VALUE"), iupAttribGet(ih, "IMAGE"), iupAttribGet(ih, "IMPRESS")); } } cb = IupGetCallback(ih, "ACTION"); if (cb && cb(ih)==IUP_CLOSE) IupExitLoop(); (void)widget; }
/** * gtk_image_menu_item_get_image: * @image_menu_item: a #GtkImageMenuItem * * Gets the widget that is currently set as the image of @image_menu_item. * See gtk_image_menu_item_set_image(). * * Returns: (transfer none): the widget set as image of @image_menu_item * * Deprecated: 3.10 **/ GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item) { g_return_val_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item), NULL); return image_menu_item->priv->image; }
/** * gtk_image_menu_item_get_use_stock: * @image_menu_item: a #GtkImageMenuItem * * Checks whether the label set in the menuitem is used as a * stock id to select the stock item for the item. * * Returns: %TRUE if the label set in the menuitem is used as a * stock id to select the stock item for the item * * Since: 2.16 * * Deprecated: 3.10 */ gboolean gtk_image_menu_item_get_use_stock (GtkImageMenuItem *image_menu_item) { g_return_val_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item), FALSE); return image_menu_item->priv->use_stock; }
static void traverse_container (GtkWidget *widget, gpointer data) { if (GTK_IS_IMAGE_MENU_ITEM (widget)) show_image_change_notify (GTK_IMAGE_MENU_ITEM (widget)); else if (GTK_IS_CONTAINER (widget)) gtk_container_forall (GTK_CONTAINER (widget), traverse_container, NULL); }
static void serializer_visit_image (Serializer* self, GtkImage* image) { g_return_if_fail (self != NULL); g_return_if_fail (image != NULL); if (GTK_IS_IMAGE_MENU_ITEM (gtk_widget_get_parent ((GtkWidget*) image))) { return; } self->priv->guessed_type = "i"; serializer_append_icon_attribute (self, image); }
static int gtkSubmenuSetImageAttrib(Ihandle* ih, const char* value) { if (GTK_IS_IMAGE_MENU_ITEM(ih->handle)) { gtkItemUpdateImage(ih, NULL, value, NULL); return 1; } else return 0; }
static int gtkItemSetImpressAttrib(Ihandle* ih, const char* value) { if (GTK_IS_IMAGE_MENU_ITEM(ih->handle)) { gtkItemUpdateImage(ih, iupAttribGet(ih, "VALUE"), iupAttribGet(ih, "IMAGE"), value); return 1; } else return 0; }
/** * gtk_image_menu_item_get_always_show_image: * @image_menu_item: a #GtkImageMenuItem * * Returns whether the menu item will ignore the #GtkSettings:gtk-menu-images * setting and always show the image, if available. * * Returns: %TRUE if the menu item will always show the image * * Since: 2.16 */ gboolean gtk_image_menu_item_get_always_show_image (GtkImageMenuItem *image_menu_item) { GtkImageMenuItemPrivate *priv; g_return_val_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item), FALSE); priv = GET_PRIVATE (image_menu_item); return priv->always_show_image; }
static void mateconf_bookmarks_set_have_icons (GtkWidget *menu, gboolean have_icons) { GList *items, *n; items = gtk_container_get_children (GTK_CONTAINER (menu)); for (n = items; n != NULL; n = n->next) if (GTK_IS_IMAGE_MENU_ITEM (n->data)) mateconf_bookmarks_set_item_has_icon (GTK_WIDGET (n->data), have_icons); }
static void go_action_combo_pixmaps_connect_proxy (GtkAction *a, GtkWidget *proxy) { GTK_ACTION_CLASS (combo_pixmaps_parent)->connect_proxy (a, proxy); if (GTK_IS_IMAGE_MENU_ITEM (proxy)) { /* set the icon */ GOActionComboPixmaps *paction = (GOActionComboPixmaps *)a; const char *stock_id = paction->elements[0].stock_id; GdkPixbuf *icon = make_icon (a, stock_id, proxy); if (icon) { GtkWidget *image = gtk_image_new_from_pixbuf (icon); g_object_unref (icon); gtk_widget_show (image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), image); } } }
/** * gtk_image_menu_item_set_use_stock: * @image_menu_item: a #GtkImageMenuItem * @use_stock: %TRUE if the menuitem should use a stock item * * If %TRUE, the label set in the menuitem is used as a * stock id to select the stock item for the item. * * Since: 2.16 * * Deprecated: 3.10 */ void gtk_image_menu_item_set_use_stock (GtkImageMenuItem *image_menu_item, gboolean use_stock) { GtkImageMenuItemPrivate *priv; g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item)); priv = image_menu_item->priv; if (priv->use_stock != use_stock) { priv->use_stock = use_stock; gtk_image_menu_item_recalculate (image_menu_item); g_object_notify (G_OBJECT (image_menu_item), "use-stock"); } }
static void gimp_procedure_action_connect_proxy (GtkAction *action, GtkWidget *proxy) { GimpProcedureAction *procedure_action = GIMP_PROCEDURE_ACTION (action); GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); if (GTK_IS_IMAGE_MENU_ITEM (proxy) && procedure_action->procedure) { GdkPixbuf *pixbuf; g_object_get (procedure_action->procedure, "icon-pixbuf", &pixbuf, NULL); if (pixbuf) { GtkSettings *settings = gtk_widget_get_settings (proxy); gint width; gint height; GtkWidget *image; gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &width, &height); if (width != gdk_pixbuf_get_width (pixbuf) || height != gdk_pixbuf_get_height (pixbuf)) { GdkPixbuf *copy; copy = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); g_object_unref (pixbuf); pixbuf = copy; } image = gtk_image_new_from_pixbuf (pixbuf); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), image); g_object_unref (pixbuf); } } }
static int gtkItemSetValueAttrib(Ihandle* ih, const char* value) { if (GTK_IS_CHECK_MENU_ITEM(ih->handle)) { if (iupAttribGetBoolean(ih->parent, "RADIO")) value = "ON"; g_signal_handlers_block_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkItemActivate), ih); gtk_check_menu_item_set_active((GtkCheckMenuItem*)ih->handle, iupStrBoolean(value)); g_signal_handlers_unblock_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkItemActivate), ih); return 0; } else if (GTK_IS_IMAGE_MENU_ITEM(ih->handle)) { gtkItemUpdateImage(ih, value, iupAttribGet(ih, "IMAGE"), iupAttribGet(ih, "IMPRESS")); return 1; } else return 0; }
void init_power_indicator(void) { gboolean allow_any = FALSE; for(int i = 0; i < POWER_ACTIONS_COUNT; ++i) { gtk_widget_set_visible(greeter.ui.power.actions_box[i], POWER_ACTIONS[i].get_allow() && config.power.enabled); allow_any |= POWER_ACTIONS[i].get_allow(); } if(!config.power.enabled || !allow_any) { if(!allow_any) g_warning("Power menu: no actions allowed, hiding widget"); gtk_widget_hide(greeter.ui.power.box); } else if(GTK_IS_IMAGE_MENU_ITEM(greeter.ui.power.widget)) { fix_image_menu_item_if_empty(GTK_IMAGE_MENU_ITEM(greeter.ui.power.widget)); } }
/*---------------------------------------------------------------------------*/ static void descend_menu_set_always_show_image (GtkMenu *menu) { GList *children, *p; GtkWidget *submenu; GtkWidget *menu_item; children = gtk_container_get_children (GTK_CONTAINER (menu)); for ( p = children; p != NULL; p = p->next ) { menu_item = GTK_WIDGET (p->data); submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu_item)); if ( submenu ) { descend_menu_set_always_show_image (GTK_MENU (submenu)); } else if ( GTK_IS_IMAGE_MENU_ITEM (menu_item) ) { g_object_set (menu_item, "always-show-image", TRUE, NULL); } } }
static void gimp_action_set_proxy (GimpAction *action, GtkWidget *proxy) { if (! GTK_IS_IMAGE_MENU_ITEM (proxy)) return; if (action->color) { GtkWidget *area; area = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (proxy)); if (GIMP_IS_COLOR_AREA (area)) { gimp_color_area_set_color (GIMP_COLOR_AREA (area), action->color); } else { gint width, height; area = gimp_color_area_new (action->color, GIMP_COLOR_AREA_SMALL_CHECKS, 0); gimp_color_area_set_draw_border (GIMP_COLOR_AREA (area), TRUE); gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (proxy), GTK_ICON_SIZE_MENU, &width, &height); gtk_widget_set_size_request (area, width, height); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), area); gtk_widget_show (area); } } else if (action->viewable) { GtkWidget *view; view = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (proxy)); if (GIMP_IS_VIEW (view) && g_type_is_a (G_TYPE_FROM_INSTANCE (action->viewable), GIMP_VIEW (view)->renderer->viewable_type)) { gimp_view_set_viewable (GIMP_VIEW (view), action->viewable); } else { GtkIconSize size; gint width, height; gint border_width; if (GIMP_IS_IMAGEFILE (action->viewable)) { size = GTK_ICON_SIZE_LARGE_TOOLBAR; border_width = 0; } else { size = GTK_ICON_SIZE_MENU; border_width = 1; } gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (proxy), size, &width, &height); view = gimp_view_new_full (action->context, action->viewable, width, height, border_width, FALSE, FALSE, FALSE); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), view); gtk_widget_show (view); } } else { GtkWidget *image; image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (proxy)); if (GIMP_IS_VIEW (image) || GIMP_IS_COLOR_AREA (image)) { gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), NULL); g_object_notify (G_OBJECT (action), "stock-id"); } } { GtkWidget *child = gtk_bin_get_child (GTK_BIN (proxy)); if (GTK_IS_LABEL (child)) { GtkLabel *label = GTK_LABEL (child); gtk_label_set_ellipsize (label, action->ellipsize); gtk_label_set_max_width_chars (label, action->max_width_chars); } } }
/* * 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); }
static void store_populate_menu_items (GtkListStore *store, GtkMenuShell *menu, const gchar *parent_path) { GList *children; GList *node; children = gtk_container_get_children (GTK_CONTAINER (menu)); for (node = children; node; node = node->next) { if (GTK_IS_SEPARATOR_MENU_ITEM (node->data) || ! gtk_widget_get_visible (node->data)) { /* skip that */ } else if (GTK_IS_MENU_ITEM (node->data)) { GtkWidget *submenu; gchar *path; gchar *item_label; gboolean use_underline; GtkStockItem item; if (GTK_IS_IMAGE_MENU_ITEM (node->data) && gtk_image_menu_item_get_use_stock (node->data) && gtk_stock_lookup (gtk_menu_item_get_label (node->data), &item)) { item_label = g_strdup (item.label); use_underline = TRUE; } else { item_label = g_strdup (gtk_menu_item_get_label (node->data)); use_underline = gtk_menu_item_get_use_underline (node->data); } /* remove underlines */ if (use_underline) { gchar *p = item_label; gsize len = strlen (p); while ((p = strchr (p, '_')) != NULL) { len -= (gsize) (p - item_label); memmove (p, p + 1, len); } } if (parent_path) { path = g_strconcat (parent_path, PATH_SEPARATOR, item_label, NULL); } else { path = g_strdup (item_label); } submenu = gtk_menu_item_get_submenu (node->data); if (submenu) { /* go deeper in the menus... */ store_populate_menu_items (store, GTK_MENU_SHELL (submenu), path); } else { gchar *tmp; gchar *tooltip; gchar *label = g_markup_printf_escaped ("<big>%s</big>", item_label); tooltip = gtk_widget_get_tooltip_markup (node->data); if (tooltip) { SETPTR (label, g_strconcat (label, "\n<small>", tooltip, "</small>", NULL)); g_free (tooltip); } tmp = g_markup_escape_text (path, -1); SETPTR (label, g_strconcat (label, "\n<small><i>", tmp, "</i></small>", NULL)); g_free (tmp); gtk_list_store_insert_with_values (store, NULL, -1, COL_LABEL, label, COL_PATH, path, COL_TYPE, COL_TYPE_MENU_ITEM, COL_WIDGET, node->data, -1); g_free (label); } g_free (item_label); g_free (path); } else { g_warning ("Unknown widget type in the menu: %s", G_OBJECT_TYPE_NAME (node->data)); } } g_list_free (children); }
static void serializer_visit_menuitem (Serializer* self, GtkMenuItem* menuitem) { char* _tmp0_; gboolean _tmp2_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (menuitem != NULL); if (GTK_IS_TEAROFF_MENU_ITEM (menuitem)) { return; } serializer_indent (self); g_string_append (self->priv->sb, "<item"); g_string_append (self->priv->sb, _tmp0_ = g_markup_printf_escaped (" id=\"W%lu\"", (gulong) menuitem)); _g_free0 (_tmp0_); if (self->priv->hybrid) { g_string_append (self->priv->sb, " client-side=\"1\""); } g_string_erase (self->priv->label_sb, (gssize) 0, (gssize) (-1)); self->priv->last_item_empty = TRUE; self->priv->guessed_type = NULL; serializer_visit_container (self, (GtkContainer*) menuitem); if (self->priv->label_sb->len > 0) { char* _tmp1_; g_string_append (self->priv->sb, _tmp1_ = g_markup_printf_escaped (" label=\"%s\"", self->priv->label_sb->str)); _g_free0 (_tmp1_); self->priv->last_item_empty = FALSE; } if (GTK_IS_SEPARATOR_MENU_ITEM (menuitem)) { _tmp2_ = TRUE; } else { _tmp2_ = gtk_bin_get_child ((GtkBin*) menuitem) == NULL; } if (_tmp2_) { self->priv->guessed_type = "s"; self->priv->last_item_empty = FALSE; } if (GTK_IS_IMAGE_MENU_ITEM (menuitem)) { GtkMenuItem* _tmp3_; GtkWidget* _tmp4_; GtkImage* image; image = _g_object_ref0 ((_tmp4_ = gtk_image_menu_item_get_image ((_tmp3_ = menuitem, GTK_IS_IMAGE_MENU_ITEM (_tmp3_) ? ((GtkImageMenuItem*) _tmp3_) : NULL)), GTK_IS_IMAGE (_tmp4_) ? ((GtkImage*) _tmp4_) : NULL)); if (image != NULL) { self->priv->guessed_type = "i"; serializer_append_icon_attribute (self, image); self->priv->last_item_empty = FALSE; } _g_object_unref0 (image); } if (GTK_IS_CHECK_MENU_ITEM (menuitem)) { GtkMenuItem* _tmp5_; GtkCheckMenuItem* checkmenuitem; checkmenuitem = _g_object_ref0 ((_tmp5_ = menuitem, GTK_IS_CHECK_MENU_ITEM (_tmp5_) ? ((GtkCheckMenuItem*) _tmp5_) : NULL)); if (gtk_check_menu_item_get_draw_as_radio (checkmenuitem)) { self->priv->guessed_type = "r"; } else { self->priv->guessed_type = "c"; } if (!gtk_check_menu_item_get_inconsistent (checkmenuitem)) { if (gtk_check_menu_item_get_active (checkmenuitem)) { g_string_append (self->priv->sb, " state=\"1\""); } else { g_string_append (self->priv->sb, " state=\"0\""); } } self->priv->last_item_empty = FALSE; _g_object_unref0 (checkmenuitem); } if (gtk_widget_get_visible ((GtkWidget*) menuitem) == FALSE) { g_string_append (self->priv->sb, " visible=\"0\""); self->priv->last_item_empty = FALSE; } if (gtk_widget_get_sensitive ((GtkWidget*) menuitem) == FALSE) { g_string_append (self->priv->sb, " sensitive=\"0\""); } if (self->priv->last_item_empty) { g_string_append (self->priv->sb, " visible=\"0\""); } if (self->priv->guessed_type != NULL) { g_string_append_printf (self->priv->sb, " type=\"%s\"", self->priv->guessed_type); } if (gtk_menu_item_get_submenu (menuitem) == NULL) { g_string_append (self->priv->sb, "/>"); serializer_linebreak (self); } else { g_string_append_c (self->priv->sb, '>'); serializer_linebreak (self); self->priv->level++; if (gtk_menu_item_get_submenu (menuitem) != NULL) { serializer_visit_menu (self, gtk_menu_item_get_submenu (menuitem)); } self->priv->level--; serializer_indent (self); g_string_append (self->priv->sb, "</item>"); serializer_linebreak (self); } }