[gnome-panel] [clock] Use the polkit helper from g-s-d to set time/timezone



commit 4362e6cfafee8aebc2778ae97134406e23b1e59e
Author: Vincent Untz <vuntz gnome org>
Date:   Sun Aug 8 04:30:11 2010 +0200

    [clock] Use the polkit helper from g-s-d to set time/timezone
    
    gnome-clock-applet-mechanism has moved to gnome-settings-daemon (since
    2.31.4) and is now named gsd-datetime-mechanism. The D-Bus interface is
    the same, except for the name of the service and the name of the
    interface. So we simply need to remove a lot of code that is now
    duplicated.
    
    Note that this means polkit is not needed anymore to build gnome-panel.

 applets/clock/Makefile.am                          |   74 +---
 applets/clock/gnome-clock-applet-mechanism-main.c  |  171 ------
 applets/clock/gnome-clock-applet-mechanism.c       |  631 --------------------
 applets/clock/gnome-clock-applet-mechanism.h       |   95 ---
 applets/clock/gnome-clock-applet-mechanism.xml     |   81 ---
 applets/clock/org.gnome.ClockApplet.Mechanism.conf |   19 -
 .../org.gnome.ClockApplet.Mechanism.service.in     |    4 -
 .../org.gnome.clockapplet.mechanism.policy.in      |   38 --
 applets/clock/set-timezone-dummy.c                 |   75 ---
 applets/clock/set-timezone.c                       |    8 +-
 configure.in                                       |   25 -
 11 files changed, 8 insertions(+), 1213 deletions(-)
---
diff --git a/applets/clock/Makefile.am b/applets/clock/Makefile.am
index 80fcf66..4d76f04 100644
--- a/applets/clock/Makefile.am
+++ b/applets/clock/Makefile.am
@@ -29,16 +29,6 @@ CALENDAR_SOURCES =		\
 	calendar-debug.h
 endif
 
-if HAVE_POLKIT
-SETTIME_SOURCES =		\
-	set-timezone.c		\
-	set-timezone.h
-else
-SETTIME_SOURCES =		\
-	set-timezone-dummy.c	\
-	set-timezone.h
-endif
-
 CLOCK_SOURCES = 		\
 	calendar-window.c	\
 	calendar-window.h	\
@@ -56,11 +46,12 @@ CLOCK_SOURCES = 		\
 	clock-sunpos.h		\
 	clock-utils.c		\
 	clock-utils.h		\
+	set-timezone.c		\
+	set-timezone.h		\
 	system-timezone.c	\
 	system-timezone.h	\
 	$(BUILT_SOURCES)	\
-	$(CALENDAR_SOURCES)	\
-	$(SETTIME_SOURCES)
+	$(CALENDAR_SOURCES)
 
 CLOCK_LDADD =						\
 	../../libpanel-applet/libpanel-applet-3.la	\
@@ -112,31 +103,6 @@ clock-typebuiltins.h: @REBUILD@ $(clock_enum_headers)
 			--eprod "GType @enum_name _get_type (void);\n" \
 		$(clock_enum_headers) >  $@
 
-gnome-clock-applet-mechanism-glue.h: $(srcdir)/gnome-clock-applet-mechanism.xml
-	$(AM_V_GEN)dbus-binding-tool \
-			--prefix=gnome_clock_applet_mechanism --mode=glib-server	\
-			--output=gnome-clock-applet-mechanism-glue.h			\
-			$(srcdir)/gnome-clock-applet-mechanism.xml
-
-gnome_clock_applet_mechanism_SOURCES =		\
-	gnome-clock-applet-mechanism.c		\
-	gnome-clock-applet-mechanism.h		\
-	gnome-clock-applet-mechanism-main.c	\
-	system-timezone.c			\
-	system-timezone.h
-
-if HAVE_POLKIT
-BUILT_SOURCES += gnome-clock-applet-mechanism-glue.h
-endif
-
-gnome_clock_applet_mechanism_INCLUDES =	\
-	$(CLOCK_MECHANISM_CFLAGS) 	\
-	$(POLKIT_CFLAGS)
-
-gnome_clock_applet_mechanism_LDADD =	\
-	$(CLOCK_MECHANISM_LIBS)		\
-	$(POLKIT_LIBS)
-
 if CLOCK_INPROCESS
 APPLET_IN_PROCESS = true
 APPLET_LOCATION   = $(pkglibdir)/libclock-applet.so
@@ -161,10 +127,6 @@ clock_applet_CFLAGS =
 $(clock_applet_OBJECTS): $(BUILT_SOURCES)
 endif
 
-if HAVE_POLKIT
-libexec_PROGRAMS += gnome-clock-applet-mechanism
-endif
-
 uidir		= $(datadir)/gnome-panel/ui
 ui_DATA		= clock.ui
 
@@ -213,30 +175,6 @@ else
 install-data-local:
 endif
 
-dbus_servicesdir = $(datadir)/dbus-1/system-services
-dbus_confdir = $(sysconfdir)/dbus-1/system.d
-polkitdir = $(datadir)/polkit-1/actions
-
-dbus_services_in_files = org.gnome.ClockApplet.Mechanism.service.in
-polkit_in_files = org.gnome.clockapplet.mechanism.policy.in
-
-if HAVE_POLKIT
-dbus_services_DATA = $(dbus_services_in_files:.service.in=.service)
-
-$(dbus_services_DATA): $(dbus_services_in_files)
-	$(AM_V_GEN)sed -e "s|\ LIBEXECDIR\@|$(libexecdir)|" $< > $@
-
-dbus_conf_DATA = org.gnome.ClockApplet.Mechanism.conf
-
- INTLTOOL_POLICY_RULE@
-polkit_DATA = $(polkit_in_files:.policy.in=.policy)
-
-else
-dbus_services_DATA =
-dbus_conf_DATA =
-polkit_DATA =
-endif
-
 noinst_PROGRAMS = test-system-timezone
 
 test_system_timezone_SOURCES = 	\
@@ -255,11 +193,7 @@ EXTRA_DIST =						\
 	$(xmlui_DATA)					\
 	$(ui_DATA)					\
 	clock-marshallers.list				\
-	$(service_in_files)				\
-	$(dbus_services_in_files)			\
-	org.gnome.ClockApplet.Mechanism.conf		\
-	$(polkit_in_files)				\
-	gnome-clock-applet-mechanism.xml
+	$(service_in_files)
 
 CLEANFILES =			\
 	$(BUILT_SOURCES)	\
diff --git a/applets/clock/set-timezone.c b/applets/clock/set-timezone.c
index 30dffc0..91c80dd 100644
--- a/applets/clock/set-timezone.c
+++ b/applets/clock/set-timezone.c
@@ -86,9 +86,9 @@ refresh_can_do (const gchar *action, CanDoFunc callback)
                 return;
 
 	proxy = dbus_g_proxy_new_for_name (bus,
-					   "org.gnome.ClockApplet.Mechanism",
+					   "org.gnome.SettingsDaemon.DateTimeMechanism",
 					   "/",
-					   "org.gnome.ClockApplet.Mechanism");
+					   "org.gnome.SettingsDaemon.DateTimeMechanism");
 
 	dbus_g_proxy_begin_call_with_timeout (proxy,
 					      action,
@@ -213,9 +213,9 @@ set_time_async (SetTimeCallbackData *data)
                 return;
 
 	proxy = dbus_g_proxy_new_for_name (bus,
-					   "org.gnome.ClockApplet.Mechanism",
+					   "org.gnome.SettingsDaemon.DateTimeMechanism",
 					   "/",
-					   "org.gnome.ClockApplet.Mechanism");
+					   "org.gnome.SettingsDaemon.DateTimeMechanism");
 
 	data->ref_count++;
 	if (strcmp (data->call, "SetTime") == 0)
diff --git a/configure.in b/configure.in
index 43d119c..38b2db2 100644
--- a/configure.in
+++ b/configure.in
@@ -136,33 +136,9 @@ PKG_CHECK_MODULES(CLOCK_MECHANISM, [ gthread-2.0 gio-2.0 dbus-glib-1 ])
 AC_SUBST(CLOCK_MECHANISM_CFLAGS)
 AC_SUBST(CLOCK_MECHANISM_LIBS)
 
-POLKIT_REQUIRED=0.91
 DBUS_REQUIRED=1.1.2
 NETWORK_MANAGER_REQUIRED=0.6
  
-# PolicyKit detection; defaults to 'auto' (use it if it's available)
-#
-POLKIT_CFLAGS=
-POLKIT_LIBS=
-AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit],[Enable PolicyKit support (auto)]),enable_polkit=$enableval,enable_polkit=auto)
-if test "x$enable_polkit" = "xno" ; then
-  HAVE_POLKIT=no
-else
-  HAVE_POLKIT=no
-  PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-1 >= $DBUS_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no)
- 
-  if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno" ; then
-    AC_MSG_ERROR(PolicyKit support explicity enabled but not available)
-  fi
-
-  if test "x$HAVE_POLKIT" = "xyes" ; then
-    AC_DEFINE(HAVE_POLKIT, 1, [Defined if PolicyKit support is enabled])
-  fi
-fi
-AM_CONDITIONAL(HAVE_POLKIT, test "x$HAVE_POLKIT" = "xyes")
-AC_SUBST(POLKIT_CFLAGS)
-AC_SUBST(POLKIT_LIBS)
-
 AC_ARG_ENABLE(network_manager, AS_HELP_STRING([--enable-network-manager],[Enable NetworkManager support (auto)]),enable_network_manager=$enableval,enable_network_manager=auto)
 if test "x$enable_network_manager" = "xno" ; then
   HAVE_NETWORK_MANAGER=no
@@ -447,7 +423,6 @@ echo "
         Bonobo applets support:        ${HAVE_BONOBO}
         Applets to build in-process:   ${PANEL_INPROCESS_APPLETS}
         Evolution-Data-Server support: ${HAVE_EDS}
-        PolicyKit support:             ${HAVE_POLKIT}
         NetworkManager support:        ${HAVE_NETWORK_MANAGER}
         XRandr support:                ${have_randr}
         Build introspection support:   ${found_introspection}



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