Hello community,

here is the log from the commit of package hp-drive-guard for openSUSE:Factory
checked in at Fri Jul 29 16:38:01 CEST 2011.



--------
--- hp-drive-guard/hp-drive-guard.changes       2011-06-28 13:13:33.000000000 
+0200
+++ /mounts/work_src_done/STABLE/hp-drive-guard/hp-drive-guard.changes  
2011-07-29 15:32:32.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Jul 29 12:43:05 CEST 2011 - ti...@suse.de
+
+- Convert to new polkit-1 (bnc#708992)
+- Use gtk3 for FACTORY
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


New:
----
  use-gtk3.diff
  use-new-polkit.diff

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hp-drive-guard.spec ++++++
--- /var/tmp/diff_new_pack.NvzP3x/_old  2011-07-29 16:37:14.000000000 +0200
+++ /var/tmp/diff_new_pack.NvzP3x/_new  2011-07-29 16:37:14.000000000 +0200
@@ -17,12 +17,32 @@
 
 # norootforbuild
 
+%define new_polkit     (%suse_version >= 1140)
+%define use_upower     (%suse_version > 1120)
+%define use_gtk3       (%suse_version > 1140)
+
+%if %{new_polkit}
+%define polkitdir      %{_datadir}/polkit-1/actions
+%else
+%define polkitdir      %{_datadir}/PolicyKit/policy
+%endif
 
 Name:           hp-drive-guard
 BuildRequires:  fdupes gnome-common intltool
-BuildRequires:  gtk2-devel libnotify-devel
+%if %{use_gtk3}
+BuildRequires:  gtk3-devel
+%else
+BuildRequires:  gtk2-devel
+%endif
+BuildRequires:  libnotify-devel
+BuildRequires:  dbus-1-glib-devel
+BuildRequires:  libxslt
+%if %{new_polkit}
+BuildRequires:  polkit-devel
+%else
 BuildRequires:  PolicyKit-gnome-devel
-%if %suse_version > 1120
+%endif
+%if %{use_upower}
 BuildRequires:  libupower-glib-devel
 %else
 BuildRequires:  hal-devel
@@ -32,11 +52,13 @@
 License:        GPLv2+
 Group:          Hardware/Mobile
 Version:        0.3.12
-Release:        6
+Release:        8
 Summary:        HP DriveGuard for SuSE
 Source:         hp-drive-guard-%{version}.tar.bz2
 Patch1:         0001-Fix-misc-compile-warnings.patch
 Patch2:         0002-Fix-build-with-the-new-libnotify.patch
+Patch3:         use-new-polkit.diff
+Patch4:         use-gtk3.diff
 Url:            http://www.gnome.org
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
@@ -55,12 +77,19 @@
 %setup -q
 %patch1 -p1
 %patch2 -p1
+%if %{new_polkit}
+%patch3 -p1
+%endif
+%if %{use_gtk3}
+%patch4 -p1
+%endif
 
-%if %suse_version > 1120
+%if %use_upower
 %define pm_method      upower
 %else
 %define pm_method      hal
 %endif
+
 %if %suse_version >= 1120
 %define user_setup     --enable-user-setup
 %else
@@ -100,6 +129,6 @@
 %{_sysconfdir}/xdg/autostart/hp-drive-guard-client.desktop
 %{_sysconfdir}/dbus-1/system.d/hp-drive-guard-dbus.conf
 %{_sysconfdir}/init.d/hp-drive-guard
-%{_datadir}/PolicyKit/policy/*
+%{polkitdir}/*
 
 %changelog

++++++ use-gtk3.diff ++++++
---
 configure.ac |    2 +-
 src/client.c |    6 +++---
 src/setup.c  |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@
 AM_GNU_GETTEXT_VERSION([0.17])
 
 PKG_CHECK_MODULES(GLIB, glib-2.0)
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
+PKG_CHECK_MODULES(GTK, gtk+-3.0)
 PKG_CHECK_MODULES(DBUS, dbus-glib-1)
 PKG_CHECK_MODULES(LIBNOTIFY, libnotify)
 PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)
--- a/src/client.c
+++ b/src/client.c
@@ -245,7 +245,7 @@
   if (drive_guard->current_tooltip != drive_guard->current_state)
   {
     drive_guard->current_tooltip = drive_guard->current_state;
-    gtk_status_icon_set_tooltip (drive_guard->status_icon,
+    gtk_status_icon_set_tooltip_text (drive_guard->status_icon,
                                 gettext (tooltip_msgs 
[drive_guard->current_tooltip]));
   }
 
@@ -581,7 +581,7 @@
   }
 
   drive_guard->status_icon = gtk_status_icon_new_from_pixbuf 
(drive_guard->state_pixbuf [DRIVE_GUARD_DRIVE_STATE_NONE]);
-  gtk_status_icon_set_tooltip (drive_guard->status_icon,
+  gtk_status_icon_set_tooltip_text (drive_guard->status_icon,
                                _("Looking for HP DriveGuard service"));
   init_state_change_notification (drive_guard);
   queue_state_change_notification (drive_guard);
@@ -635,7 +635,7 @@
     return 1;
 
   textdomain (PACKAGE);
-  gtk_set_locale ();
+  setlocale (LC_ALL, "");
 
   notify_init ("DriveGuard");
 
--- a/src/setup.c
+++ b/src/setup.c
@@ -171,7 +171,7 @@
 
   vbox1 = gtk_vbox_new (FALSE, 0);
   gtk_widget_show (vbox1);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox1, FALSE, 
FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG 
(dialog))), vbox1, FALSE, FALSE, 0);
 
   device_enable = gtk_check_button_new_with_label (_("Enable HP DriveGuard"));
   gtk_widget_show (device_enable);
++++++ use-new-polkit.diff ++++++
---
 configure.ac    |    3 --
 src/Makefile.am |    8 +++----
 src/client.c    |   38 ++++++++-------------------------
 src/daemon.c    |   64 ++++++++++++++++++++++----------------------------------
 4 files changed, 41 insertions(+), 72 deletions(-)

--- a/configure.ac
+++ b/configure.ac
@@ -40,8 +40,7 @@
 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
 PKG_CHECK_MODULES(DBUS, dbus-glib-1)
 PKG_CHECK_MODULES(LIBNOTIFY, libnotify)
-PKG_CHECK_MODULES(POLKITDBUS, polkit-dbus)
-PKG_CHECK_MODULES(POLKITGNOME, polkit-gnome)
+PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)
 AC_ARG_WITH(pm,
   AS_HELP_STRING([--with-pm=hal|upower],
                 [Power-management backend, either hal or upower]),
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
 hp_drive_guarddatadir = $(datadir)/hp-drive-guard
 dbusservicedir=$(DBUS_SYS_DIR)
-polkit_policydir = $(datadir)/PolicyKit/policy
+polkitdir = $(datadir)/polkit-1/actions
 
 hpgcdir = @HELPER_EXEC_DIR@
 
@@ -11,8 +11,8 @@
 hp_drive_guard_client_SOURCES = \
   client.c common.h setup.c serverconfig.c serverconfig.h
 
-LDADD = @POLKITGNOME_LIBS@ @LIBNOTIFY_LIBS@ 
-AM_CFLAGS = @POLKITGNOME_CFLAGS@ @LIBNOTIFY_CFLAGS@ 
+LDADD = @POLKIT_LIBS@ @LIBNOTIFY_LIBS@ 
+AM_CFLAGS = @POLKIT_CFLAGS@ @LIBNOTIFY_CFLAGS@ 
 if PM_BACKEND_HAL
 LDADD += @HAL_LIBS@
 AM_CFLAGS += @HAL_CFLAGS@
@@ -45,7 +45,7 @@
 
 dbusservice_DATA = hp-drive-guard-dbus.conf
 autostart_DATA = hp-drive-guard-client.desktop
-dist_polkit_policy_DATA = com.hp.driveguard.policy
+dist_polkit_DATA = com.hp.driveguard.policy
 
 EXTRA_DIST = \
        hp-drive-guard-dbus.conf \
--- a/src/client.c
+++ b/src/client.c
@@ -44,8 +44,6 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-#include <polkit-gnome/polkit-gnome.h>
-
 #include "../config.h"
 #include "common.h"
 
@@ -126,8 +124,6 @@
   NotifyNotification *notifications [2];
 
   DBusConnection *dbus_connection;
-
-  PolKitGnomeContext *pkgc;
 }
 DriveGuard;
 
@@ -451,13 +447,13 @@
 }
 
 static void
-drive_guard_start_protection_cb (PolKitGnomeAction *action, gpointer data)
+drive_guard_start_protection_cb (GtkMenuItem *item, gpointer data)
 {
   send_enable_method ((DriveGuard *)data, TRUE);
 }
 
 static void
-drive_guard_stop_protection_cb (PolKitGnomeAction *action, gpointer data)
+drive_guard_stop_protection_cb (GtkMenuItem *item, gpointer data)
 {
   send_enable_method ((DriveGuard *)data, FALSE);
 }
@@ -481,6 +477,14 @@
     N_("_System Setup"), "<control>S",
     N_("Setup HP DriveGuard service"), /* tooltip */
     G_CALLBACK (drive_guard_setup_cb) },
+  { "start", GTK_STOCK_GO_FORWARD,
+    N_("Start Protection"), "<control>F",
+    N_("Start HP DriveGuard again"), /* tooltip */
+    G_CALLBACK (drive_guard_start_protection_cb) },
+  { "stop", GTK_STOCK_STOP,
+    N_("Pause Protection"), "<control>T",
+    N_("Stop HP DriveGuard temporarily"), /* tooltip */
+    G_CALLBACK (drive_guard_stop_protection_cb) },
   { "quit", GTK_STOCK_QUIT,
     N_("_Quit"), "<control>Q",
     N_("Quit"), /* tooltip */
@@ -524,8 +528,6 @@
 drive_guard_popup_menu_cb (GtkStatusIcon *status_icon, guint button,
                           guint32 timestamp, DriveGuard *drive_guard)
 {
-  PolKitAction *pk_action;
-  PolKitGnomeAction *action;
   GtkActionGroup *actions;
   GtkUIManager *ui;
   GtkWidget *menu;
@@ -534,24 +536,6 @@
   gtk_action_group_set_translation_domain (actions, PACKAGE);
   gtk_action_group_add_actions (actions, entries, G_N_ELEMENTS (entries), 
drive_guard);
 
-  pk_action = polkit_action_new ();
-  polkit_action_set_action_id (pk_action, DRIVE_GUARD_POLICY_ACTION_TOGGLE);
-  action = polkit_gnome_action_new_default ("start", pk_action,
-                                           _("Start Protection"),
-                                            _("Start HP DriveGuard again"));
-  g_signal_connect (G_OBJECT (action), "activate",
-                   G_CALLBACK (drive_guard_start_protection_cb),
-                   drive_guard);
-  gtk_action_group_add_action (actions, GTK_ACTION (action));
-  action = polkit_gnome_action_new_default ("stop", pk_action,
-                                           _("Pause Protection"),
-                                            _("Stop HP DriveGuard 
temporarily"));
-  g_signal_connect (G_OBJECT (action), "activate",
-                   G_CALLBACK (drive_guard_stop_protection_cb),
-                   drive_guard);
-  gtk_action_group_add_action (actions, GTK_ACTION (action));
-  polkit_action_unref (pk_action);
-
   ui = gtk_ui_manager_new ();
   gtk_ui_manager_insert_action_group (ui, actions, 0);
   switch (drive_guard->current_state) {
@@ -591,8 +575,6 @@
   context = g_main_context_default ();
   drive_guard->main_loop = g_main_loop_new (context, FALSE);
 
-  drive_guard->pkgc = polkit_gnome_context_get (NULL);
-
   for (i = 0; i < DRIVE_GUARD_DRIVE_STATE_MAX; i++)
   {
     drive_guard->state_pixbuf [i] = make_drive_state_pixbuf (i);
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -42,7 +42,7 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-#include <polkit-dbus/polkit-dbus.h>
+#include <polkit/polkit.h>
 
 #include "common.h"
 #include "serverconfig.h"
@@ -179,7 +179,7 @@
   LaptopHW *laptop_hw;
   int current_timeout;
 
-  PolKitContext *polkit_ctx;
+  PolkitAuthority *auth;
 
   char *core_argv[MAX_DRIVE_GUARD_DEVICES + 3];
   int num_unload_devs;
@@ -238,37 +238,32 @@
 }
 
 static gboolean
-check_polkit_authorized (DBusConnection *conn, DBusMessage *message,
+check_polkit_authorized (DBusMessage *message,
                         DriveGuardServer *drive_guard)
 {
-  DBusError error;
-  PolKitCaller *pk_caller;
-  PolKitAction *pk_action;
-  PolKitResult pk_result;
-
-  if (!drive_guard->polkit_ctx)
-    return FALSE;
-
-  dbus_error_init (&error);
-  pk_caller = polkit_caller_new_from_dbus_name (conn,
-                                               dbus_message_get_sender 
(message),
-                                               &error);
-  if (dbus_error_is_set (&error)) {
-    dbus_error_free (&error);
-    if (pk_caller)
-      polkit_caller_unref (pk_caller);
+  const char *sender;
+  PolkitSubject *subject;
+  PolkitAuthorizationResult *result;
+  gboolean authed;
+  GError *error = NULL;
+
+  sender = dbus_message_get_sender (message);
+  subject = polkit_system_bus_name_new (sender);
+  result = polkit_authority_check_authorization_sync (drive_guard->auth,
+                                                      subject,
+                                                      
DRIVE_GUARD_POLICY_ACTION_TOGGLE,
+                                                      NULL,
+                                                      
POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+                                                      NULL, &error);
+  g_object_unref (subject);
+  if (error) {
+    g_error_free (error);
     return FALSE;
   }
 
-  pk_action = polkit_action_new ();
-  polkit_action_set_action_id (pk_action, DRIVE_GUARD_POLICY_ACTION_TOGGLE);
-  pk_result = polkit_context_is_caller_authorized (drive_guard->polkit_ctx,
-                                                  pk_action, pk_caller,
-                                                  FALSE, NULL);
-  polkit_caller_unref (pk_caller);
-  polkit_action_unref (pk_action);
-
-  return (pk_result == POLKIT_RESULT_YES);
+  authed = polkit_authorization_result_get_is_authorized (result);
+  g_object_unref (result);
+  return authed;
 }
 
 static void drive_guard_start_core (DriveGuardServer *drive_guard);
@@ -369,7 +364,7 @@
   {
     guint32 n;
 
-    if (!check_polkit_authorized (conn, message, drive_guard_server)) {
+    if (!check_polkit_authorized (message, drive_guard_server)) {
       goto fail;
     }
     
@@ -575,7 +570,7 @@
   int freefall_fd;
   int shmfd;
   struct hp_drive_guard_shm *shm;
-  PolKitError *err;
+  GError *error = NULL;
 
   freefall_fd = open (FREEFALL_WATCH_DEVICE, O_RDONLY | O_NONBLOCK);
   if (freefall_fd < 0) {
@@ -617,14 +612,7 @@
   drive_guard_server->context = g_main_context_default ();
   drive_guard_server->main_loop = g_main_loop_new 
(drive_guard_server->context, FALSE);
 
-  drive_guard_server->polkit_ctx = polkit_context_new ();
-  err = NULL;
-  if (!polkit_context_init (drive_guard_server->polkit_ctx, &err)) {
-    if (err)
-      polkit_error_free (err);
-    polkit_context_unref (drive_guard_server->polkit_ctx);
-    drive_guard_server->polkit_ctx = NULL;
-  }
+  drive_guard_server->auth = polkit_authority_get_sync (NULL, &error);
 
   drive_guard_server_init_dbus (drive_guard_server);
 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to