[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add initial support for utmp file

noreply at xfce.org noreply at xfce.org
Wed Jul 26 22:01:34 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 14375854d02819be600e6401576b8c76dfb0b59b
Author: Igor <f2404 at yandex.ru>
Date:   Wed Jul 26 16:00:35 2017 -0400

    Add initial support for utmp file
    
    libutempter is used. Need to build using --with-utempter parameter.
---
 configure.ac.in            | 16 +++++++++++++++-
 terminal/Makefile.am       |  4 ++++
 terminal/terminal-screen.c |  7 +++++++
 terminal/terminal-widget.c |  7 +++++++
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/configure.ac.in b/configure.ac.in
index 73be17c..8293745 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -104,7 +104,7 @@ AC_PATH_PROG([XMLLINT], [xmllint], [no])
 dnl ***************************************************
 dnl *** Check if we need to build the documentation ***
 dnl ***************************************************
-AC_ARG_ENABLE([gen-doc], [AC_HELP_STRING([--enable-gen-doc], 
+AC_ARG_ENABLE([gen-doc], [AC_HELP_STRING([--enable-gen-doc],
               [Generate HTML documentation (requires xsltproc, xml2po and xmllint) [default=no]])],, [enable_gen_doc=no])
 if test x"$enable_gen_doc" = x"yes"; then
     AC_PATH_PROG([XSLTPROC], [xsltproc], [no])
@@ -129,6 +129,20 @@ fi
 AM_CONDITIONAL([GENERATE_DOCUMENTATION], [test x"$enable_gen_doc" = x"yes"])
 
 dnl ****************************************
+dnl *** Check if we need to use utempter ***
+dnl ****************************************
+AC_ARG_WITH([utempter], [AC_HELP_STRING([--with-utempter],
+            [Support for utmp/wtmp files (requires libutempter) [default=no]])],, [with_utempter=no])
+if test x"$with_utempter" = x"yes"; then
+    AC_CHECK_LIB([utempter],[utempter_add_record],,[with_utempter=no])
+
+    if test x"$with_utempter" = x"no"; then
+        AC_MSG_ERROR([Compiling with --with-utempter but libutempter not found.])
+    fi
+fi
+AM_CONDITIONAL([HAVE_UTEMPTER], [test x"$with_utempter" = x"yes"])
+
+dnl ****************************************
 dnl *** Register in Gnome Control Center ***
 dnl ****************************************
 AC_ARG_WITH([gnome-default-appsdir],
diff --git a/terminal/Makefile.am b/terminal/Makefile.am
index 704c978..71e2d3c 100644
--- a/terminal/Makefile.am
+++ b/terminal/Makefile.am
@@ -72,6 +72,10 @@ xfce4_terminal_LDADD = \
 	$(LIBXFCE4UI_LIBS) \
 	$(TERMINAL_LIBS)
 
+if HAVE_UTEMPTER
+xfce4_terminal_LDADD += -lutempter
+endif
+
 uidir = $(datadir)/xfce4/terminal
 ui_DATA = \
 	terminal-preferences.ui
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 472c677..007700a 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -37,6 +37,9 @@
 #ifdef HAVE_TIME_H
 #include <time.h>
 #endif
+#ifdef HAVE_LIBUTEMPTER
+#include <utempter.h>
+#endif
 
 #include <libxfce4ui/libxfce4ui.h>
 
@@ -1653,6 +1656,10 @@ terminal_screen_launch_child (TerminalScreen *screen)
           g_error_free (error);
         }
 
+#ifdef HAVE_LIBUTEMPTER
+      utempter_add_record (vte_pty_get_fd (vte_terminal_get_pty (VTE_TERMINAL (screen->terminal))), NULL);
+#endif
+
       g_free (argv2);
 
       g_strfreev (argv);
diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index be93321..4a0e431 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -27,6 +27,9 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
+#ifdef HAVE_LIBUTEMPTER
+#include <utempter.h>
+#endif
 
 #include <libxfce4ui/libxfce4ui.h>
 
@@ -193,6 +196,10 @@ terminal_widget_finalize (GObject *object)
 {
   TerminalWidget *widget = TERMINAL_WIDGET (object);
 
+#ifdef HAVE_LIBUTEMPTER
+  utempter_remove_record (vte_pty_get_fd (vte_terminal_get_pty (VTE_TERMINAL (widget))));
+#endif
+
   /* disconnect the misc-highlight-urls watch */
   g_signal_handlers_disconnect_by_func (G_OBJECT (widget->preferences), G_CALLBACK (terminal_widget_update_highlight_urls), widget);
 

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


More information about the Xfce4-commits mailing list