[Goodies-commits] r3397 - in xfce4-places-plugin/trunk: . panel-plugin

Diego Ongaro ongardie at xfce.org
Wed Oct 17 00:41:35 CEST 2007


Author: ongardie
Date: 2007-10-16 22:41:35 +0000 (Tue, 16 Oct 2007)
New Revision: 3397

Modified:
   xfce4-places-plugin/trunk/ChangeLog
   xfce4-places-plugin/trunk/panel-plugin/model.h
   xfce4-places-plugin/trunk/panel-plugin/view.c
Log:
2007-10-16	Diego Ongaro <ongardie at gmail.com>

* model.h, view.c: Added force_gray option to bookmarks for Bug #3565


Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog	2007-10-16 22:13:45 UTC (rev 3396)
+++ xfce4-places-plugin/trunk/ChangeLog	2007-10-16 22:41:35 UTC (rev 3397)
@@ -4,7 +4,9 @@
 	~/.gtk-bookmarks is missing (resulted in menu "blinking")
 	* model*.c: Use places_bookmark_create() as counterpart to
 	places_bookmark_free()
-	* model_volumes.c: Added "Mount and Open" action
+	* model_volumes.c: Added "Mount and Open" action for Bug #3565
+	* model.h, view.c: Added force_gray option to bookmarks for
+	Bug #3565
 
 2007-10-15	Diego Ongaro <ongardie at gmail.com>
 

Modified: xfce4-places-plugin/trunk/panel-plugin/model.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model.h	2007-10-16 22:13:45 UTC (rev 3396)
+++ xfce4-places-plugin/trunk/panel-plugin/model.h	2007-10-16 22:41:35 UTC (rev 3397)
@@ -58,6 +58,7 @@
     places_uri_scheme      uri_scheme;    
     gchar                 *icon;           /* may be NULL */
     PlacesBookmarkAction  *primary_action; /* may be NULL */
+    gboolean               force_gray;
     GList                 *actions;        /* may be NULL (empty) */
 
     gpointer               priv;           /* private data */

Modified: xfce4-places-plugin/trunk/panel-plugin/view.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/view.c	2007-10-16 22:13:45 UTC (rev 3396)
+++ xfce4-places-plugin/trunk/panel-plugin/view.c	2007-10-16 22:41:35 UTC (rev 3397)
@@ -391,7 +391,8 @@
 pview_cb_menu_item_do_alt(PlacesView *pd, GtkWidget *menu_item)
 {
     
-    GList *actions = (GList*) g_object_get_data(G_OBJECT(menu_item), "actions");
+    PlacesBookmark *bookmark = (PlacesBookmark*) g_object_get_data(G_OBJECT(menu_item), "bookmark");
+    GList *actions = bookmark->actions;
     GtkWidget *context, *context_item;
     PlacesBookmarkAction *action;
 
@@ -399,7 +400,7 @@
 
         context = gtk_menu_new();
 
-        while(actions != NULL){
+        do{
             action = (PlacesBookmarkAction*) actions->data;
 
             context_item = gtk_menu_item_new_with_label(action->label);
@@ -412,7 +413,7 @@
             gtk_widget_show(context_item);
 
             actions = actions->next;
-        }
+        }while(actions != NULL);
 
         gtk_widget_show(context);
         gtk_menu_popup(GTK_MENU(context),
@@ -434,9 +435,9 @@
 
     gboolean ctrl =  (event->state & GDK_CONTROL_MASK) && 
                     !(event->state & (GDK_MOD1_MASK|GDK_SHIFT_MASK|GDK_MOD4_MASK));
-    gboolean sensitive = GTK_WIDGET_IS_SENSITIVE(gtk_bin_get_child(GTK_BIN(menu_item)));
+    PlacesBookmark *bookmark = (PlacesBookmark*) g_object_get_data(G_OBJECT(menu_item), "bookmark");
 
-    if(event->button == 3 || (event->button == 1 && (ctrl || !sensitive)))
+    if(event->button == 3 || (event->button == 1 && (ctrl || bookmark->primary_action == NULL)))
         return pview_cb_menu_item_do_alt(pd, menu_item);
     else
         return FALSE;
@@ -511,8 +512,7 @@
         }
     }
 
-    if(bookmark->actions != NULL)
-        g_object_set_data(G_OBJECT(item), "actions", bookmark->actions);
+    g_object_set_data(G_OBJECT(item), "bookmark", bookmark);
 
     /* do this always so that the menu doesn't close on right-clicks */
     g_signal_connect(item, "button-release-event",
@@ -524,7 +524,8 @@
                                  G_CALLBACK(places_bookmark_action_call), 
                                  bookmark->primary_action);
 
-    }else{
+    }
+    if(bookmark->force_gray || bookmark->primary_action == NULL){
 
         /* Gray it out. */
         gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(item)),




More information about the Goodies-commits mailing list