Magellan Linux

Contents of /trunk/control-center/patches/control-center-2.14.1-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, 5 months ago) by niro
File size: 6675 byte(s)
-import

1 --- control-center-2.14.1/capplets/theme-switcher/gnome-theme-installer.c.orig 2006-04-16 16:41:35.000000000 +0200
2 +++ control-center-2.14.1/capplets/theme-switcher/gnome-theme-installer.c 2006-04-16 17:29:05.000000000 +0200
3 @@ -139,19 +139,31 @@
4 transfer_done_targz_idle_cb (gpointer data)
5 {
6 int status;
7 - gchar *command, *filename;
8 + gchar *command, *filename, *gzip, *tar;
9 theme_properties *theme_props = data;
10 +
11 + if (!(gzip = g_find_program_in_path("gzip"))) {
12 + return FALSE;
13 + }
14 + if (!(tar = g_find_program_in_path("tar"))) {
15 + g_free(gzip);
16 + return FALSE;
17 + }
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,19 +183,31 @@
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
54 filename = g_shell_quote(theme_props->filename);
55 /* this should be something more clever and nonblocking */
56 - command = g_strdup_printf ("sh -c 'cd \"%s\"; /usr/bin/bzip2 -d -c < \"%s\" | /bin/tar xf - '",
57 - theme_props->target_tmp_dir, filename);
58 + command = g_strdup_printf ("sh -c 'cd \"%s\"; %s -d -c < \"%s\" | %s xf - '",
59 + theme_props->target_tmp_dir, bzip2, filename, tar);
60 g_free (filename);
61 if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0) {
62 g_free (command);
63 + g_free(bzip2);
64 + g_free(tar);
65 return TRUE;
66 } else {
67 g_free (command);
68 + g_free(bzip2);
69 + g_free(tar);
70 return FALSE;
71 }
72 }
73 @@ -193,7 +217,7 @@
74 {
75 GtkWidget *dialog;
76 int len = strlen (path);
77 - gchar *command,**dir, *first_line, *filename;
78 + gchar *command,**dir, *first_line, *filename, *gzip, *bzip2, *tar;
79 int status,theme_type;
80 theme_properties *theme_props;
81 GnomeVFSURI *theme_source_dir, *theme_dest_dir;
82 @@ -205,18 +229,21 @@
83 theme_props->target_tmp_dir = g_strdup_printf ("%s/.themes/.theme-%u",
84 g_get_home_dir(),
85 g_random_int());
86 -
87 +
88 + gzip = g_find_program_in_path("gzip");
89 + bzip2 = g_find_program_in_path("bzip2");
90 + tar = g_find_program_in_path("tar");
91
92 - if (path && len > 7 && ( (!strcmp (path + len - 7, ".tar.gz")) || (!strcmp (path + len - 4, ".tgz")) )) {
93 + if (tar && gzip && path && len > 7 && ( (!strcmp (path + len - 7, ".tar.gz")) || (!strcmp (path + len - 4, ".tgz")) )) {
94 filename = g_shell_quote (path);
95 - command = g_strdup_printf ("sh -c '/bin/gzip -d -c < \"%s\" | /bin/tar ft - | head -n 1'",
96 - filename);
97 + command = g_strdup_printf ("sh -c '%s -d -c < \"%s\" | %s ft - | head -1'",
98 + gzip, filename, tar);
99 theme_props->filetype=TARGZ;
100 g_free (filename);
101 - } else if (path && len > 8 && !strcmp (path + len - 8, ".tar.bz2")) {
102 + } else if (tar && bzip2 && path && len > 8 && !strcmp (path + len - 8, ".tar.bz2")) {
103 filename = g_shell_quote (path);
104 - command = g_strdup_printf ("sh -c '/usr/bin/bzip2 -d -c < \"%s\" | /bin/tar ft - | head -n 1'",
105 - filename);
106 + command = g_strdup_printf ("sh -c '%s -d -c < \"%s\" | %s ft - | head -1'",
107 + bzip2, filename, tar);
108 theme_props->filetype=TARBZ;
109 g_free (filename);
110 } else {
111 @@ -230,6 +257,9 @@
112 gnome_vfs_unlink(path);
113 g_free (theme_props->target_tmp_dir);
114 g_free (theme_props);
115 + g_free(gzip);
116 + g_free(bzip2);
117 + g_free(tar);
118 return;
119 }
120
121 @@ -245,6 +275,9 @@
122 g_free (command);
123 g_free (theme_props->target_tmp_dir);
124 g_free (theme_props);
125 + g_free(gzip);
126 + g_free(bzip2);
127 + g_free(tar);
128 return;
129 }
130
131 @@ -252,7 +285,7 @@
132 theme_props->filename=g_strdup(path);
133
134 if (theme_props->filetype == TARBZ ) {
135 - if (!g_file_test ("/usr/bin/bzip2", G_FILE_TEST_EXISTS)) {
136 + if (!bzip2) {
137 dialog = gtk_message_dialog_new (NULL,
138 GTK_DIALOG_MODAL,
139 GTK_MESSAGE_ERROR,
140 @@ -265,6 +298,9 @@
141 g_free (theme_props->target_tmp_dir);
142 g_free (theme_props->filename);
143 g_free (theme_props);
144 + g_free(gzip);
145 + g_free(bzip2);
146 + g_free(tar);
147 return;
148 }
149
150 @@ -281,12 +317,15 @@
151 g_free (theme_props->filename);
152 g_free (theme_props);
153 g_free (command);
154 + g_free(gzip);
155 + g_free(bzip2);
156 + g_free(tar);
157 return;
158 }
159 }
160
161 if (theme_props->filetype == TARGZ ) {
162 - if (!g_file_test ("/bin/gzip", G_FILE_TEST_EXISTS)) {
163 + if (!gzip) {
164 dialog = gtk_message_dialog_new (NULL,
165 GTK_DIALOG_MODAL,
166 GTK_MESSAGE_ERROR,
167 @@ -299,6 +338,9 @@
168 g_free (theme_props->target_tmp_dir);
169 g_free (theme_props->filename);
170 g_free (theme_props);
171 + g_free(gzip);
172 + g_free(bzip2);
173 + g_free(tar);
174 return;
175 }
176 if (!transfer_done_targz_idle_cb(theme_props)) {
177 @@ -314,6 +356,9 @@
178 g_free (theme_props->filename);
179 g_free (theme_props);
180 g_free (command);
181 + g_free(gzip);
182 + g_free(bzip2);
183 + g_free(tar);
184 return;
185 }
186 }
187 @@ -351,6 +396,9 @@
188 g_free (theme_props->theme_tmp_dir);
189 g_free (theme_props);
190 g_free (command);
191 + g_free(gzip);
192 + g_free(bzip2);
193 + g_free(tar);
194 return;
195 } else {
196 dialog = gtk_message_dialog_new (NULL,
197 @@ -365,6 +413,9 @@
198 g_free (theme_props->theme_tmp_dir);
199 g_free (theme_props);
200 g_free (command);
201 + g_free(gzip);
202 + g_free(bzip2);
203 + g_free(tar);
204 return;
205 }
206 /* Move the Dir to the target dir */
207 @@ -391,6 +442,9 @@
208 g_free (theme_props->user_message);
209 g_free (theme_props);
210 g_free (command);
211 + g_free(gzip);
212 + g_free(bzip2);
213 + g_free(tar);
214 return;
215 } else {
216 dialog = gtk_message_dialog_new (NULL,
217 @@ -408,6 +462,9 @@
218 g_free (theme_props->user_message);
219 g_free (theme_props);
220 g_free (command);
221 + g_free(gzip);
222 + g_free(bzip2);
223 + g_free(tar);
224 return;
225 }
226
227 @@ -416,6 +473,9 @@
228 g_free (theme_props->target_tmp_dir);
229 g_free (theme_props->filename);
230 g_free (theme_props);
231 + g_free(gzip);
232 + g_free(bzip2);
233 + g_free(tar);
234 }
235
236 static void