policykit-gnome r91 - in trunk: . src



Author: davidz
Date: Wed Jan 21 05:33:35 2009
New Revision: 91
URL: http://svn.gnome.org/viewvc/policykit-gnome?rev=91&view=rev

Log:
update to polkit 0.90



Modified:
   trunk/Makefile.am
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/main.c
   trunk/src/polkit-gnome-auth-dialog.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Wed Jan 21 05:33:35 2009
@@ -1,11 +1,15 @@
-SUBDIRS = data src polkit-gnome tools
+#SUBDIRS = data src polkit-gnome tools
 
-if BUILD_EXAMPLES
-SUBDIRS += examples
-endif
+SUBDIRS = src
+
+#if BUILD_EXAMPLES
+#SUBDIRS += examples
+#endif
 
 # Need to build docs after examples because the docs include generated files
-SUBDIRS += doc po
+#SUBDIRS += doc po
+
+SUBDIRS += po
 
 # Creating ChangeLog from git log (taken from cairo/Makefile.am):
 ChangeLog: $(srcdir)/ChangeLog

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Wed Jan 21 05:33:35 2009
@@ -1,4 +1,4 @@
-AC_INIT([PolicyKit-gnome],[0.9.2],[mailto:david fubar dk],[PolicyKit-gnome])
+AC_INIT([PolicyKit-gnome],[0.90],[http://lists.freedesktop.org/mailman/listinfo/polkit-devel],[PolicyKit-gnome])
 
 AM_INIT_AUTOMAKE([1.9 foreign dist-bzip2 no-dist-gzip])
 
@@ -124,9 +124,9 @@
 
 GTK_REQUIRED=2.13.6
 GCONF_REQUIRED=2.8
-DBUS_GLIB_REQUIRED=0.71
-POLKIT_DBUS_REQUIRED=0.9
-POLKIT_GRANT_REQUIRED=0.9
+EGGDBUS_REQUIRED=0.2
+POLKIT_AGENT_REQUIRED=0.90
+POLKIT_GOBJECT_REQUIRED=0.90
 
 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
 AC_SUBST(GTK_CFLAGS)
@@ -136,17 +136,17 @@
 AC_SUBST(GCONF_CFLAGS)
 AC_SUBST(GCONF_LIBS)
 
-PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
-AC_SUBST(DBUS_GLIB_CFLAGS)
-AC_SUBST(DBUS_GLIB_LIBS)
-
-PKG_CHECK_MODULES(POLKIT_DBUS, polkit-dbus >= $POLKIT_DBUS_REQUIRED)
-AC_SUBST(POLKIT_DBUS_CFLAGS)
-AC_SUBST(POLKIT_DBUS_LIBS)
-
-PKG_CHECK_MODULES(POLKIT_GRANT, polkit-grant >= $POLKIT_GRANT_REQUIRED)
-AC_SUBST(POLKIT_GRANT_CFLAGS)
-AC_SUBST(POLKIT_GRANT_LIBS)
+PKG_CHECK_MODULES(EGGDBUS, eggdbus-1 >= $EGGDBUS_REQUIRED)
+AC_SUBST(EGGDBUS_CFLAGS)
+AC_SUBST(EGGDBUS_LIBS)
+
+PKG_CHECK_MODULES(POLKIT_AGENT, polkit-agent-1 >= $POLKIT_AGENT_REQUIRED)
+AC_SUBST(POLKIT_AGENT_CFLAGS)
+AC_SUBST(POLKIT_AGENT_LIBS)
+
+PKG_CHECK_MODULES(POLKIT_GOBJECT, polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED)
+AC_SUBST(POLKIT_GOBJECT_CFLAGS)
+AC_SUBST(POLKIT_GOBJECT_LIBS)
 
 AC_ARG_ENABLE([examples],
               AC_HELP_STRING([--enable-examples], [Build the example programs]),,
@@ -154,13 +154,13 @@
 
 AM_CONDITIONAL(BUILD_EXAMPLES, test "x$enable_examples" = "xyes")
 
-if test "x$enable_examples" = "xyes"; then
-    AC_CHECK_PROG([POLKIT_POLICY_FILE_VALIDATE],
-                  [polkit-policy-file-validate], [polkit-policy-file-validate])
-    if test -z "$POLKIT_POLICY_FILE_VALIDATE"; then
-        AC_MSG_ERROR([polkit-policy-file-validate not found])
-    fi
-fi
+#if test "x$enable_examples" = "xyes"; then
+#    AC_CHECK_PROG([POLKIT_POLICY_FILE_VALIDATE],
+#                  [polkit-policy-file-validate], [polkit-policy-file-validate])
+#    if test -z "$POLKIT_POLICY_FILE_VALIDATE"; then
+#        AC_MSG_ERROR([polkit-policy-file-validate not found])
+#    fi
+#fi
 
 dnl ==============================================
 dnl Special GConf section 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Wed Jan 21 05:33:35 2009
@@ -1,14 +1,7 @@
 
-BUILT_SOURCES =							\
-	polkit-gnome-manager-glue.h
-
-polkit-gnome-manager-glue.h: polkit-gnome-manager.xml Makefile.am
-	dbus-binding-tool --prefix=polkit_gnome_manager --mode=glib-server --output=polkit-gnome-manager-glue.h polkit-gnome-manager.xml
-
 libexec_PROGRAMS = polkit-gnome-manager
 
 polkit_gnome_manager_SOURCES = 						\
-	polkit-gnome-manager.h		polkit-gnome-manager.c		\
 	polkit-gnome-auth-dialog.h	polkit-gnome-auth-dialog.c	\
 	sexy-url-label.h 		sexy-url-label.c		\
 	main.c								\
@@ -25,9 +18,9 @@
 polkit_gnome_manager_CFLAGS = 				\
 	$(GTK_CFLAGS)					\
 	$(GCONF_CFLAGS)					\
-	$(DBUS_GLIB_CFLAGS)				\
-	$(POLKIT_DBUS_CFLAGS)				\
-	$(POLKIT_GRANT_CFLAGS)				\
+	$(EGGDBUS_CFLAGS)				\
+	$(POLKIT_AGENT_CFLAGS)				\
+	$(POLKIT_GOBJECT_CFLAGS)			\
 	$(WARN_CFLAGS)					\
 	$(AM_CFLAGS)
 
@@ -37,9 +30,9 @@
 polkit_gnome_manager_LDADD = 				\
 	$(GTK_LIBS)					\
 	$(GCONF_LIBS)					\
-	$(DBUS_GLIB_LIBS)				\
-	$(POLKIT_DBUS_LIBS)				\
-	$(POLKIT_GRANT_LIBS)				\
+	$(EGGDBUS_LIBS)					\
+	$(POLKIT_AGENT_LIBS)				\
+	$(POLKIT_GOBJECT_LIBS)				\
 	$(INTLLIBS)
 
 CLEANFILES = $(BUILT_SOURCES)

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Wed Jan 21 05:33:35 2009
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
+/*
  * Copyright (C) 2007 David Zeuthen <david fubar dk>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -36,163 +35,472 @@
 #include <glib/gi18n.h>
 #include <glib-object.h>
 
+#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
-#include "polkit-gnome-manager.h"
-
-static DBusGProxy *
-get_bus_proxy (DBusGConnection *connection)
-{
-        DBusGProxy *bus_proxy;
-
-	bus_proxy = dbus_g_proxy_new_for_name (connection,
-                                               DBUS_SERVICE_DBUS,
-                                               DBUS_PATH_DBUS,
-                                               DBUS_INTERFACE_DBUS);
-        return bus_proxy;
+#include <polkitagent/polkitagent.h>
+
+#include "polkit-gnome-auth-dialog.h"
+
+static PolkitAuthority *authority;
+
+typedef struct
+{
+  gchar *action_id;
+  PolkitActionDescription *action_desc;
+  gchar *cookie;
+  GList *identities;
+  gpointer pending_call;
+
+  gboolean gained_authorization;
+  gboolean was_cancelled;
+  gboolean invalid_data;
+
+  GMainLoop *loop;
+  PolkitAgentAuthenticationSession *session;
+  GtkWidget *dialog;
+
+} AuthData;
+
+static AuthData *
+auth_data_new (const gchar *action_id,
+               const gchar *cookie,
+               GList *identities,
+               gpointer pending_call)
+{
+  AuthData *data;
+
+  data = g_new0 (AuthData, 1);
+  data->action_id = g_strdup (action_id);
+  data->cookie = g_strdup (cookie);
+
+  data->identities = g_list_copy (identities);
+  g_list_foreach (data->identities, (GFunc) g_object_ref, NULL);
+
+  data->pending_call = pending_call;
+
+  return data;
 }
 
-static gboolean
-acquire_name_on_proxy (DBusGProxy *bus_proxy, const char *name)
+static void
+auth_data_free (AuthData *data)
+{
+  g_free (data->action_id);
+
+  if (data->action_desc != NULL)
+    g_object_unref (data->action_desc);
+
+  g_free (data->cookie);
+  g_list_foreach (data->identities, (GFunc) g_object_unref, NULL);
+  g_list_free (data->identities);
+
+  if (data->session != NULL)
+    g_object_unref (data->session);
+
+  g_main_loop_unref (data->loop);
+
+  gtk_widget_destroy (data->dialog);
+
+  g_free (data);
+}
+
+static AuthData *auth_data = NULL;
+static PolkitAgentAuthenticationAgent *agent;
+
+static void
+do_show_dialog (void)
 {
-        GError     *error;
-        guint       result;
-        gboolean    res;
-        gboolean    ret;
-
-        ret = FALSE;
-
-        if (bus_proxy == NULL) {
-                goto out;
-        }
-
-        error = NULL;
-	res = dbus_g_proxy_call (bus_proxy,
-                                 "RequestName",
-                                 &error,
-                                 G_TYPE_STRING, name,
-                                 G_TYPE_UINT, 0,
-                                 G_TYPE_INVALID,
-                                 G_TYPE_UINT, &result,
-                                 G_TYPE_INVALID);
-        if (! res) {
-                if (error != NULL) {
-                        g_warning ("Failed to acquire %s: %s", name, error->message);
-                        g_error_free (error);
-                } else {
-                        g_warning ("Failed to acquire %s", name);
-                }
-                goto out;
-	}
-
- 	if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
-                if (error != NULL) {
-                        g_warning ("Failed to acquire %s: %s", name, error->message);
-                        g_error_free (error);
-                } else {
-                        g_warning ("Failed to acquire %s", name);
-                }
-                goto out;
+  guint32 server_time;
+
+  gtk_widget_realize (auth_data->dialog);
+  server_time = gdk_x11_get_server_time (auth_data->dialog->window);
+  gtk_window_present_with_time (GTK_WINDOW (auth_data->dialog), server_time);
+  gtk_widget_show_all (auth_data->dialog);
+}
+
+static void
+do_cancel_auth (void)
+{
+  auth_data->was_cancelled = TRUE;
+  polkit_agent_authentication_session_cancel (auth_data->session);
+}
+
+static char *
+conversation_pam_prompt (PolkitAgentAuthenticationSession *session,
+                         const char *request,
+                         gboolean echo_on,
+                         gpointer user_data)
+{
+  gchar *password;
+  int response;
+
+  password = NULL;
+
+  g_debug ("in conversation_pam_prompt, request='%s', echo_on=%d", request, echo_on);
+
+#if 0
+  /* Fix up, and localize, password prompt if it's password auth */
+  printf ("request: '%s'\n", request);
+  if (g_ascii_strncasecmp (request, "password:", 9) == 0)
+    {
+      if (auth_data->requires_admin)
+        {
+          if (auth_data->admin_user_selected != NULL)
+            {
+              request2 = g_strdup_printf (_("_Password for %s:"), auth_data->admin_user_selected);
+            }
+          else
+            {
+              request2 = g_strdup (_("_Password for root:"));
+            }
+        }
+      else
+        {
+          request2 = g_strdup (_("_Password:"));
+        }
+    }
+  else if (g_ascii_strncasecmp (request, "password or swipe finger:", 25) == 0)
+    {
+      if (auth_data->requires_admin)
+        {
+          if (auth_data->admin_user_selected != NULL)
+            {
+              request2 = g_strdup_printf (_("_Password or swipe finger for %s:"),
+                                          auth_data->admin_user_selected);
+            }
+          else
+            {
+              request2 = g_strdup (_("_Password or swipe finger for root:"));
+            }
         }
+      else
+        {
+          request2 = g_strdup (_("_Password or swipe finger:"));
+        }
+    }
+  else
+    {
+      request2 = g_strdup (request);
+    }
+#endif
 
-        ret = TRUE;
+  polkit_gnome_auth_dialog_set_prompt (POLKIT_GNOME_AUTH_DIALOG (auth_data->dialog), request, echo_on);
 
- out:
-        return ret;
+  do_show_dialog ();
+
+  response = gtk_dialog_run (GTK_DIALOG (auth_data->dialog));
+
+  /* cancel auth unless user clicked "Authenticate" */
+  if (response != GTK_RESPONSE_OK)
+    {
+      do_cancel_auth ();
+      goto out;
+    }
+
+  password = g_strdup (polkit_gnome_auth_dialog_get_password (POLKIT_GNOME_AUTH_DIALOG (auth_data->dialog)));
+
+out:
+  return password;
 }
 
-static DBusGConnection *
-get_session_bus (void)
+static char *
+conversation_pam_prompt_echo_off (PolkitAgentAuthenticationSession *session,
+                                  const char *request,
+                                  gpointer user_data)
 {
-        GError          *error;
-        DBusGConnection *bus;
-        DBusConnection  *connection;
+  return conversation_pam_prompt (session, request, FALSE, user_data);
+}
 
-        error = NULL;
-        bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-        if (bus == NULL) {
-                g_warning ("Couldn't connect to session bus: %s", error->message);
-                g_error_free (error);
-                goto out;
+static char *
+conversation_pam_prompt_echo_on (PolkitAgentAuthenticationSession *session,
+                                 const char *request,
+                                 gpointer user_data)
+{
+  return conversation_pam_prompt (session, request, TRUE, FALSE);
+}
+
+static void
+conversation_pam_error_msg (PolkitAgentAuthenticationSession *session,
+                            const char *msg,
+                            gpointer user_data)
+{
+  g_debug ("error_msg='%s'", msg);
+}
+
+static void
+conversation_pam_text_info (PolkitAgentAuthenticationSession *session,
+                            const char *msg,
+                            gpointer user_data)
+{
+  g_debug ("text_info='%s'", msg);
+}
+
+
+static void
+conversation_done (PolkitAgentAuthenticationSession *session,
+                   gboolean                          gained_authorization,
+                   gboolean                          invalid_data,
+                   gpointer                          user_data)
+{
+  auth_data->gained_authorization = gained_authorization;
+  auth_data->invalid_data = invalid_data;;
+
+  g_debug ("in conversation_done gained=%d, invalid=%d", gained_authorization, invalid_data);
+
+  if ((auth_data->invalid_data || auth_data->was_cancelled) && auth_data->dialog != NULL)
+    {
+      gtk_widget_destroy (auth_data->dialog);
+      auth_data->dialog = NULL;
+    }
+
+  g_main_loop_quit (auth_data->loop);
+}
+
+static PolkitActionDescription *
+get_desc_for_action (const gchar *action_id)
+{
+  GList *action_descs;
+  GList *l;
+  PolkitActionDescription *result;
+
+  result = NULL;
+
+  action_descs = polkit_authority_enumerate_actions_sync (authority,
+                                                          NULL,
+                                                          NULL,
+                                                          NULL);
+  for (l = action_descs; l != NULL; l = l->next)
+    {
+      PolkitActionDescription *action_desc = POLKIT_ACTION_DESCRIPTION (l->data);
+
+      if (strcmp (polkit_action_description_get_action_id (action_desc), action_id) == 0)
+        {
+          result = g_object_ref (action_desc);
+          goto out;
         }
+    }
+
+ out:
+
+  g_list_foreach (action_descs, (GFunc) g_object_unref, NULL);
+  g_list_free (action_descs);
+
+  return result;
+}
+
+static gboolean
+do_authentication (gpointer user_data)
+{
+  gint num_tries;
+  PolkitIdentity *identity;
+  GIcon *icon;
+  gchar *icon_name;
+
+  auth_data->action_desc = get_desc_for_action (auth_data->action_id);
+
+  icon_name = NULL;
+
+  icon = polkit_action_description_get_icon (auth_data->action_desc);
+  if (icon != NULL)
+    icon_name = g_icon_to_string (icon);
+
+  auth_data->dialog = polkit_gnome_auth_dialog_new ("", /* TODO: path to exe file */
+                                                    auth_data->action_id,
+                                                    polkit_action_description_get_vendor_name (auth_data->action_desc),
+                                                    polkit_action_description_get_vendor_url (auth_data->action_desc),
+                                                    icon_name,
+                                                    polkit_action_description_get_message (auth_data->action_desc));
+
+  polkit_gnome_auth_dialog_set_options (POLKIT_GNOME_AUTH_DIALOG (auth_data->dialog),
+                                        FALSE,
+                                        FALSE,
+                                        FALSE,
+                                        NULL);
+
+  auth_data->loop = g_main_loop_new (NULL, TRUE);
+
+  num_tries = 0;
+
+  identity = POLKIT_IDENTITY (auth_data->identities->data);
+
+ try_again:
+
+  /* TODO: make this work with multiple users */
+  auth_data->session = polkit_agent_authentication_session_new (identity,
+                                                                auth_data->cookie);
+
+  polkit_agent_authentication_session_set_functions (auth_data->session,
+                                                     conversation_pam_prompt_echo_off,
+                                                     conversation_pam_prompt_echo_on,
+                                                     conversation_pam_error_msg,
+                                                     conversation_pam_text_info,
+                                                     conversation_done,
+                                                     NULL);
+
+
+  if (!polkit_agent_authentication_session_initiate_auth (auth_data->session))
+    {
+      g_warning ("Failed to initiate authentication session");
+      goto done;
+    }
+  g_main_loop_run (auth_data->loop);
+
+  num_tries++;
+
+  g_debug ("gained_authorization=%d was_cancelled=%d invalid_data=%d.",
+           auth_data->gained_authorization,
+           auth_data->was_cancelled,
+           auth_data->invalid_data);
+
+  if (!auth_data->gained_authorization && !auth_data->was_cancelled && !auth_data->invalid_data)
+    {
+      if (auth_data->dialog != NULL)
+        {
+          /* shake the dialog to indicate error */
+          polkit_gnome_auth_dialog_indicate_auth_error (POLKIT_GNOME_AUTH_DIALOG (auth_data->dialog));
+
+          if (num_tries < 3)
+            {
+              g_object_unref (auth_data->session);
+              auth_data->session = NULL;
+              goto try_again;
+            }
+        }
+    }
+
+ done:
+
+  polkit_agent_authentication_agent_finish (agent,
+                                            auth_data->pending_call,
+                                            NULL);
+
+  auth_data_free (auth_data);
+  auth_data = NULL;
+
+  g_free (icon_name);
+
+  return FALSE;
+}
+
+
+static void
+begin_authentication_func (PolkitAgentAuthenticationAgent *agent,
+                           const gchar                    *action_id,
+                           const gchar                    *cookie,
+                           GList                          *identities,
+                           gpointer                        pending_call)
+{
+  GList *l;
+
+  g_debug ("Begin authentication func action_id=%s cookie=%s num_identities=%d",
+           action_id,
+           cookie,
+           g_list_length (identities));
+
+  for (l = identities; l != NULL; l = l->next)
+    {
+      PolkitIdentity *identity = POLKIT_IDENTITY (l->data);
+      gchar *identity_str;
+
+      identity_str = polkit_identity_to_string (identity);
+      g_debug ("  identity %s", identity_str);
+      g_free (identity_str);
+    }
+
+  if (auth_data != NULL)
+    {
+      GError *error;
+
+      error = g_error_new (POLKIT_ERROR,
+                           POLKIT_ERROR_FAILED,
+                           "Authentication is already in progress for another action");
+
+      polkit_agent_authentication_agent_finish (agent,
+                                                auth_data->pending_call,
+                                                error);
+
+      g_error_free (error);
+      goto out;
+    }
+
+  auth_data = auth_data_new (action_id,
+                             cookie,
+                             identities,
+                             pending_call);
+
+  g_idle_add (do_authentication, NULL);
 
-        connection = dbus_g_connection_get_connection (bus);
  out:
-        return bus;
+  ;
+}
+
+static void
+cancel_authentication_func (PolkitAgentAuthenticationAgent *agent,
+                            const gchar                    *cookie,
+                            gpointer                        user_data)
+{
+  g_debug ("Cancel authentication func cookie=%s", cookie);
+
+  if (auth_data != NULL)
+    {
+      if (strcmp (auth_data->cookie, cookie) == 0)
+        {
+          do_cancel_auth ();
+        }
+    }
 }
 
 int
 main (int argc, char **argv)
 {
-        GMainLoop           *loop;
-        PolKitGnomeManager  *manager;
-        GOptionContext      *context;
-        DBusGProxy          *bus_proxy;
-        DBusGConnection     *connection;
-        int                  ret;
-        static gboolean     no_exit      = FALSE;
-        static GOptionEntry entries []   = {
-                { "no-exit", 0, 0, G_OPTION_ARG_NONE, &no_exit, N_("Don't exit after 30 seconds of inactivity"), NULL },
-                { NULL }
-        };
-
-        ret = 1;
+  GMainLoop *loop;
+  GError *error;
+  int ret;
 
-        g_type_init ();
-        gtk_init (&argc, &argv);
+  g_type_init ();
+  gtk_init (&argc, &argv);
 
-        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 #if HAVE_BIND_TEXTDOMAIN_CODESET
-        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 #endif
-        textdomain (GETTEXT_PACKAGE);
+  textdomain (GETTEXT_PACKAGE);
 
-        context = g_option_context_new (_("PolicyKit GNOME session daemon"));
-        g_option_context_add_main_entries (context, entries, NULL);
-        g_option_context_parse (context, &argc, &argv, NULL);
-        g_option_context_free (context);
+  ret = 1;
 
-        connection = get_session_bus ();
-        if (connection == NULL) {
-                goto out;
-        }
+  loop = NULL;
+  authority = NULL;
+  agent = NULL;
 
-        bus_proxy = get_bus_proxy (connection);
-        if (bus_proxy == NULL) {
-                g_warning ("Could not construct bus_proxy object; bailing out");
-                goto out;
-        }
+  authority = polkit_authority_get ();
 
-        if (!acquire_name_on_proxy (bus_proxy, "org.gnome.PolicyKit") ) {
-                g_warning ("Could not acquire name; bailing out");
-                goto out;
-        }
+  error = NULL;
+  agent = polkit_agent_authentication_agent_new (begin_authentication_func,
+                                                 cancel_authentication_func,
+                                                 NULL,
+                                                 &error);
+  if (agent == NULL)
+    {
+      g_warning ("Error registering authentication agent: %s", error->message);
+      g_error_free (error);
+      goto out;
+    }
 
-        if (!acquire_name_on_proxy (bus_proxy, "org.freedesktop.PolicyKit.AuthenticationAgent") ) {
-                g_warning ("Could not acquire name; bailing out");
-                goto out;
-        }
-
-        g_debug (_("Starting PolicyKit GNOME session daemon version %s"), VERSION);
+  loop = g_main_loop_new (NULL, FALSE);
 
-        manager = polkit_gnome_manager_new (no_exit);
+  g_main_loop_run (loop);
 
-        if (manager == NULL) {
-                goto out;
-        }
+  ret = 0;
 
-        loop = g_main_loop_new (NULL, FALSE);
+ out:
+  if (agent != NULL)
+    g_object_unref (agent);
 
-        g_main_loop_run (loop);
+  if (loop != NULL)
+    g_main_loop_unref (loop);
 
-        g_object_unref (manager);
-        g_main_loop_unref (loop);
-        ret = 0;
+  if (authority != NULL)
+    g_object_unref (authority);
 
-out:
-        return ret;
+  return ret;
 }

Modified: trunk/src/polkit-gnome-auth-dialog.c
==============================================================================
--- trunk/src/polkit-gnome-auth-dialog.c	(original)
+++ trunk/src/polkit-gnome-auth-dialog.c	Wed Jan 21 05:33:35 2009
@@ -36,8 +36,6 @@
 
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
 
 #include "sexy-url-label.h"
 #include "polkit-gnome-auth-dialog.h"
@@ -616,6 +614,7 @@
 static void
 action_id_activated (SexyUrlLabel *url_label, char *url, gpointer user_data)
 {
+#if 0
         GError *error;
         DBusGConnection *bus;
         DBusGProxy *manager_proxy;
@@ -653,6 +652,7 @@
 	}
 out:
 	;
+#endif
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]