/pidgin/main: 9169710b5af5: Hide GtkWebViewToolbar stuff within ...

Elliott Sales de Andrade qulogic at pidgin.im
Mon Aug 5 17:52:42 EDT 2013


Changeset: 9169710b5af5644d6ea82ca2354f8aaf65d8eb39
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-08-04 05:35 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/9169710b5af5

Description:

Hide GtkWebViewToolbar stuff within the GtkWebView.

diffstat:

 pidgin/gtkconv.c                               |  35 ++++++++---------
 pidgin/gtkconv.h                               |   2 -
 pidgin/gtkdebug.c                              |   2 +-
 pidgin/gtkdialogs.c                            |   2 +-
 pidgin/gtklog.c                                |   2 +-
 pidgin/gtknotify.c                             |   2 +-
 pidgin/gtkpluginpref.c                         |   8 ++--
 pidgin/gtkpounce.c                             |   2 +-
 pidgin/gtkprefs.c                              |   8 +--
 pidgin/gtkrequest.c                            |   3 +-
 pidgin/gtksavedstatuses.c                      |  11 +----
 pidgin/gtkstatusbox.c                          |   2 +-
 pidgin/gtkutils.c                              |   6 +--
 pidgin/gtkutils.h                              |   5 +--
 pidgin/gtkwebview.c                            |  52 ++++++++++++++++++++++++++
 pidgin/gtkwebview.h                            |  47 +++++++++++++++++++++++
 pidgin/gtkwebviewtoolbar.c                     |  34 ++++++++--------
 pidgin/gtkwebviewtoolbar.h                     |  25 +-----------
 pidgin/plugins/musicmessaging/musicmessaging.c |   2 +
 19 files changed, 155 insertions(+), 95 deletions(-)

diffs (truncated from 693 to 300 lines):

diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -65,7 +65,6 @@
 #include "gtkthemes.h"
 #include "gtkutils.h"
 #include "gtkwebview.h"
-#include "gtkwebviewtoolbar.h"
 #include "pidginstock.h"
 #include "pidgintooltip.h"
 #include "smileyparser.h"
@@ -1271,12 +1270,12 @@ menu_insert_link_cb(GtkAction *action, g
 {
 	PidginWindow *win = data;
 	PidginConversation *gtkconv;
-	GtkWebViewToolbar *toolbar;
+	GtkWebView *entry;
 
 	gtkconv = pidgin_conv_window_get_active_gtkconv(win);
-	toolbar = GTK_WEBVIEWTOOLBAR(gtkconv->toolbar);
-
-	gtk_webviewtoolbar_activate(toolbar, GTK_WEBVIEWTOOLBAR_ACTION_LINK);
+	entry = GTK_WEBVIEW(gtkconv->entry);
+
+	gtk_webview_activate_toolbar(entry, GTK_WEBVIEW_ACTION_LINK);
 }
 
 static void
@@ -1284,12 +1283,12 @@ menu_insert_image_cb(GtkAction *action, 
 {
 	PidginWindow *win = data;
 	PidginConversation *gtkconv;
-	GtkWebViewToolbar *toolbar;
+	GtkWebView *entry;
 
 	gtkconv = pidgin_conv_window_get_active_gtkconv(win);
-	toolbar = GTK_WEBVIEWTOOLBAR(gtkconv->toolbar);
-
-	gtk_webviewtoolbar_activate(toolbar, GTK_WEBVIEWTOOLBAR_ACTION_IMAGE);
+	entry = GTK_WEBVIEW(gtkconv->entry);
+
+	gtk_webview_activate_toolbar(entry, GTK_WEBVIEW_ACTION_IMAGE);
 }
 
 static void
@@ -2317,8 +2316,6 @@ pidgin_conv_switch_active_conversation(P
 
 	purple_debug_info("gtkconv", "setting active conversation on toolbar %p\n",
 		conv);
-	gtk_webviewtoolbar_switch_active_conversation(GTK_WEBVIEWTOOLBAR(gtkconv->toolbar),
-		conv);
 
 	if (old_conv == conv)
 		return;
@@ -5451,7 +5448,7 @@ setup_common_pane(PidginConversation *gt
 	g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
 
 	/* Setup the webkit widget */
-	frame = pidgin_create_webview(FALSE, &gtkconv->webview, NULL, &webview_sw);
+	frame = pidgin_create_webview(FALSE, &gtkconv->webview, &webview_sw);
 	gtk_widget_set_size_request(gtkconv->webview, -1, 0);
 
 	load_conv_theme(gtkconv);
@@ -5491,8 +5488,8 @@ setup_common_pane(PidginConversation *gt
 	gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE, FALSE, 0);
 	gtk_widget_show(gtkconv->lower_hbox);
 
-	/* Setup the toolbar, entry widget and all signals */
-	frame = pidgin_create_webview(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
+	/* Setup the entry widget and all signals */
+	frame = pidgin_create_webview(TRUE, &gtkconv->entry, NULL);
 	gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), frame, TRUE, TRUE, 0);
 	gtk_widget_show(frame);
 
@@ -5877,9 +5874,9 @@ private_gtkconv_new(PurpleConversation *
 	}
 
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"))
-		gtk_widget_show(gtkconv->toolbar);
+		gtk_webview_show_toolbar(GTK_WEBVIEW(gtkconv->entry));
 	else
-		gtk_widget_hide(gtkconv->toolbar);
+		gtk_webview_hide_toolbar(GTK_WEBVIEW(gtkconv->entry));
 
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
 		gtk_widget_show(gtkconv->infopane_hbox);
@@ -7294,7 +7291,7 @@ gray_stuff_out(PidginConversation *gtkco
 
 		gtk_webview_set_format_functions(GTK_WEBVIEW(gtkconv->entry), buttons);
 		if (account != NULL)
-			gtk_webviewtoolbar_associate_smileys(GTK_WEBVIEWTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account));
+			gtk_webview_set_protocol_name(GTK_WEBVIEW(gtkconv->entry), purple_account_get_protocol_id(account));
 
 		/* Deal with menu items */
 		gtk_action_set_sensitive(win->menu.view_log, TRUE);
@@ -8018,9 +8015,9 @@ show_formatting_toolbar_pref_cb(const ch
 		        (gboolean)GPOINTER_TO_INT(value));
 
 		if ((gboolean)GPOINTER_TO_INT(value))
-			gtk_widget_show(gtkconv->toolbar);
+			gtk_webview_show_toolbar(GTK_WEBVIEW(gtkconv->entry));
 		else
-			gtk_widget_hide(gtkconv->toolbar);
+			gtk_webview_hide_toolbar(GTK_WEBVIEW(gtkconv->entry));
 
 		g_idle_add((GSourceFunc)resize_webview_cb, gtkconv);
 	}
diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h
--- a/pidgin/gtkconv.h
+++ b/pidgin/gtkconv.h
@@ -118,8 +118,6 @@ struct _PidginConversation
 
 	GtkWidget *lower_hbox;
 
-	GtkWidget *toolbar;
-
 	PidginUnseenState unseen_state;
 	guint unseen_count;
 
diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -605,7 +605,7 @@ debug_window_new(void)
 	}
 
 	/* Add the gtkwebview */
-	frame = pidgin_create_webview(FALSE, &win->text, NULL, NULL);
+	frame = pidgin_create_webview(FALSE, &win->text, NULL);
 	gtk_webview_set_format_functions(GTK_WEBVIEW(win->text),
 	                                 GTK_WEBVIEW_ALL ^ GTK_WEBVIEW_SMILEY ^ GTK_WEBVIEW_IMAGE);
 	gtk_webview_load_html_string(GTK_WEBVIEW(win->text), gtkdebug_html);
diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c
--- a/pidgin/gtkdialogs.c
+++ b/pidgin/gtkdialogs.c
@@ -473,7 +473,7 @@ pidgin_build_help_dialog(const char *tit
 	g_free(tmp);
 	gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0);
 
-	frame = pidgin_create_webview(FALSE, &webview, NULL, NULL);
+	frame = pidgin_create_webview(FALSE, &webview, NULL);
 	gtk_webview_set_format_functions(GTK_WEBVIEW(webview), GTK_WEBVIEW_ALL ^ GTK_WEBVIEW_SMILEY);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 
diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c
--- a/pidgin/gtklog.c
+++ b/pidgin/gtklog.c
@@ -661,7 +661,7 @@ static PidginLogViewer *display_log_view
 	gtk_paned_add2(GTK_PANED(pane), vbox);
 
 	/* Viewer ************/
-	frame = pidgin_create_webview(FALSE, &lv->web_view, NULL, NULL);
+	frame = pidgin_create_webview(FALSE, &lv->web_view, NULL);
 	gtk_widget_set_name(lv->web_view, "pidgin_log_web_view");
 	gtk_widget_set_size_request(lv->web_view, 320, 200);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c
--- a/pidgin/gtknotify.c
+++ b/pidgin/gtknotify.c
@@ -889,7 +889,7 @@ pidgin_notify_formatted(const char *titl
 	gtk_widget_show(label);
 
 	/* Add the webview */
-	frame = pidgin_create_webview(FALSE, &web_view, NULL, NULL);
+	frame = pidgin_create_webview(FALSE, &web_view, NULL);
 	gtk_widget_set_name(web_view, "pidgin_notify_webview");
 	gtk_widget_set_size_request(web_view, 300, 250);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
diff --git a/pidgin/gtkpluginpref.c b/pidgin/gtkpluginpref.c
--- a/pidgin/gtkpluginpref.c
+++ b/pidgin/gtkpluginpref.c
@@ -105,7 +105,6 @@ make_string_pref(GtkWidget *parent, Purp
 				GtkWidget *hbox;
 				GtkWidget *spacer;
 				GtkWidget *webview;
-				GtkWidget *toolbar;
 				GtkWidget *frame;
 
 				box = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
@@ -129,9 +128,10 @@ make_string_pref(GtkWidget *parent, Purp
 				gtk_box_pack_start(GTK_BOX(hbox), spacer, FALSE, FALSE, 0);
 				gtk_widget_show(spacer);
 
-				frame = pidgin_create_webview(TRUE, &webview, &toolbar, NULL);
-				if (!(format & PURPLE_STRING_FORMAT_TYPE_HTML)) {
-					gtk_widget_destroy(toolbar);
+				if ((format & PURPLE_STRING_FORMAT_TYPE_HTML) != 0) {
+					frame = pidgin_create_webview(TRUE, &webview, NULL);
+				} else {
+					frame = pidgin_create_webview(FALSE, &webview, NULL);
 					gtk_webview_set_format_functions(GTK_WEBVIEW(webview), 0);
 				}
 
diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c
--- a/pidgin/gtkpounce.c
+++ b/pidgin/gtkpounce.c
@@ -698,7 +698,7 @@ pidgin_pounce_editor_show(PurpleAccount 
 	dialog->play_sound
 		= gtk_check_button_new_with_mnemonic(_("P_lay a sound"));
 
-	send_msg_webview = pidgin_create_webview(TRUE, &dialog->send_msg_entry, NULL, NULL);
+	send_msg_webview = pidgin_create_webview(TRUE, &dialog->send_msg_entry, NULL);
 	reset_send_msg_entry(dialog, NULL);
 	dialog->exec_cmd_entry    = gtk_entry_new();
 	dialog->popup_entry       = gtk_entry_new();
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -58,7 +58,6 @@
 #include "gtkthemes.h"
 #include "gtkutils.h"
 #include "gtkwebview.h"
-#include "gtkwebviewtoolbar.h"
 #include "pidginstock.h"
 #ifdef USE_VV
 #include "media-gst.h"
@@ -1538,7 +1537,7 @@ theme_page(void)
 }
 
 static void
-formatting_toggle_cb(GtkWebView *webview, GtkWebViewButtons buttons, void *toolbar)
+formatting_toggle_cb(GtkWebView *webview, GtkWebViewButtons buttons, void *data)
 {
 	gboolean bold, italic, uline, strike;
 
@@ -1837,7 +1836,6 @@ conv_page(void)
 {
 	GtkWidget *ret;
 	GtkWidget *vbox;
-	GtkWidget *toolbar;
 	GtkWidget *iconpref1;
 	GtkWidget *iconpref2;
 	GtkWidget *webview;
@@ -1935,7 +1933,7 @@ conv_page(void)
 
 	vbox = pidgin_make_frame(ret, _("Default Formatting"));
 
-	frame = pidgin_create_webview(TRUE, &webview, &toolbar, NULL);
+	frame = pidgin_create_webview(TRUE, &webview, NULL);
 	gtk_widget_show(frame);
 	gtk_widget_set_name(webview, "pidgin_prefs_font_webview");
 	gtk_widget_set_size_request(frame, 450, -1);
@@ -1963,7 +1961,7 @@ conv_page(void)
 	                        PURPLE_CONNECTION_FORMATTING_WBFO);
 
 	g_signal_connect_after(G_OBJECT(webview), "format-toggled",
-	                       G_CALLBACK(formatting_toggle_cb), toolbar);
+	                       G_CALLBACK(formatting_toggle_cb), NULL);
 	g_signal_connect_after(G_OBJECT(webview), "format-cleared",
 	                       G_CALLBACK(formatting_clear_cb), NULL);
 	sample_webview = webview;
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -325,7 +325,6 @@ pidgin_request_input(const char *title, 
 	GtkWidget *label;
 	GtkWidget *entry;
 	GtkWidget *img;
-	GtkWidget *toolbar;
 	char *label_text;
 	char *primary_esc, *secondary_esc;
 
@@ -408,7 +407,7 @@ pidgin_request_input(const char *title, 
 		GtkWidget *frame;
 
 		/* webview */
-		frame = pidgin_create_webview(TRUE, &entry, &toolbar, NULL);
+		frame = pidgin_create_webview(TRUE, &entry, NULL);
 		gtk_widget_set_size_request(entry, 320, 130);
 		gtk_widget_set_name(entry, "pidgin_request_webview");
 		if (default_value != NULL)
diff --git a/pidgin/gtksavedstatuses.c b/pidgin/gtksavedstatuses.c
--- a/pidgin/gtksavedstatuses.c
+++ b/pidgin/gtksavedstatuses.c
@@ -39,7 +39,6 @@
 #include "pidginstock.h"
 #include "gtkutils.h"
 #include "gtkwebview.h"
-#include "gtkwebviewtoolbar.h"
 
 #include "gtk3compat.h"
 
@@ -132,7 +131,6 @@ typedef struct
 	GtkListStore *model;
 	GtkComboBox *box;
 	GtkWebView *message;
-	GtkWebViewToolbar *toolbar;
 } SubStatusEditor;
 
 static StatusWindow *status_window = NULL;
@@ -1084,7 +1082,6 @@ pidgin_status_editor_show(gboolean edit,
 	GtkWidget *frame;
 	GtkWidget *hbox;
 	GtkWidget *text;
-	GtkWidget *toolbar;
 	GtkWidget *vbox;
 	GtkWidget *win;
 	GList *focus_chain = NULL;
@@ -1149,7 +1146,7 @@ pidgin_status_editor_show(gboolean edit,
 	pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Status:"), sg, dropdown, TRUE, NULL);
 



More information about the Commits mailing list