[Xfce4-commits] <thunar:jannis/port-to-udev> Also react on undev change events.

Jannis Pohlmann noreply at xfce.org
Mon Mar 1 11:54:04 CET 2010


Updating branch refs/heads/jannis/port-to-udev
         to 2edd604ede98a574c8e484e1b721a5a9563e5c42 (commit)
       from 84dd4e0edacc46a45e4441cdcd42554a61e362c8 (commit)

commit 2edd604ede98a574c8e484e1b721a5a9563e5c42
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Thu Jan 28 19:56:19 2010 +0100

    Also react on undev change events.

 thunar/thunar-application.c |   71 +------------------------------------------
 1 files changed, 1 insertions(+), 70 deletions(-)

diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index b3709bc..32b6a83 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -103,11 +103,6 @@ static void           thunar_application_uevent                 (GUdevClient
                                                                  const gchar            *action,
                                                                  GUdevDevice            *device,
                                                                  ThunarApplication      *application);
-#if 0
-static void           thunar_application_drive_eject            (GVolumeMonitor         *volume_monitor,
-                                                                 GDrive                 *drive,
-                                                                 ThunarApplication      *application);
-#endif
 static gboolean       thunar_application_volman_idle            (gpointer                user_data);
 static void           thunar_application_volman_idle_destroy    (gpointer                user_data);
 static void           thunar_application_volman_watch           (GPid                    pid,
@@ -220,14 +215,6 @@ thunar_application_init (ThunarApplication *application)
     }
 
 #ifdef HAVE_GUDEV
-#if 0
-  /* connect to the volume manager */
-  application->volume_monitor = g_volume_monitor_get ();
-
-  /* connect the volume manager support callbacks (used to spawn thunar-volman appropriately) */
-  g_signal_connect (application->volume_monitor, "drive-eject-button", G_CALLBACK (thunar_application_drive_eject), application);
-#endif
-
   /* establish connection with udev */
   application->udev_client = g_udev_client_new (subsystems);
 
@@ -272,11 +259,6 @@ thunar_application_finalize (GObject *object)
   g_slist_foreach (application->volman_udis, (GFunc) g_free, NULL);
   g_slist_free (application->volman_udis);
 
-#if 0
-  /* disconnect from the volume monitor */
-  g_object_unref (application->volume_monitor);
-#endif
-
   /* disconnect from the udev client */
   g_object_unref (application->udev_client);
 #endif
@@ -512,7 +494,7 @@ thunar_application_uevent (GUdevClient       *client,
   sysfs_path = g_udev_device_get_sysfs_path (device);
 
   /* distinguish between "add" and "remove" actions, ignore "change" and "move" */
-  if (g_strcmp0 (action, "add") == 0)
+  if (g_strcmp0 (action, "add") == 0 || g_strcmp0 (action, "change") == 0)
     {
       /* only insert the path if we don't have it already */
       if (g_slist_find_custom (application->volman_udis, sysfs_path, 
@@ -551,57 +533,6 @@ thunar_application_uevent (GUdevClient       *client,
 
 
 
-#if 0
-static void
-thunar_application_drive_eject (GVolumeMonitor    *volume_monitor,
-                                GDrive            *drive,
-                                ThunarApplication *application)
-{
-  GdkScreen *screen;
-  GError    *err = NULL;
-  gchar     *argv[4];
-  gchar     *udi;
-
-  _thunar_return_if_fail (G_IS_VOLUME_MONITOR (volume_monitor));
-  _thunar_return_if_fail (application->volume_monitor == volume_monitor);
-  _thunar_return_if_fail (G_IS_DRIVE (drive));
-  _thunar_return_if_fail (THUNAR_IS_APPLICATION (application));
-
-  /* determine the HAL UDI for this device */
-  udi = g_drive_get_identifier (drive, G_VOLUME_IDENTIFIER_KIND_HAL_UDI);
-
-  /* check if we have a UDI */
-  if (G_LIKELY (udi != NULL))
-    {
-      /* generate the argument list for exo-eject */
-      argv[0] = (gchar *) "exo-eject";
-      argv[1] = (gchar *) "-h";
-      argv[2] = (gchar *) udi;
-      argv[3] = NULL;
-
-      /* locate the currently active screen (the one with the pointer) */
-      screen = xfce_gdk_screen_get_active (NULL);
-
-      /* try to spawn the volume_monitor on the active screen */
-      if (!gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &err))
-        {
-          /* failed to launch exo-eject, inform the user about this */
-          thunar_dialogs_show_error (screen, err, _("Failed to execute \"%s\""), "exo-eject");
-          g_error_free (err);
-        }
-      else
-        {
-          /* we most probably removed the device */
-          thunar_application_drive_disconnected (volume_monitor, drive, application);
-        }
-
-      g_free (udi);
-    }
-}
-#endif
-
-
-
 static gboolean
 thunar_application_volman_idle (gpointer user_data)
 {



More information about the Xfce4-commits mailing list