Author: freetz                       Date: Thu Aug  4 18:22:38 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- misc fixes (thx ubuntu dudes)

---- Files affected:
SOURCES:
   gnome-volume-manager-automount_enabled_hint.patch (NONE -> 1.1)  (NEW), 
gnome-volume-manager-camera_detection.patch (NONE -> 1.1)  (NEW), 
gnome-volume-manager-fix_nonmountable_media.patch (NONE -> 1.1)  (NEW), 
gnome-volume-manager-mount_at_start.patch (NONE -> 1.1)  (NEW), 
gnome-volume-manager-reconnect_on_dbus_exit.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/gnome-volume-manager-automount_enabled_hint.patch
diff -u /dev/null SOURCES/gnome-volume-manager-automount_enabled_hint.patch:1.1
--- /dev/null   Thu Aug  4 20:22:38 2005
+++ SOURCES/gnome-volume-manager-automount_enabled_hint.patch   Thu Aug  4 
20:22:33 2005
@@ -0,0 +1,47 @@
+diff -ruN gnome-volume-manager-1.3.2-old/src/manager.c 
gnome-volume-manager-1.3.2/src/manager.c
+--- gnome-volume-manager-1.3.2-old/src/manager.c       2005-07-04 
16:51:55.233715000 +0200
++++ gnome-volume-manager-1.3.2/src/manager.c   2005-07-04 16:52:29.355527760 
+0200
+@@ -1134,6 +1134,31 @@
+       libhal_free_string (media_type);
+ }
+ 
++/** Return the value of storage.automount_enabled_hint. First check the given
++ * volume's parent (which is the drive), then the volume itself. Default to
++ * true if the property is not set on either node.
++ */
++static gboolean
++gvm_get_automount_enabled_hint (const char* udi)
++{
++    gchar *parent;
++    gboolean ret = TRUE;
++
++    parent = libhal_device_get_property_string(hal_ctx, udi, "info.parent", 
NULL);
++    if (libhal_device_property_exists (hal_ctx, parent,
++              "storage.automount_enabled_hint", NULL)) {
++      ret = libhal_device_get_property_bool (hal_ctx, parent,
++                  "storage.automount_enabled_hint", NULL);
++    }
++    if (libhal_device_property_exists (hal_ctx, udi,
++              "storage.automount_enabled_hint", NULL)) {
++      ret = libhal_device_get_property_bool (hal_ctx, udi,
++                  "storage.automount_enabled_hint", NULL);
++    }
++    libhal_free_string (parent);
++    return ret;
++}
++
+ /** Invoked when a device is added to the Global Device List. 
+  *
+  *  @param  ctx                 LibHal context
+@@ -1190,7 +1215,10 @@
+               
+ #ifndef ASSUME_SUBMOUNT
+               if (config.automount_drives && mountable) {
+-                      gvm_device_mount (udi, device, NULL);
++                      if (gvm_get_automount_enabled_hint (udi))
++                          gvm_device_mount (udi, device, NULL);
++                      else
++                          dbg("%s has storage.automount_enabled_hint == 
false, not mounting\n", udi);
+                       mounted_volumes_policy_queue = g_slist_append 
(mounted_volumes_policy_queue, g_strdup (udi));
+               }
+ #else

================================================================
Index: SOURCES/gnome-volume-manager-camera_detection.patch
diff -u /dev/null SOURCES/gnome-volume-manager-camera_detection.patch:1.1
--- /dev/null   Thu Aug  4 20:22:38 2005
+++ SOURCES/gnome-volume-manager-camera_detection.patch Thu Aug  4 20:22:33 2005
@@ -0,0 +1,25 @@
+diff -ruN gnome-volume-manager-1.3.2-old/src/manager.c 
gnome-volume-manager-1.3.2/src/manager.c
+--- gnome-volume-manager-1.3.2-old/src/manager.c       2005-07-29 
17:02:13.000000000 +0200
++++ gnome-volume-manager-1.3.2/src/manager.c   2005-07-29 17:02:13.000000000 
+0200
+@@ -614,15 +614,13 @@
+ static gboolean
+ gvm_udi_is_camera (const char *udi, gboolean check_libgphoto2)
+ {
+-      if (!libhal_device_query_capability (hal_ctx, udi, "camera", NULL))
+-              return FALSE;
+-      
+-      if (check_libgphoto2 && !libhal_device_get_property_bool (hal_ctx, udi, 
"camera.libgphoto2_support", NULL))
+-              return FALSE;
+-      
+-      dbg ("Camera detected: %s\n", udi);
++      if (libhal_device_query_capability (hal_ctx, udi, "camera", NULL) ||
++            (check_libgphoto2 && libhal_device_get_property_bool (hal_ctx, 
udi, "camera.libgphoto2_support", NULL))) {
++                dbg ("Camera detected: %s\n", udi);
++                return TRUE;
++        }
+       
+-      return TRUE;
++      return FALSE;
+ }
+ 
+ /*

================================================================
Index: SOURCES/gnome-volume-manager-fix_nonmountable_media.patch
diff -u /dev/null SOURCES/gnome-volume-manager-fix_nonmountable_media.patch:1.1
--- /dev/null   Thu Aug  4 20:22:38 2005
+++ SOURCES/gnome-volume-manager-fix_nonmountable_media.patch   Thu Aug  4 
20:22:33 2005
@@ -0,0 +1,12 @@
+diff -ruN gnome-volume-manager-1.3.2-old/src/manager.c 
gnome-volume-manager-1.3.2/src/manager.c
+--- gnome-volume-manager-1.3.2-old/src/manager.c       2005-06-30 
22:12:29.000000000 +0200
++++ gnome-volume-manager-1.3.2/src/manager.c   2005-07-04 17:11:08.779349472 
+0200
+@@ -1180,7 +1180,7 @@
+                * Does this device support removable media?  Note that we
+                * check storage_device and not our own UDI
+                */
+-              if (mountable && libhal_device_get_property_bool (hal_ctx, 
storage_device, "storage.removable", NULL)) {
++              if (libhal_device_get_property_bool (hal_ctx, storage_device, 
"storage.removable", NULL)) {
+                       /* we handle media change events separately */
+                       dbg ("Changed: %s\n", device);
+                       gvm_media_changed (udi, storage_device, device);

================================================================
Index: SOURCES/gnome-volume-manager-mount_at_start.patch
diff -u /dev/null SOURCES/gnome-volume-manager-mount_at_start.patch:1.1
--- /dev/null   Thu Aug  4 20:22:38 2005
+++ SOURCES/gnome-volume-manager-mount_at_start.patch   Thu Aug  4 20:22:33 2005
@@ -0,0 +1,24 @@
+diff -ruN gnome-volume-manager-1.3.2-old/src/manager.c 
gnome-volume-manager-1.3.2/src/manager.c
+--- gnome-volume-manager-1.3.2-old/src/manager.c       2005-07-04 
14:44:53.636373000 +0200
++++ gnome-volume-manager-1.3.2/src/manager.c   2005-07-04 14:49:45.811956536 
+0200
+@@ -1533,6 +1533,20 @@
+                       continue;
+               }
+               libhal_free_string (prop);
++ 
++              /* Check if configured policy disables mounting */
++                gboolean do_mount = TRUE;
++              gchar* drive_udi = libhal_device_get_property_string(ctx, udi, 
"info.parent", NULL);
++                if (libhal_device_property_exists(ctx, drive_udi, 
"storage.hotpluggable", NULL) &&
++                                libhal_device_get_property_bool(ctx, 
drive_udi, "storage.hotpluggable", NULL)) {
++                        do_mount = config.automount_drives;
++                } else if (
++                        libhal_device_property_exists(ctx, drive_udi, 
"storage.removable", NULL) &&
++                        libhal_device_get_property_bool(ctx, drive_udi, 
"storage.removable", NULL)) {
++                        do_mount = config.automount_media;
++                }
++                libhal_free_string(drive_udi);
++                if (!do_mount) continue;
+               
+               /* mount the device */
+               if (!(dev = libhal_device_get_property_string (ctx, udi, 
"block.device", &error))) {

================================================================
Index: SOURCES/gnome-volume-manager-reconnect_on_dbus_exit.patch
diff -u /dev/null SOURCES/gnome-volume-manager-reconnect_on_dbus_exit.patch:1.1
--- /dev/null   Thu Aug  4 20:22:38 2005
+++ SOURCES/gnome-volume-manager-reconnect_on_dbus_exit.patch   Thu Aug  4 
20:22:33 2005
@@ -0,0 +1,116 @@
+diff -ruN gnome-volume-manager-1.3.2-old/src/manager.c 
gnome-volume-manager-1.3.2/src/manager.c
+--- gnome-volume-manager-1.3.2-old/src/manager.c       2005-06-30 
22:12:29.000000000 +0200
++++ gnome-volume-manager-1.3.2/src/manager.c   2005-07-04 14:43:15.822243984 
+0200
+@@ -48,7 +48,8 @@
+ #define NAUTILUS_COMMAND       BIN_NAUTILUS" -n --no-desktop %m"
+ 
+ static struct gvm_configuration config;
+-static LibHalContext *hal_ctx;
++static LibHalContext *hal_ctx = NULL;
++static DBusConnection *dbus_connection = NULL;
+ 
+ #ifndef ASSUME_SUBMOUNT
+ /** List of UDI's for volumes mounted by g-v-m that we need to apply policy 
to*/
+@@ -1332,6 +1333,73 @@
+ {
+ }
+ 
++static LibHalContext * gvm_do_hal_init ();
++
++/** Invoked by gvm_do_filter_dbus_msg in response to a D-BUS disconnect event.
++ *
++ * @param  data                 Context pointer
++ * @return true if it should be tried again, false if success or failure.
++ */
++static gboolean
++gvm_reconnect_to_hal (gpointer data __attribute__((__unused__)))
++{
++       static unsigned int retries = 0;
++       DBusError error;
++
++       dbg ("Trying a reconnect ...\n");
++       hal_ctx = gvm_do_hal_init ();
++       if (hal_ctx != NULL) {
++               dbg ("Reconnected OK.\n");
++               retries = 0;
++               return FALSE;
++       } else if (dbus_connection){
++               /* shut down dbus connection to try it again */
++               dbus_connection_unref (dbus_connection);
++               dbus_connection = NULL;
++       }
++
++       /* Retry later if it failed. */
++       if (retries++ < 100)
++               return TRUE;
++
++       /* Too many retries; clean up and bail. */
++       warn("gvm_reconnect_to_hal: no reconnection after 100 retries, 
exiting\n");
++       libhal_ctx_shutdown (hal_ctx, &error);
++       libhal_ctx_free (hal_ctx);
++       hal_ctx = NULL;
++       gtk_main_quit ();
++       return FALSE;
++}
++
++/** Invoked by D-BUS to filter messages.
++ *
++ * @param  connection  D-BUS connection
++ * @param  message     D-BUS message
++ * @param  user_data   Context pointer
++ */
++static DBusHandlerResult
++gvm_do_filter_dbus_msg (DBusConnection *connection 
__attribute__((__unused__)),
++                        DBusMessage *message,
++                        void *user_data __attribute__((__unused__)))
++{
++       DBusError error;
++       
++       if (dbus_message_is_signal (message,
++                                   DBUS_INTERFACE_LOCAL,
++                                   "Disconnected")) {
++               dbg("gvm_do_filter_dbus_msg: received Disconnected message\n");
++               g_timeout_add(500, gvm_reconnect_to_hal, NULL);
++               libhal_ctx_shutdown (hal_ctx, &error);
++               libhal_ctx_free (hal_ctx);
++               hal_ctx = NULL;
++               dbus_connection_unref (dbus_connection);
++               dbus_connection = NULL;
++               return DBUS_HANDLER_RESULT_HANDLED;
++       }
++       else
++               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++}
++
+ /** Integrate a dbus mainloop. 
+  *
+  *  @param  ctx                 LibHal context
+@@ -1342,14 +1410,15 @@
+ static dbus_bool_t 
+ hal_mainloop_integration (LibHalContext *ctx, DBusError *error)
+ {
+-      DBusConnection *dbus_connection;
+-
+       dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, error);
+ 
+       if (dbus_error_is_set (error))
+               return FALSE;
++
++        dbus_connection_set_exit_on_disconnect (dbus_connection, FALSE);
+       
+         dbus_connection_setup_with_g_main (dbus_connection, NULL);
++        dbus_connection_add_filter (dbus_connection, gvm_do_filter_dbus_msg, 
NULL, NULL);
+ 
+       libhal_ctx_set_dbus_connection (ctx, dbus_connection);
+       
+@@ -1492,6 +1561,10 @@
+       DBusError error;
+       GSList *l;
+       
++        if (ctx == NULL) {
++            warn("unmount_all: No hal connection! can't unmount volumes\n");
++            return;
++        }
+       dbg ("unmounting all volumes that we saw mounted in our life\n");
+       dbus_error_init (&error);
+       for (l = all_mounted_volumes; l != NULL; l = g_slist_next (l)) {
================================================================
_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to