[Goodies-commits] r5365 - xfburn/trunk/xfburn
David Mohr
squisher at xfce.org
Sun Sep 7 22:04:17 CEST 2008
Author: squisher
Date: 2008-09-07 20:04:17 +0000 (Sun, 07 Sep 2008)
New Revision: 5365
Modified:
xfburn/trunk/xfburn/xfburn-device-box.c
xfburn/trunk/xfburn/xfburn-hal-manager.c
Log:
Invoke voodoo magic of thunar_vfs_volume_manager, since otherwise the hal callbacks don't get invoked
Modified: xfburn/trunk/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-box.c 2008-09-07 19:12:25 UTC (rev 5364)
+++ xfburn/trunk/xfburn/xfburn-device-box.c 2008-09-07 20:04:17 UTC (rev 5365)
@@ -96,9 +96,6 @@
GtkWidget *combo_mode;
gboolean have_asked_for_blanking;
-#ifdef HAVE_THUNAR_VFS
- ThunarVfsVolumeManager *thunar_volman;
-#endif
#ifdef HAVE_HAL
gulong volume_changed_handlerid;
@@ -319,17 +316,6 @@
#ifdef HAVE_HAL
priv->volume_changed_handlerid = g_signal_connect (G_OBJECT (xfburn_hal_manager_get_instance ()), "volume-changed", G_CALLBACK (cb_volumes_changed), box);
#endif
-#ifdef HAVE_THUNAR_VFS
- /*
- priv->thunar_volman = thunar_vfs_volume_manager_get_default ();
- if (priv->thunar_volman != NULL) {
- //g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-added", G_CALLBACK (cb_volumes_changed), box);
- //g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-removed", G_CALLBACK (cb_volumes_changed), box);
- } else {
- g_warning ("Error trying to access the thunar-vfs-volume-manager!");
- }
- */
-#endif
priv->have_asked_for_blanking = FALSE;
}
@@ -339,12 +325,7 @@
{
#ifdef HAVE_HAL
XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (object);
-#endif
-#ifdef HAVE_THUNAR_VFS
- //g_object_unref (priv->thunar_volman);
-#endif
-#ifdef HAVE_HAL
//g_object_unref (priv->hal_manager);
g_signal_handler_disconnect (xfburn_hal_manager_get_instance (), priv->volume_changed_handlerid);
#endif
@@ -840,10 +821,6 @@
}
#endif
-#ifdef HAVE_THUNAR_VFS
-//(ThunarVfsVolumeManager *volman, gpointer volumes, XfburnDeviceBox *box)
-#endif
-
static void
refresh (GtkWidget *widget)
{
Modified: xfburn/trunk/xfburn/xfburn-hal-manager.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-hal-manager.c 2008-09-07 19:12:25 UTC (rev 5364)
+++ xfburn/trunk/xfburn/xfburn-hal-manager.c 2008-09-07 20:04:17 UTC (rev 5365)
@@ -65,6 +65,10 @@
LibHalContext *hal_context;
DBusConnection *dbus_connection;
gchar *error;
+
+#ifdef HAVE_THUNAR_VFS
+ ThunarVfsVolumeManager *thunar_volman;
+#endif
} XfburnHalManagerPrivate;
static XfburnHalManager *halman = NULL;
@@ -167,13 +171,33 @@
}
dbus_error_free (&derror);
} else {
- libhal_ctx_set_device_added (hal_context, cb_device_added);
- libhal_ctx_set_device_removed (hal_context, cb_device_removed);
- libhal_ctx_set_device_property_modified (hal_context, cb_prop_modified);
+ if (!libhal_ctx_set_device_added (hal_context, cb_device_added))
+ g_warning ("Could not setup HAL callback for device_added");
+
+ if (!libhal_ctx_set_device_removed (hal_context, cb_device_removed))
+ g_warning ("Could not setup HAL callback for device_removed");
+
+ if (!libhal_ctx_set_device_property_modified (hal_context, cb_prop_modified))
+ g_warning ("Could not setup HAL callback for prop_modified");
}
priv->hal_context = hal_context;
priv->dbus_connection = dbus_connection;
+
+#ifdef HAVE_THUNAR_VFS
+ /* FIXME: for some weird reason the hal callbacks don't actually work,
+ * unless we also fetch an instance of thunar_vfs_volman. Why??
+ * Not terrible though, because we'll need to use it eventually anyways */
+ priv->thunar_volman = thunar_vfs_volume_manager_get_default ();
+ if (priv->thunar_volman != NULL) {
+ //g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-added", G_CALLBACK (cb_volumes_changed), box);
+ //g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-removed", G_CALLBACK (cb_volumes_changed), box);
+ } else {
+ g_warning ("Error trying to access the thunar-vfs-volume-manager!");
+ }
+ /*
+ */
+#endif
}
static void
@@ -181,6 +205,10 @@
{
XfburnHalManagerPrivate *priv = XFBURN_HAL_MANAGER_GET_PRIVATE (object);
+#ifdef HAVE_THUNAR_VFS
+ g_object_unref (priv->thunar_volman);
+#endif
+
hal_finalize (priv->hal_context);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -219,10 +247,10 @@
static void cb_prop_modified (LibHalContext *ctx, const char *udi,
const char *key, dbus_bool_t is_removed, dbus_bool_t is_added)
{
- DBG ("HAL: property modified");
/* Lets ignore this for now,
* way too many of these get triggered when a disc is
* inserted or removed!
+ DBG ("HAL: property modified");
g_signal_emit (halman, signals[VOLUME_CHANGED], 0);
*/
}
@@ -462,7 +490,6 @@
#ifdef HAVE_THUNAR_VFS
const char *mp;
ThunarVfsInfo *th_info;
- ThunarVfsVolumeManager *th_volman;
ThunarVfsVolume *th_vol;
ThunarVfsPath *th_path;
#endif
@@ -495,18 +522,15 @@
return FALSE;
}
- th_volman = thunar_vfs_volume_manager_get_default ();
- th_vol = thunar_vfs_volume_manager_get_volume_by_info (th_volman, th_info);
+ th_vol = thunar_vfs_volume_manager_get_volume_by_info (priv->thunar_volman, th_info);
thunar_vfs_info_unref (th_info);
if (!th_vol) {
g_warning ("Error getting thunar volume for %s!", mp);
- g_object_unref (th_volman);
return FALSE;
}
if (!thunar_vfs_volume_is_mounted (th_vol)) {
- g_object_unref (th_volman);
return FALSE;
}
@@ -519,7 +543,6 @@
DBG ("Failed to unmount %s", mp);
}
- g_object_unref (th_volman);
#endif
return unmounted;
}
More information about the Goodies-commits
mailing list