Author: vuntz
Date: Sun Feb 10 22:13:52 2008
New Revision: 10800
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=10800&view=rev

Log:
2008-02-10  Vincent Untz  <[EMAIL PROTECTED]>

        * panel-menu-items.c: (panel_place_menu_item_append_volumes): renamed
        to...
        (panel_place_menu_item_append_local_gio): this. Also add mounts that
        have no volume and that have a root with a file: scheme
        (panel_place_menu_item_append_mounts): renamed to...
        (panel_place_menu_item_append_remote_gio): this. Only add mounts that
        have not a root with a file: scheme
        (panel_place_menu_item_create_menu): updated


Modified:
   trunk/gnome-panel/ChangeLog
   trunk/gnome-panel/panel-menu-items.c

Modified: trunk/gnome-panel/panel-menu-items.c
==============================================================================
--- trunk/gnome-panel/panel-menu-items.c        (original)
+++ trunk/gnome-panel/panel-menu-items.c        Sun Feb 10 22:13:52 2008
@@ -694,8 +694,8 @@
 
 /* this is loosely based on update_places() from nautilus-places-sidebar.c */
 static void
-panel_place_menu_item_append_volumes (PanelPlaceMenuItem *place_item,
-                                     GtkWidget          *menu)
+panel_place_menu_item_append_local_gio (PanelPlaceMenuItem *place_item,
+                                       GtkWidget          *menu)
 {
        GList   *l;
        GList   *ll;
@@ -703,6 +703,7 @@
        GDrive  *drive;
        GList   *volumes;
        GVolume *volume;
+       GList   *mounts;
        GMount  *mount;
 
        /* first go through all connected drives */
@@ -779,12 +780,43 @@
                g_object_unref (volume);
        }
        g_list_free (volumes);
+
+       /* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
+       mounts = g_volume_monitor_get_mounts (place_item->priv->volume_monitor);
+       for (l = mounts; l != NULL; l = l->next) {
+               GFile *root;
+               char  *scheme;
+
+               mount = l->data;
+
+               volume = g_mount_get_volume (mount);
+               if (volume != NULL) {
+                       g_object_unref (volume);
+                       g_object_unref (mount);
+                       continue;
+               }
+
+               root = g_mount_get_root (mount);
+               scheme = g_file_get_uri_scheme (root);
+               g_object_unref (root);
+
+               if (scheme && strcmp (scheme, "file") != 0) {
+                       g_free (scheme);
+                       g_object_unref (mount);
+                       continue;
+               }
+               g_free (scheme);
+
+               panel_menu_item_append_mount (menu, mount);
+               g_object_unref (mount);
+       }
+       g_list_free (mounts);
 }
 
 /* this is loosely based on update_places() from nautilus-places-sidebar.c */
 static void
-panel_place_menu_item_append_mounts (PanelPlaceMenuItem *place_item,
-                                    GtkWidget          *menu)
+panel_place_menu_item_append_remote_gio (PanelPlaceMenuItem *place_item,
+                                        GtkWidget          *menu)
 {
        GtkWidget *add_menu;
        GList     *mounts, *l;
@@ -797,6 +829,8 @@
 
        for (l = mounts; l; l = l->next) {
                GVolume *volume;
+               GFile   *root;
+               char    *scheme;
 
                mount = l->data;
                volume = g_mount_get_volume (mount);
@@ -806,6 +840,17 @@
                        continue;
                }
 
+               root = g_mount_get_root (mount);
+               scheme = g_file_get_uri_scheme (root);
+               g_object_unref (root);
+
+               if (scheme && strcmp (scheme, "file") == 0) {
+                       g_free (scheme);
+                       g_object_unref (mount);
+                       continue;
+               }
+               g_free (scheme);
+
                add_mounts = g_slist_prepend (add_mounts, mount);
        }
        add_mounts = g_slist_reverse (add_mounts);
@@ -902,13 +947,13 @@
                                              "nautilus-cd-burner.desktop",
                                              NULL);
 
-       panel_place_menu_item_append_volumes (place_item, places_menu);
+       panel_place_menu_item_append_local_gio (place_item, places_menu);
        add_menu_separator (places_menu);
 
        panel_menu_items_append_from_desktop (places_menu,
                                              "network-scheme.desktop",
                                              NULL);
-       panel_place_menu_item_append_mounts (place_item, places_menu);
+       panel_place_menu_item_append_remote_gio (place_item, places_menu);
 
        if (panel_is_program_in_path ("nautilus-connect-server")) {
                item = panel_menu_items_create_action_item 
(PANEL_ACTION_CONNECT_SERVER);
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to