[Goodies-commits] r2488 - in xfce4-volstatus-icon/branches/hal-drive: . xfce4-volstatus-icon
Brian Tarricone
kelnos at xfce.org
Wed Feb 7 02:27:23 CET 2007
Author: kelnos
Date: 2007-02-07 01:27:22 +0000 (Wed, 07 Feb 2007)
New Revision: 2488
Modified:
xfce4-volstatus-icon/branches/hal-drive/configure.ac.in
xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/Makefile.am
xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/main.c
xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.c
xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.h
xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.c
xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.h
Log:
start working on using hal directly. doesn't compile yet.
Modified: xfce4-volstatus-icon/branches/hal-drive/configure.ac.in
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/configure.ac.in 2007-02-07 00:20:16 UTC (rev 2487)
+++ xfce4-volstatus-icon/branches/hal-drive/configure.ac.in 2007-02-07 01:27:22 UTC (rev 2488)
@@ -28,7 +28,7 @@
dnl check for standard header files
AC_HEADER_STDC
-AC_CHECK_HEADERS([signal.h])
+AC_CHECK_HEADERS([signal.h stdlib.h unistd.h])
dnl get svn revision
SVN=`which svn`
@@ -53,7 +53,8 @@
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.4.0])
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.4.0])
-XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.5.0])
+XDT_CHECK_PACKAGE([HAL_STORAGE], [hal-storage], [0.5.7.1])
+XDT_CHECK_PACKAGE([EXO_HAL], [exo-hal-0.3], [0.3.2])
dnl check for debugging support
XDT_FEATURE_DEBUG
Modified: xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/Makefile.am
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/Makefile.am 2007-02-07 00:20:16 UTC (rev 2487)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/Makefile.am 2007-02-07 01:27:22 UTC (rev 2488)
@@ -16,11 +16,13 @@
@GTK_CFLAGS@ \
@LIBXFCE4UTIL_CFLAGS@ \
@LIBXFCEGUI4_CFLAGS@ \
- @THUNAR_VFS_CFLAGS@
+ @HAL_STORAGE_CFLAGS@ \
+ @EXO_HAL_CFLAGS@
xfce4_volstatus_icon_LDADD = \
@GTHREAD_LIBS@ \
@GTK_LIBS@ \
@LIBXFCE4UTIL_LIBS@ \
@LIBXFCEGUI4_LIBS@ \
- @THUNAR_VFS_LIBS@
+ @HAL_STORAGE_LIBS@ \
+ @EXO_HAL_LIBS@
Modified: xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/main.c
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/main.c 2007-02-07 00:20:16 UTC (rev 2487)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/main.c 2007-02-07 01:27:22 UTC (rev 2488)
@@ -25,11 +25,14 @@
#include <signal.h>
#endif
+#include <stdlib.h>
+
#include <libxfce4util/libxfce4util.h>
#include <gtk/gtk.h>
-#include <thunar-vfs/thunar-vfs.h>
+#include <libhal-storage.h>
+#include <exo-hal/exo-hal.h>
#include "xfce-volstatus-common.h"
#include "xfce-volstatus-icon.h"
@@ -40,57 +43,59 @@
{
gint i, level = gtk_main_level();
+ if(!level)
+ exit(EXIT_SUCCESS);
+
for(i = 0; i < level; ++i)
gtk_main_quit();
}
static void
-xfce_volstatus_volume_changed(ThunarVfsVolume *volume,
- gpointer user_data)
+xfce_volstatus_device_changed(LibHalContext *hal_ctx,
+ const char *udi,
+ const char *key,
+ dbus_bool_t is_removed,
+ dbus_bool_t is_added)
{
- XfceVolstatusIcon *icon = XFCE_VOLSTATUS_ICON(user_data);
+ XfceVolstatusIcon *icon = libhal_ctx_get_user_data(hal_ctx);;
- if(thunar_vfs_volume_is_mounted(volume))
- xfce_volstatus_icon_add_volume(icon, volume);
- else
- xfce_volstatus_icon_remove_volume(icon, volume);
+ (void)icon;
+
+ /* FIXME: do stuff */
}
static void
-xfce_volstatus_volumes_added(ThunarVfsVolumeManager *manager,
- GList *volumes,
- gpointer user_data)
+xfce_volstatus_device_added(LibHalContext *hal_ctx,
+ const char *udi)
{
- GList *l;
+ XfceVolstatusIcon *icon = (XfceVolstatusIcon *)libhal_ctx_get_user_data(hal_ctx);
+ LibHalDrive *hal_drive;
- for(l = volumes; l; l = l->next) {
- ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(l->data);
-
- if(thunar_vfs_volume_is_removable(volume)) {
- g_signal_connect(G_OBJECT(volume), "changed",
- G_CALLBACK(xfce_volstatus_volume_changed),
- user_data);
- if(thunar_vfs_volume_is_mounted(volume)) {
- xfce_volstatus_icon_add_volume(XFCE_VOLSTATUS_ICON(user_data),
- volume);
- }
- }
+ hal_drive = libhal_drive_from_udi(hal_ctx, udi);
+ if(!hal_drive) /* is the device a drive? */
+ return;
+
+ if(!libhal_drive_is_hotpluggable(hal_drive)
+ || !libhal_drive_uses_removable_media(hal_drive))
+ {
+ /* device isn't removable */
+ libhal_drive_free(hal_drive);
+ return;
}
+
+ /* FIXME: only add the drive if it has a mounted volume */
+ xfce_volstatus_icon_add_drive(icon, hal_drive);
}
static void
-xfce_volstatus_volumes_removed(ThunarVfsVolumeManager *manager,
- GList *volumes,
- gpointer user_data)
+xfce_volstatus_device_removed(LibHalContext *hal_ctx,
+ const char *udi)
{
- GList *l;
+ XfceVolstatusIcon *icon = libhal_ctx_get_user_data(hal_ctx);;
- for(l = volumes; l; l = l->next) {
- ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(l->data);
-
- xfce_volstatus_icon_remove_volume(XFCE_VOLSTATUS_ICON(user_data),
- volume);
- }
+ (void)icon;
+
+ /* FIXME: do stuff */
}
int
@@ -98,15 +103,22 @@
char **argv)
{
const gchar *icon_name;
+ LibHalContext *hal_ctx;
+ DBusError derror;
GtkStatusIcon *icon;
- ThunarVfsVolumeManager *manager;
- GList *volumes;
+ char **devices;
+ int num_devices = 0, i;
+ signal(SIGPIPE, SIG_IGN);
+ signal(SIGINT, sighandler);
+ signal(SIGQUIT, sighandler);
+ signal(SIGTERM, sighandler);
+
xfce_textdomain(PACKAGE, LOCALEDIR, "UTF-8");
g_thread_init(NULL);
gtk_init(&argc, &argv);
- thunar_vfs_init();
+ exo_hal_init();
icon_name = xfce_volstatus_get_icon_name();
if(icon_name)
@@ -115,25 +127,48 @@
icon = xfce_volstatus_icon_new(NULL);
gtk_status_icon_set_visible(icon, FALSE);
- manager = thunar_vfs_volume_manager_get_default();
- g_signal_connect(G_OBJECT(manager), "volumes-added",
- G_CALLBACK(xfce_volstatus_volumes_added), icon);
- g_signal_connect(G_OBJECT(manager), "volumes-removed",
- G_CALLBACK(xfce_volstatus_volumes_removed), icon);
+ dbus_error_init(&derror);
+ hal_ctx = libhal_ctx_init_direct(&derror);
+ if(!hal_ctx) {
+ g_error("Unable to connect to HAL: %s", derror.message);
+ return EXIT_FAILURE;
+ }
+ dbus_error_free(&derror);
- volumes = thunar_vfs_volume_manager_get_volumes(manager);
- xfce_volstatus_volumes_added(manager, volumes, icon);
+ libhal_ctx_set_user_data(hal_ctx, icon);
+ libhal_ctx_set_device_added(hal_ctx, xfce_volstatus_device_added);
+ libhal_ctx_set_device_removed(hal_ctx, xfce_volstatus_device_removed);
+ libhal_ctx_set_device_property_modified(hal_ctx,
+ xfce_volstatus_device_changed);
- signal(SIGPIPE, SIG_IGN);
- signal(SIGINT, sighandler);
- signal(SIGQUIT, sighandler);
- signal(SIGTERM, sighandler);
+ dbus_error_init(&derror);
+ devices = libhal_find_device_by_capability(hal_ctx, "storage",
+ &num_devices, &derror);
+ if(dbus_error_is_set(&derror)) {
+ g_error("Failed to get device list from HAL: %s", derror.message);
+ return EXIT_FAILURE;
+ }
+ dbus_error_free(&derror);
+ for(i = 0; i < num_devices; ++i) {
+ /* just try to add it. the device added function will make sure
+ * it's a removable drive */
+ xfce_volstatus_device_added(hal_ctx, devices[i]);
+ }
+ libhal_free_string_array(devices);
+
+ dbus_error_init(&derror);
+ if(!libhal_device_property_watch_all(hal_ctx, &derror)) {
+ g_error("Unable to watch all HAL device properties: %s", derror.message);
+ return EXIT_FAILURE;
+ }
+ dbus_error_free(&derror);
+
gtk_main();
+ libhal_ctx_shutdown(hal_ctx, NULL);
+ libhal_ctx_free(hal_ctx);
g_object_unref(G_OBJECT(icon));
- g_object_unref(G_OBJECT(manager));
- thunar_vfs_shutdown();
- return 0;
+ return EXIT_SUCCESS;
}
Modified: xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.c
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.c 2007-02-07 00:20:16 UTC (rev 2487)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.c 2007-02-07 01:27:22 UTC (rev 2488)
@@ -23,29 +23,72 @@
#include <libxfcegui4/libxfcegui4.h>
+#include <exo-hal/exo-hal.h>
+
#include "xfce-volstatus-common.h"
gboolean
-xfce_volstatus_remove_volume(ThunarVfsVolume *volume)
+xfce_volstatus_remove_drive(LibHalContext *hal_ctx,
+ LibHalDrive *drive)
{
+ char **volumes;
+ int num_volumes = 0, i;
gboolean ret = TRUE;
GError *error = NULL;
+ gint exit_status = 0;
- g_return_val_if_fail(THUNAR_VFS_IS_VOLUME(volume), FALSE);
+ g_return_val_if_fail(drive, FALSE);
- if(thunar_vfs_volume_is_ejectable(volume))
- ret = thunar_vfs_volume_eject(volume, NULL, &error);
- else if(thunar_vfs_volume_is_mounted(volume))
- ret = thunar_vfs_volume_unmount(volume, NULL, &error);
+ volumes = libhal_drive_find_all_volumes(hal_ctx, drive, &num_volumes);
+ if(volumes) {
+ for(i = 0; i < num_volumes; ++i) {
+ LibHalVolume *volume = libhal_volume_from_udi(hal_ctx, volumes[i]);
+ if(!volume)
+ continue;
+
+ if(libhal_volume_is_mounted(volume)) {
+ gchar *udi_quoted = g_shell_quote(volumes[i]);
+ gchar *cmd = g_strdup_printf("exo-unmount -n -h %s", udi_quoted);
+
+ ret = g_spawn_command_line_sync(cmd, NULL, NULL, &exit_status,
+ &error);
+
+ g_free(udi_quoted);
+ g_free(cmd);
+
+ if(!ret || exit_status) {
+ libhal_volume_free(volume);
+ break;
+ }
+ }
+
+ libhal_volume_free(volume);
+ }
+
+ libhal_free_string_array(volumes);
+ }
- if(!ret && error) {
- gchar *primary = g_strdup_printf(_("Unable to remove \"%s\""),
- thunar_vfs_volume_get_name(volume));
+ if(libhal_drive_requires_eject(drive)) {
+ gchar *udi_quoted = g_shell_quote(libhal_drive_get_udi(drive));
+ gchar *cmd = g_strdup_printf("exo-eject -n -h %s", udi_quoted);
+
+ ret = g_spawn_command_line_sync(cmd, NULL, NULL, &exit_status, &error);
+
+ g_free(udi_quoted);
+ g_free(cmd);
+ }
+
+ if(!ret) {
+ gchar *name = exo_hal_drive_compute_display_name(hal_ctx, drive);
+ gchar *primary = g_strdup_printf(_("Unable to remove \"%s\""), name);
xfce_message_dialog(NULL, _("Removal Failure"),
- GTK_STOCK_DIALOG_WARNING, primary, error->message,
+ GTK_STOCK_DIALOG_WARNING, primary,
+ error ? error->message : _("Unknown error"),
GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL);
+ g_free(name);
g_free(primary);
- g_error_free(error);
+ if(error)
+ g_error_free(error);
}
return ret;
Modified: xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.h
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.h 2007-02-07 00:20:16 UTC (rev 2487)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.h 2007-02-07 01:27:22 UTC (rev 2488)
@@ -20,11 +20,12 @@
#ifndef __XFCE_VOLSTATUS_COMMON_H
#define __XFCE_VOLSTATUS_COMMON_H
-#include <thunar-vfs/thunar-vfs.h>
+#include <libhal-storage.h>
G_BEGIN_DECLS
-gboolean xfce_volstatus_remove_volume(ThunarVfsVolume *volume);
+gboolean xfce_volstatus_remove_drive(LibHalContext *hal_ctx,
+ LibHalDrive *drive);
const gchar *xfce_volstatus_get_icon_name();
Modified: xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.c
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.c 2007-02-07 00:20:16 UTC (rev 2487)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.c 2007-02-07 01:27:22 UTC (rev 2488)
@@ -23,6 +23,8 @@
#include <libxfcegui4/libxfcegui4.h>
+#include <exo-hal/exo-hal.h>
+
#include "xfce-volstatus-dialog.h"
#include "xfce-volstatus-common.h"
#include "xfce-volstatus-icon.h"
@@ -32,7 +34,7 @@
{
GtkStatusIcon parent;
- GList *volumes;
+ GList *drives;
GtkWidget *status_dialog;
};
@@ -41,16 +43,16 @@
GtkStatusIconClass parent;
/*< signals >*/
- void (*volume_added)(XfceVolstatusIcon *icon,
- ThunarVfsVolume *volume);
- void (*volume_removed)(XfceVolstatusIcon *icon,
- ThunarVfsVolume *volume);
+ void (*drive_added)(XfceVolstatusIcon *icon,
+ LibHalDrive *drive);
+ void (*drive_removed)(XfceVolstatusIcon *icon,
+ LibHalDrive *drive);
} XfceVolstatusIconClass;
enum
{
- SIG_VOLUME_ADDED = 0,
- SIG_VOLUME_REMOVED,
+ SIG_DRIVE_ADDED = 0,
+ SIG_DRIVE_REMOVED,
N_SIGS,
};
@@ -66,8 +68,8 @@
static void xfce_volstatus_icon_menu_deactivate(GtkWidget *widget,
gpointer user_data);
-static void xfce_volstatus_icon_volume_activate(GtkMenuItem *mi,
- gpointer user_data);
+static void xfce_volstatus_icon_drive_activate(GtkMenuItem *mi,
+ gpointer user_data);
static guint xvsi_signals[N_SIGS] = { 0, };
@@ -86,25 +88,25 @@
icon_class->activate = xfce_volstatus_icon_activate;
icon_class->popup_menu = xfce_volstatus_icon_popup_menu;
- xvsi_signals[SIG_VOLUME_ADDED] = g_signal_new("volume-added",
- XFCE_TYPE_VOLSTATUS_ICON,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(XfceVolstatusIconClass,
- volume_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- THUNAR_VFS_TYPE_VOLUME);
+ xvsi_signals[SIG_DRIVE_ADDED] = g_signal_new("drive-added",
+ XFCE_TYPE_VOLSTATUS_ICON,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(XfceVolstatusIconClass,
+ drive_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
- xvsi_signals[SIG_VOLUME_REMOVED] = g_signal_new("volume-removed",
- XFCE_TYPE_VOLSTATUS_ICON,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(XfceVolstatusIconClass,
- volume_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- THUNAR_VFS_TYPE_VOLUME);
+ xvsi_signals[SIG_DRIVE_REMOVED] = g_signal_new("drive-removed",
+ XFCE_TYPE_VOLSTATUS_ICON,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(XfceVolstatusIconClass,
+ drive_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
}
static void
@@ -124,8 +126,8 @@
gtk_widget_destroy(icon->status_dialog);
}
- g_list_foreach(icon->volumes, (GFunc)g_object_unref, NULL);
- g_list_free(icon->volumes);
+ g_list_foreach(icon->drives, (GFunc)libhal_drive_free, NULL);
+ g_list_free(icon->drives);
G_OBJECT_CLASS(xfce_volstatus_icon_parent_class)->finalize(obj);
}
@@ -164,29 +166,29 @@
g_signal_connect(G_OBJECT(menu), "deactivate",
G_CALLBACK(xfce_volstatus_icon_menu_deactivate), icon);
- if(G_LIKELY(icon->volumes)) {
+ if(G_LIKELY(icon->drives)) {
GList *l;
- for(l = icon->volumes; l; l = l->next) {
- ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(l->data);
- gchar *label = g_strdup_printf(_("Safely remove \"%s\""),
- thunar_vfs_volume_get_name(volume));
+ for(l = icon->drives; l; l = l->next) {
+ LibHalDrive *drive = l->data;
+ gchar *name = exo_hal_drive_compute_display_name(hal_ctx, drive);
+ gchar *label = g_strdup_printf(_("Safely remove \"%s\""), name);
+ g_free(name);
+
mi = gtk_menu_item_new_with_label(label);
- g_object_set_data_full(G_OBJECT(mi), "thunar-vfs-volume",
- g_object_ref(G_OBJECT(volume)),
- (GDestroyNotify)g_object_unref);
+ g_object_set_data(G_OBJECT(mi), "libhal-drive", drive);
gtk_widget_show(mi);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
g_signal_connect(G_OBJECT(mi), "activate",
- G_CALLBACK(xfce_volstatus_icon_volume_activate),
+ G_CALLBACK(xfce_volstatus_icon_drive_activate),
icon);
g_free(label);
}
} else {
/* this shouldn't happen, but just to be safe... */
- mi = gtk_menu_item_new_with_label(_("(no removable volumes"));
+ mi = gtk_menu_item_new_with_label(_("(no removable drives)"));
gtk_widget_set_sensitive(mi, FALSE);
gtk_widget_show(mi);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
@@ -214,12 +216,11 @@
}
static void
-xfce_volstatus_icon_volume_activate(GtkMenuItem *mi,
- gpointer user_data)
+xfce_volstatus_icon_drive_activate(GtkMenuItem *mi,
+ gpointer user_data)
{
- ThunarVfsVolume *volume = g_object_get_data(G_OBJECT(mi),
- "thunar-vfs-volume");
- xfce_volstatus_remove_volume(volume);
+ LibHalDrive *drive = g_object_get_data(G_OBJECT(mi), "libhal-drive");
+ xfce_volstatus_remove_drive(drive);
}
@@ -246,47 +247,42 @@
}
void
-xfce_volstatus_icon_add_volume(XfceVolstatusIcon *icon,
- ThunarVfsVolume *volume)
+xfce_volstatus_icon_add_drive(XfceVolstatusIcon *icon,
+ LibHalDrive *drive)
{
- g_return_if_fail(XFCE_IS_VOLSTATUS_ICON(icon)
- && THUNAR_VFS_IS_VOLUME(volume));
+ g_return_if_fail(XFCE_IS_VOLSTATUS_ICON(icon) && drive);
- if(g_list_find(icon->volumes, volume))
+ if(g_list_find(icon->drive, drive))
return;
- if(!icon->volumes)
+ if(!icon->drives)
gtk_status_icon_set_visible(GTK_STATUS_ICON(icon), TRUE);
- g_object_ref(G_OBJECT(volume));
- icon->volumes = g_list_prepend(icon->volumes, volume);
+ icon->drives = g_list_prepend(icon->drives, drive);
- g_signal_emit(G_OBJECT(icon), xvsi_signals[SIG_VOLUME_ADDED], 0, volume);
+ g_signal_emit(G_OBJECT(icon), xvsi_signals[SIG_DRIVE_ADDED], 0, drive);
}
void
-xfce_volstatus_icon_remove_volume(XfceVolstatusIcon *icon,
- ThunarVfsVolume *volume)
+xfce_volstatus_icon_remove_drive(XfceVolstatusIcon *icon,
+ LibHalDrive *drive)
{
- g_return_if_fail(XFCE_IS_VOLSTATUS_ICON(icon)
- && THUNAR_VFS_IS_VOLUME(volume));
+ g_return_if_fail(XFCE_IS_VOLSTATUS_ICON(icon) && drive);
- if(!g_list_find(icon->volumes, volume))
+ if(!g_list_find(icon->drives, drive))
return;
- icon->volumes = g_list_remove(icon->volumes, volume);
+ icon->drives = g_list_remove(icon->drives, drive);
- g_signal_emit(G_OBJECT(icon), xvsi_signals[SIG_VOLUME_REMOVED], 0, volume);
+ g_signal_emit(G_OBJECT(icon), xvsi_signals[SIG_DRIVE_REMOVED], 0, drive);
- g_object_unref(G_OBJECT(volume));
-
- if(!icon->volumes)
+ if(!icon->drive)
gtk_status_icon_set_visible(GTK_STATUS_ICON(icon), FALSE);
}
GList *
-xfce_volstatus_icon_list_volumes(XfceVolstatusIcon *icon)
+xfce_volstatus_icon_list_drives(XfceVolstatusIcon *icon)
{
g_return_val_if_fail(XFCE_IS_VOLSTATUS_ICON(icon), NULL);
- return icon->volumes;
+ return icon->drives;
}
Modified: xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.h
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.h 2007-02-07 00:20:16 UTC (rev 2487)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.h 2007-02-07 01:27:22 UTC (rev 2488)
@@ -22,7 +22,7 @@
#include <gtk/gtk.h>
-#include <thunar-vfs/thunar-vfs.h>
+#include <libhal-storage.h>
#define XFCE_TYPE_VOLSTATUS_ICON (xfce_volstatus_icon_get_type())
#define XFCE_VOLSTATUS_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFCE_TYPE_VOLSTATUS_ICON, XfceVolstatusIcon))
@@ -36,13 +36,12 @@
GtkStatusIcon *xfce_volstatus_icon_new(GdkScreen *screen);
-void xfce_volstatus_icon_add_volume(XfceVolstatusIcon *icon,
- ThunarVfsVolume *volume);
-void xfce_volstatus_icon_remove_volume(XfceVolstatusIcon *icon,
- ThunarVfsVolume *volume);
-GList *xfce_volstatus_icon_list_volumes(XfceVolstatusIcon *icon);
+void xfce_volstatus_icon_add_drive(XfceVolstatusIcon *icon,
+ LibHalDrive *drive);
+void xfce_volstatus_icon_remove_drive(XfceVolstatusIcon *icon,
+ LibHalDrive *drive);
+GList *xfce_volstatus_icon_list_drives(XfceVolstatusIcon *icon);
-
G_END_DECLS
#endif /* __XFCE_VOLSTATUS_ICON_H__ */
More information about the Goodies-commits
mailing list