[gnome-text-editor] window: allow dragging tab into new window
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] window: allow dragging tab into new window
- Date: Tue, 26 Oct 2021 22:23:13 +0000 (UTC)
commit 0a074ae66d0510fda16646882fde225537446214
Author: Christian Hergert <chergert redhat com>
Date: Tue Oct 26 15:19:42 2021 -0700
window: allow dragging tab into new window
You can just drag it out of the window now and a new window will be
created on the fly.
Related #199
src/editor-window.c | 18 ++++++++++++++++++
src/editor-window.ui | 1 +
2 files changed, 19 insertions(+)
---
diff --git a/src/editor-window.c b/src/editor-window.c
index bafc2d6..bb21597 100644
--- a/src/editor-window.c
+++ b/src/editor-window.c
@@ -522,6 +522,23 @@ on_notify_reveal_flap_cb (EditorWindow *self,
adw_flap_set_locked (flap, TRUE);
}
+static AdwTabView *
+on_tab_view_create_window_cb (EditorWindow *self,
+ AdwTabView *tab_view)
+{
+ EditorWindow *window;
+ AdwTabView *ret;
+
+ g_assert (EDITOR_IS_WINDOW (self));
+ g_assert (ADW_IS_TAB_VIEW (tab_view));
+
+ window = _editor_session_create_window_no_draft (EDITOR_SESSION_DEFAULT);
+ ret = window->tab_view;
+ gtk_window_present (GTK_WINDOW (window));
+
+ return ret;
+}
+
static void
editor_window_dispose (GObject *object)
{
@@ -638,6 +655,7 @@ editor_window_class_init (EditorWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_tab_view_close_page_cb);
gtk_widget_class_bind_template_callback (widget_class, on_notify_reveal_flap_cb);
gtk_widget_class_bind_template_callback (widget_class, on_tab_view_setup_menu_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_tab_view_create_window_cb);
gtk_widget_class_add_binding_action (widget_class, GDK_KEY_w, GDK_CONTROL_MASK,
"win.close-page-or-window", NULL);
gtk_widget_class_add_binding_action (widget_class, GDK_KEY_o, GDK_CONTROL_MASK, "win.open", NULL);
diff --git a/src/editor-window.ui b/src/editor-window.ui
index 2428fc4..7213c16 100644
--- a/src/editor-window.ui
+++ b/src/editor-window.ui
@@ -151,6 +151,7 @@
<property name="vexpand">true</property>
<signal name="close-page" handler="on_tab_view_close_page_cb" swapped="true"/>
<signal name="setup-menu" handler="on_tab_view_setup_menu_cb" swapped="true"/>
+ <signal name="create-window" handler="on_tab_view_create_window_cb" swapped="true"/>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]