Merge lp:~kalikiana/midori/externally into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: André Stösel
Approved revision: 6228
Merged at revision: 6250
Proposed branch: lp:~kalikiana/midori/externally
Merge into: lp:midori
Diff against target: 122 lines (+49/-18)
2 files modified
midori/midori-browser.c (+27/-4)
midori/midori-view.c (+22/-14)
To merge this branch: bzr merge lp:~kalikiana/midori/externally
Reviewer Review Type Date Requested Status
André Stösel Approve
Review via email: mp+170913@code.launchpad.net

Commit message

Consistently open windows/ tabs in external browser/ new process

Description of the change

Consistently open windows/ tabs in external browser/ new process

To post a comment you must log in.
Revision history for this message
André Stösel (ivaldi) wrote :

The private mode part looks good and does work as I would expect, but the app mode part is kind of misleading.

If I'm using a none default profile, start some app and choose to open a link in a new window (in app mode), I woudln't expect midori do use my default profile to show this link.

Possible solutions:
 - detect which profiles are running and ask which one to use (especially when midori would start a new one)

PS: During testing there was a bug which causes midori to run the default profile twice, but I can't reproduce it -> I guess it was some kind of race condition in some lib

Revision history for this message
Cris Dywan (kalikiana) wrote :

My expectation was to always launch the default browser which doesn't strictly even have to be Midori. Further more we have no concept of an "active" profile, the default is - as of yet - always the original in ~/.config/midori .

Revision history for this message
Cris Dywan (kalikiana) wrote :

In fact I would consider this as a new feature if you want something like a profile dialog or switching - not to say those are bad ideas but I don't see that as a requirement for what I want to solve here.

Revision history for this message
André Stösel (ivaldi) wrote :

Hm... the caption is still misleading. We could change the text from "Open Link in New Window" to "Open Link" in app mode!?

lp:~kalikiana/midori/externally updated
6227. By Cris Dywan

Only show "Open Link in New Tab" in app mode

Revision history for this message
André Stösel (ivaldi) wrote :

The "in New Tab" part of the label is still confusing and we should change it to "Open Link".
(Same text as in the xfce terminal.)

review: Needs Fixing
lp:~kalikiana/midori/externally updated
6228. By Cris Dywan

Rename menu item to Open Link in app mode

Revision history for this message
André Stösel (ivaldi) wrote :

Looks good.

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 2013-07-01 20:20:53 +0000
3+++ midori/midori-browser.c 2013-07-04 20:33:29 +0000
4@@ -1318,12 +1318,29 @@
5 }
6 }
7
8+static bool
9+midori_view_forward_external (GtkWidget* view,
10+ const gchar* uri)
11+{
12+ if (midori_paths_get_runtime_mode () == MIDORI_RUNTIME_MODE_APP)
13+ return sokoke_show_uri (gtk_widget_get_screen (view), uri, 0, NULL);
14+ else if (midori_paths_get_runtime_mode () == MIDORI_RUNTIME_MODE_PRIVATE)
15+ {
16+ sokoke_spawn_app (uri, TRUE);
17+ return TRUE;
18+ }
19+ return FALSE;
20+}
21+
22 static void
23 midori_view_new_tab_cb (GtkWidget* view,
24 const gchar* uri,
25 gboolean background,
26 MidoriBrowser* browser)
27 {
28+ if (midori_view_forward_external (view, uri))
29+ return;
30+
31 GtkWidget* new_view = midori_browser_add_uri (browser, uri);
32 midori_browser_view_copy_history (new_view, view, FALSE);
33
34@@ -1338,12 +1355,13 @@
35 const gchar* uri,
36 MidoriBrowser* browser)
37 {
38+ if (midori_view_forward_external (view, uri))
39+ return;
40+
41 MidoriBrowser* new_browser;
42 g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
43- if (new_browser)
44- midori_browser_add_uri (new_browser, uri);
45- else /* No MidoriApp, so this is app or private mode */
46- sokoke_spawn_app (uri, TRUE);
47+ g_assert (new_browser != NULL);
48+ midori_view_new_tab_cb (view, uri, FALSE, new_browser);
49 }
50
51 static void
52@@ -1353,11 +1371,16 @@
53 gboolean user_initiated,
54 MidoriBrowser* browser)
55 {
56+ if (midori_view_forward_external (new_view,
57+ katze_item_get_uri (midori_view_get_proxy_item (MIDORI_VIEW (new_view)))))
58+ return;
59+
60 midori_browser_view_copy_history (new_view, view, TRUE);
61 if (where == MIDORI_NEW_VIEW_WINDOW)
62 {
63 MidoriBrowser* new_browser;
64 g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
65+ g_assert (new_browser != NULL);
66 midori_browser_add_tab (new_browser, new_view);
67 midori_browser_set_current_tab (new_browser, new_view);
68 }
69
70=== modified file 'midori/midori-view.c'
71--- midori/midori-view.c 2013-07-01 20:20:33 +0000
72+++ midori/midori-view.c 2013-07-04 20:33:29 +0000
73@@ -2471,19 +2471,25 @@
74 }
75 if (view->link_uri)
76 {
77- if (!midori_view_always_same_tab (view->link_uri))
78- {
79- midori_view_insert_menu_item (menu_shell, -1,
80- _("Open Link in New _Tab"), STOCK_TAB_NEW,
81- G_CALLBACK (midori_web_view_menu_new_tab_activate_cb), widget);
82- midori_view_insert_menu_item (menu_shell, -1,
83- view->open_tabs_in_the_background
84- ? _("Open Link in _Foreground Tab")
85- : _("Open Link in _Background Tab"), NULL,
86- G_CALLBACK (midori_web_view_menu_background_tab_activate_cb), widget);
87- midori_view_insert_menu_item (menu_shell, -1,
88- _("Open Link in New _Window"), STOCK_WINDOW_NEW,
89- G_CALLBACK (midori_web_view_menu_new_window_activate_cb), widget);
90+ if (midori_paths_get_runtime_mode () == MIDORI_RUNTIME_MODE_APP)
91+ {
92+ midori_view_insert_menu_item (menu_shell, -1,
93+ _("Open _Link"), STOCK_TAB_NEW,
94+ G_CALLBACK (midori_web_view_menu_new_tab_activate_cb), widget);
95+ }
96+ else if (!midori_view_always_same_tab (view->link_uri))
97+ {
98+ midori_view_insert_menu_item (menu_shell, -1,
99+ _("Open Link in New _Tab"), STOCK_TAB_NEW,
100+ G_CALLBACK (midori_web_view_menu_new_tab_activate_cb), widget);
101+ midori_view_insert_menu_item (menu_shell, -1,
102+ view->open_tabs_in_the_background
103+ ? _("Open Link in _Foreground Tab")
104+ : _("Open Link in _Background Tab"), NULL,
105+ G_CALLBACK (midori_web_view_menu_background_tab_activate_cb), widget);
106+ midori_view_insert_menu_item (menu_shell, -1,
107+ _("Open Link in New _Window"), STOCK_WINDOW_NEW,
108+ G_CALLBACK (midori_web_view_menu_new_window_activate_cb), widget);
109 }
110
111 midori_view_insert_menu_item (menu_shell, -1,
112@@ -2789,7 +2795,9 @@
113 new_view = view;
114 else
115 {
116- new_view = (MidoriView*)midori_view_new_with_item (NULL, view->settings);
117+ KatzeItem* item = katze_item_new ();
118+ item->uri = g_strdup (webkit_web_frame_get_uri (web_frame));
119+ new_view = (MidoriView*)midori_view_new_with_item (item, view->settings);
120 g_signal_connect (new_view->web_view, "web-view-ready",
121 G_CALLBACK (webkit_web_view_web_view_ready_cb), view);
122 }

Subscribers

People subscribed via source and target branches

to all changes: