Merge lp:~midori/midori/sendByEmail into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6430
Merged at revision: 6579
Proposed branch: lp:~midori/midori/sendByEmail
Merge into: lp:midori
Diff against target: 76 lines (+23/-2)
1 file modified
midori/midori-browser.c (+23/-2)
To merge this branch: bzr merge lp:~midori/midori/sendByEmail
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+208484@code.launchpad.net

Commit message

Implement Send Page Link by Email

Description of the change

TODO:
 - unit test

To post a comment you must log in.
Revision history for this message
Paweł Forysiuk (tuxator) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-browser.c'
2--- midori/midori-browser.c 2014-02-26 22:15:36 +0000
3+++ midori/midori-browser.c 2014-03-01 12:09:49 +0000
4@@ -289,6 +289,7 @@
5
6 _action_set_sensitive (browser, "AddSpeedDial", !midori_view_is_blank (view));
7 _action_set_sensitive (browser, "BookmarkAdd", !midori_view_is_blank (view));
8+ _action_set_sensitive (browser, "MailTo", !midori_view_is_blank (view));
9 _action_set_sensitive (browser, "SaveAs", midori_tab_can_save (MIDORI_TAB (view)));
10 _action_set_sensitive (browser, "ZoomIn", midori_view_can_zoom_in (view));
11 _action_set_sensitive (browser, "ZoomOut", midori_view_can_zoom_out (view));
12@@ -885,14 +886,14 @@
13 gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
14
15 renderer = gtk_cell_renderer_pixbuf_new ();
16- g_object_set (G_OBJECT (renderer),
17+ g_object_set (G_OBJECT (renderer),
18 "stock-id", GTK_STOCK_DIRECTORY,
19 "stock-size", GTK_ICON_SIZE_MENU,
20 NULL);
21 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
22
23 renderer = katze_cell_renderer_combobox_text_new ();
24- g_object_set (G_OBJECT (renderer),
25+ g_object_set (G_OBJECT (renderer),
26 "width-chars", 40, /* FIXME: figure out a way to define an acceptable string length */
27 "ellipsize", PANGO_ELLIPSIZE_END,
28 "unfolded-text", _("Select [text]"),
29@@ -2733,6 +2734,21 @@
30 }
31
32 static void
33+_action_mail_to_activate (GtkAction* action,
34+ MidoriBrowser* browser)
35+{
36+ MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));
37+ gchar* uri = g_uri_escape_string (midori_view_get_display_uri (view), NULL, TRUE);
38+ gchar* title = g_uri_escape_string (midori_view_get_display_title (view), NULL, TRUE);
39+ gchar* mailto = g_strconcat ("mailto:?cc=&bcc=&subject=", title, "&body=", uri, NULL);
40+ gboolean handled = FALSE;
41+ g_signal_emit_by_name (view, "open-uri", mailto, &handled);
42+ g_free (mailto);
43+ g_free (title);
44+ g_free (uri);
45+}
46+
47+static void
48 _action_print_activate (GtkAction* action,
49 MidoriBrowser* browser)
50 {
51@@ -3217,6 +3233,7 @@
52 midori_context_action_add_by_name (menu, "Find");
53 midori_context_action_add_by_name (menu, "Print");
54 midori_context_action_add_by_name (menu, "Fullscreen");
55+ midori_context_action_add_by_name (menu, "MailTo");
56 midori_context_action_add (menu, NULL);
57 gsize j = 0;
58 GtkWidget* widget;
59@@ -5073,6 +5090,9 @@
60 { "Print", GTK_STOCK_PRINT,
61 NULL, "<Ctrl>p",
62 N_("Print the current page"), G_CALLBACK (_action_print_activate) },
63+ { "MailTo", NULL,
64+ N_("Send Page Link Via Email"), "<Ctrl>m",
65+ NULL, G_CALLBACK (_action_mail_to_activate) },
66 { "Quit", GTK_STOCK_QUIT,
67 N_("Close a_ll Windows"), "<Ctrl><Shift>q",
68 NULL, G_CALLBACK (_action_quit_activate) },
69@@ -5476,6 +5496,7 @@
70 "<menuitem action='TabClose'/>"
71 "<menuitem action='WindowClose'/>"
72 "<separator/>"
73+ "<menuitem action='MailTo'/>"
74 "<menuitem action='Print'/>"
75 "<separator/>"
76 "<menuitem action='Quit'/>"

Subscribers

People subscribed via source and target branches

to all changes: