[gtk+] placesview: don't show mount for Computer row



commit 98f9532a22bc37118f5958f795c5167714d31e00
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jul 29 19:37:19 2015 -0300

    placesview: don't show mount for Computer row
    
    The "Computer" row from places view is an abstract volume
    that represents the root of the current partition. As such,
    it cannot be mounted or unmounted.
    
    Remove the related item on context menu for Computer row.

 gtk/gtkplacesview.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index e44867d..bbeb6c2 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -1289,9 +1289,11 @@ build_popup_menu (GtkPlacesView    *view,
   GtkPlacesViewPrivate *priv;
   GtkWidget *item;
   GMount *mount;
+  GFile *file;
 
   priv = gtk_places_view_get_instance_private (view);
   mount = gtk_places_view_row_get_mount (row);
+  file = gtk_places_view_row_get_file (row);
 
   priv->popup_menu = gtk_menu_new ();
   gtk_style_context_add_class (gtk_widget_get_style_context (priv->popup_menu),
@@ -1332,6 +1334,13 @@ build_popup_menu (GtkPlacesView    *view,
       gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), item);
     }
 
+  /*
+   * The only item that contains a file up to now is the Computer
+   * item, which cannot be mounted or unmounted.
+   */
+  if (file)
+    return;
+
   /* Separator */
   item = gtk_separator_menu_item_new ();
   gtk_widget_show (item);


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