mirror of https://github.com/GNOME/gimp.git
app/widgets/gimpaction.c app/widgets/gimpdockable.c
2008-08-22 Sven Neumann <sven@gimp.org> * app/widgets/gimpaction.c * app/widgets/gimpdockable.c * app/widgets/gimpradioaction.c * app/widgets/gimpstringaction.c * app/widgets/gimptoggleaction.c: added basic support for icon names for actions and dockables. Uses the stock-id as icon name if the icon theme provides an icon under this name. * app/dialogs/dialogs.c * app/actions/documents-actions.c * app/actions/dialogs-actions.c: use the "document-open-recent" icon for the document history. svn path=/trunk/; revision=26710
This commit is contained in:
parent
cafc9289fc
commit
961683cc23
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2008-08-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpaction.c
|
||||
* app/widgets/gimpdockable.c
|
||||
* app/widgets/gimpradioaction.c
|
||||
* app/widgets/gimpstringaction.c
|
||||
* app/widgets/gimptoggleaction.c: added basic support for icon
|
||||
names for actions and dockables. Uses the stock-id as icon name
|
||||
if the icon theme provides an icon under this name.
|
||||
|
||||
* app/dialogs/dialogs.c
|
||||
* app/actions/documents-actions.c
|
||||
* app/actions/dialogs-actions.c: use the "document-open-recent"
|
||||
icon for the document history.
|
||||
|
||||
2008-08-22 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/widgets/gimpnavigationview.c: Adapted to play nicely with
|
||||
|
|
|
@ -173,7 +173,7 @@ const GimpStringActionEntry dialogs_dockable_actions[] =
|
|||
"gimp-image-list|gimp-image-grid",
|
||||
GIMP_HELP_IMAGE_DIALOG },
|
||||
|
||||
{ "dialogs-document-history", GTK_STOCK_OPEN,
|
||||
{ "dialogs-document-history", "document-open-recent",
|
||||
N_("Document Histor_y"), "",
|
||||
N_("Open the document history dialog"),
|
||||
"gimp-document-list|gimp-document-grid",
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
static const GimpActionEntry documents_actions[] =
|
||||
{
|
||||
{ "documents-popup", GTK_STOCK_OPEN,
|
||||
{ "documents-popup", "document-open-recent",
|
||||
N_("Documents Menu"), NULL, NULL, NULL,
|
||||
GIMP_HELP_DOCUMENT_DIALOG },
|
||||
|
||||
|
@ -48,13 +48,13 @@ static const GimpActionEntry documents_actions[] =
|
|||
G_CALLBACK (documents_open_cmd_callback),
|
||||
GIMP_HELP_DOCUMENT_OPEN },
|
||||
|
||||
{ "documents-raise-or-open", GTK_STOCK_OPEN,
|
||||
{ "documents-raise-or-open", NULL,
|
||||
N_("_Raise or Open Image"), "",
|
||||
N_("Raise window if already open"),
|
||||
G_CALLBACK (documents_raise_or_open_cmd_callback),
|
||||
GIMP_HELP_DOCUMENT_OPEN },
|
||||
|
||||
{ "documents-file-open-dialog", GTK_STOCK_OPEN,
|
||||
{ "documents-file-open-dialog", NULL,
|
||||
N_("File Open _Dialog"), "",
|
||||
N_("Open image dialog"),
|
||||
G_CALLBACK (documents_file_open_dialog_cmd_callback),
|
||||
|
@ -84,13 +84,13 @@ static const GimpActionEntry documents_actions[] =
|
|||
G_CALLBACK (documents_recreate_preview_cmd_callback),
|
||||
GIMP_HELP_DOCUMENT_REFRESH },
|
||||
|
||||
{ "documents-reload-previews", GTK_STOCK_REFRESH,
|
||||
{ "documents-reload-previews", NULL,
|
||||
N_("Reload _all Previews"), "",
|
||||
N_("Reload all previews"),
|
||||
G_CALLBACK (documents_reload_previews_cmd_callback),
|
||||
GIMP_HELP_DOCUMENT_REFRESH },
|
||||
|
||||
{ "documents-remove-dangling", GTK_STOCK_REFRESH,
|
||||
{ "documents-remove-dangling", NULL,
|
||||
N_("Remove Dangling E_ntries"), "",
|
||||
N_("Remove dangling entries"),
|
||||
G_CALLBACK (documents_remove_dangling_cmd_callback),
|
||||
|
|
|
@ -168,7 +168,7 @@ static const GimpDialogFactoryEntry dock_entries[] =
|
|||
GIMP_HELP_TOOLS_DIALOG, GIMP_VIEW_SIZE_SMALL),
|
||||
LISTGRID (buffer, N_("Buffers"), NULL, GIMP_STOCK_BUFFER,
|
||||
GIMP_HELP_BUFFER_DIALOG, GIMP_VIEW_SIZE_MEDIUM),
|
||||
LISTGRID (document, N_("History"), N_("Document History"), GTK_STOCK_OPEN,
|
||||
LISTGRID (document, N_("History"), N_("Document History"), "document-open-recent",
|
||||
GIMP_HELP_DOCUMENT_DIALOG, GIMP_VIEW_SIZE_LARGE),
|
||||
LISTGRID (template, N_("Templates"), N_("Image Templates"), GIMP_STOCK_TEMPLATE,
|
||||
GIMP_HELP_TEMPLATE_DIALOG, GIMP_VIEW_SIZE_SMALL),
|
||||
|
|
|
@ -278,12 +278,22 @@ gimp_action_new (const gchar *name,
|
|||
const gchar *tooltip,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
return g_object_new (GIMP_TYPE_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"stock-id", stock_id,
|
||||
NULL);
|
||||
GimpAction *action;
|
||||
|
||||
action = g_object_new (GIMP_TYPE_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"stock-id", stock_id,
|
||||
NULL);
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), stock_id))
|
||||
g_object_set (action, "icon-name", stock_id, NULL);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
|
@ -691,6 +691,21 @@ gimp_dockable_forall (GtkContainer *container,
|
|||
callback, callback_data);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gimp_dockable_get_icon (GimpDockable *dockable,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (dockable));
|
||||
GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
|
||||
|
||||
if (gtk_icon_theme_has_icon (theme, dockable->stock_id))
|
||||
{
|
||||
return gtk_image_new_from_icon_name (dockable->stock_id, size);
|
||||
}
|
||||
|
||||
return gtk_image_new_from_stock (dockable->stock_id, size);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gimp_dockable_get_tab_widget_internal (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
|
@ -725,7 +740,7 @@ gimp_dockable_get_tab_widget_internal (GimpDockable *dockable,
|
|||
case GIMP_TAB_STYLE_ICON:
|
||||
case GIMP_TAB_STYLE_ICON_NAME:
|
||||
case GIMP_TAB_STYLE_ICON_BLURB:
|
||||
icon = gtk_image_new_from_stock (dockable->stock_id, size);
|
||||
icon = gimp_dockable_get_icon (dockable, size);
|
||||
break;
|
||||
|
||||
case GIMP_TAB_STYLE_PREVIEW:
|
||||
|
@ -739,7 +754,7 @@ gimp_dockable_get_tab_widget_internal (GimpDockable *dockable,
|
|||
context, size);
|
||||
|
||||
if (! icon)
|
||||
icon = gtk_image_new_from_stock (dockable->stock_id, size);
|
||||
icon = gimp_dockable_get_icon (dockable, size);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1213,6 +1228,17 @@ gimp_dockable_show_menu (GimpDockable *dockable)
|
|||
"visible", TRUE,
|
||||
NULL);
|
||||
|
||||
if (dockable->stock_id)
|
||||
{
|
||||
if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
|
||||
dockable->stock_id))
|
||||
{
|
||||
g_object_set (parent_menu_action,
|
||||
"icon-name", dockable->stock_id,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (! GTK_IS_MENU (child_menu_widget))
|
||||
{
|
||||
g_warning ("%s: child_menu_widget (%p) is not a GtkMenu",
|
||||
|
@ -1222,8 +1248,8 @@ gimp_dockable_show_menu (GimpDockable *dockable)
|
|||
|
||||
/* FIXME */
|
||||
{
|
||||
GtkWidget *image = gtk_image_new_from_stock (dockable->stock_id,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
GtkWidget *image = gimp_dockable_get_icon (dockable,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (parent_menu_widget),
|
||||
image);
|
||||
|
|
|
@ -80,13 +80,24 @@ gimp_radio_action_new (const gchar *name,
|
|||
const gchar *stock_id,
|
||||
gint value)
|
||||
{
|
||||
return g_object_new (GIMP_TYPE_RADIO_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"stock-id", stock_id,
|
||||
"value", value,
|
||||
NULL);
|
||||
GtkRadioAction *action;
|
||||
|
||||
action = g_object_new (GIMP_TYPE_RADIO_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"value", value,
|
||||
NULL);
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
if (gtk_icon_factory_lookup_default (stock_id))
|
||||
g_object_set (action, "stock-id", stock_id, NULL);
|
||||
else
|
||||
g_object_set (action, "icon-name", stock_id, NULL);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -158,13 +158,23 @@ gimp_string_action_new (const gchar *name,
|
|||
const gchar *stock_id,
|
||||
const gchar *value)
|
||||
{
|
||||
return g_object_new (GIMP_TYPE_STRING_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"stock-id", stock_id,
|
||||
"value", value,
|
||||
NULL);
|
||||
GimpStringAction *action;
|
||||
|
||||
action = g_object_new (GIMP_TYPE_STRING_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"stock-id", stock_id,
|
||||
"value", value,
|
||||
NULL);
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), stock_id))
|
||||
g_object_set (action, "icon-name", stock_id, NULL);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -79,12 +79,24 @@ gimp_toggle_action_new (const gchar *name,
|
|||
const gchar *tooltip,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
return g_object_new (GIMP_TYPE_TOGGLE_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"stock-id", stock_id,
|
||||
NULL);
|
||||
GtkToggleAction *action;
|
||||
|
||||
action = g_object_new (GIMP_TYPE_TOGGLE_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
"stock-id", stock_id,
|
||||
NULL);
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
if (gtk_icon_factory_lookup_default (stock_id))
|
||||
g_object_set (action, "stock-id", stock_id, NULL);
|
||||
else
|
||||
g_object_set (action, "icon-name", stock_id, NULL);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue