kov changed libgksu/branches/libgksu2/ChangeLog, libgksu/branches/libgksu2/aclocal.m4, libgksu/branches/libgksu2/configure.ac, libgksu/branches/libgksu2/libgksu/ChangeLog, libgksu/branches/libgksu2/libgksu/Makefile.am, libgksu/branches/libgksu2/libgksu/libgksu.c, libgksu/branches/libgksu2/libgksu/libgksu.h, libgksu/branches/libgksu2/libgksu/libgksu2.pc.in

Gustavo Noronha kov at costa.debian.org
Fri Mar 3 02:15:44 UTC 2006


Mensagem de log: 
	* libgksu.c:
	- integrated patch by Michael Vogt to support startup notfication
	- added accessor methods for the GksuContext structure, I want it
	  to be opaque
	* Makefile.am, libgksu2.pc.in:
	- misc fixes to build system


-----


Modified: libgksu/branches/libgksu2/ChangeLog
===================================================================
--- libgksu/branches/libgksu2/ChangeLog	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/ChangeLog	2006-03-03 02:15:42 UTC (rev 512)
@@ -1,3 +1,10 @@
+2006-03-02  Gustavo Noronha Silva  <kov at debian.org>
+
+	* configure.ac:
+	- added dependency on libstartup-notification-1.0 to
+	  PKG_CHECK_MODULES; startup notification support has
+	  been added!
+
 2006-01-07  Gustavo Noronha Silva  <kov at debian.org>
 
 	* libgksu/libgksu.c, docs/*:

Modified: libgksu/branches/libgksu2/aclocal.m4
===================================================================
--- libgksu/branches/libgksu2/aclocal.m4	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/aclocal.m4	2006-03-03 02:15:42 UTC (rev 512)
@@ -900,7 +900,7 @@
 
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 
-# serial 48 Debian 1.5.22-1 AC_PROG_LIBTOOL
+# serial 48 Debian 1.5.22-2 AC_PROG_LIBTOOL
 
 
 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)

Modified: libgksu/branches/libgksu2/configure.ac
===================================================================
--- libgksu/branches/libgksu2/configure.ac	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/configure.ac	2006-03-03 02:15:42 UTC (rev 512)
@@ -32,7 +32,7 @@
 AC_PATH_PROG(GCONFTOOL, gconftool-2)
 AM_GCONF_SOURCE_2
 
-PKG_CHECK_MODULES(LIBKGKSU, [gtk+-2.0 >= 2.4.0, gconf-2.0])
+PKG_CHECK_MODULES(LIBGKSU, [gtk+-2.0 >= 2.4.0, gconf-2.0, libstartup-notification-1.0])
 
 # Checks for library functions.
 ALL_LINGUAS="ca cs da de es eu hu pl pt_BR ro ru sk nb nl"

Modified: libgksu/branches/libgksu2/libgksu/ChangeLog
===================================================================
--- libgksu/branches/libgksu2/libgksu/ChangeLog	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/libgksu/ChangeLog	2006-03-03 02:15:42 UTC (rev 512)
@@ -1,3 +1,12 @@
+2006-03-02  Gustavo Noronha Silva  <kov at debian.org>
+
+	* libgksu.c:
+	- integrated patch by Michael Vogt to support startup notfication
+	- added accessor methods for the GksuContext structure, I want it
+	  to be opaque
+	* Makefile.am, libgksu2.pc.in:
+	- misc fixes to build system
+
 2005-12-11  Gustavo Noronha Silva  <kov at debian.org>
 
 	* libgksu.c:

Modified: libgksu/branches/libgksu2/libgksu/Makefile.am
===================================================================
--- libgksu/branches/libgksu2/libgksu/Makefile.am	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/libgksu/Makefile.am	2006-03-03 02:15:42 UTC (rev 512)
@@ -1,5 +1,5 @@
 AM_CFLAGS = -g -O2 -Wall
-INCLUDES = `pkg-config --cflags gtk+-2.0 gconf-2.0`
+INCLUDES = ${LIBGKSU_CFLAGS}
 AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" -DDATA_DIR=\"$(datadir)\" -DPREFIX=\"$(prefix)\"
 
 lib_LTLIBRARIES = libgksu2.la
@@ -9,17 +9,17 @@
 # minor -> keeps compatibility (additions to the API)
 # micro -> no change to the API/ABI
 libgksu2_la_LIBADD = ../libgksuui/libgksuui1.0.la
-libgksu2_la_LDFLAGS = -version-info 0:0:0 -Wl,--version-script=libgksu.ver -Wl,-O1 `pkg-config --libs gtk+-2.0 gobject-2.0 gconf-2.0` -lutil
+libgksu2_la_LDFLAGS = -version-info 0:0:0 -Wl,--version-script=libgksu.ver -Wl,-O1 -lutil ${LIBGKSU_LIBS}
 
 noinst_HEADERS = defines.h
 
 include_HEADERS = gksu.h libgksu.h
-includedir = ${prefix}/include/libgksu2
+includedir = ${prefix}/include/${PACKAGE}
 
 pkgconfigdir = ${libdir}/pkgconfig
 pkgconfig_DATA = libgksu2.pc
 
-pkglibdir = ${libdir}/libgksu2
+pkglibdir = ${libdir}/${PACKAGE}
 pkglib_PROGRAMS = gksu-run-helper
 gksu_run_helper_LDFLAGS = `pkg-config --libs glib-2.0`
 gksu_run_helper_SOURCES = gksu-run-helper.c

Modified: libgksu/branches/libgksu2/libgksu/libgksu.c
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu.c	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/libgksu/libgksu.c	2006-03-03 02:15:42 UTC (rev 512)
@@ -31,6 +31,9 @@
 #include <sys/select.h>
 #include <errno.h>
 
+#define SN_API_NOT_YET_FROZEN
+#include <libsn/sn.h>
+
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
 #include <locale.h>
@@ -719,7 +722,7 @@
 
   context->sudo_mode = FALSE;
 
-  context->user = NULL;
+  context->user = g_strdup ("root");
   context->command = NULL;
 
   context->login_shell = FALSE;
@@ -729,10 +732,186 @@
 
   context->debug = FALSE;
 
+  get_configuration_options (context);
+
   return context;
 }
 
 /**
+ * gksu_context_set_user:
+ * @context: the #GksuContext you want to modify
+ * @username: the target username
+ *
+ * Sets up what user the command will be run as. The default
+ * is root, but you can run the command as any user.
+ *
+ */
+void
+gksu_context_set_user (GksuContext *context, gchar *username)
+{
+  g_assert (username != NULL);
+
+  if (context->user)
+    g_free (context->user);
+  context->user = g_strdup (username);
+}
+
+/**
+ * gksu_context_get_user:
+ * @context: the #GksuContext from which to grab the information
+ *
+ * Gets the user the command will be run as, as set 
+ * by gksu_context_set_user.
+ *
+ * Returns: a pointer to the string containing the username.
+ */
+const gchar*
+gksu_context_get_user (GksuContext *context)
+{
+  return context->user;
+}
+
+/**
+ * gksu_context_set_command:
+ * @context: the #GksuContext you want to modify
+ * @command: the command that shall be ran
+ *
+ * Sets up what command will run with the target user.
+ *
+ */
+void
+gksu_context_set_command (GksuContext *context, gchar *command)
+{
+  g_assert (command != NULL);
+
+  if (context->command)
+    g_free (context->command);
+  context->command = g_strdup (command);
+}
+
+/**
+ * gksu_context_get_command:
+ * @context: the #GksuContext from which to grab the information
+ *
+ * Gets the command that will be run, as set by 
+ * gksu_context_set_command.
+ *
+ * Returns: a pointer to the string containing the command.
+ */
+const gchar*
+gksu_context_get_command (GksuContext *context)
+{
+  return context->command;
+}
+
+/**
+ * gksu_context_set_login_shell:
+ * @context: the #GksuContext you want to modify
+ * @value: TRUE or FALSE
+ *
+ * Should the shell in which the command will be run be
+ * a login shell?
+ */
+void
+gksu_context_set_login_shell (GksuContext *context, gboolean value)
+{
+  context->login_shell = value;
+}
+
+/**
+ * gksu_context_get_login_shell:
+ * @context: the #GksuContext from which to grab the information
+ *
+ * Finds out if the shell created by the underlying su process
+ * will be a login shell.
+ *
+ * Returns: TRUE if the shell will be a login shell, FALSE otherwise.
+ */
+gboolean
+gksu_context_get_login_shell (GksuContext *context)
+{
+  return context->login_shell;
+}
+
+/**
+ * gksu_context_set_keep_env:
+ * @context: the #GksuContext you want to modify
+ * @value: TRUE or FALSE
+ *
+ * Should the environment be kept as it is? Defaults to
+ * TRUE. Notice that setting this to FALSE may cause the
+ * X authorization stuff to fail.
+ */
+void
+gksu_context_set_keep_env (GksuContext *context, gboolean value)
+{
+  context->keep_env = value;
+}
+
+/**
+ * gksu_context_get_keep_env:
+ * @context: the #GksuContext from which to grab the information
+ *
+ * Finds out if the environment in which the program will be
+ * run will be reset.
+ *
+ * Returns: TRUE if the environment is going to be kept, 
+ * FALSE otherwise.
+ */
+gboolean
+gksu_context_get_keep_env (GksuContext *context)
+{
+  return context->keep_env;
+}
+
+/**
+ * gksu_context_set_debug:
+ * @context: the #GksuContext you want to modify
+ * @value: TRUE or FALSE
+ *
+ * Set up if debuging information should be printed.
+ */
+void
+gksu_context_set_grab (GksuContext *context, gboolean value)
+{
+  context->grab = value;
+}
+
+gboolean
+gksu_context_get_grab (GksuContext *context)
+{
+  return context->grab;
+}
+
+/**
+ * gksu_context_set_debug:
+ * @context: the #GksuContext you want to modify
+ * @value: TRUE or FALSE
+ *
+ * Set up if debuging information should be printed.
+ */
+void
+gksu_context_set_debug (GksuContext *context, gboolean value)
+{
+  context->debug = value;
+}
+
+/**
+ * gksu_context_get_debug:
+ * @context: the #GksuContext from which to grab the information
+ *
+ * Finds out if the library is configured to print debuging
+ * information.
+ *
+ * Returns: TRUE if it is, FALSE otherwise.
+ */
+gboolean
+gksu_context_get_debug (GksuContext *context)
+{
+  return context->debug;
+}
+
+/**
  * gksu_context_free
  * @context: the #GksuContext to be freed.
  *
@@ -796,8 +975,6 @@
   int fdpty;
   pid_t pid;
 
-  get_configuration_options (context);
-
   gksu_quark = g_quark_from_string (PACKAGE);
 
   if (!context->command)
@@ -824,6 +1001,15 @@
   */
   prepare_xauth (context);
 
+  if(context->sn_context)
+    {
+       gchar *sid = g_strdup_printf ("%s",sn_launcher_context_get_startup_id (context->sn_context));
+       if (context->debug)
+	 fprintf (stderr, "STARTUP_ID: %s\n", sid);
+       setenv ("DESKTOP_STARTUP_ID", sid, TRUE);
+       g_free(sid);
+    }
+
   pid = forkpty (&fdpty, NULL, NULL, NULL);
   if (pid == 0)
     {
@@ -1167,8 +1353,6 @@
   int parent_pipe[2];	/* For talking to the parent */
   int child_pipe[2];	/* For talking to the child */
 
-  get_configuration_options (context);
-
   gksu_quark = g_quark_from_string (PACKAGE);
 
   if (!context->command)
@@ -1209,6 +1393,15 @@
   xauth_env = getenv ("XAUTHORITY");
   setenv ("XAUTHORITY", xauth, TRUE);
 
+  /* set startup id */
+  if(context->sn_context)
+    {
+       gchar *sid = g_strdup_printf ("%s",sn_launcher_context_get_startup_id (context->sn_context));
+       if (context->debug)
+	 fprintf (stderr, "STARTUP_ID: %s\n", sid);
+       setenv ("DESKTOP_STARTUP_ID", sid, TRUE);
+       g_free(sid);
+    }
   if (context->debug)
     fprintf (stderr, "xauth: %s\n", xauth);
 
@@ -1459,7 +1652,12 @@
 			       "the system administrator."));
 	    }
 	}
-
+#if 0
+      // stop startup notification (we may want something smarter here,
+      // like using SnMonitorContext)
+      if(context->sn_context)
+	 sn_launcher_context_complete(context->sn_context);
+#endif
       while (!waitpid (pid, &status, WNOHANG))
 	{
 	  if (cmdline)

Modified: libgksu/branches/libgksu2/libgksu/libgksu.h
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu.h	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/libgksu/libgksu.h	2006-03-03 02:15:42 UTC (rev 512)
@@ -24,6 +24,9 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#define SN_API_NOT_YET_FROZEN
+#include <libsn/sn.h>
+
 #include <gtk/gtk.h>
 
 #include <gconf/gconf-client.h>
@@ -59,6 +62,9 @@
   /* UI options */
   gboolean grab;
 
+  /* startup notification */
+  SnLauncherContext *sn_context;
+
   gboolean debug;
 } GksuContext;
 
@@ -89,7 +95,47 @@
 GksuContext*
 gksu_context_new ();
 
+/*
+   getters and setters for the configuration
+   options
+*/
 void
+gksu_context_set_user (GksuContext *context, gchar *username);
+
+const gchar*
+gksu_context_get_user (GksuContext *context);
+
+void
+gksu_context_set_command (GksuContext *context, gchar *command);
+
+const gchar*
+gksu_context_get_command (GksuContext *context);
+
+void
+gksu_context_set_login_shell (GksuContext *context, gboolean value);
+
+gboolean
+gksu_context_get_login_shell (GksuContext *context);
+
+void
+gksu_context_set_keep_env (GksuContext *context, gboolean value);
+
+gboolean
+gksu_context_get_keep_env (GksuContext *context);
+
+void
+gksu_context_set_grab (GksuContext *context, gboolean value);
+
+gboolean
+gksu_context_get_grab (GksuContext *context);
+
+void
+gksu_context_set_debug (GksuContext *context, gboolean value);
+
+gboolean
+gksu_context_get_debug (GksuContext *context);
+
+void
 gksu_context_free (GksuContext *context);
 
 gboolean

Modified: libgksu/branches/libgksu2/libgksu/libgksu2.pc.in
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu2.pc.in	2006-01-29 21:20:48 UTC (rev 511)
+++ libgksu/branches/libgksu2/libgksu/libgksu2.pc.in	2006-03-03 02:15:42 UTC (rev 512)
@@ -2,10 +2,10 @@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@prefix@/include
- 
+
 Name: LibGKSu
 Version: @VERSION@
-Description: GKSu library version 0.
-Requires: glib-2.0
-Libs: -L${libdir} -lgksu1.2 @LIBS@
-Cflags: -I${includedir}/libgksu1.2
+Description: GKSu library version 2.
+Requires: glib-2.0, libstartup-notification-1.0
+Libs: -L${libdir} -lgksu2 @LIBS@
+Cflags: -I${includedir}/libgksu




More information about the gksu-commits mailing list