Magellan Linux

Contents of /trunk/control-center/patches/control-center-2.12.3-path-fix.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (show annotations) (download)
Tue May 8 20:06:05 2007 UTC (17 years ago) by niro
File size: 6600 byte(s)
-import

1 diff -Naur control-center-2.12.3/capplets/theme-switcher/gnome-theme-installer.c control-center-2.12.3_fixed/capplets/theme-switcher/gnome-theme-installer.c
2 --- control-center-2.12.3/capplets/theme-switcher/gnome-theme-installer.c 2005-11-14 16:30:29.000000000 +0100
3 +++ control-center-2.12.3_fixed/capplets/theme-switcher/gnome-theme-installer.c 2006-02-25 17:55:13.000000000 +0100
4 @@ -139,19 +139,30 @@
5 transfer_done_targz_idle_cb (gpointer data)
6 {
7 int status;
8 - gchar *command, *filename;
9 + gchar *command, *filename, *gzip, *tar;
10 theme_properties *theme_props = data;
11
12 + if (!(gzip = g_find_program_in_path("gzip"))) {
13 + return FALSE;
14 + }
15 + if (!(tar = g_find_program_in_path("tar"))) {
16 + g_free(gzip);
17 + return FALSE;
18 + }
19 /* this should be something more clever and nonblocking */
20 filename = g_shell_quote(theme_props->filename);
21 - command = g_strdup_printf ("sh -c 'cd \"%s\"; /bin/gzip -d -c < \"%s\" | /bin/tar xf - '",
22 - theme_props->target_tmp_dir, filename);
23 + command = g_strdup_printf ("sh -c 'cd \"%s\"; %s -d -c < \"%s\" | %s xf - '",
24 + theme_props->target_tmp_dir, gzip, filename, tar);
25 g_free(filename);
26 if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0) {
27 g_free (command);
28 + g_free(gzip);
29 + g_free(tar);
30 return TRUE;
31 } else {
32 g_free (command);
33 + g_free(gzip);
34 + g_free(tar);
35 return FALSE;
36 }
37 }
38 @@ -171,18 +182,29 @@
39 transfer_done_tarbz2_idle_cb (gpointer data)
40 {
41 int status;
42 - gchar *command, *filename;
43 + gchar *command, *filename, *bzip2, *tar;
44 theme_properties *theme_props = data;
45
46 + if (!(bzip2 = g_find_program_in_path("bzip2"))) {
47 + return FALSE;
48 + }
49 + if (!(tar = g_find_program_in_path("tar"))) {
50 + g_free(bzip2);
51 + return FALSE;
52 + }
53 filename = g_shell_quote(theme_props->filename);
54 /* this should be something more clever and nonblocking */
55 - command = g_strdup_printf ("sh -c 'cd \"%s\"; /usr/bin/bzip2 -d -c < \"%s\" | /bin/tar xf - '",
56 - theme_props->target_tmp_dir, filename);
57 + command = g_strdup_printf ("sh -c 'cd \"%s\"; %s -d -c < \"%s\" | %s xf - '",
58 + theme_props->target_tmp_dir, bzip2, filename, tar);
59 g_free (filename);
60 if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0) {
61 + g_free(bzip2);
62 + g_free(tar);
63 g_free (command);
64 return TRUE;
65 } else {
66 + g_free(bzip2);
67 + g_free(tar);
68 g_free (command);
69 return FALSE;
70 }
71 @@ -193,7 +215,7 @@
72 {
73 GtkWidget *dialog;
74 int len = strlen (path);
75 - gchar *command,**dir, *first_line, *filename;
76 + gchar *command,**dir, *first_line, *filename, *gzip, *bzip2, *tar;
77 int status,theme_type;
78 theme_properties *theme_props;
79 GnomeVFSURI *theme_source_dir, *theme_dest_dir;
80 @@ -206,17 +228,20 @@
81 g_get_home_dir(),
82 g_random_int());
83
84 + gzip = g_find_program_in_path("gzip");
85 + bzip2 = g_find_program_in_path("bzip2");
86 + tar = g_find_program_in_path("tar");
87
88 - if (path && len > 7 && ( (!strcmp (path + len - 7, ".tar.gz")) || (!strcmp (path + len - 4, ".tgz")) )) {
89 + if (tar && gzip && path && len > 7 && ( (!strcmp (path + len - 7, ".tar.gz")) || (!strcmp (path + len - 4, ".tgz")) )) {
90 filename = g_shell_quote (path);
91 - command = g_strdup_printf ("sh -c '/bin/gzip -d -c < \"%s\" | /bin/tar ft - | head -1'",
92 - filename);
93 + command = g_strdup_printf ("sh -c '%s -d -c < \"%s\" | %s ft - | head -1'",
94 + gzip, filename, tar);
95 theme_props->filetype=TARGZ;
96 g_free (filename);
97 - } else if (path && len > 8 && !strcmp (path + len - 8, ".tar.bz2")) {
98 + } else if (tar && bzip2 && path && len > 8 && !strcmp (path + len - 8, ".tar.bz2")) {
99 filename = g_shell_quote (path);
100 - command = g_strdup_printf ("sh -c '/usr/bin/bzip2 -d -c < \"%s\" | /bin/tar ft - | head -1'",
101 - filename);
102 + command = g_strdup_printf ("sh -c '%s -d -c < \"%s\" | %s ft - | head -1'",
103 + bzip2, filename, tar);
104 theme_props->filetype=TARBZ;
105 g_free (filename);
106 } else {
107 @@ -230,6 +255,9 @@
108 gnome_vfs_unlink(path);
109 g_free (theme_props->target_tmp_dir);
110 g_free (theme_props);
111 + g_free(gzip);
112 + g_free(bzip2);
113 + g_free(tar);
114 return;
115 }
116
117 @@ -245,6 +273,9 @@
118 g_free (command);
119 g_free (theme_props->target_tmp_dir);
120 g_free (theme_props);
121 + g_free(gzip);
122 + g_free(bzip2);
123 + g_free(tar);
124 return;
125 }
126
127 @@ -252,7 +283,7 @@
128 theme_props->filename=g_strdup(path);
129
130 if (theme_props->filetype == TARBZ ) {
131 - if (!g_file_test ("/usr/bin/bzip2", G_FILE_TEST_EXISTS)) {
132 + if (!bzip2) {
133 dialog = gtk_message_dialog_new (NULL,
134 GTK_DIALOG_MODAL,
135 GTK_MESSAGE_ERROR,
136 @@ -265,6 +296,9 @@
137 g_free (theme_props->target_tmp_dir);
138 g_free (theme_props->filename);
139 g_free (theme_props);
140 + g_free(gzip);
141 + g_free(bzip2);
142 + g_free(tar);
143 return;
144 }
145
146 @@ -286,7 +320,7 @@
147 }
148
149 if (theme_props->filetype == TARGZ ) {
150 - if (!g_file_test ("/bin/gzip", G_FILE_TEST_EXISTS)) {
151 + if (!gzip) {
152 dialog = gtk_message_dialog_new (NULL,
153 GTK_DIALOG_MODAL,
154 GTK_MESSAGE_ERROR,
155 @@ -299,6 +333,9 @@
156 g_free (theme_props->target_tmp_dir);
157 g_free (theme_props->filename);
158 g_free (theme_props);
159 + g_free(gzip);
160 + g_free(bzip2);
161 + g_free(tar);
162 return;
163 }
164 if (!transfer_done_targz_idle_cb(theme_props)) {
165 @@ -314,6 +351,9 @@
166 g_free (theme_props->filename);
167 g_free (theme_props);
168 g_free (command);
169 + g_free(gzip);
170 + g_free(bzip2);
171 + g_free(tar);
172 return;
173 }
174 }
175 @@ -351,6 +391,9 @@
176 g_free (theme_props->theme_tmp_dir);
177 g_free (theme_props);
178 g_free (command);
179 + g_free(gzip);
180 + g_free(bzip2);
181 + g_free(tar);
182 return;
183 } else {
184 dialog = gtk_message_dialog_new (NULL,
185 @@ -365,6 +408,9 @@
186 g_free (theme_props->theme_tmp_dir);
187 g_free (theme_props);
188 g_free (command);
189 + g_free(gzip);
190 + g_free(bzip2);
191 + g_free(tar);
192 return;
193 }
194 /* Move the Dir to the target dir */
195 @@ -391,6 +437,9 @@
196 g_free (theme_props->user_message);
197 g_free (theme_props);
198 g_free (command);
199 + g_free(gzip);
200 + g_free(bzip2);
201 + g_free(tar);
202 return;
203 } else {
204 dialog = gtk_message_dialog_new (NULL,
205 @@ -408,6 +457,9 @@
206 g_free (theme_props->user_message);
207 g_free (theme_props);
208 g_free (command);
209 + g_free(gzip);
210 + g_free(bzip2);
211 + g_free(tar);
212 return;
213 }
214
215 @@ -416,6 +468,9 @@
216 g_free (theme_props->target_tmp_dir);
217 g_free (theme_props->filename);
218 g_free (theme_props);
219 + g_free(gzip);
220 + g_free(bzip2);
221 + g_free(tar);
222 }
223
224 static void