pidgin/gtkrequest.c

branch
cpw.malu.ft_thumbnails
changeset 28810
92c3b2ccbc48
parent 28793
31a37be33d28
parent 27754
ebe2fa742d5c
child 29731
e50d65336613
equal deleted inserted replaced
28806:a724c42684d3 28810:92c3b2ccbc48
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
659 /* Setup the main horizontal box */ 662 /* Setup the main horizontal box */
660 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); 663 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
661 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); 664 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
662 665
663 /* Dialog icon. */ 666 /* Dialog icon. */
664 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, 667 if (icon_data) {
668 GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
669 GdkPixbuf *pixbuf = NULL;
670 if (gdk_pixbuf_loader_write(loader, icon_data, icon_size, NULL)) {
671 pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
672 if (pixbuf) {
673 img = gtk_image_new_from_pixbuf(pixbuf);
674 }
675 } else {
676 purple_debug_info("pidgin", "failed to parse dialog icon\n");
677 }
678 gdk_pixbuf_loader_close(loader, NULL);
679 g_object_unref(loader);
680 }
681
682 if (!img) {
683 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
665 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); 684 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
685 }
666 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); 686 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
667 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); 687 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
668 688
669 /* Vertical box */ 689 /* Vertical box */
670 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); 690 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
710 pidgin_auto_parent_window(dialog); 730 pidgin_auto_parent_window(dialog);
711 731
712 gtk_widget_show_all(dialog); 732 gtk_widget_show_all(dialog);
713 733
714 return data; 734 return data;
735 }
736
737 static void *
738 pidgin_request_action(const char *title, const char *primary,
739 const char *secondary, int default_action,
740 PurpleAccount *account, const char *who, PurpleConversation *conv,
741 void *user_data, size_t action_count, va_list actions)
742 {
743 pidgin_request_action_with_icon(title, primary, secondary, default_action,
744 account, who, conv, NULL, 0, user_data, action_count, actions);
715 } 745 }
716 746
717 static void 747 static void
718 req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field) 748 req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field)
719 { 749 {
1754 pidgin_request_action, 1784 pidgin_request_action,
1755 pidgin_request_fields, 1785 pidgin_request_fields,
1756 pidgin_request_file, 1786 pidgin_request_file,
1757 pidgin_close_request, 1787 pidgin_close_request,
1758 pidgin_request_folder, 1788 pidgin_request_folder,
1759 NULL, 1789 pidgin_request_action_with_icon,
1760 NULL, 1790 NULL,
1761 NULL, 1791 NULL,
1762 NULL 1792 NULL
1763 }; 1793 };
1764 1794

mercurial