comparison pidgin/gtknotify.c @ 32602:3b4c865dc2ce

Use pidgin_create_webview in the gtknotify code.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 09 Sep 2011 02:40:51 +0000
parents 8e1ec44ede75
children 0f94ec89f0bc 2ec94166be43
comparison
equal deleted inserted replaced
32601:def5b2a97fee 32602:3b4c865dc2ce
817 GtkWidget *window; 817 GtkWidget *window;
818 GtkWidget *vbox; 818 GtkWidget *vbox;
819 GtkWidget *label; 819 GtkWidget *label;
820 GtkWidget *button; 820 GtkWidget *button;
821 GtkWidget *web_view; 821 GtkWidget *web_view;
822 GtkWidget *scrolled_window; 822 GtkWidget *frame;
823 char label_text[2048]; 823 char label_text[2048];
824 char *linked_text, *primary_esc, *secondary_esc; 824 char *linked_text, *primary_esc, *secondary_esc;
825 825
826 window = gtk_dialog_new(); 826 window = gtk_dialog_new();
827 gtk_window_set_title(GTK_WINDOW(window), title); 827 gtk_window_set_title(GTK_WINDOW(window), title);
853 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); 853 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
854 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); 854 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
855 gtk_widget_show(label); 855 gtk_widget_show(label);
856 856
857 /* Add the webview */ 857 /* Add the webview */
858 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 858 frame = pidgin_create_webview(FALSE, &web_view, NULL, NULL);
859 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
860 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
861
862 web_view = gtk_webview_new();
863 gtk_container_add(GTK_CONTAINER(scrolled_window), web_view);
864
865 gtk_widget_set_name(web_view, "pidgin_notify_webview"); 859 gtk_widget_set_name(web_view, "pidgin_notify_webview");
866 gtk_widget_set_size_request(web_view, 300, 250); 860 gtk_widget_set_size_request(web_view, 300, 250);
867 gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); 861 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
868 gtk_widget_show_all(scrolled_window); 862 gtk_widget_show(frame);
869 863
870 /* Add the Close button. */ 864 /* Add the Close button. */
871 button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); 865 button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
872 gtk_widget_grab_focus(button); 866 gtk_widget_grab_focus(button);
873 867
1136 info = purple_notify_user_info_get_text_with_newline(user_info, "<br />"); 1130 info = purple_notify_user_info_get_text_with_newline(user_info, "<br />");
1137 pinfo = g_hash_table_lookup(userinfo, key); 1131 pinfo = g_hash_table_lookup(userinfo, key);
1138 if (pinfo != NULL) { 1132 if (pinfo != NULL) {
1139 GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget"); 1133 GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget");
1140 char *linked_text = purple_markup_linkify(info); 1134 char *linked_text = purple_markup_linkify(info);
1141 g_assert(webview);
1142 gtk_webview_load_html_string_with_imgstore(GTK_WEBVIEW(webview), linked_text); 1135 gtk_webview_load_html_string_with_imgstore(GTK_WEBVIEW(webview), linked_text);
1143 g_free(linked_text); 1136 g_free(linked_text);
1144 g_free(key); 1137 g_free(key);
1145 ui_handle = pinfo->window; 1138 ui_handle = pinfo->window;
1146 pinfo->count++; 1139 pinfo->count++;