Commit 1e50d79b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

add an "ellipsize" property that is applied to all proxy menu items'

2008-05-11  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpaction.[ch]: add an "ellipsize" property that is
	applied to all proxy menu items' labels.

	* app/actions/windows-actions.c: set the dock actions to
	PANGO_ELLIPSIZE_END because their labels can be insanely long.


svn path=/trunk/; revision=25635
parent a0e6800c
2008-05-11 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpaction.[ch]: add an "ellipsize" property that is
applied to all proxy menu items' labels.
* app/actions/windows-actions.c: set the dock actions to
PANGO_ELLIPSIZE_END because their labels can be insanely long.
2008-05-11 Michael Natterer <mitch@gimp.org> 2008-05-11 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpaction.c (gimp_action_set_proxy): small cleanup. * app/widgets/gimpaction.c (gimp_action_set_proxy): small cleanup.
......
...@@ -261,6 +261,10 @@ windows_actions_dock_added (GimpDialogFactory *factory, ...@@ -261,6 +261,10 @@ windows_actions_dock_added (GimpDialogFactory *factory,
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name); action_name);
g_object_set (action,
"ellipsize", PANGO_ELLIPSIZE_END,
NULL);
g_object_set_data (G_OBJECT (action), "dock", dock); g_object_set_data (G_OBJECT (action), "dock", dock);
g_free (action_name); g_free (action_name);
......
...@@ -46,7 +46,8 @@ enum ...@@ -46,7 +46,8 @@ enum
PROP_0, PROP_0,
PROP_CONTEXT, PROP_CONTEXT,
PROP_COLOR, PROP_COLOR,
PROP_VIEWABLE PROP_VIEWABLE,
PROP_ELLIPSIZE
}; };
...@@ -102,13 +103,21 @@ gimp_action_class_init (GimpActionClass *klass) ...@@ -102,13 +103,21 @@ gimp_action_class_init (GimpActionClass *klass)
NULL, NULL, NULL, NULL,
GIMP_TYPE_VIEWABLE, GIMP_TYPE_VIEWABLE,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_ELLIPSIZE,
g_param_spec_enum ("ellipsize",
NULL, NULL,
PANGO_TYPE_ELLIPSIZE_MODE,
PANGO_ELLIPSIZE_NONE,
GIMP_PARAM_READWRITE));
} }
static void static void
gimp_action_init (GimpAction *action) gimp_action_init (GimpAction *action)
{ {
action->color = NULL; action->color = NULL;
action->viewable = NULL; action->viewable = NULL;
action->ellipsize = PANGO_ELLIPSIZE_NONE;
} }
static void static void
...@@ -156,6 +165,10 @@ gimp_action_get_property (GObject *object, ...@@ -156,6 +165,10 @@ gimp_action_get_property (GObject *object,
case PROP_VIEWABLE: case PROP_VIEWABLE:
g_value_set_object (value, action->viewable); g_value_set_object (value, action->viewable);
break; break;
case PROP_ELLIPSIZE:
g_value_set_enum (value, action->ellipsize);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
...@@ -190,6 +203,11 @@ gimp_action_set_property (GObject *object, ...@@ -190,6 +203,11 @@ gimp_action_set_property (GObject *object,
action->viewable = GIMP_VIEWABLE (g_value_dup_object (value)); action->viewable = GIMP_VIEWABLE (g_value_dup_object (value));
set_proxy = TRUE; set_proxy = TRUE;
break; break;
case PROP_ELLIPSIZE:
action->ellipsize = g_value_get_enum (value);
set_proxy = TRUE;
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
...@@ -372,4 +390,13 @@ gimp_action_set_proxy (GimpAction *action, ...@@ -372,4 +390,13 @@ gimp_action_set_proxy (GimpAction *action,
g_object_notify (G_OBJECT (action), "stock-id"); g_object_notify (G_OBJECT (action), "stock-id");
} }
} }
{
GtkWidget *label = gtk_bin_get_child (GTK_BIN (proxy));
if (GTK_IS_LABEL (label))
{
gtk_label_set_ellipsize (GTK_LABEL (label), action->ellipsize);
}
}
} }
...@@ -38,12 +38,13 @@ typedef struct _GimpActionClass GimpActionClass; ...@@ -38,12 +38,13 @@ typedef struct _GimpActionClass GimpActionClass;
struct _GimpAction struct _GimpAction
{ {
GtkAction parent_instance; GtkAction parent_instance;
GimpContext *context; GimpContext *context;
GimpRGB *color; GimpRGB *color;
GimpViewable *viewable; GimpViewable *viewable;
PangoEllipsizeMode ellipsize;
}; };
struct _GimpActionClass struct _GimpActionClass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment