gimp r25635 - in trunk: . app/actions app/widgets



Author: mitch
Date: Sun May 11 09:26:17 2008
New Revision: 25635
URL: http://svn.gnome.org/viewvc/gimp?rev=25635&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/app/actions/windows-actions.c
   trunk/app/widgets/gimpaction.c
   trunk/app/widgets/gimpaction.h

Modified: trunk/app/actions/windows-actions.c
==============================================================================
--- trunk/app/actions/windows-actions.c	(original)
+++ trunk/app/actions/windows-actions.c	Sun May 11 09:26:17 2008
@@ -261,6 +261,10 @@
   action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                         action_name);
 
+  g_object_set (action,
+                "ellipsize", PANGO_ELLIPSIZE_END,
+                NULL);
+
   g_object_set_data (G_OBJECT (action), "dock", dock);
 
   g_free (action_name);

Modified: trunk/app/widgets/gimpaction.c
==============================================================================
--- trunk/app/widgets/gimpaction.c	(original)
+++ trunk/app/widgets/gimpaction.c	Sun May 11 09:26:17 2008
@@ -46,7 +46,8 @@
   PROP_0,
   PROP_CONTEXT,
   PROP_COLOR,
-  PROP_VIEWABLE
+  PROP_VIEWABLE,
+  PROP_ELLIPSIZE
 };
 
 
@@ -102,13 +103,21 @@
                                                         NULL, NULL,
                                                         GIMP_TYPE_VIEWABLE,
                                                         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
 gimp_action_init (GimpAction *action)
 {
-  action->color    = NULL;
-  action->viewable = NULL;
+  action->color     = NULL;
+  action->viewable  = NULL;
+  action->ellipsize = PANGO_ELLIPSIZE_NONE;
 }
 
 static void
@@ -156,6 +165,10 @@
     case PROP_VIEWABLE:
       g_value_set_object (value, action->viewable);
       break;
+    case PROP_ELLIPSIZE:
+      g_value_set_enum (value, action->ellipsize);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -190,6 +203,11 @@
       action->viewable = GIMP_VIEWABLE (g_value_dup_object (value));
       set_proxy = TRUE;
       break;
+    case PROP_ELLIPSIZE:
+      action->ellipsize = g_value_get_enum (value);
+      set_proxy = TRUE;
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -372,4 +390,13 @@
           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);
+      }
+  }
 }

Modified: trunk/app/widgets/gimpaction.h
==============================================================================
--- trunk/app/widgets/gimpaction.h	(original)
+++ trunk/app/widgets/gimpaction.h	Sun May 11 09:26:17 2008
@@ -38,12 +38,13 @@
 
 struct _GimpAction
 {
-  GtkAction     parent_instance;
+  GtkAction           parent_instance;
 
-  GimpContext  *context;
+  GimpContext        *context;
 
-  GimpRGB      *color;
-  GimpViewable *viewable;
+  GimpRGB            *color;
+  GimpViewable       *viewable;
+  PangoEllipsizeMode  ellipsize;
 };
 
 struct _GimpActionClass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]