# HG changeset patch # User Rob Flynn # Date 1042795635 0 # Node ID eb63f9960d07d66e570b312d2b34bbd4ef77e69a # Parent 7fd57453e6fc6c5344dc23d508e2c1fdb5230c7a [gaim-migrate @ 4582] You can drag and drop from the web to install themes. Yay. committer: Tailor Script diff -r 7fd57453e6fc -r eb63f9960d07 doc/the_penguin.txt --- a/doc/the_penguin.txt Fri Jan 17 08:35:21 2003 +0000 +++ b/doc/the_penguin.txt Fri Jan 17 09:27:15 2003 +0000 @@ -1,8 +1,8 @@ The Penguin -by Jeramey Crawford +by Rob Flynn and - Rob Flynn + Jeramey Crawford Once upon a term'nal dreary, while I hack'ed, weak and weary, diff -r 7fd57453e6fc -r eb63f9960d07 src/prefs.c --- a/src/prefs.c Fri Jan 17 08:35:21 2003 +0000 +++ b/src/prefs.c Fri Jan 17 09:27:15 2003 +0000 @@ -259,7 +259,7 @@ return path; } -void theme_install_theme(char *path) { +void theme_install_theme(char *path, char *extn) { gchar *command; gchar *destdir; gchar *tail; @@ -268,7 +268,9 @@ g_strchomp(path); /* I dont know what you are, get out of here */ - if ((tail = strrchr(path, '.')) == NULL) + if (extn != NULL) + tail = extn; + else if ((tail = strrchr(path, '.')) == NULL) return; destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); @@ -291,6 +293,20 @@ theme_refresh_theme_list(); } +static void theme_got_url(gpointer data, char *themedata, unsigned long len) { + FILE *f; + gchar *path; + + f = gaim_mkstemp(&path); + fwrite(themedata, len, 1, f); + fclose(f); + + theme_install_theme(path, data); + + unlink(path); + g_free(path); +} + gint theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t, gpointer data) { GList *dcl = dc->targets; @@ -303,7 +319,21 @@ if (!g_strncasecmp(name, "file://", 7)) { /* It looks like we're dealing with a local file. Let's * just untar it in the right place */ - theme_install_theme(name + 7); + theme_install_theme(name + 7, NULL); + } else if (!g_strncasecmp(name, "http://", 7)) { + /* Oo, a web drag and drop. This is where things + * will start to get interesting */ + gchar *tail; + + if ((tail = strrchr(name, '.')) == NULL) + return; + + /* We'll check this just to make sure. This also lets us do something different on + * other platforms, if need be */ + if (!g_strcasecmp(tail, ".gz") || !g_strcasecmp(tail, ".tgz")) + grab_url(name, FALSE, theme_got_url, ".tgz"); + + g_free(tail); } gtk_drag_finish(dc, TRUE, FALSE, t);