[dia] Simple context menu also for selection of objects



commit 55d3b2604d91667de9c071a8253ae3bcc7df22db
Author: Hans Breuer <hans breuer org>
Date:   Sun Dec 27 16:05:05 2009 +0100

    Simple context menu also for selection of objects
    
    We can offer the Properties entry also for multiple selected
    objects since Sameer's work on group properties.

 app/disp_callbacks.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index afaa6f0..a43648b 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -215,13 +215,13 @@ popup_object_menu(DDisplay *ddisp, GdkEventButton *bevent)
   int num_items;
   
   diagram = ddisp->diagram;
-  if (g_list_length (diagram->data->selected) != 1)
+  if (g_list_length (diagram->data->selected) < 1)
     return;
   
   selected_list = diagram->data->selected;
   
   /* Have to have exactly one selected object */
-  if (selected_list == NULL || g_list_next(selected_list) != NULL) {
+  if (selected_list == NULL) {
     message_error("Selected list is %s while selected_count is %d\n",
 		  (selected_list?"long":"empty"), g_list_length (diagram->data->selected));
     return;
@@ -232,13 +232,18 @@ popup_object_menu(DDisplay *ddisp, GdkEventButton *bevent)
   /* Possibly react differently at a handle? */
 
   /* Get its menu, and remember the # of object-generated items */
-  if (obj->ops->get_object_menu == NULL || (obj->ops->get_object_menu)(obj, &object_menu_clicked_point) == NULL) {
+  if (    g_list_length (diagram->data->selected) > 1
+      ||  obj->ops->get_object_menu == NULL
+      || (obj->ops->get_object_menu)(obj, &object_menu_clicked_point) == NULL) {
     dia_menu = &empty_menu;
     if (dia_menu->title &&
 	(0 != strcmp(dia_menu->title,obj->type->name))) {
       dia_menu->app_data_free(dia_menu);
     }
-    dia_menu->title = obj->type->name;
+    if (g_list_length (diagram->data->selected) > 1)
+      dia_menu->title = _("Selection");
+    else
+      dia_menu->title = obj->type->name;
     num_items = 0;
   } else {
     dia_menu = (obj->ops->get_object_menu)(obj, &object_menu_clicked_point);



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