Magellan Linux

Contents of /trunk/control-center/patches/control-center-2.12.0-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: 6670 byte(s)
-import

1 diff -u -ruN control-center-2.10.1.orig/capplets/theme-switcher/gnome-theme-installer.c control-center-2.10.1/capplets/theme-switcher/gnome-theme-installer.c
2 --- control-center-2.10.1.orig/capplets/theme-switcher/gnome-theme-installer.c 2005-02-08 17:42:10.000000000 -0500
3 +++ control-center-2.10.1/capplets/theme-switcher/gnome-theme-installer.c 2005-05-26 12:17:39.000000000 -0400
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 @@ -247,6 +275,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 @@ -254,7 +285,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 GtkWidget *dialog;
134
135 dialog = gtk_message_dialog_new (NULL,
136 @@ -269,6 +300,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 @@ -287,12 +321,15 @@
147 g_free (theme_props->filename);
148 g_free (theme_props);
149 g_free (command);
150 + g_free(gzip);
151 + g_free(bzip2);
152 + g_free(tar);
153 return;
154 }
155 }
156
157 if (theme_props->filetype == TARGZ ) {
158 - if (!g_file_test ("/bin/gzip", G_FILE_TEST_EXISTS)) {
159 + if (!gzip) {
160 GtkWidget *dialog;
161
162 dialog = gtk_message_dialog_new (NULL,
163 @@ -307,6 +344,9 @@
164 g_free (theme_props->target_tmp_dir);
165 g_free (theme_props->filename);
166 g_free (theme_props);
167 + g_free(gzip);
168 + g_free(bzip2);
169 + g_free(tar);
170 return;
171 }
172 if (!transfer_done_targz_idle_cb(theme_props)) {
173 @@ -324,6 +364,9 @@
174 g_free (theme_props->filename);
175 g_free (theme_props);
176 g_free (command);
177 + g_free(gzip);
178 + g_free(bzip2);
179 + g_free(tar);
180 return;
181 }
182 }
183 @@ -363,6 +406,9 @@
184 g_free (theme_props->theme_tmp_dir);
185 g_free (theme_props);
186 g_free (command);
187 + g_free(gzip);
188 + g_free(bzip2);
189 + g_free(tar);
190 return;
191 } else {
192 GtkWidget *dialog;
193 @@ -379,6 +425,9 @@
194 g_free (theme_props->theme_tmp_dir);
195 g_free (theme_props);
196 g_free (command);
197 + g_free(gzip);
198 + g_free(bzip2);
199 + g_free(tar);
200 return;
201 }
202 /* Move the Dir to the target dir */
203 @@ -407,6 +456,9 @@
204 g_free (theme_props->user_message);
205 g_free (theme_props);
206 g_free (command);
207 + g_free(gzip);
208 + g_free(bzip2);
209 + g_free(tar);
210 return;
211 } else {
212 GtkWidget *dialog;
213 @@ -426,6 +478,9 @@
214 g_free (theme_props->user_message);
215 g_free (theme_props);
216 g_free (command);
217 + g_free(gzip);
218 + g_free(bzip2);
219 + g_free(tar);
220 return;
221 }
222
223 @@ -434,6 +489,9 @@
224 g_free (theme_props->target_tmp_dir);
225 g_free (theme_props->filename);
226 g_free (theme_props);
227 + g_free(gzip);
228 + g_free(bzip2);
229 + g_free(tar);
230 }
231
232 static void