Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 84997 | Differences between
and this patch

Collapse All | Expand All

(-)control-center-2.10.1.orig/capplets/theme-switcher/gnome-theme-installer.c (-15 / +73 lines)
Lines 139-157 Link Here
139
transfer_done_targz_idle_cb (gpointer data)
139
transfer_done_targz_idle_cb (gpointer data)
140
{
140
{
141
	int status;
141
	int status;
142
	gchar *command, *filename;
142
	gchar *command, *filename, *gzip, *tar;
143
	theme_properties *theme_props = data;
143
	theme_properties *theme_props = data;
144
		
144
		
145
	if (!(gzip = g_find_program_in_path("gzip"))) {
146
		return FALSE;
147
	}
148
	if (!(tar = g_find_program_in_path("tar"))) {
149
		g_free(gzip);
150
		return FALSE;
151
	}
145
	/* this should be something more clever and nonblocking */
152
	/* this should be something more clever and nonblocking */
146
	filename = g_shell_quote(theme_props->filename);
153
	filename = g_shell_quote(theme_props->filename);
147
	command = g_strdup_printf ("sh -c 'cd \"%s\"; /bin/gzip -d -c < \"%s\" | /bin/tar xf - '",
154
	command = g_strdup_printf ("sh -c 'cd \"%s\"; %s -d -c < \"%s\" | %s xf - '",
148
				    theme_props->target_tmp_dir, filename);
155
				    theme_props->target_tmp_dir, gzip, filename, tar);
149
	g_free(filename);
156
	g_free(filename);
150
	if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0) {
157
	if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0) {
151
		g_free (command);
158
		g_free (command);
159
		g_free(gzip);
160
		g_free(tar);
152
		return TRUE;
161
		return TRUE;
153
	} else {	
162
	} else {	
154
		g_free (command);
163
		g_free (command);
164
		g_free(gzip);
165
		g_free(tar);
155
		return FALSE;
166
		return FALSE;
156
	}
167
	}
157
}
168
}
Lines 171-188 Link Here
171
transfer_done_tarbz2_idle_cb (gpointer data)
182
transfer_done_tarbz2_idle_cb (gpointer data)
172
{
183
{
173
	int status;
184
	int status;
174
	gchar *command, *filename;
185
	gchar *command, *filename, *bzip2, *tar;
175
	theme_properties *theme_props = data;
186
	theme_properties *theme_props = data;
176
	
187
	
188
	if (!(bzip2 = g_find_program_in_path("bzip2"))) {
189
		return FALSE;
190
	}
191
	if (!(tar = g_find_program_in_path("tar"))) {
192
		g_free(bzip2);
193
		return FALSE;
194
	}
177
	filename = g_shell_quote(theme_props->filename);
195
	filename = g_shell_quote(theme_props->filename);
178
	/* this should be something more clever and nonblocking */
196
	/* this should be something more clever and nonblocking */
179
	command = g_strdup_printf ("sh -c 'cd \"%s\"; /usr/bin/bzip2 -d -c < \"%s\" | /bin/tar xf - '",
197
	command = g_strdup_printf ("sh -c 'cd \"%s\"; %s -d -c < \"%s\" | %s xf - '",
180
				   theme_props->target_tmp_dir, filename);
198
				   theme_props->target_tmp_dir, bzip2, filename, tar);
181
	g_free (filename);
199
	g_free (filename);
182
	if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0) {
200
	if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0) {
201
		g_free(bzip2);
202
		g_free(tar);
183
		g_free (command);
203
		g_free (command);
184
		return TRUE;
204
		return TRUE;
185
	} else {
205
	} else {
206
		g_free(bzip2);
207
		g_free(tar);
186
		g_free (command);
208
		g_free (command);
187
		return FALSE;
209
		return FALSE;
188
	}
210
	}
Lines 193-199 Link Here
193
{
215
{
194
	GtkWidget *dialog;
216
	GtkWidget *dialog;
195
	int len = strlen (path);
217
	int len = strlen (path);
196
	gchar *command,**dir, *first_line, *filename;
218
	gchar *command,**dir, *first_line, *filename, *gzip, *bzip2, *tar;
197
	int status,theme_type;
219
	int status,theme_type;
198
	theme_properties *theme_props;
220
	theme_properties *theme_props;
199
	GnomeVFSURI *theme_source_dir, *theme_dest_dir;
221
	GnomeVFSURI *theme_source_dir, *theme_dest_dir;
Lines 206-222 Link Here
206
				 			g_get_home_dir(), 
228
				 			g_get_home_dir(), 
207
							g_random_int());
229
							g_random_int());
208
		
230
		
231
	gzip = g_find_program_in_path("gzip");
232
	bzip2 = g_find_program_in_path("bzip2");
233
	tar = g_find_program_in_path("tar");
209
	
234
	
210
	if (path && len > 7 && ( (!strcmp (path + len - 7, ".tar.gz")) || (!strcmp (path + len - 4, ".tgz")) )) {
235
	if (tar && gzip && path && len > 7 && ( (!strcmp (path + len - 7, ".tar.gz")) || (!strcmp (path + len - 4, ".tgz")) )) {
211
		filename = g_shell_quote (path);
236
		filename = g_shell_quote (path);
212
		command = g_strdup_printf ("sh -c '/bin/gzip -d -c < \"%s\" | /bin/tar ft -  | head -1'",
237
		command = g_strdup_printf ("sh -c '%s -d -c < \"%s\" | %s ft -  | head -1'",
213
					    filename);
238
					    gzip, filename, tar);
214
		theme_props->filetype=TARGZ;
239
		theme_props->filetype=TARGZ;
215
		g_free (filename);
240
		g_free (filename);
216
	} else if (path && len > 8 && !strcmp (path + len - 8, ".tar.bz2")) {
241
	} else if (tar && bzip2 && path && len > 8 && !strcmp (path + len - 8, ".tar.bz2")) {
217
		filename = g_shell_quote (path);
242
		filename = g_shell_quote (path);
218
		command = g_strdup_printf ("sh -c '/usr/bin/bzip2 -d -c < \"%s\" | /bin/tar ft - | head -1'",
243
		command = g_strdup_printf ("sh -c '%s -d -c < \"%s\" | %s ft - | head -1'",
219
					    filename);
244
					    bzip2, filename, tar);
220
		theme_props->filetype=TARBZ;
245
		theme_props->filetype=TARBZ;
221
		g_free (filename);
246
		g_free (filename);
222
	} else {
247
	} else {
Lines 230-235 Link Here
230
		gnome_vfs_unlink(path);		
255
		gnome_vfs_unlink(path);		
231
		g_free (theme_props->target_tmp_dir);
256
		g_free (theme_props->target_tmp_dir);
232
		g_free (theme_props);
257
		g_free (theme_props);
258
		g_free(gzip);
259
		g_free(bzip2);
260
		g_free(tar);
233
		return;	
261
		return;	
234
	}
262
	}
235
	
263
	
Lines 247-252 Link Here
247
		g_free (command);
275
		g_free (command);
248
		g_free (theme_props->target_tmp_dir);
276
		g_free (theme_props->target_tmp_dir);
249
		g_free (theme_props);
277
		g_free (theme_props);
278
		g_free(gzip);
279
		g_free(bzip2);
280
		g_free(tar);
250
		return;	
281
		return;	
251
	}
282
	}
252
	
283
	
Lines 254-260 Link Here
254
	theme_props->filename=g_strdup(path);
285
	theme_props->filename=g_strdup(path);
255
	
286
	
256
	if (theme_props->filetype == TARBZ ) {
287
	if (theme_props->filetype == TARBZ ) {
257
		if (!g_file_test ("/usr/bin/bzip2", G_FILE_TEST_EXISTS)) {
288
		if (!bzip2) {
258
			GtkWidget *dialog;
289
			GtkWidget *dialog;
259
				
290
				
260
			dialog = gtk_message_dialog_new (NULL,
291
			dialog = gtk_message_dialog_new (NULL,
Lines 269-274 Link Here
269
			g_free (theme_props->target_tmp_dir);
300
			g_free (theme_props->target_tmp_dir);
270
			g_free (theme_props->filename);
301
			g_free (theme_props->filename);
271
			g_free (theme_props);
302
			g_free (theme_props);
303
			g_free(gzip);
304
			g_free(bzip2);
305
				g_free(tar);
272
			return;	
306
			return;	
273
		}
307
		}
274
		
308
		
Lines 287-298 Link Here
287
			g_free (theme_props->filename);
321
			g_free (theme_props->filename);
288
			g_free (theme_props);
322
			g_free (theme_props);
289
			g_free (command);
323
			g_free (command);
324
			g_free(gzip);
325
			g_free(bzip2);
326
			g_free(tar);
290
			return;	
327
			return;	
291
		}
328
		}
292
	}
329
	}
293
	
330
	
294
	if (theme_props->filetype == TARGZ ) {
331
	if (theme_props->filetype == TARGZ ) {
295
		if (!g_file_test ("/bin/gzip", G_FILE_TEST_EXISTS)) {
332
		if (!gzip) {
296
			GtkWidget *dialog;
333
			GtkWidget *dialog;
297
334
298
			dialog = gtk_message_dialog_new (NULL,
335
			dialog = gtk_message_dialog_new (NULL,
Lines 307-312 Link Here
307
			g_free (theme_props->target_tmp_dir);
344
			g_free (theme_props->target_tmp_dir);
308
			g_free (theme_props->filename);
345
			g_free (theme_props->filename);
309
			g_free (theme_props);
346
			g_free (theme_props);
347
			g_free(gzip);
348
			g_free(bzip2);
349
			g_free(tar);
310
			return;	
350
			return;	
311
		}
351
		}
312
		if (!transfer_done_targz_idle_cb(theme_props)) {
352
		if (!transfer_done_targz_idle_cb(theme_props)) {
Lines 324-329 Link Here
324
			g_free (theme_props->filename);
364
			g_free (theme_props->filename);
325
			g_free (theme_props);
365
			g_free (theme_props);
326
			g_free (command);
366
			g_free (command);
367
			g_free(gzip);
368
			g_free(bzip2);
369
			g_free(tar);
327
			return;	
370
			return;	
328
		}	
371
		}	
329
	}
372
	}
Lines 363-368 Link Here
363
			g_free (theme_props->theme_tmp_dir);
406
			g_free (theme_props->theme_tmp_dir);
364
			g_free (theme_props);
407
			g_free (theme_props);
365
			g_free (command);
408
			g_free (command);
409
			g_free(gzip);
410
			g_free(bzip2);
411
			g_free(tar);
366
			return;	
412
			return;	
367
		} else {
413
		} else {
368
			GtkWidget *dialog;
414
			GtkWidget *dialog;
Lines 379-384 Link Here
379
                        g_free (theme_props->theme_tmp_dir);
425
                        g_free (theme_props->theme_tmp_dir);
380
                        g_free (theme_props);
426
                        g_free (theme_props);
381
			g_free (command);
427
			g_free (command);
428
			g_free(gzip);
429
			g_free(bzip2);
430
			g_free(tar);
382
			return;	
431
			return;	
383
		}
432
		}
384
		/* Move the Dir to the target dir */
433
		/* Move the Dir to the target dir */
Lines 407-412 Link Here
407
			g_free (theme_props->user_message);
456
			g_free (theme_props->user_message);
408
                        g_free (theme_props);
457
                        g_free (theme_props);
409
			g_free (command);
458
			g_free (command);
459
			g_free(gzip);
460
			g_free(bzip2);
461
			g_free(tar);
410
			return;	
462
			return;	
411
		} else {
463
		} else {
412
			GtkWidget *dialog;
464
			GtkWidget *dialog;
Lines 426-431 Link Here
426
			g_free (theme_props->user_message);
478
			g_free (theme_props->user_message);
427
                        g_free (theme_props);
479
                        g_free (theme_props);
428
			g_free (command);
480
			g_free (command);
481
			g_free(gzip);
482
			g_free(bzip2);
483
			g_free(tar);
429
			return;	
484
			return;	
430
		}
485
		}
431
		
486
		
Lines 434-439 Link Here
434
	g_free (theme_props->target_tmp_dir);
489
	g_free (theme_props->target_tmp_dir);
435
	g_free (theme_props->filename);
490
	g_free (theme_props->filename);
436
	g_free (theme_props);
491
	g_free (theme_props);
492
	g_free(gzip);
493
	g_free(bzip2);
494
	g_free(tar);
437
}
495
}
438
496
439
static void
497
static void

Return to bug 84997