Mercurial > pidgin
comparison src/prefs.c @ 5013:e44e68aa6ea3
[gaim-migrate @ 5349]
doing get_filename_from_uri in theme_dnd_recv
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Sat, 05 Apr 2003 01:55:57 +0000 |
parents | 330a78666a5b |
children | 74dd2e4ed0c1 |
comparison
equal
deleted
inserted
replaced
5012:3ee1b1409660 | 5013:e44e68aa6ea3 |
---|---|
259 | 259 |
260 void theme_install_theme(char *path, char *extn) { | 260 void theme_install_theme(char *path, char *extn) { |
261 gchar *command; | 261 gchar *command; |
262 gchar *destdir; | 262 gchar *destdir; |
263 gchar *tail; | 263 gchar *tail; |
264 gchar *tmp; | |
265 GError *converr = NULL; | |
266 | 264 |
267 /* Just to be safe */ | 265 /* Just to be safe */ |
268 g_strchomp(path); | 266 g_strchomp(path); |
269 | |
270 if(!(tmp = g_filename_from_uri(path, NULL, &converr))) { | |
271 debug_printf("%s\n", converr ? converr->message : "g_filename_from_uri error"); | |
272 return; | |
273 } | |
274 | 267 |
275 /* I dont know what you are, get out of here */ | 268 /* I dont know what you are, get out of here */ |
276 if (extn != NULL) | 269 if (extn != NULL) |
277 tail = extn; | 270 tail = extn; |
278 else if ((tail = strrchr(tmp, '.')) == NULL) { | 271 else if ((tail = strrchr(path, '.')) == NULL) |
279 g_free(tmp); | |
280 return; | 272 return; |
281 } | 273 |
282 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); | 274 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); |
283 | 275 |
284 /* We'll check this just to make sure. This also lets us do something different on | 276 /* We'll check this just to make sure. This also lets us do something different on |
285 * other platforms, if need be */ | 277 * other platforms, if need be */ |
286 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) { | 278 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) { |
287 #ifndef _WIN32 | 279 #ifndef _WIN32 |
288 command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", tmp, destdir); | 280 command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", tmp, destdir); |
289 #else | 281 #else |
290 if(!wgaim_gz_untar(tmp, destdir)) { | 282 if(!wgaim_gz_untar(path, destdir)) { |
291 g_free(destdir); | 283 g_free(destdir); |
292 g_free(tmp); | |
293 return; | 284 return; |
294 } | 285 } |
295 #endif | 286 #endif |
296 } | 287 } |
297 else { | 288 else { |
298 g_free(tmp); | |
299 g_free(destdir); | 289 g_free(destdir); |
300 return; | 290 return; |
301 } | 291 } |
302 | 292 |
303 #ifndef _WIN32 | 293 #ifndef _WIN32 |
304 /* Fire! */ | 294 /* Fire! */ |
305 system(command); | 295 system(command); |
306 | 296 |
307 g_free(command); | 297 g_free(command); |
308 #endif | 298 #endif |
309 g_free(tmp); | |
310 g_free(destdir); | 299 g_free(destdir); |
311 | 300 |
312 theme_refresh_theme_list(); | 301 theme_refresh_theme_list(); |
313 } | 302 } |
314 | 303 |
333 if ((sd->length >= 0) && (sd->format == 8)) { | 322 if ((sd->length >= 0) && (sd->format == 8)) { |
334 /* Well, it looks like the drag event was cool. | 323 /* Well, it looks like the drag event was cool. |
335 * Let's do something with it */ | 324 * Let's do something with it */ |
336 | 325 |
337 if (!g_ascii_strncasecmp(name, "file://", 7)) { | 326 if (!g_ascii_strncasecmp(name, "file://", 7)) { |
327 GError *converr = NULL; | |
328 gchar *tmp; | |
338 /* It looks like we're dealing with a local file. Let's | 329 /* It looks like we're dealing with a local file. Let's |
339 * just untar it in the right place */ | 330 * just untar it in the right place */ |
340 theme_install_theme(name, NULL); | 331 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { |
332 debug_printf("%s\n", converr ? converr->message : "g_filename_from_uri error"); | |
333 return; | |
334 } | |
335 theme_install_theme(tmp, NULL); | |
336 g_free(tmp); | |
341 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { | 337 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { |
342 /* Oo, a web drag and drop. This is where things | 338 /* Oo, a web drag and drop. This is where things |
343 * will start to get interesting */ | 339 * will start to get interesting */ |
344 gchar *tail; | 340 gchar *tail; |
345 | 341 |