/pidgin/main: 0c8cfc86bdc2: Add method for activating GtkWebView...

Elliott Sales de Andrade qulogic at pidgin.im
Tue Aug 14 04:03:26 EDT 2012


Changeset: 0c8cfc86bdc2d2eae93cac8c02718b044ca5803e
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-08-13 03:43 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/0c8cfc86bdc2

Description:

Add method for activating GtkWebViewToolbar items.

diffstat:

 pidgin/gtkwebviewtoolbar.c |  85 ++++++++++++++++++++++++++++++++++++++++++++++
 pidgin/gtkwebviewtoolbar.h |  30 ++++++++++++++++
 2 files changed, 115 insertions(+), 0 deletions(-)

diffs (139 lines):

diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c
--- a/pidgin/gtkwebviewtoolbar.c
+++ b/pidgin/gtkwebviewtoolbar.c
@@ -1637,3 +1637,88 @@ gtk_webviewtoolbar_switch_active_convers
 		PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL);
 }
 
+void
+gtk_webviewtoolbar_activate(GtkWebViewToolbar *toolbar,
+                            GtkWebViewToolbarAction action)
+{
+	GtkWebViewToolbarPriv *priv;
+	GtkAction *act;
+
+	g_return_if_fail(toolbar != NULL);
+
+	priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
+	switch (action) {
+		case GTK_WEBVIEWTOOLBAR_ACTION_BOLD:
+			act = priv->bold;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_ITALIC:
+			act = priv->italic;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_UNDERLINE:
+			act = priv->underline;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_STRIKE:
+			act = priv->strike;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_LARGER:
+			act = priv->larger_size;
+			break;
+
+#if 0
+		case GTK_WEBVIEWTOOLBAR_ACTION_NORMAL:
+			act = priv->normal_size;
+			break;
+#endif
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_SMALLER:
+			act = priv->smaller_size;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_FONTFACE:
+			act = priv->font;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_FGCOLOR:
+			act = priv->fgcolor;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_BGCOLOR:
+			act = priv->bgcolor;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_CLEAR:
+			act = priv->clear;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_IMAGE:
+			act = priv->image;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_LINK:
+			act = priv->link;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_HR:
+			act = priv->hr;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_SMILEY:
+			act = priv->smiley;
+			break;
+
+		case GTK_WEBVIEWTOOLBAR_ACTION_ATTENTION:
+			act = priv->attention;
+			break;
+
+		default:
+			g_return_if_reached();
+			break;
+	}
+
+	gtk_action_activate(act);
+}
+
diff --git a/pidgin/gtkwebviewtoolbar.h b/pidgin/gtkwebviewtoolbar.h
--- a/pidgin/gtkwebviewtoolbar.h
+++ b/pidgin/gtkwebviewtoolbar.h
@@ -35,6 +35,27 @@
 #define GTK_IS_WEBVIEWTOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEWTOOLBAR))
 #define GTK_WEBVIEWTOOLBAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarClass))
 
+typedef enum {
+	GTK_WEBVIEWTOOLBAR_ACTION_BOLD,
+	GTK_WEBVIEWTOOLBAR_ACTION_ITALIC,
+	GTK_WEBVIEWTOOLBAR_ACTION_UNDERLINE,
+	GTK_WEBVIEWTOOLBAR_ACTION_STRIKE,
+	GTK_WEBVIEWTOOLBAR_ACTION_LARGER,
+#if 0
+	GTK_WEBVIEWTOOLBAR_ACTION_NORMAL,
+#endif
+	GTK_WEBVIEWTOOLBAR_ACTION_SMALLER,
+	GTK_WEBVIEWTOOLBAR_ACTION_FONTFACE,
+	GTK_WEBVIEWTOOLBAR_ACTION_FGCOLOR,
+	GTK_WEBVIEWTOOLBAR_ACTION_BGCOLOR,
+	GTK_WEBVIEWTOOLBAR_ACTION_CLEAR,
+	GTK_WEBVIEWTOOLBAR_ACTION_IMAGE,
+	GTK_WEBVIEWTOOLBAR_ACTION_LINK,
+	GTK_WEBVIEWTOOLBAR_ACTION_HR,
+	GTK_WEBVIEWTOOLBAR_ACTION_SMILEY,
+	GTK_WEBVIEWTOOLBAR_ACTION_ATTENTION
+} GtkWebViewToolbarAction;
+
 typedef struct _GtkWebViewToolbar GtkWebViewToolbar;
 typedef struct _GtkWebViewToolbarClass GtkWebViewToolbarClass;
 
@@ -90,6 +111,15 @@ void gtk_webviewtoolbar_associate_smiley
 void gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar,
                                                    PurpleConversation *conv);
 
+/**
+ * Activate a GtkWebViewToolbar action
+ *
+ * @param toolbar The GtkWebViewToolbar object
+ * @param action  The GtkWebViewToolbarAction
+ */
+void gtk_webviewtoolbar_activate(GtkWebViewToolbar *toolbar,
+                                 GtkWebViewToolbarAction action);
+
 G_END_DECLS
 
 #endif /* _PIDGINWEBVIEWTOOLBAR_H_ */



More information about the Commits mailing list