Mercurial > pidgin
comparison pidgin/gtkrequest.c @ 29812:1e8dc177415e
propagate from branch 'im.pidgin.pidgin' (head 267f28808ab6eeda6b5d68f6433f2b3fcf230d4f)
to branch 'im.pidgin.cpw.malu.ft_thumbnails' (head e638c5bb96c2400620511beaf38c52bedb56db4b)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Thu, 18 Feb 2010 21:59:26 +0000 |
parents | 422889fb57e0 59510eac0bdf |
children | 6d3a90b49dba |
comparison
equal
deleted
inserted
replaced
29401:bc2760c74a79 | 29812:1e8dc177415e |
---|---|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
25 */ | 25 */ |
26 #include "internal.h" | 26 #include "internal.h" |
27 #include "pidgin.h" | 27 #include "pidgin.h" |
28 | 28 |
29 #include "debug.h" | |
29 #include "prefs.h" | 30 #include "prefs.h" |
30 #include "util.h" | 31 #include "util.h" |
31 | 32 |
32 #include "gtkimhtml.h" | 33 #include "gtkimhtml.h" |
33 #include "gtkimhtmltoolbar.h" | 34 #include "gtkimhtmltoolbar.h" |
590 | 591 |
591 return data; | 592 return data; |
592 } | 593 } |
593 | 594 |
594 static void * | 595 static void * |
595 pidgin_request_action(const char *title, const char *primary, | 596 pidgin_request_action_with_icon(const char *title, const char *primary, |
596 const char *secondary, int default_action, | 597 const char *secondary, int default_action, |
597 PurpleAccount *account, const char *who, PurpleConversation *conv, | 598 PurpleAccount *account, const char *who, |
599 PurpleConversation *conv, gconstpointer icon_data, | |
600 gsize icon_size, | |
598 void *user_data, size_t action_count, va_list actions) | 601 void *user_data, size_t action_count, va_list actions) |
599 { | 602 { |
600 PidginRequestData *data; | 603 PidginRequestData *data; |
601 GtkWidget *dialog; | 604 GtkWidget *dialog; |
602 GtkWidget *vbox; | 605 GtkWidget *vbox; |
603 GtkWidget *hbox; | 606 GtkWidget *hbox; |
604 GtkWidget *label; | 607 GtkWidget *label; |
605 GtkWidget *img; | 608 GtkWidget *img = NULL; |
606 void **buttons; | 609 void **buttons; |
607 char *label_text; | 610 char *label_text; |
608 char *primary_esc, *secondary_esc; | 611 char *primary_esc, *secondary_esc; |
609 int i; | 612 int i; |
610 | 613 |
657 /* Setup the main horizontal box */ | 660 /* Setup the main horizontal box */ |
658 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); | 661 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); |
659 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); | 662 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
660 | 663 |
661 /* Dialog icon. */ | 664 /* Dialog icon. */ |
662 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, | 665 if (icon_data) { |
666 GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); | |
667 GdkPixbuf *pixbuf = NULL; | |
668 if (gdk_pixbuf_loader_write(loader, icon_data, icon_size, NULL)) { | |
669 pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); | |
670 if (pixbuf) { | |
671 img = gtk_image_new_from_pixbuf(pixbuf); | |
672 } | |
673 } else { | |
674 purple_debug_info("pidgin", "failed to parse dialog icon\n"); | |
675 } | |
676 gdk_pixbuf_loader_close(loader, NULL); | |
677 g_object_unref(loader); | |
678 } | |
679 | |
680 if (!img) { | |
681 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, | |
663 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); | 682 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); |
683 } | |
664 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | 684 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
665 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | 685 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
666 | 686 |
667 /* Vertical box */ | 687 /* Vertical box */ |
668 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); | 688 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); |
708 pidgin_auto_parent_window(dialog); | 728 pidgin_auto_parent_window(dialog); |
709 | 729 |
710 gtk_widget_show_all(dialog); | 730 gtk_widget_show_all(dialog); |
711 | 731 |
712 return data; | 732 return data; |
733 } | |
734 | |
735 static void * | |
736 pidgin_request_action(const char *title, const char *primary, | |
737 const char *secondary, int default_action, | |
738 PurpleAccount *account, const char *who, PurpleConversation *conv, | |
739 void *user_data, size_t action_count, va_list actions) | |
740 { | |
741 pidgin_request_action_with_icon(title, primary, secondary, default_action, | |
742 account, who, conv, NULL, 0, user_data, action_count, actions); | |
713 } | 743 } |
714 | 744 |
715 static void | 745 static void |
716 req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field) | 746 req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field) |
717 { | 747 { |
1677 pidgin_request_action, | 1707 pidgin_request_action, |
1678 pidgin_request_fields, | 1708 pidgin_request_fields, |
1679 pidgin_request_file, | 1709 pidgin_request_file, |
1680 pidgin_close_request, | 1710 pidgin_close_request, |
1681 pidgin_request_folder, | 1711 pidgin_request_folder, |
1682 NULL, | 1712 pidgin_request_action_with_icon, |
1683 NULL, | 1713 NULL, |
1684 NULL, | 1714 NULL, |
1685 NULL | 1715 NULL |
1686 }; | 1716 }; |
1687 | 1717 |