pidgin/gtkstatusbox.c

changeset 34225
3bba206f27f6
parent 33896
fb896f14715b
child 34274
9169710b5af5
child 34855
9c289149eed4
equal deleted inserted replaced
34224:b9db365c4894 34225:3bba206f27f6
41 */ 41 */
42 42
43 #include <gdk/gdkkeysyms.h> 43 #include <gdk/gdkkeysyms.h>
44 44
45 #include "internal.h" 45 #include "internal.h"
46 #include "obsolete.h"
47 46
48 #include "account.h" 47 #include "account.h"
49 #include "buddyicon.h" 48 #include "buddyicon.h"
50 #include "core.h" 49 #include "core.h"
51 #include "imgstore.h" 50 #include "imgstore.h"
370 gtk_drag_finish(dc, TRUE, FALSE, t); 369 gtk_drag_finish(dc, TRUE, FALSE, t);
371 } 370 }
372 gtk_drag_finish(dc, FALSE, FALSE, t); 371 gtk_drag_finish(dc, FALSE, FALSE, t);
373 } 372 }
374 373
375 static void
376 statusbox_got_url(PurpleUtilFetchUrlData *url_data, gpointer user_data,
377 const gchar *themedata, size_t len, const gchar *error_message)
378 {
379 FILE *f;
380 gchar *path;
381 size_t wc;
382
383 if ((error_message != NULL) || (len == 0))
384 return;
385
386 f = purple_mkstemp(&path, TRUE);
387 wc = fwrite(themedata, len, 1, f);
388 if (wc != 1) {
389 purple_debug_warning("theme_got_url", "Unable to write theme data.\n");
390 fclose(f);
391 g_unlink(path);
392 g_free(path);
393 return;
394 }
395 fclose(f);
396
397 icon_choose_cb(path, user_data);
398
399 g_unlink(path);
400 g_free(path);
401 }
402
403
404 static gboolean
405 statusbox_uri_handler(const char *proto, const char *cmd, GHashTable *params, void *data)
406 {
407 const char *src;
408
409 if (g_ascii_strcasecmp(proto, "aim"))
410 return FALSE;
411
412 if (g_ascii_strcasecmp(cmd, "buddyicon"))
413 return FALSE;
414
415 src = g_hash_table_lookup(params, "account");
416 if (src == NULL)
417 return FALSE;
418
419 purple_util_fetch_url(src, TRUE, NULL, FALSE, -1, statusbox_got_url, data);
420 return TRUE;
421 }
422
423 static gboolean 374 static gboolean
424 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) 375 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
425 { 376 {
426 gdk_window_set_cursor(gtk_widget_get_window(widget), box->hand_cursor); 377 gdk_window_set_cursor(gtk_widget_get_window(widget), box->hand_cursor);
427 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); 378 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover);
1956 1907
1957 purple_prefs_connect_callback(status_box, PIDGIN_PREFS_ROOT "/conversations/spellcheck", 1908 purple_prefs_connect_callback(status_box, PIDGIN_PREFS_ROOT "/conversations/spellcheck",
1958 spellcheck_prefs_cb, status_box); 1909 spellcheck_prefs_cb, status_box);
1959 purple_prefs_connect_callback(status_box, PIDGIN_PREFS_ROOT "/accounts/buddyicon", 1910 purple_prefs_connect_callback(status_box, PIDGIN_PREFS_ROOT "/accounts/buddyicon",
1960 update_buddyicon_cb, status_box); 1911 update_buddyicon_cb, status_box);
1961 purple_signal_connect(purple_get_core(), "uri-handler", status_box,
1962 PURPLE_CALLBACK(statusbox_uri_handler), status_box);
1963 1912
1964 } 1913 }
1965 1914
1966 #if GTK_CHECK_VERSION(3,0,0) 1915 #if GTK_CHECK_VERSION(3,0,0)
1967 static void 1916 static void

mercurial