[Goodies-commits] r2489 - in xfce4-volstatus-icon/branches/hal-drive: . xfce4-volstatus-icon

Brian Tarricone kelnos at xfce.org
Wed Feb 7 09:28:15 CET 2007


Author: kelnos
Date: 2007-02-07 08:28:15 +0000 (Wed, 07 Feb 2007)
New Revision: 2489

Modified:
   xfce4-volstatus-icon/branches/hal-drive/INSTALL
   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-dialog.c
   xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.c
Log:
it compiles, but doesn't work.  awesome.  bedtime.


Modified: xfce4-volstatus-icon/branches/hal-drive/INSTALL
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/INSTALL	2007-02-07 01:27:22 UTC (rev 2488)
+++ xfce4-volstatus-icon/branches/hal-drive/INSTALL	2007-02-07 08:28:15 UTC (rev 2489)
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
 
 This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
@@ -10,7 +10,10 @@
 Basic Installation
 ==================
 
-These are generic installation instructions.
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -23,9 +26,9 @@
 
    It can also use an optional file (typically called `config.cache'
 and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  (Caching is
+the results of its tests to speed up reconfiguring.  Caching is
 disabled by default to prevent problems with accidental use of stale
-cache files.)
+cache files.
 
    If you need to do unusual things to compile the package, please try
 to figure out how `configure' could check whether to do them, and mail
@@ -35,20 +38,17 @@
 may remove or edit it.
 
    The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
 
 The simplest way to compile this package is:
 
   1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
+     `./configure' to configure the package for your system.
 
-     Running `configure' takes awhile.  While running, it prints some
-     messages telling which features it is checking for.
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
 
   2. Type `make' to compile the package.
 
@@ -78,7 +78,7 @@
 by setting variables in the command line or in the environment.  Here
 is an example:
 
-     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
 
    *Note Defining Variables::, for more details.
 
@@ -87,17 +87,15 @@
 
 You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+own directory.  To do this, you can use GNU `make'.  `cd' to the
 directory where you want the object files and executables to go and run
 the `configure' script.  `configure' automatically checks for the
 source code in the directory that `configure' is in and in `..'.
 
-   If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory.  After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
 
 Installation Names
 ==================
@@ -190,12 +188,12 @@
      ./configure CC=/usr/local2/bin/gcc
 
 causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).  Here is a another example:
+overridden in the site shell script).
 
-     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
 
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
 
 `configure' Invocation
 ======================

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 01:27:22 UTC (rev 2488)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/main.c	2007-02-07 08:28:15 UTC (rev 2489)
@@ -128,7 +128,7 @@
     gtk_status_icon_set_visible(icon, FALSE);
     
     dbus_error_init(&derror);
-    hal_ctx = libhal_ctx_init_direct(&derror);
+    hal_ctx = xfce_volstatus_init_hal_context(&derror);
     if(!hal_ctx) {
         g_error("Unable to connect to HAL: %s", derror.message);
         return EXIT_FAILURE;
@@ -166,8 +166,7 @@
     
     gtk_main();
     
-    libhal_ctx_shutdown(hal_ctx, NULL);
-    libhal_ctx_free(hal_ctx);
+    xfce_volstatus_free_hal_context();
     g_object_unref(G_OBJECT(icon));
     
     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 01:27:22 UTC (rev 2488)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.c	2007-02-07 08:28:15 UTC (rev 2489)
@@ -107,3 +107,30 @@
     
     return icon_name;
 }
+
+static LibHalContext *__hal_ctx = NULL;
+
+LibHalContext *
+xfce_volstatus_init_hal_context(DBusError *derror)
+{
+    g_return_val_if_fail(!__hal_ctx, __hal_ctx);
+    __hal_ctx = libhal_ctx_init_direct(derror);
+    return __hal_ctx;
+}
+
+LibHalContext *
+xfce_volstatus_get_hal_context()
+{
+    g_assert(__hal_ctx);  /* this should never ever ever fail */
+    return __hal_ctx;
+}
+
+void
+xfce_volstatus_free_hal_context()
+{
+    if(G_LIKELY(__hal_ctx)) {
+        libhal_ctx_shutdown(__hal_ctx, NULL);
+        libhal_ctx_free(__hal_ctx);
+        __hal_ctx = NULL;
+    }
+}

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 01:27:22 UTC (rev 2488)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-common.h	2007-02-07 08:28:15 UTC (rev 2489)
@@ -29,6 +29,10 @@
 
 const gchar *xfce_volstatus_get_icon_name();
 
+LibHalContext *xfce_volstatus_init_hal_context(DBusError *derror);
+LibHalContext *xfce_volstatus_get_hal_context();
+void xfce_volstatus_free_hal_context();
+
 G_END_DECLS
 
 #endif  /* __XFCE_VOLSTATUS_COMMON_H */

Modified: xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-dialog.c
===================================================================
--- xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-dialog.c	2007-02-07 01:27:22 UTC (rev 2488)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-dialog.c	2007-02-07 08:28:15 UTC (rev 2489)
@@ -22,8 +22,10 @@
 #endif
 
 #include <libxfcegui4/libxfcegui4.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-dialog.h"
 
@@ -54,7 +56,7 @@
 {
     COL_PIXBUF = 0,
     COL_NAME,
-    COL_VOLUME,
+    COL_DRIVE,
 };
 
 
@@ -63,12 +65,12 @@
 static void xfce_volstatus_dialog_init(XfceVolstatusDialog *dialog);
 static void xfce_volstatus_dialog_finalize(GObject *obj);
 
-static void xfce_volstatus_dialog_volume_added(XfceVolstatusIcon *icon,
-                                               ThunarVfsVolume *volume,
-                                               gpointer user_data);
-static void xfce_volstatus_dialog_volume_removed(XfceVolstatusIcon *icon,
-                                                 ThunarVfsVolume *volume,
-                                                 gpointer user_data);
+static void xfce_volstatus_dialog_drive_added(XfceVolstatusIcon *icon,
+                                              LibHalDrive *drive,
+                                              gpointer user_data);
+static void xfce_volstatus_dialog_drive_removed(XfceVolstatusIcon *icon,
+                                                LibHalDrive *drive,
+                                                gpointer user_data);
 
 
 G_DEFINE_TYPE(XfceVolstatusDialog, xfce_volstatus_dialog, XFCE_TYPE_TITLED_DIALOG)
@@ -94,10 +96,10 @@
     XfceVolstatusDialog *dialog = XFCE_VOLSTATUS_DIALOG(obj);
     
     g_signal_handlers_disconnect_by_func(G_OBJECT(dialog->icon),
-                                         G_CALLBACK(xfce_volstatus_dialog_volume_added),
+                                         G_CALLBACK(xfce_volstatus_dialog_drive_added),
                                          dialog);
     g_signal_handlers_disconnect_by_func(G_OBJECT(dialog->icon),
-                                         G_CALLBACK(xfce_volstatus_dialog_volume_removed),
+                                         G_CALLBACK(xfce_volstatus_dialog_drive_removed),
                                          dialog);
     
     G_OBJECT_CLASS(xfce_volstatus_dialog_parent_class)->finalize(obj);
@@ -105,82 +107,169 @@
 
 
 static const gchar *
-xfce_volstatus_volkind_to_string(ThunarVfsVolumeKind kind)
+xfce_volstatus_drive_type_to_string(LibHalDrive *drive)
 {
-    switch(kind) {
-        case THUNAR_VFS_VOLUME_KIND_CDROM:
-            return _("Data CD");
-        case THUNAR_VFS_VOLUME_KIND_CDR:
-            return _("Recordable CD");
-        case THUNAR_VFS_VOLUME_KIND_CDRW:
-            return _("Rewritable CD");
-        case THUNAR_VFS_VOLUME_KIND_DVDROM:
-            return _("Data or Video DVD");
-        case THUNAR_VFS_VOLUME_KIND_DVDRAM:
-            return _("Rewritable DVD (DVD-RAM)");
-        case THUNAR_VFS_VOLUME_KIND_DVDR:
-        case THUNAR_VFS_VOLUME_KIND_DVDPLUSR:
-            return _("Recordable DVD");
-        case THUNAR_VFS_VOLUME_KIND_DVDRW:
-        case THUNAR_VFS_VOLUME_KIND_DVDPLUSRW:
-            return _("Rewritable DVD");
-        case THUNAR_VFS_VOLUME_KIND_FLOPPY:
+    LibHalDriveType drive_type = libhal_drive_get_type(drive);
+    
+    switch(drive_type) {
+        case LIBHAL_DRIVE_TYPE_CDROM:
+            {
+                LibHalContext *hal_ctx = xfce_volstatus_get_hal_context();
+                char **volume_udis = NULL;
+                int num_volumes = 0;
+                LibHalVolume *volume = NULL;
+                LibHalVolumeDiscType disc_type;
+                const gchar *type_str = NULL;
+                
+                volume_udis = libhal_drive_find_all_volumes(hal_ctx,
+                                                            drive,
+                                                            &num_volumes);
+                if(G_UNLIKELY(!volume_udis))
+                    goto cdrom_type_out;
+                
+                /* maybe it's a multi-disc changer, perhaps, so it might have
+                 * different things in it */
+                if(G_UNLIKELY(num_volumes != 1))
+                    goto cdrom_type_out;
+                
+                volume = libhal_volume_from_udi(hal_ctx, volume_udis[0]);
+                if(G_UNLIKELY(!volume))
+                    goto cdrom_type_out;
+                
+                if(libhal_volume_disc_has_audio(volume))
+                    type_str =  _("Audio CD");
+                else {
+                    disc_type = libhal_volume_get_disc_type(volume);
+                    switch(disc_type) {
+                        case LIBHAL_VOLUME_DISC_TYPE_CDROM:
+                            goto cdrom_type_out;
+                        case LIBHAL_VOLUME_DISC_TYPE_CDR:
+                            type_str = _("Recordable CD");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_CDRW:
+                            type_str = _("Rewritable CD");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_DVDROM:
+                            type_str = _("DVD");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_DVDRAM:
+                            type_str =  _("Rewritable DVD (DVD-RAM)");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_DVDR:
+                        case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR:
+                        case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR_DL:
+                            type_str = _("Recordable DVD");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_DVDRW:
+                        case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSRW:
+                            type_str = _("Rewritable DVD");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_BDROM:
+                            type_str = _("Blu-ray Disc");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_BDR:
+                            type_str = _("Recordable Blu-ray Disc");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_BDRE:
+                            type_str = _("Rewritable Blu-ray Disc");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_HDDVDROM:
+                            type_str = _("HD-DVD");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_HDDVDR:
+                            type_str = _("Recordable HD-DVD");
+                            break;
+                        case LIBHAL_VOLUME_DISC_TYPE_HDDVDRW:
+                            type_str = _("Rewritable HD-DVD");
+                            break;
+                        default:
+                            type_str = _("Data CD");
+                    }
+                }
+                
+cdrom_type_out:
+                if(volume)
+                    libhal_volume_free(volume);
+                if(volume_udis)
+                    libhal_free_string_array(volume_udis);
+                
+                if(G_UNLIKELY(!type_str))
+                    type_str =  _("Optical Drive");
+                
+                return type_str;
+            }
+            break;
+        case LIBHAL_DRIVE_TYPE_FLOPPY:
             return _("Floppy Disk");
-        case THUNAR_VFS_VOLUME_KIND_HARDDISK:
+        case LIBHAL_DRIVE_TYPE_REMOVABLE_DISK:
+        case LIBHAL_DRIVE_TYPE_DISK:
             return _("Hard Disk");
-        case THUNAR_VFS_VOLUME_KIND_USBSTICK:
-            return _("USB Flash Disk");
-        case THUNAR_VFS_VOLUME_KIND_AUDIO_PLAYER:
+        case LIBHAL_DRIVE_TYPE_COMPACT_FLASH:
+        case LIBHAL_DRIVE_TYPE_FLASHKEY:
+            return _("Flash Disk");
+        case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
             return _("Audio Player");
-        case THUNAR_VFS_VOLUME_KIND_AUDIO_CD:
-            return _("Audio CD");
-        case THUNAR_VFS_VOLUME_KIND_MEMORY_CARD:
-            return _("Memory Card");
-        case THUNAR_VFS_VOLUME_KIND_REMOVABLE_DISK:
-            return _("Disk");
-        case THUNAR_VFS_VOLUME_KIND_UNKNOWN:
+        case LIBHAL_DRIVE_TYPE_MEMORY_STICK:
+            return _("Memory Stick");
+        case LIBHAL_DRIVE_TYPE_SMART_MEDIA:
+            return _("Smart Media Disk");
+        case LIBHAL_DRIVE_TYPE_SD_MMC:
+            return _("SD/MMC Disk");
+        case LIBHAL_DRIVE_TYPE_CAMERA:
+            return _("Camera");
+        case LIBHAL_DRIVE_TYPE_ZIP:
+            return _("Zip Disk");
+        case LIBHAL_DRIVE_TYPE_JAZ:
+            return _("Jaz Disk");
         default:
             return _("Unknown");
     }
 }
 
 static void
-xfce_volstatus_dialog_volume_added(XfceVolstatusIcon *icon,
-                                   ThunarVfsVolume *volume,
-                                   gpointer user_data)
+xfce_volstatus_dialog_drive_added(XfceVolstatusIcon *icon,
+                                  LibHalDrive *drive,
+                                  gpointer user_data)
 {
+    LibHalContext *hal_ctx = xfce_volstatus_get_hal_context();
     XfceVolstatusDialog *dialog = XFCE_VOLSTATUS_DIALOG(user_data);
-    GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
-    const gchar *icon_name;
+    GList *icon_list, *l;
+    gchar *name;
     gint w, h;
     GdkPixbuf *pix = NULL;
     GtkTreeIter iter;
     
-    icon_name = thunar_vfs_volume_lookup_icon_name(volume, icon_theme);
-    if(icon_name) {
+    icon_list = exo_hal_drive_compute_icon_list(hal_ctx, drive);
+    if(icon_list) {
         gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &w, &h);
-        pix = xfce_themed_icon_load(icon_name, w);
+        for(l = icon_list; !pix && l; l = l->next)
+            pix = xfce_themed_icon_load((const gchar *)l->data, w);
+        g_list_foreach(icon_list, (GFunc)g_free, NULL);
+        g_list_free(icon_list);
     }
     
+    name = exo_hal_drive_compute_display_name(hal_ctx, drive);
+    
     gtk_list_store_append(dialog->ls, &iter);
     gtk_list_store_set(dialog->ls, &iter,
                        COL_PIXBUF, pix,
-                       COL_NAME, thunar_vfs_volume_get_name(volume),
-                       COL_VOLUME, volume,
+                       COL_NAME, name,
+                       COL_DRIVE, drive,
                        -1);
     
+    g_free(name);
     if(pix)
         g_object_unref(G_OBJECT(pix));
 }
 
 static void
-xfce_volstatus_dialog_volume_removed(XfceVolstatusIcon *icon,
-                                     ThunarVfsVolume *volume,
-                                     gpointer user_data)
+xfce_volstatus_dialog_drive_removed(XfceVolstatusIcon *icon,
+                                    LibHalDrive *drive,
+                                    gpointer user_data)
 {
     XfceVolstatusDialog *dialog = XFCE_VOLSTATUS_DIALOG(user_data);
     GtkTreeIter iter;
-    ThunarVfsVolume *a_volume;
+    LibHalDrive *a_drive;
     
     /* FIXME: this is pretty inefficient */
     
@@ -189,14 +278,12 @@
     
     do {
         gtk_tree_model_get(GTK_TREE_MODEL(dialog->ls), &iter,
-                           COL_VOLUME, &a_volume,
+                           COL_DRIVE, &a_drive,
                            -1);
-        if(a_volume == volume) {
+        if(a_drive == drive) {
             gtk_list_store_remove(dialog->ls, &iter);
-            g_object_unref(G_OBJECT(volume));
             break;
         }
-        g_object_unref(G_OBJECT(volume));
     } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(dialog->ls), &iter));
 }
 
@@ -207,20 +294,19 @@
     XfceVolstatusDialog *dialog = XFCE_VOLSTATUS_DIALOG(user_data);
     GtkTreeSelection *sel;
     GtkTreeIter iter;
-    ThunarVfsVolume *volume = NULL;
+    LibHalDrive *drive = NULL;
     
     sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
     if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
         return;
     
     gtk_tree_model_get(GTK_TREE_MODEL(dialog->ls), &iter,
-                       COL_VOLUME, &volume,
+                       COL_DRIVE, &drive,
                        -1);
-    if(!volume)
+    if(!drive)
         return;
     
-    xfce_volstatus_remove_volume(volume);
-    g_object_unref(G_OBJECT(volume));
+    xfce_volstatus_remove_drive(xfce_volstatus_get_hal_context(), drive);
 }
 
 static void
@@ -229,7 +315,7 @@
 {
     XfceVolstatusDialog *dialog = XFCE_VOLSTATUS_DIALOG(user_data);
     GtkTreeIter iter;
-    ThunarVfsVolume *volume = NULL;
+    LibHalDrive *drive = NULL;
     
     if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) {
         gtk_label_set_text(GTK_LABEL(dialog->name_lbl), "");
@@ -237,28 +323,27 @@
         gtk_label_set_text(GTK_LABEL(dialog->mntpt_lbl), "");
         gtk_widget_set_sensitive(dialog->remove_btn, FALSE);
     } else {
-        ThunarVfsPath *path;
+        /*LibHalContext *hal_ctx = xfce_volstatus_get_hal_context();*/
+        gchar *name, *mount_point;
+        const gchar *type;
         
         gtk_tree_model_get(GTK_TREE_MODEL(dialog->ls), &iter,
-                           COL_VOLUME, &volume,
+                           COL_NAME, &name,
+                           COL_DRIVE, &drive,
                            -1);
         
-        gtk_label_set_text(GTK_LABEL(dialog->name_lbl),
-                                     thunar_vfs_volume_get_name(volume));
-        gtk_label_set_text(GTK_LABEL(dialog->kind_lbl),
-                           xfce_volstatus_volkind_to_string(thunar_vfs_volume_get_kind(volume)));
+        type = xfce_volstatus_drive_type_to_string(drive);
+        /* FIXME: only useful for volumes */
+        mount_point = NULL;
         
-        path = thunar_vfs_volume_get_mount_point(volume);
-        if(path) {
-            gchar *path_str = thunar_vfs_path_dup_string(path);
-            gtk_label_set_text(GTK_LABEL(dialog->mntpt_lbl), path_str);
-            g_free(path_str);
-        } else
-            gtk_label_set_text(GTK_LABEL(dialog->mntpt_lbl), "");
-        
+        gtk_label_set_text(GTK_LABEL(dialog->name_lbl), name);
+        gtk_label_set_text(GTK_LABEL(dialog->kind_lbl), type);
+        gtk_label_set_text(GTK_LABEL(dialog->mntpt_lbl), _("n/a"));
+
         gtk_widget_set_sensitive(dialog->remove_btn, TRUE);
         
-        g_object_unref(G_OBJECT(volume));
+        g_free(name);
+        g_free(mount_point);
     }
 }
 
@@ -288,8 +373,7 @@
     gtk_widget_show(sw);
     gtk_box_pack_start(GTK_BOX(topvbox), sw, TRUE, TRUE, 0);
     
-    ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING,
-                            THUNAR_VFS_TYPE_VOLUME);
+    ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER);
     treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls));
     g_object_unref(G_OBJECT(ls));
     gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
@@ -390,14 +474,14 @@
     dialog->icon = icon;
     xfce_volstatus_dialog_create(dialog);
     
-    volumes = xfce_volstatus_icon_list_volumes(dialog->icon);
+    volumes = xfce_volstatus_icon_list_drives(dialog->icon);
     for(l = volumes; l; l = l->next)
-        xfce_volstatus_dialog_volume_added(icon, l->data, dialog);
+        xfce_volstatus_dialog_drive_added(icon, l->data, dialog);
     
     g_signal_connect(G_OBJECT(icon), "volume-added",
-                     G_CALLBACK(xfce_volstatus_dialog_volume_added), dialog);
+                     G_CALLBACK(xfce_volstatus_dialog_drive_added), dialog);
     g_signal_connect(G_OBJECT(icon), "volume-removed",
-                     G_CALLBACK(xfce_volstatus_dialog_volume_removed), dialog);
+                     G_CALLBACK(xfce_volstatus_dialog_drive_removed), dialog);
     
     return GTK_WIDGET(dialog);
 }

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 01:27:22 UTC (rev 2488)
+++ xfce4-volstatus-icon/branches/hal-drive/xfce4-volstatus-icon/xfce-volstatus-icon.c	2007-02-07 08:28:15 UTC (rev 2489)
@@ -156,6 +156,7 @@
 {
     XfceVolstatusIcon *icon = XFCE_VOLSTATUS_ICON(status_icon);
     GtkWidget *menu, *mi;
+    LibHalContext *hal_ctx = xfce_volstatus_get_hal_context();
     
     menu = gtk_menu_new();
 #if GTK_CHECK_VERSION(2, 12, 0)
@@ -220,7 +221,7 @@
                                    gpointer user_data)
 {
     LibHalDrive *drive = g_object_get_data(G_OBJECT(mi), "libhal-drive");
-    xfce_volstatus_remove_drive(drive);
+    xfce_volstatus_remove_drive(xfce_volstatus_get_hal_context(), drive);
 }
 
 
@@ -252,7 +253,7 @@
 {
     g_return_if_fail(XFCE_IS_VOLSTATUS_ICON(icon) && drive);
     
-    if(g_list_find(icon->drive, drive))
+    if(g_list_find(icon->drives, drive))
         return;
     
     if(!icon->drives)
@@ -276,7 +277,7 @@
     
     g_signal_emit(G_OBJECT(icon), xvsi_signals[SIG_DRIVE_REMOVED], 0, drive);
     
-    if(!icon->drive)
+    if(!icon->drives)
         gtk_status_icon_set_visible(GTK_STATUS_ICON(icon), FALSE);
 }
 




More information about the Goodies-commits mailing list