Merge lp:~midori/midori/dragMeBabyeOneMoreTime into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6602
Merged at revision: 6618
Proposed branch: lp:~midori/midori/dragMeBabyeOneMoreTime
Merge into: lp:midori
Diff against target: 88 lines (+31/-15)
1 file modified
midori/midori-notebook.vala (+31/-15)
To merge this branch: bzr merge lp:~midori/midori/dragMeBabyeOneMoreTime
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+211201@code.launchpad.net

Commit message

Open URIs dragged on tab label or new tab button

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
=== modified file 'midori/midori-notebook.vala'
--- midori/midori-notebook.vala 2014-03-06 23:51:16 +0000
+++ midori/midori-notebook.vala 2014-03-16 11:32:50 +0000
@@ -72,11 +72,6 @@
72 notify_property ("close-button-left");72 notify_property ("close-button-left");
73 notify["close-button-visible"].connect (close_button_visible_changed);73 notify["close-button-visible"].connect (close_button_visible_changed);
74 notify_property ("close-button-visible");74 notify_property ("close-button-visible");
75
76 Gtk.drag_dest_set (this, Gtk.DestDefaults.ALL, (Gtk.TargetEntry[])null, Gdk.DragAction.COPY);
77 Gtk.drag_dest_add_text_targets (this);
78 Gtk.drag_dest_add_uri_targets (this);
79 drag_data_received.connect (uri_dragged);
80 }75 }
8176
82#if !HAVE_GTK377#if !HAVE_GTK3
@@ -153,16 +148,6 @@
153 spinner.visible = tab.progress > 0.0;148 spinner.visible = tab.progress > 0.0;
154 icon.visible = !spinner.visible;149 icon.visible = !spinner.visible;
155 }150 }
156
157 void uri_dragged (Gdk.DragContext context, int x, int y, Gtk.SelectionData data, uint ttype, uint timestamp) {
158 /* FIXME: Navigate to the URI
159 string[] uri = data.get_uris ();
160 if (uri != null)
161 tab.uri = uri[0];
162 else
163 tab.uri = data.get_text ();
164 */
165 }
166 }151 }
167152
168 public class Notebook : Gtk.EventBox {153 public class Notebook : Gtk.EventBox {
@@ -242,6 +227,7 @@
242 notebook.create_window.connect (window_created);227 notebook.create_window.connect (window_created);
243228
244 var add = new Gtk.Button ();229 var add = new Gtk.Button ();
230 add.tooltip_text = _("Open a new tab");
245 add.relief = Gtk.ReliefStyle.NONE;231 add.relief = Gtk.ReliefStyle.NONE;
246 add.add (new Gtk.Image.from_gicon (new ThemedIcon.with_default_fallbacks ("tab-new-symbolic"), Gtk.IconSize.MENU));232 add.add (new Gtk.Image.from_gicon (new ThemedIcon.with_default_fallbacks ("tab-new-symbolic"), Gtk.IconSize.MENU));
247 add.show_all ();233 add.show_all ();
@@ -249,10 +235,39 @@
249 add.clicked.connect (()=>{235 add.clicked.connect (()=>{
250 new_tab ();236 new_tab ();
251 });237 });
238 take_incoming_uris (add);
252239
253 button_press_event.connect (button_pressed);240 button_press_event.connect (button_pressed);
254 }241 }
255242
243 void take_incoming_uris (Gtk.Widget widget) {
244 Gtk.drag_dest_set (widget, Gtk.DestDefaults.ALL, (Gtk.TargetEntry[])null, Gdk.DragAction.COPY);
245 Gtk.drag_dest_add_text_targets (widget);
246 Gtk.drag_dest_add_uri_targets (widget);
247 widget.drag_drop.connect (uri_dropped);
248 widget.drag_data_received.connect (uri_received);
249 }
250
251 bool uri_dropped (Gtk.Widget widget, Gdk.DragContext context, int x, int y, uint timestamp) {
252 Gtk.drag_finish (context, false, false, timestamp);
253 return true;
254 }
255
256 void uri_received (Gtk.Widget widget, Gdk.DragContext context, int x, int y, Gtk.SelectionData data, uint ttype, uint timestamp) {
257 string[] uri = data.get_uris ();
258 string drag_uri = uri != null ? uri[0] : data.get_text ();
259 Midori.Tab drag_tab;
260 if (widget is Tally)
261 drag_tab = (widget as Tally).tab;
262 else {
263 new_tab ();
264 // Browser will have focussed the new tab
265 drag_tab = tab;
266 }
267 drag_tab.web_view.load_uri (drag_uri);
268 }
269
270
256 ~Notebook () {271 ~Notebook () {
257 notebook.size_allocate.disconnect (size_allocated);272 notebook.size_allocate.disconnect (size_allocated);
258 notebook.switch_page.disconnect (page_switched);273 notebook.switch_page.disconnect (page_switched);
@@ -316,6 +331,7 @@
316 tally.button_press_event.connect (tab_button_pressed);331 tally.button_press_event.connect (tab_button_pressed);
317 tally.show ();332 tally.show ();
318 tally.set_size_request (tab.minimized ? -1 : last_tab_size, -1);333 tally.set_size_request (tab.minimized ? -1 : last_tab_size, -1);
334 take_incoming_uris (tally);
319335
320 /* Minimum requirements for any tab */336 /* Minimum requirements for any tab */
321 tab.can_focus = tab.visible = true;337 tab.can_focus = tab.visible = true;

Subscribers

People subscribed via source and target branches

to all changes: