~ubuntu-core-dev/gnome-volume-manager/ubuntu

« back to all changes in this revision

Viewing changes to debian/patches/03_no_gnome_mount.patch

  • Committer: martin at piware
  • Date: 2006-06-09 16:44:15 UTC
  • Revision ID: martin@piware.de-20060609164415-c5ca39c8c77c42c2
initial import of final dapper version (1.5.15-0ubuntu10)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c gnome-volume-manager-1.5.15/src/manager.c
 
2
--- gnome-volume-manager-1.5.15-old/src/manager.c       2006-04-27 16:14:23.000000000 +0200
 
3
+++ gnome-volume-manager-1.5.15/src/manager.c   2006-04-27 16:16:10.000000000 +0200
 
4
@@ -1717,10 +1717,7 @@
 
5
        
 
6
        dbg ("mounting %s...\n", udi);
 
7
        
 
8
-       if (!gnome_mount || access (gnome_mount, F_OK | R_OK | X_OK) != 0) {
 
9
-               g_free (gnome_mount);
 
10
-               gnome_mount = g_find_program_in_path ("gnome-mount");
 
11
-       }
 
12
+       gnome_mount = g_find_program_in_path ("pmount-hal");
 
13
        
 
14
        if (gnome_mount != NULL) {
 
15
                gboolean retval;
 
16
@@ -1732,16 +1729,14 @@
 
17
                
 
18
                g_hash_table_insert (mount_table, policy->udi, policy);
 
19
                
 
20
-               if (!interactive) {
 
21
-                       command = g_strdup_printf ("%s --no-ui --hal-udi=%%h", gnome_mount);
 
22
-               } else {
 
23
-                       command = g_strdup_printf ("%s --hal-udi=%%h", gnome_mount);
 
24
-               }
 
25
-               
 
26
-               retval = gvm_run_command (command, udi, NULL, NULL);
 
27
-               g_free (command);
 
28
-               
 
29
-               if (!retval) {
 
30
+                char* argv[] = { gnome_mount, udi, NULL };
 
31
+                gint exit_status;
 
32
+
 
33
+                if (!g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL,
 
34
+                            &exit_status, NULL) || 
 
35
+                        !WIFEXITED(exit_status) || WEXITSTATUS (exit_status)) {
 
36
+                        dbg ("executing %s %s failed with status %i\n",
 
37
+                                gnome_mount, udi, exit_status); 
 
38
                        g_hash_table_remove (mount_table, policy->udi);
 
39
                        g_free (policy->udi);
 
40
                        g_free (policy);
 
41
@@ -1878,14 +1873,21 @@
 
42
        
 
43
        dbg ("unmounting %s...\n", udi);
 
44
        
 
45
-       if (!gnome_mount || access (gnome_mount, F_OK | R_OK | X_OK) != 0) {
 
46
-               g_free (gnome_mount);
 
47
-               gnome_mount = g_find_program_in_path ("gnome-mount");
 
48
-       }
 
49
+       gnome_mount = g_find_program_in_path ("pumount");
 
50
        
 
51
        if (gnome_mount != NULL) {
 
52
-               command = g_strdup_printf ("%s --unmount --hal-udi=%%h", gnome_mount);
 
53
-               retval = gvm_run_command (command, udi, NULL, NULL);
 
54
+               command = g_strdup_printf ("%s %%d", gnome_mount);
 
55
+
 
56
+                const char* device = NULL;
 
57
+                dbus_error_init (&error);
 
58
+                if (!(device = libhal_device_get_property_string (hal_ctx, udi, "block.device", &error))) {
 
59
+                        warn ("cannot get block.device: %s\n", error.message);
 
60
+                        if (dbus_error_is_set (&error))
 
61
+                                dbus_error_free (&error);
 
62
+                        return FALSE;
 
63
+                }
 
64
+
 
65
+               retval = gvm_run_command (command, udi, device, NULL);
 
66
                g_free (command);
 
67
                
 
68
                return retval;
 
69
@@ -2597,14 +2599,21 @@
 
70
        
 
71
        dbg ("ejecting %s...\n", volume);
 
72
        
 
73
-       if (!gnome_mount || access (gnome_mount, F_OK | R_OK | X_OK) != 0) {
 
74
-               g_free (gnome_mount);
 
75
-               gnome_mount = g_find_program_in_path ("gnome-mount");
 
76
-       }
 
77
+       gnome_mount = g_find_program_in_path ("eject");
 
78
        
 
79
        if (gnome_mount != NULL) {
 
80
-               command = g_strdup_printf ("%s --eject --hal-udi=%%h", gnome_mount);
 
81
-               gvm_run_command (command, volume, NULL, NULL);
 
82
+               command = g_strdup_printf ("%s %%d", gnome_mount);
 
83
+
 
84
+                const char* device = NULL;
 
85
+                dbus_error_init (&error);
 
86
+                if (!(device = libhal_device_get_property_string (hal_ctx, udi, "block.device", &error))) {
 
87
+                        warn ("cannot get block.device: %s\n", error.message);
 
88
+                        if (dbus_error_is_set (&error))
 
89
+                                dbus_error_free (&error);
 
90
+                        return FALSE;
 
91
+                }
 
92
+
 
93
+               gvm_run_command (command, volume, device, NULL);
 
94
                g_free (command);
 
95
        } else {
 
96
                if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", volume,