/** * gtk_tool_item_get_icon_size: * @tool_item: a #GtkToolItem * * Returns the icon size used for @tool_item. Custom subclasses of * #GtkToolItem should call this function to find out what size icons * they should use. * * Return value: (type int): a #GtkIconSize indicating the icon size * used for @tool_item * * Since: 2.4 **/ GtkIconSize gtk_tool_item_get_icon_size (GtkToolItem *tool_item) { GtkWidget *parent; g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ICON_SIZE_LARGE_TOOLBAR); parent = GTK_WIDGET (tool_item)->parent; if (!parent || !GTK_IS_TOOL_SHELL (parent)) return GTK_ICON_SIZE_LARGE_TOOLBAR; return gtk_tool_shell_get_icon_size (GTK_TOOL_SHELL (parent)); }
static void on_toolbar_reconfigured(GtkToolItem *tool_item, ToolItem *item) { GtkToolShell *shell = GTK_TOOL_SHELL(gtk_widget_get_parent(item->widget)); gboolean large = gtk_tool_shell_get_icon_size(shell) > GTK_ICON_SIZE_MENU; gchar *tooltip = NULL; if (gtk_tool_shell_get_style(shell) == GTK_TOOLBAR_ICONS) { GtkMenuItem *menu_item = GTK_MENU_ITEM(debug_menu_items[item->index].widget); tooltip = g_strdup(gtk_menu_item_get_label(menu_item)); utils_str_remove_chars(tooltip, "_"); } gtk_tool_item_set_tooltip_text(tool_item, tooltip); g_free(tooltip); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(tool_item), get_widget(item->icon[large])); }