[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add a UI control whether to update utmp/wtmp records

noreply at xfce.org noreply at xfce.org
Wed Oct 11 22:31:25 CEST 2017


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 62dfc39954cef2b2c7649f874a27b38142ee855b
Author: Igor <f2404 at yandex.ru>
Date:   Wed Oct 11 16:23:19 2017 -0400

    Add a UI control whether to update utmp/wtmp records
    
    Only visible when built against libutempter.
    Fixes bug #13710
---
 terminal/terminal-preferences-dialog.c |  8 ++++++++
 terminal/terminal-preferences.c        | 11 +++++++++++
 terminal/terminal-preferences.glade    | 23 ++++++++++++++++++++---
 terminal/terminal-screen.c             |  7 ++++++-
 4 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index d356aaa..36027c7 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -140,6 +140,7 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
   gchar            *current;
   GtkTreeIter       current_iter;
   const gchar      *props_active[] = { "title-mode", "command-login-shell",
+                                       "command-update-records",
                                        "run-custom-command", "use-default-working-dir",
                                        "scrolling-on-output", "scrolling-on-keystroke",
                                        "scrolling-bar", "scrolling-unlimited",
@@ -258,6 +259,13 @@ error:
   BIND_PROPERTIES ("background-darkness", "value");
   BIND_PROPERTIES ("background-image-shading", "value");
 
+#ifndef HAVE_LIBUTEMPTER
+  /* hide "Update utmp/wtmp records" if no support for that */
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), "command-update-records");
+  terminal_return_if_fail (G_IS_OBJECT (object));
+  gtk_widget_hide (GTK_WIDGET (object));
+#endif
+
   /* run custom command button */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "run-custom-command");
   object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "hbox3");
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 7accf1d..bebafc4 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -64,6 +64,7 @@ enum
   PROP_COLOR_BOLD_USE_DEFAULT,
   PROP_COLOR_PALETTE,
   PROP_COMMAND_LOGIN_SHELL,
+  PROP_COMMAND_UPDATE_RECORDS,
   PROP_RUN_CUSTOM_COMMAND,
   PROP_CUSTOM_COMMAND,
   PROP_DROPDOWN_ANIMATION_TIME,
@@ -557,6 +558,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:command-update-records:
+   **/
+  preferences_props[PROP_COMMAND_UPDATE_RECORDS] =
+      g_param_spec_boolean ("command-update-records",
+                            NULL,
+                            "CommandUpdateRecords",
+                            FALSE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:run-custom-command:
    **/
   preferences_props[PROP_RUN_CUSTOM_COMMAND] =
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 350cb42..6c3c2ff 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -417,6 +417,23 @@
                               </packing>
                             </child>
                             <child>
+                              <object class="GtkCheckButton" id="command-update-records">
+                                <property name="label" translatable="yes">_Update utmp/wtmp records when command is launched</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="tooltip_text" translatable="yes">Select this option to allow commands that use utmp/wtmp records (such as `write` or `wall`) to work.</property>
+                                <property name="halign">start</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
                               <object class="GtkCheckButton" id="run-custom-command">
                                 <property name="label" translatable="yes">Run a _custom command instead of my shell</property>
                                 <property name="visible">True</property>
@@ -430,7 +447,7 @@
                               <packing>
                                 <property name="expand">True</property>
                                 <property name="fill">True</property>
-                                <property name="position">1</property>
+                                <property name="position">2</property>
                               </packing>
                             </child>
                             <child>
@@ -471,7 +488,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">2</property>
+                                <property name="position">3</property>
                               </packing>
                             </child>
                             <child>
@@ -515,7 +532,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">3</property>
+                                <property name="position">4</property>
                               </packing>
                             </child>
                           </object>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index c49d0b2..39a8b2d 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1667,6 +1667,9 @@ terminal_screen_launch_child (TerminalScreen *screen)
   guint         i;
   VtePtyFlags   pty_flags = VTE_PTY_DEFAULT;
   GSpawnFlags   spawn_flags = G_SPAWN_CHILD_INHERITS_STDIN | G_SPAWN_SEARCH_PATH;
+#ifdef HAVE_LIBUTEMPTER
+  gboolean      update_records;
+#endif
 
   terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
 
@@ -1710,7 +1713,9 @@ terminal_screen_launch_child (TerminalScreen *screen)
         }
 
 #ifdef HAVE_LIBUTEMPTER
-      utempter_add_record (vte_pty_get_fd (vte_terminal_get_pty (VTE_TERMINAL (screen->terminal))), NULL);
+      g_object_get (G_OBJECT (screen->preferences), "command-update-records", &update_records, NULL);
+      if (update_records)
+        utempter_add_record (vte_pty_get_fd (vte_terminal_get_pty (VTE_TERMINAL (screen->terminal))), NULL);
 #endif
 
       g_free (argv2);

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


More information about the Xfce4-commits mailing list