[console/wip/msandova/remember-window-size: 17/19] window: Remove win.new-window action
- From: Maximiliano <msandova src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [console/wip/msandova/remember-window-size: 17/19] window: Remove win.new-window action
- Date: Thu, 11 Aug 2022 10:27:44 +0000 (UTC)
commit 76083fa17d33e332561c15cc148f12835ab76003
Author: Maximiliano Sandoval R <msandova gnome org>
Date: Sat Jul 30 00:46:22 2022 +0200
window: Remove win.new-window action
We can use app.new-window instead.
src/help-overlay.ui | 2 +-
src/kgx-application.c | 11 +++++++++--
src/kgx-window.c | 23 -----------------------
src/kgx-window.ui | 2 +-
4 files changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
index 451bfdc..7690815 100644
--- a/src/help-overlay.ui
+++ b/src/help-overlay.ui
@@ -12,7 +12,7 @@
<property name="title" translatable="yes" context="shortcut window">Application</property>
<child>
<object class="GtkShortcutsShortcut">
- <property name="action-name">win.new-window</property>
+ <property name="action-name">app.new-window</property>
<property name="title" translatable="yes" context="shortcut window">New Window</property>
</object>
</child>
diff --git a/src/kgx-application.c b/src/kgx-application.c
index 0b61316..09ecee1 100644
--- a/src/kgx-application.c
+++ b/src/kgx-application.c
@@ -230,7 +230,7 @@ kgx_application_startup (GApplication *app)
G_APPLICATION_CLASS (kgx_application_parent_class)->startup (app);
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
- "win.new-window", new_window_accels);
+ "app.new-window", new_window_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
"win.new-tab", new_tab_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
@@ -681,8 +681,15 @@ new_window_activated (GSimpleAction *action,
{
KgxApplication *self = KGX_APPLICATION (data);
guint32 timestamp = GDK_CURRENT_TIME;
+ GtkWindow *active_window;
+ g_autoptr (GFile) dir = NULL;
+
+ active_window = gtk_application_get_active_window (GTK_APPLICATION (self));
+ if (active_window) {
+ dir = kgx_window_get_working_dir (KGX_WINDOW (active_window));
+ }
- kgx_application_add_terminal (self, NULL, timestamp, NULL, NULL, NULL);
+ kgx_application_add_terminal (self, NULL, timestamp, dir, NULL, NULL);
}
diff --git a/src/kgx-window.c b/src/kgx-window.c
index c8b948a..05bf557 100644
--- a/src/kgx-window.c
+++ b/src/kgx-window.c
@@ -340,28 +340,6 @@ kgx_window_class_init (KgxWindowClass *klass)
}
-static void
-new_activated (GSimpleAction *action,
- GVariant *parameter,
- gpointer data)
-{
- KgxWindow *self = data;
- guint32 timestamp = GDK_CURRENT_TIME;
- GtkApplication *application = NULL;
- g_autoptr (GFile) dir = NULL;
-
- application = gtk_window_get_application (GTK_WINDOW (self));
- dir = kgx_window_get_working_dir (KGX_WINDOW (data));
-
- kgx_application_add_terminal (KGX_APPLICATION (application),
- NULL,
- timestamp,
- dir,
- NULL,
- NULL);
-}
-
-
static void
new_tab_activated (GSimpleAction *action,
GVariant *parameter,
@@ -446,7 +424,6 @@ tab_switcher_activated (GSimpleAction *action,
static GActionEntry win_entries[] = {
- { "new-window", new_activated, NULL, NULL, NULL },
{ "new-tab", new_tab_activated, NULL, NULL, NULL },
{ "close-tab", close_tab_activated, NULL, NULL, NULL },
{ "about", about_activated, NULL, NULL, NULL },
diff --git a/src/kgx-window.ui b/src/kgx-window.ui
index 32e904c..afce79f 100644
--- a/src/kgx-window.ui
+++ b/src/kgx-window.ui
@@ -15,7 +15,7 @@
<section>
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
- <attribute name="action">win.new-window</attribute>
+ <attribute name="action">app.new-window</attribute>
</item>
</section>
<section>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]