Merge lp:~fjkong/gnome-terminal/gnome-terminal into lp:gnome-terminal

Proposed by FanJun Kong - ( BH1SCW )
Status: Needs review
Proposed branch: lp:~fjkong/gnome-terminal/gnome-terminal
Merge into: lp:gnome-terminal
Diff against target: 84 lines (+26/-1)
4 files modified
src/terminal-util.c (+1/-1)
src/terminal-util.h (+4/-0)
src/terminal-window.c (+20/-0)
src/terminal.xml (+1/-0)
To merge this branch: bzr merge lp:~fjkong/gnome-terminal/gnome-terminal
Reviewer Review Type Date Requested Status
VCS imports Pending
Review via email: mp+238074@code.launchpad.net

Commit message

add search on google to right click menu

Description of the change

add search on google to right click menu

To post a comment you must log in.

Unmerged revisions

5100. By FanJun Kong - ( BH1SCW )

add search by google to right click menu

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/terminal-util.c'
2--- src/terminal-util.c 2014-03-03 20:41:33 +0000
3+++ src/terminal-util.c 2014-10-12 12:59:18 +0000
4@@ -112,7 +112,7 @@
5 }
6 }
7
8-static gboolean
9+gboolean
10 open_url (GtkWindow *parent,
11 const char *uri,
12 guint32 user_time,
13
14=== modified file 'src/terminal-util.h'
15--- src/terminal-util.h 2014-07-03 09:24:07 +0000
16+++ src/terminal-util.h 2014-10-12 12:59:18 +0000
17@@ -40,6 +40,10 @@
18 void terminal_util_set_atk_name_description (GtkWidget *widget,
19 const char *name,
20 const char *desc);
21+gboolean open_url (GtkWindow *parent,
22+ const char* uri,
23+ guint32 user_time,
24+ GError **error);
25
26 void terminal_util_open_url (GtkWidget *parent,
27 const char *orig_url,
28
29=== modified file 'src/terminal-window.c'
30--- src/terminal-window.c 2014-08-21 17:29:40 +0000
31+++ src/terminal-window.c 2014-10-12 12:59:18 +0000
32@@ -1923,6 +1923,20 @@
33 }
34
35 static void
36+search_on_google_callback (GtkAction *action,
37+ TerminalWindow *window)
38+{
39+ gchar *url;
40+ GtkClipboard *clipboard;
41+
42+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_PRIMARY);
43+ url = g_strdup_printf ("http://www.google.com/search?ie=UTF-8&q=%s", gtk_clipboard_wait_for_text(clipboard));
44+ open_url (GTK_WINDOW (window), url, gtk_get_current_event_time (), NULL);
45+
46+ g_free(url);
47+}
48+
49+static void
50 popup_leave_fullscreen_callback (GtkAction *action,
51 TerminalWindow *window)
52 {
53@@ -2028,6 +2042,9 @@
54 gtk_action_set_visible (action, show_link);
55 action = gtk_action_group_get_action (priv->action_group, "PopupCopyLinkAddress");
56 gtk_action_set_visible (action, show_link);
57+ action = gtk_action_group_get_action (priv->action_group, "PopupSearchOnGoogle");
58+ gtk_action_set_visible (action, vte_terminal_get_has_selection (VTE_TERMINAL (screen)));
59+
60
61 action = gtk_action_group_get_action (priv->action_group, "PopupCopy");
62 gtk_action_set_sensitive (action, vte_terminal_get_has_selection (VTE_TERMINAL (screen)));
63@@ -2511,6 +2528,9 @@
64 { "PopupCopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
65 NULL,
66 G_CALLBACK (popup_copy_url_callback) },
67+ { "PopupSearchOnGoogle", NULL, N_("_Search On Google"), NULL,
68+ NULL,
69+ G_CALLBACK (search_on_google_callback) },
70 { "PopupTerminalProfiles", NULL, N_("P_rofiles") },
71 { "PopupCopy", "edit-copy", N_("Copy"), "",
72 NULL,
73
74=== modified file 'src/terminal.xml'
75--- src/terminal.xml 2014-04-18 09:43:39 +0000
76+++ src/terminal.xml 2014-10-12 12:59:18 +0000
77@@ -82,6 +82,7 @@
78 <menuitem action="PopupCopyCallAddress" />
79 <menuitem action="PopupOpenLink" />
80 <menuitem action="PopupCopyLinkAddress" />
81+ <menuitem action="PopupSearchOnGoogle" />
82 <separator />
83 <menuitem action="PopupNewTerminal" />
84 <separator />

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: