app: Show custom preset icons in the tool options menus
This commit is contained in:
@ -206,12 +206,15 @@ tool_options_actions_update_presets (GimpActionGroup *group,
|
||||
list = g_list_next (list), i++)
|
||||
{
|
||||
GimpObject *preset = list->data;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
|
||||
entry.name = g_strdup_printf ("%s-%03d", action_prefix, i);
|
||||
entry.label = gimp_object_get_name (preset);
|
||||
entry.icon_name = gimp_viewable_get_icon_name (GIMP_VIEWABLE (preset));
|
||||
entry.value = i;
|
||||
|
||||
g_object_get (preset, "icon-pixbuf", &pixbuf, NULL);
|
||||
|
||||
gimp_action_group_add_enum_actions (group, NULL, &entry, 1, callback);
|
||||
|
||||
if (need_writable)
|
||||
@ -222,6 +225,9 @@ tool_options_actions_update_presets (GimpActionGroup *group,
|
||||
SET_SENSITIVE (entry.name,
|
||||
gimp_data_is_deletable (GIMP_DATA (preset)));
|
||||
|
||||
if (pixbuf)
|
||||
gimp_action_group_set_action_pixbuf (group, entry.name, pixbuf);
|
||||
|
||||
g_free ((gchar *) entry.name);
|
||||
}
|
||||
}
|
||||
|
@ -799,6 +799,30 @@ gimp_action_group_set_action_label (GimpActionGroup *group,
|
||||
gtk_action_set_label (action, label);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_action_group_set_action_pixbuf (GimpActionGroup *group,
|
||||
const gchar *action_name,
|
||||
GdkPixbuf *pixbuf)
|
||||
{
|
||||
GtkAction *action;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
|
||||
g_return_if_fail (action_name != NULL);
|
||||
|
||||
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
|
||||
|
||||
if (! action)
|
||||
{
|
||||
g_warning ("%s: Unable to set pixbuf of action "
|
||||
"which doesn't exist: %s",
|
||||
G_STRFUNC, action_name);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_action_set_gicon (action, G_ICON (pixbuf));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gimp_action_group_set_action_tooltip (GimpActionGroup *group,
|
||||
const gchar *action_name,
|
||||
|
@ -189,6 +189,9 @@ void gimp_action_group_set_action_active (GimpActionGroup *group,
|
||||
void gimp_action_group_set_action_label (GimpActionGroup *group,
|
||||
const gchar *action_name,
|
||||
const gchar *label);
|
||||
void gimp_action_group_set_action_pixbuf (GimpActionGroup *group,
|
||||
const gchar *action_name,
|
||||
GdkPixbuf *pixbuf);
|
||||
void gimp_action_group_set_action_tooltip (GimpActionGroup *group,
|
||||
const gchar *action_name,
|
||||
const gchar *tooltip);
|
||||
|
Reference in New Issue
Block a user