[balsa/gtk3] Manage "select all" better
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Manage "select all" better
- Date: Mon, 8 Apr 2013 22:30:49 +0000 (UTC)
commit af0ad3cc2f75708e055929d8232a3b12d1920c48
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Mon Apr 8 17:12:26 2013 -0400
Manage "select all" better
* libbalsa/html.c (lbh_get_web_view): can-select and select-all
sometimes pass the web-view and sometimes the container.
* src/balsa-mime-widget-text.c (bm_select_all_cb),
(bmwt_populate_popup_menu): add "select all" to the
webKitWebView context menu, the same as for a GtkTextView
ChangeLog | 8 ++++++++
libbalsa/html.c | 12 +++++++++---
src/balsa-mime-widget-text.c | 16 ++++++++++++++++
3 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 34e6bae..be2dff2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2013-04-08 Peter Bloomfield
+ * libbalsa/html.c (lbh_get_web_view): can-select and select-all
+ sometimes pass the web-view and sometimes the container.
+ * src/balsa-mime-widget-text.c (bm_select_all_cb),
+ (bmwt_populate_popup_menu): add "select all" to the
+ webKitWebView context menu, the same as for a GtkTextView
+
+2013-04-08 Peter Bloomfield
+
* libbalsa/html.c (lbh_context_menu_cb): pass the GdkEvent when
emitting "popup-menu";
* libbalsa/html.h: define key for GdkEvent.
diff --git a/libbalsa/html.c b/libbalsa/html.c
index 8ce4955..f0659c8 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -561,13 +561,19 @@ libbalsa_html_to_string(gchar ** text, size_t len)
* it to an empty string. */
}
+/*
+ * We may be passed either the WebKitWebView or its container:
+ */
static gboolean
lbh_get_web_view(GtkWidget * widget, WebKitWebView ** web_view)
{
- *web_view =
- g_object_get_data(G_OBJECT(widget), "libbalsa-html-web-view");
+ if (!WEBKIT_IS_WEB_VIEW(widget))
+ widget =
+ g_object_get_data(G_OBJECT(widget), "libbalsa-html-web-view");
- return *web_view && WEBKIT_IS_WEB_VIEW(*web_view);
+ *web_view = (WebKitWebView *) widget;
+
+ return WEBKIT_IS_WEB_VIEW(*web_view);
}
/*
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index 1d3c844..b15e85d 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -1032,6 +1032,12 @@ bm_zoom_reset(BalsaMessage * bm)
}
static void
+bm_select_all_cb(GtkWidget * html)
+{
+ libbalsa_html_select_all(html);
+}
+
+static void
bmwt_populate_popup_menu(BalsaMessage * bm,
GtkWidget * html,
GtkMenu * menu)
@@ -1059,6 +1065,16 @@ bmwt_populate_popup_menu(BalsaMessage * bm,
menuitem = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+ if (libbalsa_html_can_select(html)) {
+ menuitem = gtk_menu_item_new_with_mnemonic(_("Select _All"));
+ g_signal_connect_swapped(G_OBJECT(menuitem), "activate",
+ G_CALLBACK(bm_select_all_cb), html);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+
+ menuitem = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+ }
+
libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(menu), "text/html",
G_CALLBACK
(balsa_mime_widget_ctx_menu_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]