Merge lp:~midori/midori/aboriginaltabs into lp:midori

Proposed by Christian Dywan
Status: Work in progress
Proposed branch: lp:~midori/midori/aboriginaltabs
Merge into: lp:midori
Diff against target: 654 lines (+137/-146)
7 files modified
extensions/external-download-manager.vala (+1/-1)
extensions/tabby.vala (+5/-5)
midori/marshal.list (+1/-0)
midori/midori-browser.c (+86/-36)
midori/midori-tab.vala (+11/-0)
midori/midori-view.c (+32/-103)
midori/midori.vapi (+1/-1)
To merge this branch: bzr merge lp:~midori/midori/aboriginaltabs
Reviewer Review Type Date Requested Status
Midori Devs Pending
Review via email: mp+191516@code.launchpad.net

Commit message

Implement create-tab signal and handle non-View tabs

Description of the change

Not quite happy with the work-arounds for the API and the browse change is slightly untidy. But this works (tm) and gives an idea of what native tabs are like.

To post a comment you must log in.

Unmerged revisions

6439. By Christian Dywan

Don't handle sorting in non-View tabs

6438. By Christian Dywan

Implement create-tab signal and handle non-View tabs

6437. By Christian Dywan

Move new-tab/window/view and download_requested to Midori.Tab

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/external-download-manager.vala'
2--- extensions/external-download-manager.vala 2013-05-26 18:18:40 +0000
3+++ extensions/external-download-manager.vala 2013-10-16 21:56:27 +0000
4@@ -36,7 +36,7 @@
5 private CookieJar cookie_jar;
6 private GLib.PtrArray download_managers = new GLib.PtrArray ();
7
8- public bool download_requested (Midori.View view, WebKit.Download download) {
9+ public bool download_requested (WebKit.Download download) {
10 Midori.DownloadType download_type = download.get_data<Midori.DownloadType> ("midori-download-type");
11
12 if (download_type == Midori.DownloadType.SAVE) {
13
14=== modified file 'extensions/tabby.vala'
15--- extensions/tabby.vala 2013-10-15 18:12:34 +0000
16+++ extensions/tabby.vala 2013-10-16 21:56:27 +0000
17@@ -272,14 +272,14 @@
18
19 this.browser.notebook.page_reordered.disconnect (this.tab_reordered);
20 for(var i = 0; i < new_tabs.len; i++) {
21- Midori.View tab = new_tabs.index(i) as Midori.View;
22-
23- unowned Katze.Item item = tab.get_proxy_item ();
24+ Midori.Tab tab = new_tabs.index(i) as Midori.Tab;
25+ string? sorting_string = null;
26+ if (tab is Midori.View)
27+ sorting_string = (tab as Midori.View).get_proxy_item ().get_meta_string ("sorting");
28
29 double? sorting;
30- string? sorting_string = item.get_meta_string ("sorting");
31 if (sorting_string != null) { /* we have to use a seperate if condition to avoid a `possibly unassigned local variable` error */
32- if (double.try_parse (item.get_meta_string ("sorting"), out sorting)) {
33+ if (double.try_parse (sorting_string, out sorting)) {
34 this.tab_sorting.insert_sorted_with_data (sorting, helper_compare_data);
35
36 int index = this.tab_sorting.position (this.tab_sorting.find_custom (sorting, helper_compare_func));
37
38=== modified file 'midori/marshal.list'
39--- midori/marshal.list 2013-09-03 14:45:17 +0000
40+++ midori/marshal.list 2013-10-16 21:56:27 +0000
41@@ -4,6 +4,7 @@
42 BOOLEAN:VOID
43 BOOLEAN:STRING
44 OBJECT:OBJECT
45+OBJECT:STRING
46 VOID:BOOLEAN,STRING
47 VOID:OBJECT,ENUM,BOOLEAN
48 VOID:OBJECT,INT,INT
49
50=== modified file 'midori/midori-browser.c'
51--- midori/midori-browser.c 2013-09-17 19:34:23 +0000
52+++ midori/midori-browser.c 2013-10-16 21:56:27 +0000
53@@ -130,6 +130,7 @@
54 enum
55 {
56 NEW_WINDOW,
57+ CREATE_TAB,
58 ADD_TAB,
59 REMOVE_TAB,
60 MOVE_TAB,
61@@ -293,20 +294,24 @@
62 {
63 GtkAction* action;
64
65- _action_set_sensitive (browser, "Back", midori_view_can_go_back (view));
66 _action_set_sensitive (browser, "Forward", midori_tab_can_go_forward (MIDORI_TAB (view)));
67- _action_set_sensitive (browser, "Previous",
68- midori_view_get_previous_page (view) != NULL);
69- _action_set_sensitive (browser, "Next",
70- midori_view_get_next_page (view) != NULL);
71-
72- _action_set_sensitive (browser, "AddSpeedDial", !midori_view_is_blank (view));
73- _action_set_sensitive (browser, "BookmarkAdd", !midori_view_is_blank (view));
74+ _action_set_sensitive (browser, "BookmarkAdd", !midori_tab_is_blank (view));
75 _action_set_sensitive (browser, "SaveAs", midori_tab_can_save (MIDORI_TAB (view)));
76- _action_set_sensitive (browser, "ZoomIn", midori_view_can_zoom_in (view));
77- _action_set_sensitive (browser, "ZoomOut", midori_view_can_zoom_out (view));
78- _action_set_sensitive (browser, "ZoomNormal",
79- midori_view_get_zoom_level (view) != 1.0f);
80+
81+ if (MIDORI_IS_VIEW (view))
82+ {
83+ _action_set_sensitive (browser, "Back", midori_view_can_go_back (view));
84+ _action_set_sensitive (browser, "Previous",
85+ midori_view_get_previous_page (view) != NULL);
86+ _action_set_sensitive (browser, "Next",
87+ midori_view_get_next_page (view) != NULL);
88+
89+ _action_set_sensitive (browser, "ZoomIn", midori_view_can_zoom_in (view));
90+ _action_set_sensitive (browser, "ZoomOut", midori_view_can_zoom_out (view));
91+ _action_set_sensitive (browser, "ZoomNormal",
92+ midori_view_get_zoom_level (view) != 1.0f);
93+ }
94+
95 _action_set_sensitive (browser, "Encoding",
96 midori_tab_can_view_source (MIDORI_TAB (view)));
97 _action_set_sensitive (browser, "SourceView",
98@@ -325,7 +330,7 @@
99 g_object_set (action,
100 "stock-id", GTK_STOCK_MEDIA_NEXT,
101 "tooltip", _("Go to the next sub-page"),
102- "sensitive", midori_view_get_next_page (view) != NULL, NULL);
103+ "sensitive", MIDORI_IS_VIEW (view) ? midori_view_get_next_page (view) != NULL : FALSE, NULL);
104 }
105
106 action = _action_by_name (browser, "Location");
107@@ -424,7 +429,7 @@
108 MidoriView* view)
109 {
110 GtkAction* action;
111- gdouble progress = midori_view_get_progress (view);
112+ gdouble progress = midori_tab_get_progress (MIDORI_TAB (view));
113 gboolean loading = progress > 0.0;
114
115 action = _action_by_name (browser, "Location");
116@@ -1807,7 +1812,7 @@
117 _midori_browser_remove_tab (MidoriBrowser* browser,
118 GtkWidget* widget)
119 {
120- MidoriView* view = MIDORI_VIEW (widget);
121+ MidoriView* view = MIDORI_TAB (widget);
122 #ifdef HAVE_GRANITE
123 granite_widgets_dynamic_notebook_remove_tab (
124 GRANITE_WIDGETS_DYNAMIC_NOTEBOOK (browser->notebook), midori_view_get_tab (view));
125@@ -1881,7 +1886,7 @@
126 midori_browser_connect_tab (MidoriBrowser* browser,
127 GtkWidget* view)
128 {
129- KatzeItem* item = midori_view_get_proxy_item (MIDORI_VIEW (view));
130+ KatzeItem* item = midori_view_get_proxy_item ((MidoriView*)view);
131 katze_array_add_item (browser->proxy_array, item);
132
133 gtk_widget_set_can_focus (view, TRUE);
134@@ -1930,7 +1935,7 @@
135 KatzeItem* item = midori_view_get_proxy_item (view);
136 if (katze_array_get_item_index (browser->proxy_array, item) != -1)
137 {
138- if (!midori_view_is_blank (view))
139+ if (!midori_tab_is_blank (MIDORI_TAB (view)))
140 {
141 if (browser->trash)
142 katze_array_add_item (browser->trash, item);
143@@ -2001,12 +2006,13 @@
144 GtkWidget* view)
145 {
146 GtkWidget* notebook = browser->notebook;
147- KatzeItem* item = midori_view_get_proxy_item (MIDORI_VIEW (view));
148+ KatzeItem* item = midori_view_get_proxy_item ((MidoriView*)view);
149 #ifndef HAVE_GRANITE
150 GtkWidget* tab_label;
151 #endif
152 guint n;
153
154+ gtk_widget_show (view);
155 midori_browser_connect_tab (browser, view);
156
157 if (!katze_item_get_meta_boolean (item, "append") &&
158@@ -2024,7 +2030,7 @@
159 GRANITE_WIDGETS_DYNAMIC_NOTEBOOK (notebook),
160 midori_view_get_tab (MIDORI_VIEW (view)), n);
161 #else
162- tab_label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
163+ tab_label = MIDORI_IS_VIEW (view) ? midori_view_get_proxy_tab_label (MIDORI_VIEW (view)) : NULL;
164 /* Don't resize empty bin, which is used for thumbnail tabs */
165 if (GTK_IS_BIN (tab_label) && gtk_bin_get_child (GTK_BIN (tab_label))
166 && !katze_object_get_boolean (view, "minimized"))
167@@ -2175,6 +2181,29 @@
168 MIDORI_TYPE_BROWSER, 1,
169 MIDORI_TYPE_BROWSER);
170
171+ /**
172+ * MidoriBrowser::create-tab:
173+ * @browser: the object on which the signal is emitted
174+ * @tab: a new tab, or %NULL
175+ *
176+ * Emitted when a new tab is going to be created. Implement
177+ * this signal to provide custom tabs.
178+ * Since: 0.5.6
179+ *
180+ * Return value: a new #MidoriTab
181+ */
182+ signals[CREATE_TAB] = g_signal_new (
183+ "create-tab",
184+ G_TYPE_FROM_CLASS (class),
185+ (GSignalFlags)(G_SIGNAL_RUN_LAST),
186+ 0,
187+ 0,
188+ NULL,
189+ midori_cclosure_marshal_OBJECT__STRING,
190+ MIDORI_TYPE_TAB, 1,
191+ G_TYPE_STRING);
192+
193+
194 signals[ADD_TAB] = g_signal_new (
195 "add-tab",
196 G_TYPE_FROM_CLASS (class),
197@@ -3910,7 +3939,7 @@
198 if (!browser->show_navigationbar || midori_browser_is_fullscreen (browser))
199 gtk_widget_hide (browser->navigationbar);
200
201- midori_browser_update_secondary_icon (browser, MIDORI_VIEW (view), action);
202+ midori_browser_update_secondary_icon (browser, view, action);
203 }
204
205 static void
206@@ -5018,7 +5047,7 @@
207 static void
208 midori_browser_switched_tab (MidoriBrowser* browser,
209 GtkWidget* old_widget,
210- MidoriView* new_view,
211+ MidoriTab* new_view,
212 gint new_page)
213 {
214 GtkAction* action;
215@@ -5039,15 +5068,16 @@
216 return;
217 }
218
219- g_return_if_fail (MIDORI_IS_VIEW (new_view));
220+ g_return_if_fail (MIDORI_IS_TAB (new_view));
221
222 uri = g_object_get_data (G_OBJECT (new_view), "midori-browser-typed-text");
223 if (!uri)
224- uri = midori_view_get_display_uri (new_view);
225- midori_browser_set_title (browser, midori_view_get_display_title (new_view));
226+ uri = midori_tab_get_uri (new_view);
227+ midori_browser_set_title (browser, MIDORI_IS_VIEW (new_view) ? midori_view_get_display_title (new_view) : uri);
228 action = _action_by_name (browser, "Location");
229 midori_location_action_set_text (MIDORI_LOCATION_ACTION (action), uri);
230- if (midori_paths_get_runtime_mode () == MIDORI_RUNTIME_MODE_APP)
231+ if (midori_paths_get_runtime_mode () == MIDORI_RUNTIME_MODE_APP
232+ && MIDORI_IS_VIEW (new_view))
233 gtk_window_set_icon (GTK_WINDOW (browser), midori_view_get_icon (new_view));
234
235 if (browser->proxy_array)
236@@ -5194,10 +5224,10 @@
237 guint page_num,
238 MidoriBrowser* browser)
239 {
240- if (!midori_browser_tab_connected (browser, MIDORI_VIEW (child)))
241+ if (!midori_browser_tab_connected (browser, MIDORI_TAB (child)))
242 midori_browser_connect_tab (browser, child);
243 midori_browser_notebook_page_reordered_cb (GTK_WIDGET (notebook),
244- MIDORI_VIEW (child), page_num, browser);
245+ MIDORI_TAB (child), page_num, browser);
246 }
247
248 static void
249@@ -5208,7 +5238,7 @@
250 {
251 midori_browser_switched_tab (browser,
252 midori_browser_get_current_tab (browser),
253- MIDORI_VIEW (midori_browser_get_nth_tab (browser, page_num)), page_num);
254+ MIDORI_TAB (midori_browser_get_nth_tab (browser, page_num)), page_num);
255 }
256
257 static void
258@@ -5217,8 +5247,8 @@
259 guint page_num,
260 MidoriBrowser* browser)
261 {
262- if (midori_browser_tab_connected (browser, MIDORI_VIEW (view)))
263- midori_browser_disconnect_tab (browser, MIDORI_VIEW (view));
264+ if (midori_browser_tab_connected (browser, MIDORI_TAB (view)))
265+ midori_browser_disconnect_tab (browser, MIDORI_TAB (view));
266 midori_browser_notebook_size_allocate_cb (browser->notebook, NULL, browser);
267 }
268
269@@ -7421,7 +7451,7 @@
270 GtkWidget* view)
271 {
272 g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1);
273- g_return_val_if_fail (MIDORI_IS_VIEW (view), -1);
274+ g_return_val_if_fail (MIDORI_IS_TAB (view), -1);
275
276 #ifdef HAVE_GRANITE
277 return granite_widgets_dynamic_notebook_get_tab_position (
278@@ -7448,7 +7478,7 @@
279 g_return_if_fail (MIDORI_IS_BROWSER (browser));
280 g_return_if_fail (GTK_IS_WIDGET (view));
281
282- midori_browser_add_tab_to_trash (browser, MIDORI_VIEW (view));
283+ midori_browser_add_tab_to_trash (browser, MIDORI_TAB (view));
284 g_signal_emit (browser, signals[REMOVE_TAB], 0, view);
285 }
286
287@@ -7472,9 +7502,14 @@
288 g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
289
290 uri = katze_item_get_uri (item);
291- view = midori_view_new_with_item (item, browser->settings);
292+ /* Allow extensions to implement custom tabs */
293+ g_signal_emit (browser, signals[CREATE_TAB], 0, uri, &view);
294+ if (view == NULL)
295+ view = midori_view_new_with_item (item, browser->settings);
296 midori_browser_add_tab (browser, view);
297- midori_view_set_uri (MIDORI_VIEW (view), uri);
298+ /* The URI must be set after adding the tab */
299+ if (MIDORI_IS_VIEW (view))
300+ midori_view_set_uri (MIDORI_VIEW (view), uri);
301 return view;
302 }
303
304@@ -7632,7 +7667,22 @@
305 g_return_if_fail (MIDORI_IS_BROWSER (browser));
306 g_return_if_fail (uri != NULL);
307
308- midori_view_set_uri (MIDORI_VIEW (midori_browser_get_current_tab (browser)), uri);
309+ GtkWidget* view;
310+ /* Allow extensions to implement custom tabs */
311+ g_signal_emit (browser, signals[CREATE_TAB], 0, uri, &view);
312+ if (view != NULL)
313+ {
314+ gint page = midori_browser_get_current_page (browser);
315+ midori_browser_close_tab (browser, midori_browser_get_nth_tab (browser, page));
316+ // TODO: move new tab to existing page
317+ midori_browser_add_tab (browser, view);
318+ midori_browser_set_current_tab (browser, view);
319+ }
320+ else
321+ {
322+ view = midori_browser_get_current_tab (browser);
323+ midori_view_set_uri (MIDORI_VIEW (view), uri);
324+ }
325 }
326
327 /**
328@@ -7681,7 +7731,7 @@
329 #else
330 gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
331 #endif
332- if (midori_view_is_blank (MIDORI_VIEW (view)))
333+ if (midori_tab_is_blank (MIDORI_TAB (view)))
334 midori_browser_activate_action (browser, "Location");
335 else
336 gtk_widget_grab_focus (view);
337
338=== modified file 'midori/midori-tab.vala'
339--- midori/midori-tab.vala 2013-08-31 09:18:21 +0000
340+++ midori/midori-tab.vala 2013-10-16 21:56:27 +0000
341@@ -92,6 +92,17 @@
342 /* Since: 0.5.5 */
343 public signal void context_menu (WebKit.HitTestResult hit_test_result, ContextAction menu);
344
345+ public signal void new_tab (string uri, bool background);
346+ public signal void new_window (string uri);
347+ /* Since: 0.1.2
348+ Since: 0.3.4 a bool argument was added. */
349+ public signal void new_view (Tab view, NewView where, bool user_initiated);
350+ /* Emitted when a new download is requested, if a file cannot be shown
351+ or a download was initiated from the context menu.
352+ Returning @true causes the download to start otherwise it's cancelled.
353+ Since: 0.1.5 */
354+ public signal bool download_requested (WebKit.Download download);
355+
356 /* A dialog tab has a fixed size, limited GUI and is transient.
357 Since: 0.5.6 */
358 public bool is_dialog { get; protected set; }
359
360=== modified file 'midori/midori-view.c'
361--- midori/midori-view.c 2013-09-17 15:41:00 +0000
362+++ midori/midori-view.c 2013-10-16 21:56:27 +0000
363@@ -155,10 +155,6 @@
364 };
365
366 enum {
367- NEW_TAB,
368- NEW_WINDOW,
369- NEW_VIEW,
370- DOWNLOAD_REQUESTED,
371 ADD_BOOKMARK,
372 ABOUT_CONTENT,
373
374@@ -203,87 +199,6 @@
375 GtkWidgetClass* gtkwidget_class;
376 GParamFlags flags;
377
378- signals[NEW_TAB] = g_signal_new (
379- "new-tab",
380- G_TYPE_FROM_CLASS (class),
381- (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
382- 0,
383- 0,
384- NULL,
385- midori_cclosure_marshal_VOID__STRING_BOOLEAN,
386- G_TYPE_NONE, 2,
387- G_TYPE_STRING,
388- G_TYPE_BOOLEAN);
389-
390- signals[NEW_WINDOW] = g_signal_new (
391- "new-window",
392- G_TYPE_FROM_CLASS (class),
393- (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
394- 0,
395- 0,
396- NULL,
397- g_cclosure_marshal_VOID__STRING,
398- G_TYPE_NONE, 1,
399- G_TYPE_STRING);
400-
401- /**
402- * MidoriView::new-view:
403- * @view: the object on which the signal is emitted
404- * @new_view: a newly created view
405- * @where: where to open the view
406- * @user_initiated: %TRUE if the user actively opened the new view
407- *
408- * Emitted when a new view is created. The value of
409- * @where determines where to open the view according
410- * to how it was opened and user preferences.
411- *
412- * Since: 0.1.2
413- *
414- * Since 0.3.4 a boolean argument was added.
415- */
416- signals[NEW_VIEW] = g_signal_new (
417- "new-view",
418- G_TYPE_FROM_CLASS (class),
419- (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
420- 0,
421- 0,
422- NULL,
423- midori_cclosure_marshal_VOID__OBJECT_ENUM_BOOLEAN,
424- G_TYPE_NONE, 3,
425- MIDORI_TYPE_VIEW,
426- MIDORI_TYPE_NEW_VIEW,
427- G_TYPE_BOOLEAN);
428-
429- /**
430- * MidoriView::download-requested:
431- * @view: the object on which the signal is emitted
432- * @download: a new download
433- *
434- * Emitted when a new download is requested, if a
435- * file cannot be displayed or a download was started
436- * from the context menu.
437- *
438- * If the download should be accepted, a callback
439- * has to return %TRUE, and the download will also
440- * be started automatically.
441- *
442- * Note: This requires WebKitGTK 1.1.3.
443- *
444- * Return value: %TRUE if the download was handled
445- *
446- * Since: 0.1.5
447- */
448- signals[DOWNLOAD_REQUESTED] = g_signal_new (
449- "download-requested",
450- G_TYPE_FROM_CLASS (class),
451- (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
452- 0,
453- g_signal_accumulator_true_handled,
454- NULL,
455- midori_cclosure_marshal_BOOLEAN__OBJECT,
456- G_TYPE_BOOLEAN, 1,
457- G_TYPE_OBJECT);
458-
459 /**
460 * MidoriView::add-bookmark:
461 * @view: the object on which the signal is emitted
462@@ -1646,14 +1561,14 @@
463 background = view->open_tabs_in_the_background;
464 if (MIDORI_MOD_BACKGROUND (event->state))
465 background = !background;
466- g_signal_emit (view, signals[NEW_TAB], 0, link_uri, background);
467+ g_signal_emit_by_name (view, "new-tab", link_uri, background);
468 view->button_press_handled = TRUE;
469 return TRUE;
470 }
471 else if (MIDORI_MOD_NEW_WINDOW (event->state))
472 {
473 /* Open link in new window */
474- g_signal_emit (view, signals[NEW_WINDOW], 0, link_uri);
475+ g_signal_emit_by_name (view, "new-window", link_uri);
476 view->button_press_handled = TRUE;
477 return TRUE;
478 }
479@@ -1668,7 +1583,7 @@
480 background = view->open_tabs_in_the_background;
481 if (MIDORI_MOD_BACKGROUND (event->state))
482 background = !background;
483- g_signal_emit (view, signals[NEW_TAB], 0, link_uri, background);
484+ g_signal_emit_by_name (view, "new-tab", link_uri, background);
485 view->button_press_handled = TRUE;
486 return TRUE;
487 }
488@@ -1716,7 +1631,7 @@
489 background = view->open_tabs_in_the_background;
490 if (MIDORI_MOD_BACKGROUND (event->state))
491 background = !background;
492- g_signal_emit (view, signals[NEW_TAB], 0, uri, background);
493+ g_signal_emit_by_name (view, "new-tab", uri, background);
494 }
495 else
496 {
497@@ -1935,7 +1850,7 @@
498 gboolean background = view->open_tabs_in_the_background;
499 if (MIDORI_MOD_BACKGROUND (event->state))
500 background = !background;
501- g_signal_emit (view, signals[NEW_TAB], 0, result, background);
502+ g_signal_emit_by_name (view, "new-tab", result, background);
503 }
504 else
505 midori_view_set_uri (view, result);
506@@ -2029,7 +1944,7 @@
507 gpointer user_data)
508 {
509 MidoriView* view = user_data;
510- g_signal_emit (view, signals[NEW_WINDOW], 0, view->link_uri);
511+ g_signal_emit_by_name (view, "new-window", view->link_uri);
512 }
513
514 static void
515@@ -2057,7 +1972,7 @@
516 #endif
517 gboolean handled;
518 midori_download_set_type (download, type);
519- g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
520+ g_signal_emit_by_name (view, "download-requested", download, &handled);
521 }
522
523 static void
524@@ -2075,9 +1990,9 @@
525 MidoriView* view = user_data;
526 gchar* uri = katze_object_get_string (view->hit_test, "image-uri");
527 if (view->open_new_pages_in == MIDORI_NEW_PAGE_WINDOW)
528- g_signal_emit (view, signals[NEW_WINDOW], 0, uri);
529+ g_signal_emit_by_name (view, "new-window", uri);
530 else
531- g_signal_emit (view, signals[NEW_TAB], 0, uri,
532+ g_signal_emit_by_name (view, "new-tab", uri,
533 view->open_tabs_in_the_background);
534 g_free (uri);
535 }
536@@ -2232,7 +2147,7 @@
537 gchar* uri = sokoke_magic_uri (data, TRUE, FALSE);
538 if (!uri)
539 uri = g_strdup (data);
540- g_signal_emit (view, signals[NEW_TAB], 0, uri,
541+ g_signal_emit_by_name (view, "new-tab", uri,
542 view->open_tabs_in_the_background);
543 g_free (uri);
544 }
545@@ -2242,7 +2157,7 @@
546 gpointer user_data)
547 {
548 MidoriView* view = user_data;
549- g_signal_emit (view, signals[NEW_TAB], 0, view->link_uri,
550+ g_signal_emit_by_name (view, "new-tab", view->link_uri,
551 !view->open_tabs_in_the_background);
552 }
553
554@@ -2258,12 +2173,12 @@
555 gchar* uri = midori_uri_for_search (search, view->selected_text);
556
557 if (view->open_new_pages_in == MIDORI_NEW_PAGE_WINDOW)
558- g_signal_emit (view, signals[NEW_WINDOW], 0, uri);
559+ g_signal_emit_by_name (view, "new-window", uri);
560 /* FIXME: need a way to override behavior (middle click)
561 else if (view->open_new_pages_in == MIDORI_NEW_PAGE_CURRENT)
562 midori_view_set_uri (view, uri); */
563 else
564- g_signal_emit (view, signals[NEW_TAB], 0, uri,
565+ g_signal_emit_by_name (view, "new-tab", uri,
566 view->open_tabs_in_the_background);
567
568 g_free (uri);
569@@ -2275,7 +2190,7 @@
570 gpointer user_data)
571 {
572 MidoriView* view = user_data;
573- g_signal_emit (view, signals[NEW_WINDOW], 0,
574+ g_signal_emit_by_name (view, "new-window",
575 midori_view_get_display_uri (MIDORI_VIEW (view)));
576 }
577
578@@ -2286,7 +2201,7 @@
579 {
580 MidoriView* view = user_data;
581 WebKitWebFrame* web_frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (view->web_view));
582- g_signal_emit (view, signals[NEW_TAB], 0,
583+ g_signal_emit_by_name (view, "new-tab",
584 webkit_web_frame_get_uri (web_frame), view->open_tabs_in_the_background);
585 }
586 #endif
587@@ -2675,7 +2590,7 @@
588 where = MIDORI_NEW_VIEW_WINDOW;
589
590 gtk_widget_show (new_view);
591- g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where, FALSE);
592+ g_signal_emit_by_name (view, "new-view", new_view, where, FALSE);
593
594 if (midori_tab_get_is_dialog (MIDORI_TAB (view)))
595 {
596@@ -2892,7 +2807,7 @@
597 "signal::failed", download_failed_cb, view,
598 NULL);
599 */
600- g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
601+ g_signal_emit_by_name (view, "download-requested", download, &handled);
602 #ifndef HAVE_WEBKIT2
603 return handled;
604 #endif
605@@ -4400,7 +4315,7 @@
606
607 MidoriNewView where = MIDORI_NEW_VIEW_TAB;
608 GtkWidget* new_view = midori_view_new_with_item (view->item, view->settings);
609- g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where, TRUE);
610+ g_signal_emit_by_name (view, "new-view", new_view, where, TRUE);
611 midori_view_set_uri (MIDORI_VIEW (new_view), midori_tab_get_uri (MIDORI_TAB (view)));
612 return new_view;
613 }
614@@ -4852,6 +4767,20 @@
615 KatzeItem*
616 midori_view_get_proxy_item (MidoriView* view)
617 {
618+ /* FIXME: Naughty work-around making Tab work like View */
619+ if (!MIDORI_IS_VIEW (view))
620+ {
621+ g_return_val_if_fail (MIDORI_IS_TAB (view), NULL);
622+ KatzeItem* item = g_object_get_data (G_OBJECT (view), "proxy-item");
623+ if (item == NULL)
624+ {
625+ item = katze_item_new ();
626+ item->uri = g_strdup (midori_tab_get_uri (MIDORI_TAB (view)));
627+ g_object_set_data_full (G_OBJECT (view), "proxy-item", item, (GDestroyNotify)g_object_unref);
628+ }
629+ return item;
630+ }
631+
632 g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
633
634 return view->item;
635
636=== modified file 'midori/midori.vapi'
637--- midori/midori.vapi 2013-10-09 20:05:29 +0000
638+++ midori/midori.vapi 2013-10-16 21:56:27 +0000
639@@ -103,6 +103,7 @@
640 public bool show_tabs { get; set; }
641
642 public signal Browser new_window (Browser? browser);
643+ public signal Midori.Tab? create_tab (string uri);
644 [HasEmitter]
645 public signal void add_tab (View tab);
646 public signal void remove_tab (View tab);
647@@ -205,7 +206,6 @@
648 public GLib.Object net { get; }
649
650 [HasEmitter]
651- public signal bool download_requested (WebKit.Download download);
652 public signal bool about_content (string uri);
653
654 }

Subscribers

People subscribed via source and target branches

to all changes: