[Goodies-commits] r2906 - in xfce4-places-plugin/branches/umount: . panel-plugin
Diego Ongaro
ongardie at xfce.org
Fri Jul 13 05:14:19 CEST 2007
Author: ongardie
Date: 2007-07-13 03:14:19 +0000 (Fri, 13 Jul 2007)
New Revision: 2906
Modified:
xfce4-places-plugin/branches/umount/ChangeLog
xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c
Log:
2007-07-12 Diego Ongaro <ongardie at gmail.com>
* unmount branch: Cleaned up model_volumes.c
Modified: xfce4-places-plugin/branches/umount/ChangeLog
===================================================================
--- xfce4-places-plugin/branches/umount/ChangeLog 2007-07-13 02:55:31 UTC (rev 2905)
+++ xfce4-places-plugin/branches/umount/ChangeLog 2007-07-13 03:14:19 UTC (rev 2906)
@@ -1,6 +1,6 @@
2007-07-12 Diego Ongaro <ongardie at gmail.com>
- * unmount branch: Cleaned up places.c
+ * unmount branch: Cleaned up places.c, model_volumes.c
2007-06-04 Diego Ongaro <ongardie at gmail.com>
Modified: xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c 2007-07-13 02:55:31 UTC (rev 2905)
+++ xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c 2007-07-13 03:14:19 UTC (rev 2906)
@@ -45,7 +45,7 @@
/********** ThunarVFS Callbacks **********/
-void
+static void
places_bookmarks_volumes_cb_changed(ThunarVfsVolume *volume,
BookmarksVolumes *b)
{
@@ -55,7 +55,7 @@
BookmarkInfo *bi;
GList *volumes;
guint k;
- b->changed = TRUE;
+ b->changed = FALSE;
if(places_bookmarks_volumes_show_volume(volume)){
@@ -72,6 +72,7 @@
volumes = g_list_prepend(NULL, volume);
places_bookmarks_volumes_add(b, volumes);
g_list_free(volumes);
+ b->changed = TRUE;
}else{
DBG("volume already in array");
}
@@ -87,12 +88,13 @@
g_object_unref(bi->data);
bi->data = NULL;
g_free(bi);
+ b->changed = TRUE;
}
}
}
}
-void
+static void
places_bookmarks_volumes_cb_added(ThunarVfsVolumeManager *volume_manager,
const GList *volumes,
BookmarksVolumes *b)
@@ -102,7 +104,7 @@
b->changed = TRUE;
}
-void
+static void
places_bookmarks_volumes_cb_removed(ThunarVfsVolumeManager *volume_manager,
const GList *volumes,
BookmarksVolumes *b)
@@ -141,7 +143,25 @@
}
}
-// internal
+/********** Actions Callbacks **********/
+
+static void
+places_bookmarks_volumes_unmount(gpointer _volume)
+{
+ ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(_volume);
+ if(thunar_vfs_volume_is_mounted(volume))
+ thunar_vfs_volume_unmount(volume, NULL, NULL);
+}
+
+static void
+places_bookmarks_volumes_mount(gpointer _volume)
+{
+ ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(_volume);
+ if(!thunar_vfs_volume_is_mounted(volume))
+ thunar_vfs_volume_mount(volume, NULL, NULL);
+}
+
+/********** Internal **********/
static gboolean
places_bookmarks_volumes_show_volume(ThunarVfsVolume *volume){
@@ -185,7 +205,7 @@
}
}
-// external
+/********** External **********/
BookmarksVolumes*
places_bookmarks_volumes_init()
@@ -248,24 +268,8 @@
}
}
-void
-places_bookmarks_volumes_unmount(gpointer _volume)
-{
- ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(_volume);
- if(thunar_vfs_volume_is_mounted(volume))
- thunar_vfs_volume_unmount(volume, NULL, NULL);
-}
void
-places_bookmarks_volumes_mount(gpointer _volume)
-{
- ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(_volume);
- if(!thunar_vfs_volume_is_mounted(volume))
- thunar_vfs_volume_mount(volume, NULL, NULL);
-}
-
-
-void
places_bookmarks_volumes_visit(BookmarksVolumes *b, BookmarksVisitor *visitor)
{
guint k;
@@ -273,37 +277,35 @@
GSList *actions;
ThunarVfsVolume *volume;
gchar *uri;
+ BookmarkAction *toggle_mount;
for(k=0; k < b->bookmarks->len; k++){
bi = g_ptr_array_index(b->bookmarks, k);
volume = THUNAR_VFS_VOLUME(bi->data);
- actions = NULL;
+
+ toggle_mount = g_new0(BookmarkAction, 1); /* visitor will free */
+ toggle_mount->pass_thru = volume;
+ actions = g_slist_prepend(NULL, toggle_mount);
if(thunar_vfs_volume_is_mounted(volume)){
- BookmarkAction *unmount = g_new0(BookmarkAction, 1);
if(thunar_vfs_volume_is_disc(volume))
- unmount->label = _("Eject Volume");
+ toggle_mount->label = _("Eject Volume");
else
- unmount->label = _("Unmount Volume");
- unmount->action = places_bookmarks_volumes_unmount;
- unmount->pass_thru = volume;
- actions = g_slist_prepend(actions, unmount);
+ toggle_mount->label = _("Unmount Volume");
+ toggle_mount->action = places_bookmarks_volumes_unmount;
uri = bi->uri;
+
}else{
- BookmarkAction *mount = g_new0(BookmarkAction, 1);
- mount->label = _("Mount Volume");
- mount->action = places_bookmarks_volumes_mount;
- mount->pass_thru = volume;
- actions = g_slist_prepend(actions, mount);
+ toggle_mount->label = _("Mount Volume");
+ toggle_mount->action = places_bookmarks_volumes_mount;
uri = NULL;
}
visitor->item(visitor->pass_thru, bi->label, uri, bi->icon, actions);
- // visitor is in charge of freeing actions if not NULL
}
}
More information about the Goodies-commits
mailing list