[Xfce4-commits] [apps/xfce4-terminal] 01/01: Respect the "Working Directory" setting when opening initial window

noreply at xfce.org noreply at xfce.org
Wed Dec 25 23:54:49 CET 2019


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 1ca21ae3fb1dffa6e7e54cc73a2c4a98f954a73f
Author: Igor <f2404 at yandex.ru>
Date:   Wed Dec 25 17:52:55 2019 -0500

    Respect the "Working Directory" setting when opening initial window
    
    The current directory was used instead.
    
    Fixes bug #16292
---
 terminal/main.c            |  2 --
 terminal/terminal-screen.c | 11 ++++++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/terminal/main.c b/terminal/main.c
index 9252852..c618c89 100644
--- a/terminal/main.c
+++ b/terminal/main.c
@@ -243,8 +243,6 @@ main (int argc, char **argv)
   /* create a copy of the standard arguments with our additional stuff */
   nargv = g_new (gchar*, argc + 5); nargc = 0;
   nargv[nargc++] = g_strdup (argv[0]);
-  nargv[nargc++] = g_strdup ("--default-working-directory");
-  nargv[nargc++] = g_get_current_dir ();
 
   /* append startup if given */
   startup_id = g_getenv ("DESKTOP_STARTUP_ID");
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index f2ba041..ad40cf2 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -294,8 +294,10 @@ terminal_screen_class_init (TerminalScreenClass *klass)
 static void
 terminal_screen_init (TerminalScreen *screen)
 {
+  gchar    *default_dir;
+  gboolean  use_default_dir;
+
   screen->loader = NULL;
-  screen->working_directory = g_get_current_dir ();
   screen->dynamic_title_mode = TERMINAL_TITLE_DEFAULT;
   screen->session_id = ++screen_last_session_id;
   screen->pid = -1;
@@ -332,6 +334,13 @@ terminal_screen_init (TerminalScreen *screen)
   g_signal_connect (G_OBJECT (screen->preferences), "notify",
       G_CALLBACK (terminal_screen_preferences_changed), screen);
 
+  /* set working directory - from the preferences, if available, or the current dir otherwise */
+  g_object_get (G_OBJECT (screen->preferences),
+                "use-default-working-dir", &use_default_dir,
+                "default-working-dir", &default_dir,
+                NULL);
+  screen->working_directory = (use_default_dir && g_strcmp0 (default_dir, "") != 0) ? default_dir : g_get_current_dir ();
+
   /* show the terminal */
   gtk_widget_show_all (screen->hbox);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list