View | Details | Raw Unified | Return to bug 796055
Collapse All | Expand All

(-)a/configure.ac (-1 / +1 lines)
Lines 94-100 PKG_CHECK_MODULES(LIBSHORTCUTS, $COMMON_MODULES x11) Link Here
94
PKG_CHECK_MODULES(SHELL, $COMMON_MODULES libgnome-menu-3.0 gio-unix-2.0 x11)
94
PKG_CHECK_MODULES(SHELL, $COMMON_MODULES libgnome-menu-3.0 gio-unix-2.0 x11)
95
PKG_CHECK_MODULES(BACKGROUND_PANEL, $COMMON_MODULES libxml-2.0 gnome-desktop-3.0
95
PKG_CHECK_MODULES(BACKGROUND_PANEL, $COMMON_MODULES libxml-2.0 gnome-desktop-3.0
96
                  gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
96
                  gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
97
PKG_CHECK_MODULES(DATETIME_PANEL, $COMMON_MODULES
97
PKG_CHECK_MODULES(DATETIME_PANEL, $COMMON_MODULES dbus-glib-1
98
                  gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
98
                  gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
99
                  polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION
99
                  polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION
100
                  gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
100
                  gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
(-)a/panels/datetime/Makefile.am (-40 / +10 lines)
Lines 98-121 check-local: test-timezone-gfx test-endianess test-timezone Link Here
98
ccpanelsdir = $(PANELS_DIR)
98
ccpanelsdir = $(PANELS_DIR)
99
ccpanels_LTLIBRARIES = libdate_time.la
99
ccpanels_LTLIBRARIES = libdate_time.la
100
100
101
101
# FIXME add a way to regenerate the dtm.[ch]
102
# This requires running d-bus session and accessible timedate1 daemon
102
# gdbus-codegen --generate-c-code dtm  --interface-prefix org.gnome.SettingsDaemon  /path/to/gnome-settings-daemon/plugins/datetime/gsd-datetime-mechanism.xml
103
# FIXME: need to find a way how to filter out unnecessary d-bus stuff (introspectable, properties)
103
# See also:
104
#timedated1-interface.xml:
104
# https://bugzilla.gnome.org/show_bug.cgi?id=650875
105
#	gdbus introspect					\
105
# https://bugzilla.gnome.org/show_bug.cgi?id=650874
106
#		--xml						\
107
#		--system					\
108
#		--dest org.freedesktop.timedate1		\
109
#		--object-path /org/freedesktop/timedate1	\
110
#		 > timedated1-interface.xml
111
112
dbus_built_sources = timedated.c timedated.h
113
timedated.c: timedated.h
114
timedated.h: Makefile.am timedated1-interface.xml
115
	gdbus-codegen						\
116
		--interface-prefix org.freedesktop.		\
117
		--generate-c-code timedated			\
118
		$(srcdir)/timedated1-interface.xml
119
106
120
libdate_time_la_SOURCES =	\
107
libdate_time_la_SOURCES =	\
121
	datetime-module.c	\
108
	datetime-module.c	\
Lines 123-161 libdate_time_la_SOURCES = \ Link Here
123
	cc-datetime-panel.h	\
110
	cc-datetime-panel.h	\
124
	cc-timezone-map.c	\
111
	cc-timezone-map.c	\
125
	cc-timezone-map.h	\
112
	cc-timezone-map.h	\
113
	dtm.c			\
114
	dtm.h			\
126
	date-endian.c		\
115
	date-endian.c		\
127
	date-endian.h		\
116
	date-endian.h		\
128
	tz.c tz.h		\
117
	tz.c tz.h
129
	$(dbus_built_sources)	\
130
	$(NULL)
131
118
132
libdate_time_la_LIBADD = $(PANEL_LIBS) $(DATETIME_PANEL_LIBS)
119
libdate_time_la_LIBADD = $(PANEL_LIBS) $(DATETIME_PANEL_LIBS)
133
libdate_time_la_LDFLAGS = $(PANEL_LDFLAGS)
120
libdate_time_la_LDFLAGS = $(PANEL_LDFLAGS)
134
121
135
136
polkitdir = $(datadir)/polkit-1/actions
137
polkit_in_files = org.gnome.controlcenter.datetime.policy.in
138
139
@INTLTOOL_POLICY_RULE@
140
polkit_DATA = $(polkit_in_files:.policy.in=.policy)
141
142
143
@INTLTOOL_DESKTOP_RULE@
122
@INTLTOOL_DESKTOP_RULE@
144
123
145
desktopdir = $(datadir)/applications
124
desktopdir = $(datadir)/applications
146
desktop_in_files = gnome-datetime-panel.desktop.in
125
desktop_in_files = gnome-datetime-panel.desktop.in
147
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
126
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
148
127
149
CLEANFILES =					\
128
CLEANFILES = $(desktop_in_files) $(desktop_DATA)
150
	$(desktop_in_files)			\
151
	$(desktop_DATA)				\
152
	$(dbus_built_sources)			\
153
	org.gnome.controlcenter.datetime.policy
154
155
EXTRA_DIST =				\
156
	timedated1-interface.xml	\
157
	$(polkit_in_files)
158
159
BUILT_SOURCES = $(dbus_built_sources)
160
129
161
-include $(top_srcdir)/git.mk
130
-include $(top_srcdir)/git.mk
131
(-)a/panels/datetime/cc-datetime-panel.c (-159 / +93 lines)
Lines 24-30 Link Here
24
24
25
#include <sys/time.h>
25
#include <sys/time.h>
26
#include "cc-timezone-map.h"
26
#include "cc-timezone-map.h"
27
#include "timedated.h"
27
#include "dtm.h"
28
#include "date-endian.h"
28
#include "date-endian.h"
29
#define GNOME_DESKTOP_USE_UNSTABLE_API
29
#define GNOME_DESKTOP_USE_UNSTABLE_API
30
30
Lines 82-88 struct _CcDateTimePanelPrivate Link Here
82
82
83
  GnomeWallClock *clock_tracker;
83
  GnomeWallClock *clock_tracker;
84
84
85
  Timedate1 *dtm;
85
  DateTimeMechanism *dtm;
86
  GCancellable *cancellable;
86
  GCancellable *cancellable;
87
87
88
  GPermission *permission;
88
  GPermission *permission;
Lines 300-308 set_time_cb (GObject *source, Link Here
300
  GError *error;
300
  GError *error;
301
301
302
  error = NULL;
302
  error = NULL;
303
  if (!timedate1_call_set_time_finish (self->priv->dtm,
303
  if (!date_time_mechanism_call_set_time_finish (self->priv->dtm,
304
                                       res,
304
                                                 res,
305
                                       &error))
305
                                                 &error))
306
    {
306
    {
307
      /* TODO: display any error in a user friendly way */
307
      /* TODO: display any error in a user friendly way */
308
      g_warning ("Could not set system time: %s", error->message);
308
      g_warning ("Could not set system time: %s", error->message);
Lines 323-331 set_timezone_cb (GObject *source, Link Here
323
  GError *error;
323
  GError *error;
324
324
325
  error = NULL;
325
  error = NULL;
326
  if (!timedate1_call_set_timezone_finish (self->priv->dtm,
326
  if (!date_time_mechanism_call_set_timezone_finish (self->priv->dtm,
327
                                           res,
327
                                                     res,
328
                                           &error))
328
                                                     &error))
329
    {
329
    {
330
      /* TODO: display any error in a user friendly way */
330
      /* TODO: display any error in a user friendly way */
331
      g_warning ("Could not set system timezone: %s", error->message);
331
      g_warning ("Could not set system timezone: %s", error->message);
Lines 342-350 set_using_ntp_cb (GObject *source, Link Here
342
  GError *error;
342
  GError *error;
343
343
344
  error = NULL;
344
  error = NULL;
345
  if (!timedate1_call_set_ntp_finish (self->priv->dtm,
345
  if (!date_time_mechanism_call_set_using_ntp_finish (self->priv->dtm,
346
                                      res,
346
                                                      res,
347
                                      &error))
347
                                                      &error))
348
    {
348
    {
349
      /* TODO: display any error in a user friendly way */
349
      /* TODO: display any error in a user friendly way */
350
      g_warning ("Could not set system to use NTP: %s", error->message);
350
      g_warning ("Could not set system to use NTP: %s", error->message);
Lines 357-372 queue_set_datetime (CcDateTimePanel *self) Link Here
357
{
357
{
358
  gint64 unixtime;
358
  gint64 unixtime;
359
359
360
  /* timedated expects number of microseconds since 1 Jan 1970 UTC */
360
  /* for now just do it */
361
  unixtime = g_date_time_to_unix (self->priv->date);
361
  unixtime = g_date_time_to_unix (self->priv->date);
362
362
363
  timedate1_call_set_time (self->priv->dtm,
363
  date_time_mechanism_call_set_time (self->priv->dtm,
364
                           unixtime * 1000000,
364
                                     unixtime,
365
                           FALSE,
365
                                     self->priv->cancellable,
366
                           TRUE,
366
                                     set_time_cb,
367
                           self->priv->cancellable,
367
                                     self);
368
                           set_time_cb,
369
                           self);
370
}
368
}
371
369
372
static void
370
static void
Lines 377-388 queue_set_ntp (CcDateTimePanel *self) Link Here
377
  /* for now just do it */
375
  /* for now just do it */
378
  using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch")));
376
  using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch")));
379
377
380
  timedate1_call_set_ntp (self->priv->dtm,
378
  date_time_mechanism_call_set_using_ntp (self->priv->dtm,
381
                          using_ntp,
379
                                          using_ntp,
382
                          TRUE,
380
                                          self->priv->cancellable,
383
                          self->priv->cancellable,
381
                                          set_using_ntp_cb,
384
                          set_using_ntp_cb,
382
                                          self);
385
                          self);
386
}
383
}
387
384
388
static void
385
static void
Lines 391-402 queue_set_timezone (CcDateTimePanel *self) Link Here
391
  /* for now just do it */
388
  /* for now just do it */
392
  if (self->priv->current_location)
389
  if (self->priv->current_location)
393
    {
390
    {
394
      timedate1_call_set_timezone (self->priv->dtm,
391
      date_time_mechanism_call_set_timezone (self->priv->dtm,
395
                                   self->priv->current_location->zone,
392
                                             self->priv->current_location->zone,
396
                                   TRUE,
393
                                             self->priv->cancellable,
397
                                   self->priv->cancellable,
394
                                             set_timezone_cb,
398
                                   set_timezone_cb,
395
                                             self);
399
                                   self);
400
    }
396
    }
401
}
397
}
402
398
Lines 553-575 location_changed_cb (CcTimezoneMap *map, Link Here
553
}
549
}
554
550
555
static void
551
static void
556
get_initial_timezone (CcDateTimePanel *self)
552
get_timezone_cb (GObject      *source,
553
                 GAsyncResult *res,
554
                 gpointer      user_data)
557
{
555
{
558
  const gchar *timezone;
556
  CcDateTimePanel *self = user_data;
557
  GtkWidget *widget;
558
  gchar *timezone;
559
  GError *error;
559
560
560
  if (self->priv->dtm)
561
  error = NULL;
561
    timezone = timedate1_get_timezone (self->priv->dtm);
562
  if (!date_time_mechanism_call_get_timezone_finish (self->priv->dtm, &timezone, res, &error))
563
    {
564
      g_warning ("Could not get current timezone: %s", error->message);
565
      g_error_free (error);
566
    }
562
  else
567
  else
563
    timezone = NULL;
564
565
  if (timezone == NULL ||
566
      !cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), timezone))
567
    {
568
    {
568
      g_warning ("Timezone '%s' is unhandled, setting %s as default", timezone ? timezone : "(null)", DEFAULT_TZ);
569
      if (!cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), timezone))
569
      cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), DEFAULT_TZ);
570
        {
571
          g_warning ("Timezone '%s' is unhandled, setting %s as default", timezone, DEFAULT_TZ);
572
          cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), DEFAULT_TZ);
573
        }
574
      self->priv->current_location = cc_timezone_map_get_location (CC_TIMEZONE_MAP (self->priv->map));
575
      update_timezone (self);
570
    }
576
    }
571
  self->priv->current_location = cc_timezone_map_get_location (CC_TIMEZONE_MAP (self->priv->map));
577
572
  update_timezone (self);
578
  /* now that the initial state is loaded set connect the signals */
579
  widget = (GtkWidget*) gtk_builder_get_object (self->priv->builder,
580
                                                "region_combobox");
581
  g_signal_connect (widget, "changed", G_CALLBACK (region_changed_cb), self);
582
583
  widget = (GtkWidget*) gtk_builder_get_object (self->priv->builder,
584
                                                "city_combobox");
585
  g_signal_connect (widget, "changed", G_CALLBACK (city_changed_cb), self);
586
587
  g_signal_connect (self->priv->map, "location-changed",
588
                    G_CALLBACK (location_changed_cb), self);
589
590
591
  g_free (timezone);
573
}
592
}
574
593
575
/* load region and city tree models */
594
/* load region and city tree models */
Lines 700-712 update_widget_state_for_ntp (CcDateTimePanel *panel, Link Here
700
                             gboolean         using_ntp)
719
                             gboolean         using_ntp)
701
{
720
{
702
  CcDateTimePanelPrivate *priv = panel->priv;
721
  CcDateTimePanelPrivate *priv = panel->priv;
703
  gboolean allowed;
704
705
  /* need to check polkit before revealing to user */
706
  allowed = (! priv->permission || g_permission_get_allowed (priv->permission));
707
722
708
  gtk_widget_set_sensitive (W("table1"), !using_ntp && allowed);
723
  gtk_widget_set_sensitive (W("table1"), !using_ntp);
709
  gtk_widget_set_sensitive (W("table2"), !using_ntp && allowed);
724
  gtk_widget_set_sensitive (W("table2"), !using_ntp);
710
}
725
}
711
726
712
static void
727
static void
Lines 815-896 on_permission_changed (GPermission *permission, Link Here
815
  gtk_widget_set_sensitive (W("map-vbox"), allowed);
830
  gtk_widget_set_sensitive (W("map-vbox"), allowed);
816
  gtk_widget_set_sensitive (W("hbox2"), allowed);
831
  gtk_widget_set_sensitive (W("hbox2"), allowed);
817
  gtk_widget_set_sensitive (W("alignment2"), allowed);
832
  gtk_widget_set_sensitive (W("alignment2"), allowed);
818
  update_widget_state_for_ntp (data, using_ntp);
833
  gtk_widget_set_sensitive (W("table1"), allowed && !using_ntp);
819
}
820
821
static void
822
update_ntp_switch_from_system (CcDateTimePanel *self)
823
{
824
  CcDateTimePanelPrivate *priv = self->priv;
825
  gboolean using_ntp;
826
  GtkWidget *switch_widget;
827
828
  using_ntp = timedate1_get_ntp (self->priv->dtm);
829
830
  switch_widget = W("network_time_switch");
831
  g_signal_handlers_block_by_func (switch_widget, change_ntp, self);
832
  gtk_switch_set_active (GTK_SWITCH (switch_widget), using_ntp);
833
  update_widget_state_for_ntp (self, using_ntp);
834
  g_signal_handlers_unblock_by_func (switch_widget, change_ntp, self);
835
}
836
837
static void
838
on_ntp_changed (CcDateTimePanel *self)
839
{
840
  update_ntp_switch_from_system (self);
841
}
842
843
static void
844
on_timezone_changed (CcDateTimePanel *self)
845
{
846
  CcDateTimePanelPrivate *priv = self->priv;
847
  GtkWidget *region_combo, *city_combo;
848
849
  region_combo = W("region_combobox");
850
  city_combo = W("city_combobox");
851
852
  g_signal_handlers_block_by_func (region_combo, region_changed_cb, self);
853
  g_signal_handlers_block_by_func (city_combo, city_changed_cb, self);
854
  g_signal_handlers_block_by_func (self->priv->map, location_changed_cb, self);
855
856
  get_initial_timezone (self);
857
858
  g_signal_handlers_unblock_by_func (region_combo, region_changed_cb, self);
859
  g_signal_handlers_unblock_by_func (city_combo, city_changed_cb, self);
860
  g_signal_handlers_unblock_by_func (self->priv->map, location_changed_cb, self);
861
}
862
863
static void
864
on_timedated_properties_changed (GDBusProxy       *proxy,
865
                                 GVariant         *changed_properties,
866
                                 const gchar     **invalidated_properties,
867
                                 CcDateTimePanel  *self)
868
{
869
  GError *error;
870
  GVariant *variant;
871
  GVariant *v;
872
  guint i;
873
874
  if (invalidated_properties != NULL)
875
    for (i = 0; invalidated_properties[i] != NULL; i++) {
876
        error = NULL;
877
        /* See https://bugs.freedesktop.org/show_bug.cgi?id=37632 for the reason why we're doing this */
878
        variant = g_dbus_proxy_call_sync (proxy,
879
                                          "org.freedesktop.DBus.Properties.Get",
880
                                          g_variant_new ("(ss)", "org.freedesktop.timedate1", invalidated_properties[i]),
881
                                          G_DBUS_CALL_FLAGS_NONE,
882
                                          -1,
883
                                          NULL,
884
                                          &error);
885
        if (variant == NULL) {
886
                g_warning ("Failed to get property '%s': %s", invalidated_properties[i], error->message);
887
                g_error_free (error);
888
        } else {
889
                g_variant_get (variant, "(v)", &v);
890
                g_dbus_proxy_set_cached_property (proxy, invalidated_properties[i], v);
891
                g_variant_unref (variant);
892
        }
893
    }
894
}
834
}
895
835
896
static void
836
static void
Lines 941-946 cc_date_time_panel_init (CcDateTimePanel *self) Link Here
941
  GtkTreeModelFilter *city_modelfilter;
881
  GtkTreeModelFilter *city_modelfilter;
942
  GtkTreeModelSort *city_modelsort;
882
  GtkTreeModelSort *city_modelsort;
943
  guint i, num_days;
883
  guint i, num_days;
884
  gboolean using_ntp;
885
  gboolean can_use_ntp;
944
  int ret;
886
  int ret;
945
  DateEndianess endianess;
887
  DateEndianess endianess;
946
  GError *error;
888
  GError *error;
Lines 949-960 cc_date_time_panel_init (CcDateTimePanel *self) Link Here
949
891
950
  priv->cancellable = g_cancellable_new ();
892
  priv->cancellable = g_cancellable_new ();
951
  error = NULL;
893
  error = NULL;
952
  priv->dtm = timedate1_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
894
  priv->dtm = date_time_mechanism_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
953
                                                G_DBUS_PROXY_FLAGS_NONE,
895
                                                          G_DBUS_PROXY_FLAGS_NONE,
954
                                                "org.freedesktop.timedate1",
896
                                                          "org.gnome.SettingsDaemon.DateTimeMechanism",
955
                                                "/org/freedesktop/timedate1",
897
                                                          "/",
956
                                                priv->cancellable,
898
                                                          priv->cancellable,
957
                                                &error);
899
                                                          &error);
958
  if (priv->dtm == NULL) {
900
  if (priv->dtm == NULL) {
959
        g_warning ("could not get proxy for DateTimeMechanism: %s", error->message);
901
        g_warning ("could not get proxy for DateTimeMechanism: %s", error->message);
960
        g_error_free (error);
902
        g_error_free (error);
Lines 974-981 cc_date_time_panel_init (CcDateTimePanel *self) Link Here
974
    }
916
    }
975
917
976
  /* set up network time button */
918
  /* set up network time button */
977
  if (priv->dtm != NULL)
919
  error = NULL;
978
    update_ntp_switch_from_system (self);
920
  using_ntp = can_use_ntp = FALSE;
921
  if (!date_time_mechanism_call_get_using_ntp_sync (priv->dtm,
922
                                                    &can_use_ntp,
923
                                                    &using_ntp,
924
                                                    priv->cancellable,
925
                                                    &error))
926
    {
927
      g_warning ("Failed to get using ntp: %s", error->message);
928
      g_error_free (error);
929
    }
930
931
  gtk_switch_set_active (GTK_SWITCH (W("network_time_switch")), using_ntp);
932
  update_widget_state_for_ntp (self, using_ntp);
979
  g_signal_connect (W("network_time_switch"), "notify::active",
933
  g_signal_connect (W("network_time_switch"), "notify::active",
980
                    G_CALLBACK (change_ntp), self);
934
                    G_CALLBACK (change_ntp), self);
981
935
Lines 1066-1102 cc_date_time_panel_init (CcDateTimePanel *self) Link Here
1066
1020
1067
  /* After the initial setup, so we can be sure that
1021
  /* After the initial setup, so we can be sure that
1068
   * the model is filled up */
1022
   * the model is filled up */
1069
  get_initial_timezone (self);
1023
  date_time_mechanism_call_get_timezone (priv->dtm,
1070
1024
                                         priv->cancellable,
1071
  widget = (GtkWidget*) gtk_builder_get_object (self->priv->builder,
1025
                                         get_timezone_cb,
1072
                                                "region_combobox");
1026
                                         self);
1073
  g_signal_connect (widget, "changed", G_CALLBACK (region_changed_cb), self);
1074
1075
  widget = (GtkWidget*) gtk_builder_get_object (self->priv->builder,
1076
                                                "city_combobox");
1077
  g_signal_connect (widget, "changed", G_CALLBACK (city_changed_cb), self);
1078
1079
  g_signal_connect (self->priv->map, "location-changed",
1080
                    G_CALLBACK (location_changed_cb), self);
1081
1082
  /* Watch changes of timedated remote service properties */
1083
  if (priv->dtm)
1084
    {
1085
      g_signal_connect (priv->dtm, "g-properties-changed",
1086
                        G_CALLBACK (on_timedated_properties_changed), self);
1087
      g_signal_connect_swapped (priv->dtm, "notify::ntp",
1088
                                G_CALLBACK (on_ntp_changed), self);
1089
      g_signal_connect_swapped (priv->dtm, "notify::timezone",
1090
                                G_CALLBACK (on_timezone_changed), self);
1091
    }
1092
  /* We ignore UTC <--> LocalRTC changes at the moment */
1093
1027
1094
  /* add the lock button */
1028
  /* add the lock button */
1095
  priv->permission = polkit_permission_new_sync ("org.gnome.controlcenter.datetime.configure", NULL, NULL, NULL);
1029
  priv->permission = polkit_permission_new_sync ("org.gnome.settingsdaemon.datetimemechanism.configure", NULL, NULL, NULL);
1096
  if (priv->permission == NULL)
1030
  if (priv->permission == NULL)
1097
    {
1031
    {
1098
      g_warning ("Your system does not have the '%s' PolicyKit files installed. Please check your installation",
1032
      g_warning ("Your system does not have the '%s' PolicyKit files installed. Please check your installation",
1099
                 "org.gnome.controlcenter.datetime.configure");
1033
                 "org.gnome.settingsdaemon.datetimemechanism.configure");
1100
      return;
1034
      return;
1101
    }
1035
    }
1102
1036
(-)a/panels/datetime/dtm.c (+3066 lines)
Line 0 Link Here
1
/*
2
 * Generated by gdbus-codegen 2.29.5. DO NOT EDIT.
3
 *
4
 * The license of this code is the same as for the source it was derived from.
5
 */
6
7
#ifdef HAVE_CONFIG_H
8
#  include "config.h"
9
#endif
10
11
#include "dtm.h"
12
13
typedef struct
14
{
15
  GDBusArgInfo parent_struct;
16
  gboolean use_gvariant;
17
} _ExtendedGDBusArgInfo;
18
19
typedef struct
20
{
21
  GDBusMethodInfo parent_struct;
22
  const gchar *signal_name;
23
} _ExtendedGDBusMethodInfo;
24
25
typedef struct
26
{
27
  GDBusSignalInfo parent_struct;
28
  const gchar *signal_name;
29
} _ExtendedGDBusSignalInfo;
30
31
typedef struct
32
{
33
  GDBusPropertyInfo parent_struct;
34
  const gchar *hyphen_name;
35
  gboolean use_gvariant;
36
} _ExtendedGDBusPropertyInfo;
37
38
typedef struct
39
{
40
  GDBusInterfaceInfo parent_struct;
41
  const gchar *hyphen_name;
42
} _ExtendedGDBusInterfaceInfo;
43
44
typedef struct
45
{
46
  const _ExtendedGDBusPropertyInfo *info;
47
  guint prop_id;
48
  GValue orig_value; /* the value before the change */
49
} ChangedProperty;
50
51
static void
52
_changed_property_free (ChangedProperty *data)
53
{
54
  g_value_unset (&data->orig_value);
55
  g_free (data);
56
}
57
58
static gboolean
59
_g_strv_equal0 (gchar **a, gchar **b)
60
{
61
  gboolean ret = FALSE;
62
  guint n;
63
  if (a == NULL && b == NULL)
64
    {
65
      ret = TRUE;
66
      goto out;
67
    }
68
  if (a == NULL || b == NULL)
69
    goto out;
70
  if (g_strv_length (a) != g_strv_length (b))
71
    goto out;
72
  for (n = 0; a[n] != NULL; n++)
73
    if (g_strcmp0 (a[n], b[n]) != 0)
74
      goto out;
75
  ret = TRUE;
76
out:
77
  return ret;
78
}
79
80
static gboolean
81
_g_variant_equal0 (GVariant *a, GVariant *b)
82
{
83
  gboolean ret = FALSE;
84
  if (a == NULL && b == NULL)
85
    {
86
      ret = TRUE;
87
      goto out;
88
    }
89
  if (a == NULL || b == NULL)
90
    goto out;
91
  ret = g_variant_equal (a, b);
92
out:
93
  return ret;
94
}
95
96
G_GNUC_UNUSED static gboolean
97
_g_value_equal (const GValue *a, const GValue *b)
98
{
99
  gboolean ret = FALSE;
100
  g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
101
  switch (G_VALUE_TYPE (a))
102
    {
103
      case G_TYPE_BOOLEAN:
104
        ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
105
        break;
106
      case G_TYPE_UCHAR:
107
        ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
108
        break;
109
      case G_TYPE_INT:
110
        ret = (g_value_get_int (a) == g_value_get_int (b));
111
        break;
112
      case G_TYPE_UINT:
113
        ret = (g_value_get_uint (a) == g_value_get_uint (b));
114
        break;
115
      case G_TYPE_INT64:
116
        ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
117
        break;
118
      case G_TYPE_UINT64:
119
        ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
120
        break;
121
      case G_TYPE_DOUBLE:
122
        ret = (g_value_get_double (a) == g_value_get_double (b));
123
        break;
124
      case G_TYPE_STRING:
125
        ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
126
        break;
127
      case G_TYPE_VARIANT:
128
        ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
129
        break;
130
      default:
131
        if (G_VALUE_TYPE (a) == G_TYPE_STRV)
132
          ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
133
        else
134
          g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
135
        break;
136
    }
137
  return ret;
138
}
139
140
/* ------------------------------------------------------------------------
141
 * Code for interface org.gnome.SettingsDaemon.DateTimeMechanism
142
 * ------------------------------------------------------------------------
143
 */
144
145
/**
146
 * SECTION:DateTimeMechanism
147
 * @title: DateTimeMechanism
148
 * @short_description: Generated C code for the org.gnome.SettingsDaemon.DateTimeMechanism D-Bus interface
149
 *
150
 * This section contains code for working with the <link linkend="gdbus-interface-org-gnome-SettingsDaemon-DateTimeMechanism.top_of_page">org.gnome.SettingsDaemon.DateTimeMechanism</link> D-Bus interface in C.
151
 */
152
153
/* ---- Introspection data for org.gnome.SettingsDaemon.DateTimeMechanism ---- */
154
155
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_set_timezone_IN_ARG_tz =
156
{
157
  {
158
    -1,
159
    "tz",
160
    "s",
161
    NULL
162
  },
163
  FALSE
164
};
165
166
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_set_timezone_IN_ARG_pointers[] =
167
{
168
  &_date_time_mechanism_method_info_set_timezone_IN_ARG_tz,
169
  NULL
170
};
171
172
static const GDBusAnnotationInfo _date_time_mechanism_method_set_timezone_annotation_info_0 =
173
{
174
  -1,
175
  "org.freedesktop.DBus.GLib.Async",
176
  "",
177
  NULL
178
};
179
180
static const GDBusAnnotationInfo * const _date_time_mechanism_method_set_timezone_annotation_info_pointers[] =
181
{
182
  &_date_time_mechanism_method_set_timezone_annotation_info_0,
183
  NULL
184
};
185
186
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_set_timezone =
187
{
188
  {
189
    -1,
190
    "SetTimezone",
191
    (GDBusArgInfo **) &_date_time_mechanism_method_info_set_timezone_IN_ARG_pointers,
192
    NULL,
193
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_set_timezone_annotation_info_pointers
194
  },
195
  "handle-set-timezone"
196
};
197
198
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_get_timezone_OUT_ARG_timezone =
199
{
200
  {
201
    -1,
202
    "timezone",
203
    "s",
204
    NULL
205
  },
206
  FALSE
207
};
208
209
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_get_timezone_OUT_ARG_pointers[] =
210
{
211
  &_date_time_mechanism_method_info_get_timezone_OUT_ARG_timezone,
212
  NULL
213
};
214
215
static const GDBusAnnotationInfo _date_time_mechanism_method_get_timezone_annotation_info_0 =
216
{
217
  -1,
218
  "org.freedesktop.DBus.GLib.Async",
219
  "",
220
  NULL
221
};
222
223
static const GDBusAnnotationInfo * const _date_time_mechanism_method_get_timezone_annotation_info_pointers[] =
224
{
225
  &_date_time_mechanism_method_get_timezone_annotation_info_0,
226
  NULL
227
};
228
229
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_get_timezone =
230
{
231
  {
232
    -1,
233
    "GetTimezone",
234
    NULL,
235
    (GDBusArgInfo **) &_date_time_mechanism_method_info_get_timezone_OUT_ARG_pointers,
236
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_get_timezone_annotation_info_pointers
237
  },
238
  "handle-get-timezone"
239
};
240
241
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_can_set_timezone_OUT_ARG_value =
242
{
243
  {
244
    -1,
245
    "value",
246
    "i",
247
    NULL
248
  },
249
  FALSE
250
};
251
252
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_can_set_timezone_OUT_ARG_pointers[] =
253
{
254
  &_date_time_mechanism_method_info_can_set_timezone_OUT_ARG_value,
255
  NULL
256
};
257
258
static const GDBusAnnotationInfo _date_time_mechanism_method_can_set_timezone_annotation_info_0 =
259
{
260
  -1,
261
  "org.freedesktop.DBus.GLib.Async",
262
  "",
263
  NULL
264
};
265
266
static const GDBusAnnotationInfo * const _date_time_mechanism_method_can_set_timezone_annotation_info_pointers[] =
267
{
268
  &_date_time_mechanism_method_can_set_timezone_annotation_info_0,
269
  NULL
270
};
271
272
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_can_set_timezone =
273
{
274
  {
275
    -1,
276
    "CanSetTimezone",
277
    NULL,
278
    (GDBusArgInfo **) &_date_time_mechanism_method_info_can_set_timezone_OUT_ARG_pointers,
279
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_can_set_timezone_annotation_info_pointers
280
  },
281
  "handle-can-set-timezone"
282
};
283
284
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_set_date_IN_ARG_day =
285
{
286
  {
287
    -1,
288
    "day",
289
    "u",
290
    NULL
291
  },
292
  FALSE
293
};
294
295
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_set_date_IN_ARG_month =
296
{
297
  {
298
    -1,
299
    "month",
300
    "u",
301
    NULL
302
  },
303
  FALSE
304
};
305
306
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_set_date_IN_ARG_year =
307
{
308
  {
309
    -1,
310
    "year",
311
    "u",
312
    NULL
313
  },
314
  FALSE
315
};
316
317
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_set_date_IN_ARG_pointers[] =
318
{
319
  &_date_time_mechanism_method_info_set_date_IN_ARG_day,
320
  &_date_time_mechanism_method_info_set_date_IN_ARG_month,
321
  &_date_time_mechanism_method_info_set_date_IN_ARG_year,
322
  NULL
323
};
324
325
static const GDBusAnnotationInfo _date_time_mechanism_method_set_date_annotation_info_0 =
326
{
327
  -1,
328
  "org.freedesktop.DBus.GLib.Async",
329
  "",
330
  NULL
331
};
332
333
static const GDBusAnnotationInfo * const _date_time_mechanism_method_set_date_annotation_info_pointers[] =
334
{
335
  &_date_time_mechanism_method_set_date_annotation_info_0,
336
  NULL
337
};
338
339
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_set_date =
340
{
341
  {
342
    -1,
343
    "SetDate",
344
    (GDBusArgInfo **) &_date_time_mechanism_method_info_set_date_IN_ARG_pointers,
345
    NULL,
346
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_set_date_annotation_info_pointers
347
  },
348
  "handle-set-date"
349
};
350
351
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_set_time_IN_ARG_seconds_since_epoch =
352
{
353
  {
354
    -1,
355
    "seconds_since_epoch",
356
    "x",
357
    NULL
358
  },
359
  FALSE
360
};
361
362
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_set_time_IN_ARG_pointers[] =
363
{
364
  &_date_time_mechanism_method_info_set_time_IN_ARG_seconds_since_epoch,
365
  NULL
366
};
367
368
static const GDBusAnnotationInfo _date_time_mechanism_method_set_time_annotation_info_0 =
369
{
370
  -1,
371
  "org.freedesktop.DBus.GLib.Async",
372
  "",
373
  NULL
374
};
375
376
static const GDBusAnnotationInfo * const _date_time_mechanism_method_set_time_annotation_info_pointers[] =
377
{
378
  &_date_time_mechanism_method_set_time_annotation_info_0,
379
  NULL
380
};
381
382
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_set_time =
383
{
384
  {
385
    -1,
386
    "SetTime",
387
    (GDBusArgInfo **) &_date_time_mechanism_method_info_set_time_IN_ARG_pointers,
388
    NULL,
389
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_set_time_annotation_info_pointers
390
  },
391
  "handle-set-time"
392
};
393
394
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_can_set_time_OUT_ARG_value =
395
{
396
  {
397
    -1,
398
    "value",
399
    "i",
400
    NULL
401
  },
402
  FALSE
403
};
404
405
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_can_set_time_OUT_ARG_pointers[] =
406
{
407
  &_date_time_mechanism_method_info_can_set_time_OUT_ARG_value,
408
  NULL
409
};
410
411
static const GDBusAnnotationInfo _date_time_mechanism_method_can_set_time_annotation_info_0 =
412
{
413
  -1,
414
  "org.freedesktop.DBus.GLib.Async",
415
  "",
416
  NULL
417
};
418
419
static const GDBusAnnotationInfo * const _date_time_mechanism_method_can_set_time_annotation_info_pointers[] =
420
{
421
  &_date_time_mechanism_method_can_set_time_annotation_info_0,
422
  NULL
423
};
424
425
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_can_set_time =
426
{
427
  {
428
    -1,
429
    "CanSetTime",
430
    NULL,
431
    (GDBusArgInfo **) &_date_time_mechanism_method_info_can_set_time_OUT_ARG_pointers,
432
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_can_set_time_annotation_info_pointers
433
  },
434
  "handle-can-set-time"
435
};
436
437
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_adjust_time_IN_ARG_seconds_to_add =
438
{
439
  {
440
    -1,
441
    "seconds_to_add",
442
    "x",
443
    NULL
444
  },
445
  FALSE
446
};
447
448
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_adjust_time_IN_ARG_pointers[] =
449
{
450
  &_date_time_mechanism_method_info_adjust_time_IN_ARG_seconds_to_add,
451
  NULL
452
};
453
454
static const GDBusAnnotationInfo _date_time_mechanism_method_adjust_time_annotation_info_0 =
455
{
456
  -1,
457
  "org.freedesktop.DBus.GLib.Async",
458
  "",
459
  NULL
460
};
461
462
static const GDBusAnnotationInfo * const _date_time_mechanism_method_adjust_time_annotation_info_pointers[] =
463
{
464
  &_date_time_mechanism_method_adjust_time_annotation_info_0,
465
  NULL
466
};
467
468
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_adjust_time =
469
{
470
  {
471
    -1,
472
    "AdjustTime",
473
    (GDBusArgInfo **) &_date_time_mechanism_method_info_adjust_time_IN_ARG_pointers,
474
    NULL,
475
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_adjust_time_annotation_info_pointers
476
  },
477
  "handle-adjust-time"
478
};
479
480
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_get_hardware_clock_using_utc_OUT_ARG_is_using_utc =
481
{
482
  {
483
    -1,
484
    "is_using_utc",
485
    "b",
486
    NULL
487
  },
488
  FALSE
489
};
490
491
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_get_hardware_clock_using_utc_OUT_ARG_pointers[] =
492
{
493
  &_date_time_mechanism_method_info_get_hardware_clock_using_utc_OUT_ARG_is_using_utc,
494
  NULL
495
};
496
497
static const GDBusAnnotationInfo _date_time_mechanism_method_get_hardware_clock_using_utc_annotation_info_0 =
498
{
499
  -1,
500
  "org.freedesktop.DBus.GLib.Async",
501
  "",
502
  NULL
503
};
504
505
static const GDBusAnnotationInfo * const _date_time_mechanism_method_get_hardware_clock_using_utc_annotation_info_pointers[] =
506
{
507
  &_date_time_mechanism_method_get_hardware_clock_using_utc_annotation_info_0,
508
  NULL
509
};
510
511
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_get_hardware_clock_using_utc =
512
{
513
  {
514
    -1,
515
    "GetHardwareClockUsingUtc",
516
    NULL,
517
    (GDBusArgInfo **) &_date_time_mechanism_method_info_get_hardware_clock_using_utc_OUT_ARG_pointers,
518
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_get_hardware_clock_using_utc_annotation_info_pointers
519
  },
520
  "handle-get-hardware-clock-using-utc"
521
};
522
523
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_set_hardware_clock_using_utc_IN_ARG_is_using_utc =
524
{
525
  {
526
    -1,
527
    "is_using_utc",
528
    "b",
529
    NULL
530
  },
531
  FALSE
532
};
533
534
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_set_hardware_clock_using_utc_IN_ARG_pointers[] =
535
{
536
  &_date_time_mechanism_method_info_set_hardware_clock_using_utc_IN_ARG_is_using_utc,
537
  NULL
538
};
539
540
static const GDBusAnnotationInfo _date_time_mechanism_method_set_hardware_clock_using_utc_annotation_info_0 =
541
{
542
  -1,
543
  "org.freedesktop.DBus.GLib.Async",
544
  "",
545
  NULL
546
};
547
548
static const GDBusAnnotationInfo * const _date_time_mechanism_method_set_hardware_clock_using_utc_annotation_info_pointers[] =
549
{
550
  &_date_time_mechanism_method_set_hardware_clock_using_utc_annotation_info_0,
551
  NULL
552
};
553
554
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_set_hardware_clock_using_utc =
555
{
556
  {
557
    -1,
558
    "SetHardwareClockUsingUtc",
559
    (GDBusArgInfo **) &_date_time_mechanism_method_info_set_hardware_clock_using_utc_IN_ARG_pointers,
560
    NULL,
561
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_set_hardware_clock_using_utc_annotation_info_pointers
562
  },
563
  "handle-set-hardware-clock-using-utc"
564
};
565
566
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_get_using_ntp_OUT_ARG_can_use_ntp =
567
{
568
  {
569
    -1,
570
    "can_use_ntp",
571
    "b",
572
    NULL
573
  },
574
  FALSE
575
};
576
577
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_get_using_ntp_OUT_ARG_is_using_ntp =
578
{
579
  {
580
    -1,
581
    "is_using_ntp",
582
    "b",
583
    NULL
584
  },
585
  FALSE
586
};
587
588
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_get_using_ntp_OUT_ARG_pointers[] =
589
{
590
  &_date_time_mechanism_method_info_get_using_ntp_OUT_ARG_can_use_ntp,
591
  &_date_time_mechanism_method_info_get_using_ntp_OUT_ARG_is_using_ntp,
592
  NULL
593
};
594
595
static const GDBusAnnotationInfo _date_time_mechanism_method_get_using_ntp_annotation_info_0 =
596
{
597
  -1,
598
  "org.freedesktop.DBus.GLib.Async",
599
  "",
600
  NULL
601
};
602
603
static const GDBusAnnotationInfo * const _date_time_mechanism_method_get_using_ntp_annotation_info_pointers[] =
604
{
605
  &_date_time_mechanism_method_get_using_ntp_annotation_info_0,
606
  NULL
607
};
608
609
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_get_using_ntp =
610
{
611
  {
612
    -1,
613
    "GetUsingNtp",
614
    NULL,
615
    (GDBusArgInfo **) &_date_time_mechanism_method_info_get_using_ntp_OUT_ARG_pointers,
616
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_get_using_ntp_annotation_info_pointers
617
  },
618
  "handle-get-using-ntp"
619
};
620
621
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_set_using_ntp_IN_ARG_is_using_ntp =
622
{
623
  {
624
    -1,
625
    "is_using_ntp",
626
    "b",
627
    NULL
628
  },
629
  FALSE
630
};
631
632
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_set_using_ntp_IN_ARG_pointers[] =
633
{
634
  &_date_time_mechanism_method_info_set_using_ntp_IN_ARG_is_using_ntp,
635
  NULL
636
};
637
638
static const GDBusAnnotationInfo _date_time_mechanism_method_set_using_ntp_annotation_info_0 =
639
{
640
  -1,
641
  "org.freedesktop.DBus.GLib.Async",
642
  "",
643
  NULL
644
};
645
646
static const GDBusAnnotationInfo * const _date_time_mechanism_method_set_using_ntp_annotation_info_pointers[] =
647
{
648
  &_date_time_mechanism_method_set_using_ntp_annotation_info_0,
649
  NULL
650
};
651
652
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_set_using_ntp =
653
{
654
  {
655
    -1,
656
    "SetUsingNtp",
657
    (GDBusArgInfo **) &_date_time_mechanism_method_info_set_using_ntp_IN_ARG_pointers,
658
    NULL,
659
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_set_using_ntp_annotation_info_pointers
660
  },
661
  "handle-set-using-ntp"
662
};
663
664
static const _ExtendedGDBusArgInfo _date_time_mechanism_method_info_can_set_using_ntp_OUT_ARG_value =
665
{
666
  {
667
    -1,
668
    "value",
669
    "i",
670
    NULL
671
  },
672
  FALSE
673
};
674
675
static const _ExtendedGDBusArgInfo * const _date_time_mechanism_method_info_can_set_using_ntp_OUT_ARG_pointers[] =
676
{
677
  &_date_time_mechanism_method_info_can_set_using_ntp_OUT_ARG_value,
678
  NULL
679
};
680
681
static const GDBusAnnotationInfo _date_time_mechanism_method_can_set_using_ntp_annotation_info_0 =
682
{
683
  -1,
684
  "org.freedesktop.DBus.GLib.Async",
685
  "",
686
  NULL
687
};
688
689
static const GDBusAnnotationInfo * const _date_time_mechanism_method_can_set_using_ntp_annotation_info_pointers[] =
690
{
691
  &_date_time_mechanism_method_can_set_using_ntp_annotation_info_0,
692
  NULL
693
};
694
695
static const _ExtendedGDBusMethodInfo _date_time_mechanism_method_info_can_set_using_ntp =
696
{
697
  {
698
    -1,
699
    "CanSetUsingNtp",
700
    NULL,
701
    (GDBusArgInfo **) &_date_time_mechanism_method_info_can_set_using_ntp_OUT_ARG_pointers,
702
    (GDBusAnnotationInfo **) &_date_time_mechanism_method_can_set_using_ntp_annotation_info_pointers
703
  },
704
  "handle-can-set-using-ntp"
705
};
706
707
static const _ExtendedGDBusMethodInfo * const _date_time_mechanism_method_info_pointers[] =
708
{
709
  &_date_time_mechanism_method_info_set_timezone,
710
  &_date_time_mechanism_method_info_get_timezone,
711
  &_date_time_mechanism_method_info_can_set_timezone,
712
  &_date_time_mechanism_method_info_set_date,
713
  &_date_time_mechanism_method_info_set_time,
714
  &_date_time_mechanism_method_info_can_set_time,
715
  &_date_time_mechanism_method_info_adjust_time,
716
  &_date_time_mechanism_method_info_get_hardware_clock_using_utc,
717
  &_date_time_mechanism_method_info_set_hardware_clock_using_utc,
718
  &_date_time_mechanism_method_info_get_using_ntp,
719
  &_date_time_mechanism_method_info_set_using_ntp,
720
  &_date_time_mechanism_method_info_can_set_using_ntp,
721
  NULL
722
};
723
724
static const _ExtendedGDBusInterfaceInfo _date_time_mechanism_interface_info =
725
{
726
  {
727
    -1,
728
    "org.gnome.SettingsDaemon.DateTimeMechanism",
729
    (GDBusMethodInfo **) &_date_time_mechanism_method_info_pointers,
730
    NULL,
731
    NULL,
732
    NULL
733
  },
734
  "date-time-mechanism",
735
};
736
737
738
/**
739
 * date_time_mechanism_interface_info:
740
 *
741
 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-gnome-SettingsDaemon-DateTimeMechanism.top_of_page">org.gnome.SettingsDaemon.DateTimeMechanism</link> D-Bus interface.
742
 *
743
 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
744
 */
745
GDBusInterfaceInfo *
746
date_time_mechanism_interface_info (void)
747
{
748
  return (GDBusInterfaceInfo *) &_date_time_mechanism_interface_info;
749
}
750
751
752
753
/**
754
 * DateTimeMechanism:
755
 *
756
 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-DateTimeMechanism.top_of_page">org.gnome.SettingsDaemon.DateTimeMechanism</link>.
757
 */
758
759
/**
760
 * DateTimeMechanismIface:
761
 * @parent_iface: The parent interface.
762
 * @handle_adjust_time: Handler for the #DateTimeMechanism::handle-adjust-time signal.
763
 * @handle_can_set_time: Handler for the #DateTimeMechanism::handle-can-set-time signal.
764
 * @handle_can_set_timezone: Handler for the #DateTimeMechanism::handle-can-set-timezone signal.
765
 * @handle_can_set_using_ntp: Handler for the #DateTimeMechanism::handle-can-set-using-ntp signal.
766
 * @handle_get_hardware_clock_using_utc: Handler for the #DateTimeMechanism::handle-get-hardware-clock-using-utc signal.
767
 * @handle_get_timezone: Handler for the #DateTimeMechanism::handle-get-timezone signal.
768
 * @handle_get_using_ntp: Handler for the #DateTimeMechanism::handle-get-using-ntp signal.
769
 * @handle_set_date: Handler for the #DateTimeMechanism::handle-set-date signal.
770
 * @handle_set_hardware_clock_using_utc: Handler for the #DateTimeMechanism::handle-set-hardware-clock-using-utc signal.
771
 * @handle_set_time: Handler for the #DateTimeMechanism::handle-set-time signal.
772
 * @handle_set_timezone: Handler for the #DateTimeMechanism::handle-set-timezone signal.
773
 * @handle_set_using_ntp: Handler for the #DateTimeMechanism::handle-set-using-ntp signal.
774
 *
775
 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-DateTimeMechanism.top_of_page">org.gnome.SettingsDaemon.DateTimeMechanism</link>.
776
 */
777
778
static void
779
date_time_mechanism_default_init (DateTimeMechanismIface *iface)
780
{
781
  /* GObject signals for incoming D-Bus method calls: */
782
  /**
783
   * DateTimeMechanism::handle-set-timezone:
784
   * @object: A #DateTimeMechanism.
785
   * @invocation: A #GDBusMethodInvocation.
786
   * @tz: Argument passed by remote caller.
787
   *
788
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTimezone">SetTimezone()</link> D-Bus method.
789
   *
790
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_set_timezone() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
791
   *
792
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
793
   */
794
  g_signal_new ("handle-set-timezone",
795
    G_TYPE_FROM_INTERFACE (iface),
796
    G_SIGNAL_RUN_LAST,
797
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_set_timezone),
798
    g_signal_accumulator_true_handled,
799
    NULL,
800
    g_cclosure_marshal_generic,
801
    G_TYPE_BOOLEAN,
802
    2,
803
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
804
805
  /**
806
   * DateTimeMechanism::handle-get-timezone:
807
   * @object: A #DateTimeMechanism.
808
   * @invocation: A #GDBusMethodInvocation.
809
   *
810
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetTimezone">GetTimezone()</link> D-Bus method.
811
   *
812
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_get_timezone() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
813
   *
814
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
815
   */
816
  g_signal_new ("handle-get-timezone",
817
    G_TYPE_FROM_INTERFACE (iface),
818
    G_SIGNAL_RUN_LAST,
819
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_get_timezone),
820
    g_signal_accumulator_true_handled,
821
    NULL,
822
    g_cclosure_marshal_generic,
823
    G_TYPE_BOOLEAN,
824
    1,
825
    G_TYPE_DBUS_METHOD_INVOCATION);
826
827
  /**
828
   * DateTimeMechanism::handle-can-set-timezone:
829
   * @object: A #DateTimeMechanism.
830
   * @invocation: A #GDBusMethodInvocation.
831
   *
832
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTimezone">CanSetTimezone()</link> D-Bus method.
833
   *
834
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_can_set_timezone() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
835
   *
836
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
837
   */
838
  g_signal_new ("handle-can-set-timezone",
839
    G_TYPE_FROM_INTERFACE (iface),
840
    G_SIGNAL_RUN_LAST,
841
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_can_set_timezone),
842
    g_signal_accumulator_true_handled,
843
    NULL,
844
    g_cclosure_marshal_generic,
845
    G_TYPE_BOOLEAN,
846
    1,
847
    G_TYPE_DBUS_METHOD_INVOCATION);
848
849
  /**
850
   * DateTimeMechanism::handle-set-date:
851
   * @object: A #DateTimeMechanism.
852
   * @invocation: A #GDBusMethodInvocation.
853
   * @day: Argument passed by remote caller.
854
   * @month: Argument passed by remote caller.
855
   * @year: Argument passed by remote caller.
856
   *
857
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetDate">SetDate()</link> D-Bus method.
858
   *
859
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_set_date() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
860
   *
861
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
862
   */
863
  g_signal_new ("handle-set-date",
864
    G_TYPE_FROM_INTERFACE (iface),
865
    G_SIGNAL_RUN_LAST,
866
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_set_date),
867
    g_signal_accumulator_true_handled,
868
    NULL,
869
    g_cclosure_marshal_generic,
870
    G_TYPE_BOOLEAN,
871
    4,
872
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
873
874
  /**
875
   * DateTimeMechanism::handle-set-time:
876
   * @object: A #DateTimeMechanism.
877
   * @invocation: A #GDBusMethodInvocation.
878
   * @seconds_since_epoch: Argument passed by remote caller.
879
   *
880
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTime">SetTime()</link> D-Bus method.
881
   *
882
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_set_time() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
883
   *
884
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
885
   */
886
  g_signal_new ("handle-set-time",
887
    G_TYPE_FROM_INTERFACE (iface),
888
    G_SIGNAL_RUN_LAST,
889
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_set_time),
890
    g_signal_accumulator_true_handled,
891
    NULL,
892
    g_cclosure_marshal_generic,
893
    G_TYPE_BOOLEAN,
894
    2,
895
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT64);
896
897
  /**
898
   * DateTimeMechanism::handle-can-set-time:
899
   * @object: A #DateTimeMechanism.
900
   * @invocation: A #GDBusMethodInvocation.
901
   *
902
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTime">CanSetTime()</link> D-Bus method.
903
   *
904
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_can_set_time() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
905
   *
906
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
907
   */
908
  g_signal_new ("handle-can-set-time",
909
    G_TYPE_FROM_INTERFACE (iface),
910
    G_SIGNAL_RUN_LAST,
911
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_can_set_time),
912
    g_signal_accumulator_true_handled,
913
    NULL,
914
    g_cclosure_marshal_generic,
915
    G_TYPE_BOOLEAN,
916
    1,
917
    G_TYPE_DBUS_METHOD_INVOCATION);
918
919
  /**
920
   * DateTimeMechanism::handle-adjust-time:
921
   * @object: A #DateTimeMechanism.
922
   * @invocation: A #GDBusMethodInvocation.
923
   * @seconds_to_add: Argument passed by remote caller.
924
   *
925
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.AdjustTime">AdjustTime()</link> D-Bus method.
926
   *
927
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_adjust_time() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
928
   *
929
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
930
   */
931
  g_signal_new ("handle-adjust-time",
932
    G_TYPE_FROM_INTERFACE (iface),
933
    G_SIGNAL_RUN_LAST,
934
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_adjust_time),
935
    g_signal_accumulator_true_handled,
936
    NULL,
937
    g_cclosure_marshal_generic,
938
    G_TYPE_BOOLEAN,
939
    2,
940
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT64);
941
942
  /**
943
   * DateTimeMechanism::handle-get-hardware-clock-using-utc:
944
   * @object: A #DateTimeMechanism.
945
   * @invocation: A #GDBusMethodInvocation.
946
   *
947
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetHardwareClockUsingUtc">GetHardwareClockUsingUtc()</link> D-Bus method.
948
   *
949
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_get_hardware_clock_using_utc() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
950
   *
951
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
952
   */
953
  g_signal_new ("handle-get-hardware-clock-using-utc",
954
    G_TYPE_FROM_INTERFACE (iface),
955
    G_SIGNAL_RUN_LAST,
956
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_get_hardware_clock_using_utc),
957
    g_signal_accumulator_true_handled,
958
    NULL,
959
    g_cclosure_marshal_generic,
960
    G_TYPE_BOOLEAN,
961
    1,
962
    G_TYPE_DBUS_METHOD_INVOCATION);
963
964
  /**
965
   * DateTimeMechanism::handle-set-hardware-clock-using-utc:
966
   * @object: A #DateTimeMechanism.
967
   * @invocation: A #GDBusMethodInvocation.
968
   * @is_using_utc: Argument passed by remote caller.
969
   *
970
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetHardwareClockUsingUtc">SetHardwareClockUsingUtc()</link> D-Bus method.
971
   *
972
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_set_hardware_clock_using_utc() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
973
   *
974
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
975
   */
976
  g_signal_new ("handle-set-hardware-clock-using-utc",
977
    G_TYPE_FROM_INTERFACE (iface),
978
    G_SIGNAL_RUN_LAST,
979
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_set_hardware_clock_using_utc),
980
    g_signal_accumulator_true_handled,
981
    NULL,
982
    g_cclosure_marshal_generic,
983
    G_TYPE_BOOLEAN,
984
    2,
985
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN);
986
987
  /**
988
   * DateTimeMechanism::handle-get-using-ntp:
989
   * @object: A #DateTimeMechanism.
990
   * @invocation: A #GDBusMethodInvocation.
991
   *
992
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetUsingNtp">GetUsingNtp()</link> D-Bus method.
993
   *
994
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_get_using_ntp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
995
   *
996
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
997
   */
998
  g_signal_new ("handle-get-using-ntp",
999
    G_TYPE_FROM_INTERFACE (iface),
1000
    G_SIGNAL_RUN_LAST,
1001
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_get_using_ntp),
1002
    g_signal_accumulator_true_handled,
1003
    NULL,
1004
    g_cclosure_marshal_generic,
1005
    G_TYPE_BOOLEAN,
1006
    1,
1007
    G_TYPE_DBUS_METHOD_INVOCATION);
1008
1009
  /**
1010
   * DateTimeMechanism::handle-set-using-ntp:
1011
   * @object: A #DateTimeMechanism.
1012
   * @invocation: A #GDBusMethodInvocation.
1013
   * @is_using_ntp: Argument passed by remote caller.
1014
   *
1015
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetUsingNtp">SetUsingNtp()</link> D-Bus method.
1016
   *
1017
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_set_using_ntp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1018
   *
1019
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1020
   */
1021
  g_signal_new ("handle-set-using-ntp",
1022
    G_TYPE_FROM_INTERFACE (iface),
1023
    G_SIGNAL_RUN_LAST,
1024
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_set_using_ntp),
1025
    g_signal_accumulator_true_handled,
1026
    NULL,
1027
    g_cclosure_marshal_generic,
1028
    G_TYPE_BOOLEAN,
1029
    2,
1030
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN);
1031
1032
  /**
1033
   * DateTimeMechanism::handle-can-set-using-ntp:
1034
   * @object: A #DateTimeMechanism.
1035
   * @invocation: A #GDBusMethodInvocation.
1036
   *
1037
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetUsingNtp">CanSetUsingNtp()</link> D-Bus method.
1038
   *
1039
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call date_time_mechanism_complete_can_set_using_ntp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1040
   *
1041
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1042
   */
1043
  g_signal_new ("handle-can-set-using-ntp",
1044
    G_TYPE_FROM_INTERFACE (iface),
1045
    G_SIGNAL_RUN_LAST,
1046
    G_STRUCT_OFFSET (DateTimeMechanismIface, handle_can_set_using_ntp),
1047
    g_signal_accumulator_true_handled,
1048
    NULL,
1049
    g_cclosure_marshal_generic,
1050
    G_TYPE_BOOLEAN,
1051
    1,
1052
    G_TYPE_DBUS_METHOD_INVOCATION);
1053
1054
}
1055
1056
typedef DateTimeMechanismIface DateTimeMechanismInterface;
1057
G_DEFINE_INTERFACE (DateTimeMechanism, date_time_mechanism, G_TYPE_OBJECT);
1058
1059
/**
1060
 * date_time_mechanism_call_set_timezone:
1061
 * @proxy: A #DateTimeMechanismProxy.
1062
 * @tz: Argument to pass with the method invocation.
1063
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1064
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1065
 * @user_data: User data to pass to @callback.
1066
 *
1067
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTimezone">SetTimezone()</link> D-Bus method on @proxy.
1068
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1069
 * You can then call date_time_mechanism_call_set_timezone_finish() to get the result of the operation.
1070
 *
1071
 * See date_time_mechanism_call_set_timezone_sync() for the synchronous, blocking version of this method.
1072
 */
1073
void
1074
date_time_mechanism_call_set_timezone (
1075
    DateTimeMechanism *proxy,
1076
    const gchar *tz,
1077
    GCancellable *cancellable,
1078
    GAsyncReadyCallback callback,
1079
    gpointer user_data)
1080
{
1081
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1082
    "SetTimezone",
1083
    g_variant_new ("(s)",
1084
                   tz),
1085
    G_DBUS_CALL_FLAGS_NONE,
1086
    -1,
1087
    cancellable,
1088
    callback,
1089
    user_data);
1090
}
1091
1092
/**
1093
 * date_time_mechanism_call_set_timezone_finish:
1094
 * @proxy: A #DateTimeMechanismProxy.
1095
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_set_timezone().
1096
 * @error: Return location for error or %NULL.
1097
 *
1098
 * Finishes an operation started with date_time_mechanism_call_set_timezone().
1099
 *
1100
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1101
 */
1102
gboolean
1103
date_time_mechanism_call_set_timezone_finish (
1104
    DateTimeMechanism *proxy,
1105
    GAsyncResult *res,
1106
    GError **error)
1107
{
1108
  GVariant *_ret;
1109
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1110
  if (_ret == NULL)
1111
    goto _out;
1112
  g_variant_get (_ret,
1113
                 "()");
1114
  g_variant_unref (_ret);
1115
_out:
1116
  return _ret != NULL;
1117
}
1118
1119
/**
1120
 * date_time_mechanism_call_set_timezone_sync:
1121
 * @proxy: A #DateTimeMechanismProxy.
1122
 * @tz: Argument to pass with the method invocation.
1123
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1124
 * @error: Return location for error or %NULL.
1125
 *
1126
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTimezone">SetTimezone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1127
 *
1128
 * See date_time_mechanism_call_set_timezone() for the asynchronous version of this method.
1129
 *
1130
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1131
 */
1132
gboolean
1133
date_time_mechanism_call_set_timezone_sync (
1134
    DateTimeMechanism *proxy,
1135
    const gchar *tz,
1136
    GCancellable *cancellable,
1137
    GError **error)
1138
{
1139
  GVariant *_ret;
1140
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1141
    "SetTimezone",
1142
    g_variant_new ("(s)",
1143
                   tz),
1144
    G_DBUS_CALL_FLAGS_NONE,
1145
    -1,
1146
    cancellable,
1147
    error);
1148
  if (_ret == NULL)
1149
    goto _out;
1150
  g_variant_get (_ret,
1151
                 "()");
1152
  g_variant_unref (_ret);
1153
_out:
1154
  return _ret != NULL;
1155
}
1156
1157
/**
1158
 * date_time_mechanism_call_get_timezone:
1159
 * @proxy: A #DateTimeMechanismProxy.
1160
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1161
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1162
 * @user_data: User data to pass to @callback.
1163
 *
1164
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetTimezone">GetTimezone()</link> D-Bus method on @proxy.
1165
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1166
 * You can then call date_time_mechanism_call_get_timezone_finish() to get the result of the operation.
1167
 *
1168
 * See date_time_mechanism_call_get_timezone_sync() for the synchronous, blocking version of this method.
1169
 */
1170
void
1171
date_time_mechanism_call_get_timezone (
1172
    DateTimeMechanism *proxy,
1173
    GCancellable *cancellable,
1174
    GAsyncReadyCallback callback,
1175
    gpointer user_data)
1176
{
1177
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1178
    "GetTimezone",
1179
    g_variant_new ("()"),
1180
    G_DBUS_CALL_FLAGS_NONE,
1181
    -1,
1182
    cancellable,
1183
    callback,
1184
    user_data);
1185
}
1186
1187
/**
1188
 * date_time_mechanism_call_get_timezone_finish:
1189
 * @proxy: A #DateTimeMechanismProxy.
1190
 * @out_timezone: (out): Return location for return parameter or %NULL to ignore.
1191
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_get_timezone().
1192
 * @error: Return location for error or %NULL.
1193
 *
1194
 * Finishes an operation started with date_time_mechanism_call_get_timezone().
1195
 *
1196
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1197
 */
1198
gboolean
1199
date_time_mechanism_call_get_timezone_finish (
1200
    DateTimeMechanism *proxy,
1201
    gchar **out_timezone,
1202
    GAsyncResult *res,
1203
    GError **error)
1204
{
1205
  GVariant *_ret;
1206
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1207
  if (_ret == NULL)
1208
    goto _out;
1209
  g_variant_get (_ret,
1210
                 "(s)",
1211
                 out_timezone);
1212
  g_variant_unref (_ret);
1213
_out:
1214
  return _ret != NULL;
1215
}
1216
1217
/**
1218
 * date_time_mechanism_call_get_timezone_sync:
1219
 * @proxy: A #DateTimeMechanismProxy.
1220
 * @out_timezone: (out): Return location for return parameter or %NULL to ignore.
1221
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1222
 * @error: Return location for error or %NULL.
1223
 *
1224
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetTimezone">GetTimezone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1225
 *
1226
 * See date_time_mechanism_call_get_timezone() for the asynchronous version of this method.
1227
 *
1228
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1229
 */
1230
gboolean
1231
date_time_mechanism_call_get_timezone_sync (
1232
    DateTimeMechanism *proxy,
1233
    gchar **out_timezone,
1234
    GCancellable *cancellable,
1235
    GError **error)
1236
{
1237
  GVariant *_ret;
1238
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1239
    "GetTimezone",
1240
    g_variant_new ("()"),
1241
    G_DBUS_CALL_FLAGS_NONE,
1242
    -1,
1243
    cancellable,
1244
    error);
1245
  if (_ret == NULL)
1246
    goto _out;
1247
  g_variant_get (_ret,
1248
                 "(s)",
1249
                 out_timezone);
1250
  g_variant_unref (_ret);
1251
_out:
1252
  return _ret != NULL;
1253
}
1254
1255
/**
1256
 * date_time_mechanism_call_can_set_timezone:
1257
 * @proxy: A #DateTimeMechanismProxy.
1258
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1259
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1260
 * @user_data: User data to pass to @callback.
1261
 *
1262
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTimezone">CanSetTimezone()</link> D-Bus method on @proxy.
1263
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1264
 * You can then call date_time_mechanism_call_can_set_timezone_finish() to get the result of the operation.
1265
 *
1266
 * See date_time_mechanism_call_can_set_timezone_sync() for the synchronous, blocking version of this method.
1267
 */
1268
void
1269
date_time_mechanism_call_can_set_timezone (
1270
    DateTimeMechanism *proxy,
1271
    GCancellable *cancellable,
1272
    GAsyncReadyCallback callback,
1273
    gpointer user_data)
1274
{
1275
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1276
    "CanSetTimezone",
1277
    g_variant_new ("()"),
1278
    G_DBUS_CALL_FLAGS_NONE,
1279
    -1,
1280
    cancellable,
1281
    callback,
1282
    user_data);
1283
}
1284
1285
/**
1286
 * date_time_mechanism_call_can_set_timezone_finish:
1287
 * @proxy: A #DateTimeMechanismProxy.
1288
 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1289
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_can_set_timezone().
1290
 * @error: Return location for error or %NULL.
1291
 *
1292
 * Finishes an operation started with date_time_mechanism_call_can_set_timezone().
1293
 *
1294
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1295
 */
1296
gboolean
1297
date_time_mechanism_call_can_set_timezone_finish (
1298
    DateTimeMechanism *proxy,
1299
    gint *out_value,
1300
    GAsyncResult *res,
1301
    GError **error)
1302
{
1303
  GVariant *_ret;
1304
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1305
  if (_ret == NULL)
1306
    goto _out;
1307
  g_variant_get (_ret,
1308
                 "(i)",
1309
                 out_value);
1310
  g_variant_unref (_ret);
1311
_out:
1312
  return _ret != NULL;
1313
}
1314
1315
/**
1316
 * date_time_mechanism_call_can_set_timezone_sync:
1317
 * @proxy: A #DateTimeMechanismProxy.
1318
 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1319
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1320
 * @error: Return location for error or %NULL.
1321
 *
1322
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTimezone">CanSetTimezone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1323
 *
1324
 * See date_time_mechanism_call_can_set_timezone() for the asynchronous version of this method.
1325
 *
1326
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1327
 */
1328
gboolean
1329
date_time_mechanism_call_can_set_timezone_sync (
1330
    DateTimeMechanism *proxy,
1331
    gint *out_value,
1332
    GCancellable *cancellable,
1333
    GError **error)
1334
{
1335
  GVariant *_ret;
1336
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1337
    "CanSetTimezone",
1338
    g_variant_new ("()"),
1339
    G_DBUS_CALL_FLAGS_NONE,
1340
    -1,
1341
    cancellable,
1342
    error);
1343
  if (_ret == NULL)
1344
    goto _out;
1345
  g_variant_get (_ret,
1346
                 "(i)",
1347
                 out_value);
1348
  g_variant_unref (_ret);
1349
_out:
1350
  return _ret != NULL;
1351
}
1352
1353
/**
1354
 * date_time_mechanism_call_set_date:
1355
 * @proxy: A #DateTimeMechanismProxy.
1356
 * @day: Argument to pass with the method invocation.
1357
 * @month: Argument to pass with the method invocation.
1358
 * @year: Argument to pass with the method invocation.
1359
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1360
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1361
 * @user_data: User data to pass to @callback.
1362
 *
1363
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetDate">SetDate()</link> D-Bus method on @proxy.
1364
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1365
 * You can then call date_time_mechanism_call_set_date_finish() to get the result of the operation.
1366
 *
1367
 * See date_time_mechanism_call_set_date_sync() for the synchronous, blocking version of this method.
1368
 */
1369
void
1370
date_time_mechanism_call_set_date (
1371
    DateTimeMechanism *proxy,
1372
    guint day,
1373
    guint month,
1374
    guint year,
1375
    GCancellable *cancellable,
1376
    GAsyncReadyCallback callback,
1377
    gpointer user_data)
1378
{
1379
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1380
    "SetDate",
1381
    g_variant_new ("(uuu)",
1382
                   day,
1383
                   month,
1384
                   year),
1385
    G_DBUS_CALL_FLAGS_NONE,
1386
    -1,
1387
    cancellable,
1388
    callback,
1389
    user_data);
1390
}
1391
1392
/**
1393
 * date_time_mechanism_call_set_date_finish:
1394
 * @proxy: A #DateTimeMechanismProxy.
1395
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_set_date().
1396
 * @error: Return location for error or %NULL.
1397
 *
1398
 * Finishes an operation started with date_time_mechanism_call_set_date().
1399
 *
1400
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1401
 */
1402
gboolean
1403
date_time_mechanism_call_set_date_finish (
1404
    DateTimeMechanism *proxy,
1405
    GAsyncResult *res,
1406
    GError **error)
1407
{
1408
  GVariant *_ret;
1409
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1410
  if (_ret == NULL)
1411
    goto _out;
1412
  g_variant_get (_ret,
1413
                 "()");
1414
  g_variant_unref (_ret);
1415
_out:
1416
  return _ret != NULL;
1417
}
1418
1419
/**
1420
 * date_time_mechanism_call_set_date_sync:
1421
 * @proxy: A #DateTimeMechanismProxy.
1422
 * @day: Argument to pass with the method invocation.
1423
 * @month: Argument to pass with the method invocation.
1424
 * @year: Argument to pass with the method invocation.
1425
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1426
 * @error: Return location for error or %NULL.
1427
 *
1428
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetDate">SetDate()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1429
 *
1430
 * See date_time_mechanism_call_set_date() for the asynchronous version of this method.
1431
 *
1432
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1433
 */
1434
gboolean
1435
date_time_mechanism_call_set_date_sync (
1436
    DateTimeMechanism *proxy,
1437
    guint day,
1438
    guint month,
1439
    guint year,
1440
    GCancellable *cancellable,
1441
    GError **error)
1442
{
1443
  GVariant *_ret;
1444
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1445
    "SetDate",
1446
    g_variant_new ("(uuu)",
1447
                   day,
1448
                   month,
1449
                   year),
1450
    G_DBUS_CALL_FLAGS_NONE,
1451
    -1,
1452
    cancellable,
1453
    error);
1454
  if (_ret == NULL)
1455
    goto _out;
1456
  g_variant_get (_ret,
1457
                 "()");
1458
  g_variant_unref (_ret);
1459
_out:
1460
  return _ret != NULL;
1461
}
1462
1463
/**
1464
 * date_time_mechanism_call_set_time:
1465
 * @proxy: A #DateTimeMechanismProxy.
1466
 * @seconds_since_epoch: Argument to pass with the method invocation.
1467
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1468
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1469
 * @user_data: User data to pass to @callback.
1470
 *
1471
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTime">SetTime()</link> D-Bus method on @proxy.
1472
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1473
 * You can then call date_time_mechanism_call_set_time_finish() to get the result of the operation.
1474
 *
1475
 * See date_time_mechanism_call_set_time_sync() for the synchronous, blocking version of this method.
1476
 */
1477
void
1478
date_time_mechanism_call_set_time (
1479
    DateTimeMechanism *proxy,
1480
    gint64 seconds_since_epoch,
1481
    GCancellable *cancellable,
1482
    GAsyncReadyCallback callback,
1483
    gpointer user_data)
1484
{
1485
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1486
    "SetTime",
1487
    g_variant_new ("(x)",
1488
                   seconds_since_epoch),
1489
    G_DBUS_CALL_FLAGS_NONE,
1490
    -1,
1491
    cancellable,
1492
    callback,
1493
    user_data);
1494
}
1495
1496
/**
1497
 * date_time_mechanism_call_set_time_finish:
1498
 * @proxy: A #DateTimeMechanismProxy.
1499
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_set_time().
1500
 * @error: Return location for error or %NULL.
1501
 *
1502
 * Finishes an operation started with date_time_mechanism_call_set_time().
1503
 *
1504
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1505
 */
1506
gboolean
1507
date_time_mechanism_call_set_time_finish (
1508
    DateTimeMechanism *proxy,
1509
    GAsyncResult *res,
1510
    GError **error)
1511
{
1512
  GVariant *_ret;
1513
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1514
  if (_ret == NULL)
1515
    goto _out;
1516
  g_variant_get (_ret,
1517
                 "()");
1518
  g_variant_unref (_ret);
1519
_out:
1520
  return _ret != NULL;
1521
}
1522
1523
/**
1524
 * date_time_mechanism_call_set_time_sync:
1525
 * @proxy: A #DateTimeMechanismProxy.
1526
 * @seconds_since_epoch: Argument to pass with the method invocation.
1527
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1528
 * @error: Return location for error or %NULL.
1529
 *
1530
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTime">SetTime()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1531
 *
1532
 * See date_time_mechanism_call_set_time() for the asynchronous version of this method.
1533
 *
1534
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1535
 */
1536
gboolean
1537
date_time_mechanism_call_set_time_sync (
1538
    DateTimeMechanism *proxy,
1539
    gint64 seconds_since_epoch,
1540
    GCancellable *cancellable,
1541
    GError **error)
1542
{
1543
  GVariant *_ret;
1544
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1545
    "SetTime",
1546
    g_variant_new ("(x)",
1547
                   seconds_since_epoch),
1548
    G_DBUS_CALL_FLAGS_NONE,
1549
    -1,
1550
    cancellable,
1551
    error);
1552
  if (_ret == NULL)
1553
    goto _out;
1554
  g_variant_get (_ret,
1555
                 "()");
1556
  g_variant_unref (_ret);
1557
_out:
1558
  return _ret != NULL;
1559
}
1560
1561
/**
1562
 * date_time_mechanism_call_can_set_time:
1563
 * @proxy: A #DateTimeMechanismProxy.
1564
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1565
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1566
 * @user_data: User data to pass to @callback.
1567
 *
1568
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTime">CanSetTime()</link> D-Bus method on @proxy.
1569
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1570
 * You can then call date_time_mechanism_call_can_set_time_finish() to get the result of the operation.
1571
 *
1572
 * See date_time_mechanism_call_can_set_time_sync() for the synchronous, blocking version of this method.
1573
 */
1574
void
1575
date_time_mechanism_call_can_set_time (
1576
    DateTimeMechanism *proxy,
1577
    GCancellable *cancellable,
1578
    GAsyncReadyCallback callback,
1579
    gpointer user_data)
1580
{
1581
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1582
    "CanSetTime",
1583
    g_variant_new ("()"),
1584
    G_DBUS_CALL_FLAGS_NONE,
1585
    -1,
1586
    cancellable,
1587
    callback,
1588
    user_data);
1589
}
1590
1591
/**
1592
 * date_time_mechanism_call_can_set_time_finish:
1593
 * @proxy: A #DateTimeMechanismProxy.
1594
 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1595
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_can_set_time().
1596
 * @error: Return location for error or %NULL.
1597
 *
1598
 * Finishes an operation started with date_time_mechanism_call_can_set_time().
1599
 *
1600
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1601
 */
1602
gboolean
1603
date_time_mechanism_call_can_set_time_finish (
1604
    DateTimeMechanism *proxy,
1605
    gint *out_value,
1606
    GAsyncResult *res,
1607
    GError **error)
1608
{
1609
  GVariant *_ret;
1610
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1611
  if (_ret == NULL)
1612
    goto _out;
1613
  g_variant_get (_ret,
1614
                 "(i)",
1615
                 out_value);
1616
  g_variant_unref (_ret);
1617
_out:
1618
  return _ret != NULL;
1619
}
1620
1621
/**
1622
 * date_time_mechanism_call_can_set_time_sync:
1623
 * @proxy: A #DateTimeMechanismProxy.
1624
 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1625
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1626
 * @error: Return location for error or %NULL.
1627
 *
1628
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTime">CanSetTime()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1629
 *
1630
 * See date_time_mechanism_call_can_set_time() for the asynchronous version of this method.
1631
 *
1632
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1633
 */
1634
gboolean
1635
date_time_mechanism_call_can_set_time_sync (
1636
    DateTimeMechanism *proxy,
1637
    gint *out_value,
1638
    GCancellable *cancellable,
1639
    GError **error)
1640
{
1641
  GVariant *_ret;
1642
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1643
    "CanSetTime",
1644
    g_variant_new ("()"),
1645
    G_DBUS_CALL_FLAGS_NONE,
1646
    -1,
1647
    cancellable,
1648
    error);
1649
  if (_ret == NULL)
1650
    goto _out;
1651
  g_variant_get (_ret,
1652
                 "(i)",
1653
                 out_value);
1654
  g_variant_unref (_ret);
1655
_out:
1656
  return _ret != NULL;
1657
}
1658
1659
/**
1660
 * date_time_mechanism_call_adjust_time:
1661
 * @proxy: A #DateTimeMechanismProxy.
1662
 * @seconds_to_add: Argument to pass with the method invocation.
1663
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1664
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1665
 * @user_data: User data to pass to @callback.
1666
 *
1667
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.AdjustTime">AdjustTime()</link> D-Bus method on @proxy.
1668
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1669
 * You can then call date_time_mechanism_call_adjust_time_finish() to get the result of the operation.
1670
 *
1671
 * See date_time_mechanism_call_adjust_time_sync() for the synchronous, blocking version of this method.
1672
 */
1673
void
1674
date_time_mechanism_call_adjust_time (
1675
    DateTimeMechanism *proxy,
1676
    gint64 seconds_to_add,
1677
    GCancellable *cancellable,
1678
    GAsyncReadyCallback callback,
1679
    gpointer user_data)
1680
{
1681
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1682
    "AdjustTime",
1683
    g_variant_new ("(x)",
1684
                   seconds_to_add),
1685
    G_DBUS_CALL_FLAGS_NONE,
1686
    -1,
1687
    cancellable,
1688
    callback,
1689
    user_data);
1690
}
1691
1692
/**
1693
 * date_time_mechanism_call_adjust_time_finish:
1694
 * @proxy: A #DateTimeMechanismProxy.
1695
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_adjust_time().
1696
 * @error: Return location for error or %NULL.
1697
 *
1698
 * Finishes an operation started with date_time_mechanism_call_adjust_time().
1699
 *
1700
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1701
 */
1702
gboolean
1703
date_time_mechanism_call_adjust_time_finish (
1704
    DateTimeMechanism *proxy,
1705
    GAsyncResult *res,
1706
    GError **error)
1707
{
1708
  GVariant *_ret;
1709
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1710
  if (_ret == NULL)
1711
    goto _out;
1712
  g_variant_get (_ret,
1713
                 "()");
1714
  g_variant_unref (_ret);
1715
_out:
1716
  return _ret != NULL;
1717
}
1718
1719
/**
1720
 * date_time_mechanism_call_adjust_time_sync:
1721
 * @proxy: A #DateTimeMechanismProxy.
1722
 * @seconds_to_add: Argument to pass with the method invocation.
1723
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1724
 * @error: Return location for error or %NULL.
1725
 *
1726
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.AdjustTime">AdjustTime()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1727
 *
1728
 * See date_time_mechanism_call_adjust_time() for the asynchronous version of this method.
1729
 *
1730
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1731
 */
1732
gboolean
1733
date_time_mechanism_call_adjust_time_sync (
1734
    DateTimeMechanism *proxy,
1735
    gint64 seconds_to_add,
1736
    GCancellable *cancellable,
1737
    GError **error)
1738
{
1739
  GVariant *_ret;
1740
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1741
    "AdjustTime",
1742
    g_variant_new ("(x)",
1743
                   seconds_to_add),
1744
    G_DBUS_CALL_FLAGS_NONE,
1745
    -1,
1746
    cancellable,
1747
    error);
1748
  if (_ret == NULL)
1749
    goto _out;
1750
  g_variant_get (_ret,
1751
                 "()");
1752
  g_variant_unref (_ret);
1753
_out:
1754
  return _ret != NULL;
1755
}
1756
1757
/**
1758
 * date_time_mechanism_call_get_hardware_clock_using_utc:
1759
 * @proxy: A #DateTimeMechanismProxy.
1760
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1761
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1762
 * @user_data: User data to pass to @callback.
1763
 *
1764
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetHardwareClockUsingUtc">GetHardwareClockUsingUtc()</link> D-Bus method on @proxy.
1765
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1766
 * You can then call date_time_mechanism_call_get_hardware_clock_using_utc_finish() to get the result of the operation.
1767
 *
1768
 * See date_time_mechanism_call_get_hardware_clock_using_utc_sync() for the synchronous, blocking version of this method.
1769
 */
1770
void
1771
date_time_mechanism_call_get_hardware_clock_using_utc (
1772
    DateTimeMechanism *proxy,
1773
    GCancellable *cancellable,
1774
    GAsyncReadyCallback callback,
1775
    gpointer user_data)
1776
{
1777
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1778
    "GetHardwareClockUsingUtc",
1779
    g_variant_new ("()"),
1780
    G_DBUS_CALL_FLAGS_NONE,
1781
    -1,
1782
    cancellable,
1783
    callback,
1784
    user_data);
1785
}
1786
1787
/**
1788
 * date_time_mechanism_call_get_hardware_clock_using_utc_finish:
1789
 * @proxy: A #DateTimeMechanismProxy.
1790
 * @out_is_using_utc: (out): Return location for return parameter or %NULL to ignore.
1791
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_get_hardware_clock_using_utc().
1792
 * @error: Return location for error or %NULL.
1793
 *
1794
 * Finishes an operation started with date_time_mechanism_call_get_hardware_clock_using_utc().
1795
 *
1796
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1797
 */
1798
gboolean
1799
date_time_mechanism_call_get_hardware_clock_using_utc_finish (
1800
    DateTimeMechanism *proxy,
1801
    gboolean *out_is_using_utc,
1802
    GAsyncResult *res,
1803
    GError **error)
1804
{
1805
  GVariant *_ret;
1806
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1807
  if (_ret == NULL)
1808
    goto _out;
1809
  g_variant_get (_ret,
1810
                 "(b)",
1811
                 out_is_using_utc);
1812
  g_variant_unref (_ret);
1813
_out:
1814
  return _ret != NULL;
1815
}
1816
1817
/**
1818
 * date_time_mechanism_call_get_hardware_clock_using_utc_sync:
1819
 * @proxy: A #DateTimeMechanismProxy.
1820
 * @out_is_using_utc: (out): Return location for return parameter or %NULL to ignore.
1821
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1822
 * @error: Return location for error or %NULL.
1823
 *
1824
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetHardwareClockUsingUtc">GetHardwareClockUsingUtc()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1825
 *
1826
 * See date_time_mechanism_call_get_hardware_clock_using_utc() for the asynchronous version of this method.
1827
 *
1828
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1829
 */
1830
gboolean
1831
date_time_mechanism_call_get_hardware_clock_using_utc_sync (
1832
    DateTimeMechanism *proxy,
1833
    gboolean *out_is_using_utc,
1834
    GCancellable *cancellable,
1835
    GError **error)
1836
{
1837
  GVariant *_ret;
1838
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1839
    "GetHardwareClockUsingUtc",
1840
    g_variant_new ("()"),
1841
    G_DBUS_CALL_FLAGS_NONE,
1842
    -1,
1843
    cancellable,
1844
    error);
1845
  if (_ret == NULL)
1846
    goto _out;
1847
  g_variant_get (_ret,
1848
                 "(b)",
1849
                 out_is_using_utc);
1850
  g_variant_unref (_ret);
1851
_out:
1852
  return _ret != NULL;
1853
}
1854
1855
/**
1856
 * date_time_mechanism_call_set_hardware_clock_using_utc:
1857
 * @proxy: A #DateTimeMechanismProxy.
1858
 * @is_using_utc: Argument to pass with the method invocation.
1859
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1860
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1861
 * @user_data: User data to pass to @callback.
1862
 *
1863
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetHardwareClockUsingUtc">SetHardwareClockUsingUtc()</link> D-Bus method on @proxy.
1864
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1865
 * You can then call date_time_mechanism_call_set_hardware_clock_using_utc_finish() to get the result of the operation.
1866
 *
1867
 * See date_time_mechanism_call_set_hardware_clock_using_utc_sync() for the synchronous, blocking version of this method.
1868
 */
1869
void
1870
date_time_mechanism_call_set_hardware_clock_using_utc (
1871
    DateTimeMechanism *proxy,
1872
    gboolean is_using_utc,
1873
    GCancellable *cancellable,
1874
    GAsyncReadyCallback callback,
1875
    gpointer user_data)
1876
{
1877
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1878
    "SetHardwareClockUsingUtc",
1879
    g_variant_new ("(b)",
1880
                   is_using_utc),
1881
    G_DBUS_CALL_FLAGS_NONE,
1882
    -1,
1883
    cancellable,
1884
    callback,
1885
    user_data);
1886
}
1887
1888
/**
1889
 * date_time_mechanism_call_set_hardware_clock_using_utc_finish:
1890
 * @proxy: A #DateTimeMechanismProxy.
1891
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_set_hardware_clock_using_utc().
1892
 * @error: Return location for error or %NULL.
1893
 *
1894
 * Finishes an operation started with date_time_mechanism_call_set_hardware_clock_using_utc().
1895
 *
1896
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1897
 */
1898
gboolean
1899
date_time_mechanism_call_set_hardware_clock_using_utc_finish (
1900
    DateTimeMechanism *proxy,
1901
    GAsyncResult *res,
1902
    GError **error)
1903
{
1904
  GVariant *_ret;
1905
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1906
  if (_ret == NULL)
1907
    goto _out;
1908
  g_variant_get (_ret,
1909
                 "()");
1910
  g_variant_unref (_ret);
1911
_out:
1912
  return _ret != NULL;
1913
}
1914
1915
/**
1916
 * date_time_mechanism_call_set_hardware_clock_using_utc_sync:
1917
 * @proxy: A #DateTimeMechanismProxy.
1918
 * @is_using_utc: Argument to pass with the method invocation.
1919
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1920
 * @error: Return location for error or %NULL.
1921
 *
1922
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetHardwareClockUsingUtc">SetHardwareClockUsingUtc()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1923
 *
1924
 * See date_time_mechanism_call_set_hardware_clock_using_utc() for the asynchronous version of this method.
1925
 *
1926
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1927
 */
1928
gboolean
1929
date_time_mechanism_call_set_hardware_clock_using_utc_sync (
1930
    DateTimeMechanism *proxy,
1931
    gboolean is_using_utc,
1932
    GCancellable *cancellable,
1933
    GError **error)
1934
{
1935
  GVariant *_ret;
1936
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1937
    "SetHardwareClockUsingUtc",
1938
    g_variant_new ("(b)",
1939
                   is_using_utc),
1940
    G_DBUS_CALL_FLAGS_NONE,
1941
    -1,
1942
    cancellable,
1943
    error);
1944
  if (_ret == NULL)
1945
    goto _out;
1946
  g_variant_get (_ret,
1947
                 "()");
1948
  g_variant_unref (_ret);
1949
_out:
1950
  return _ret != NULL;
1951
}
1952
1953
/**
1954
 * date_time_mechanism_call_get_using_ntp:
1955
 * @proxy: A #DateTimeMechanismProxy.
1956
 * @cancellable: (allow-none): A #GCancellable or %NULL.
1957
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1958
 * @user_data: User data to pass to @callback.
1959
 *
1960
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetUsingNtp">GetUsingNtp()</link> D-Bus method on @proxy.
1961
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1962
 * You can then call date_time_mechanism_call_get_using_ntp_finish() to get the result of the operation.
1963
 *
1964
 * See date_time_mechanism_call_get_using_ntp_sync() for the synchronous, blocking version of this method.
1965
 */
1966
void
1967
date_time_mechanism_call_get_using_ntp (
1968
    DateTimeMechanism *proxy,
1969
    GCancellable *cancellable,
1970
    GAsyncReadyCallback callback,
1971
    gpointer user_data)
1972
{
1973
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1974
    "GetUsingNtp",
1975
    g_variant_new ("()"),
1976
    G_DBUS_CALL_FLAGS_NONE,
1977
    -1,
1978
    cancellable,
1979
    callback,
1980
    user_data);
1981
}
1982
1983
/**
1984
 * date_time_mechanism_call_get_using_ntp_finish:
1985
 * @proxy: A #DateTimeMechanismProxy.
1986
 * @out_can_use_ntp: (out): Return location for return parameter or %NULL to ignore.
1987
 * @out_is_using_ntp: (out): Return location for return parameter or %NULL to ignore.
1988
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_get_using_ntp().
1989
 * @error: Return location for error or %NULL.
1990
 *
1991
 * Finishes an operation started with date_time_mechanism_call_get_using_ntp().
1992
 *
1993
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1994
 */
1995
gboolean
1996
date_time_mechanism_call_get_using_ntp_finish (
1997
    DateTimeMechanism *proxy,
1998
    gboolean *out_can_use_ntp,
1999
    gboolean *out_is_using_ntp,
2000
    GAsyncResult *res,
2001
    GError **error)
2002
{
2003
  GVariant *_ret;
2004
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2005
  if (_ret == NULL)
2006
    goto _out;
2007
  g_variant_get (_ret,
2008
                 "(bb)",
2009
                 out_can_use_ntp,
2010
                 out_is_using_ntp);
2011
  g_variant_unref (_ret);
2012
_out:
2013
  return _ret != NULL;
2014
}
2015
2016
/**
2017
 * date_time_mechanism_call_get_using_ntp_sync:
2018
 * @proxy: A #DateTimeMechanismProxy.
2019
 * @out_can_use_ntp: (out): Return location for return parameter or %NULL to ignore.
2020
 * @out_is_using_ntp: (out): Return location for return parameter or %NULL to ignore.
2021
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2022
 * @error: Return location for error or %NULL.
2023
 *
2024
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetUsingNtp">GetUsingNtp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2025
 *
2026
 * See date_time_mechanism_call_get_using_ntp() for the asynchronous version of this method.
2027
 *
2028
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2029
 */
2030
gboolean
2031
date_time_mechanism_call_get_using_ntp_sync (
2032
    DateTimeMechanism *proxy,
2033
    gboolean *out_can_use_ntp,
2034
    gboolean *out_is_using_ntp,
2035
    GCancellable *cancellable,
2036
    GError **error)
2037
{
2038
  GVariant *_ret;
2039
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2040
    "GetUsingNtp",
2041
    g_variant_new ("()"),
2042
    G_DBUS_CALL_FLAGS_NONE,
2043
    -1,
2044
    cancellable,
2045
    error);
2046
  if (_ret == NULL)
2047
    goto _out;
2048
  g_variant_get (_ret,
2049
                 "(bb)",
2050
                 out_can_use_ntp,
2051
                 out_is_using_ntp);
2052
  g_variant_unref (_ret);
2053
_out:
2054
  return _ret != NULL;
2055
}
2056
2057
/**
2058
 * date_time_mechanism_call_set_using_ntp:
2059
 * @proxy: A #DateTimeMechanismProxy.
2060
 * @is_using_ntp: Argument to pass with the method invocation.
2061
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2062
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2063
 * @user_data: User data to pass to @callback.
2064
 *
2065
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetUsingNtp">SetUsingNtp()</link> D-Bus method on @proxy.
2066
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2067
 * You can then call date_time_mechanism_call_set_using_ntp_finish() to get the result of the operation.
2068
 *
2069
 * See date_time_mechanism_call_set_using_ntp_sync() for the synchronous, blocking version of this method.
2070
 */
2071
void
2072
date_time_mechanism_call_set_using_ntp (
2073
    DateTimeMechanism *proxy,
2074
    gboolean is_using_ntp,
2075
    GCancellable *cancellable,
2076
    GAsyncReadyCallback callback,
2077
    gpointer user_data)
2078
{
2079
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2080
    "SetUsingNtp",
2081
    g_variant_new ("(b)",
2082
                   is_using_ntp),
2083
    G_DBUS_CALL_FLAGS_NONE,
2084
    -1,
2085
    cancellable,
2086
    callback,
2087
    user_data);
2088
}
2089
2090
/**
2091
 * date_time_mechanism_call_set_using_ntp_finish:
2092
 * @proxy: A #DateTimeMechanismProxy.
2093
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_set_using_ntp().
2094
 * @error: Return location for error or %NULL.
2095
 *
2096
 * Finishes an operation started with date_time_mechanism_call_set_using_ntp().
2097
 *
2098
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2099
 */
2100
gboolean
2101
date_time_mechanism_call_set_using_ntp_finish (
2102
    DateTimeMechanism *proxy,
2103
    GAsyncResult *res,
2104
    GError **error)
2105
{
2106
  GVariant *_ret;
2107
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2108
  if (_ret == NULL)
2109
    goto _out;
2110
  g_variant_get (_ret,
2111
                 "()");
2112
  g_variant_unref (_ret);
2113
_out:
2114
  return _ret != NULL;
2115
}
2116
2117
/**
2118
 * date_time_mechanism_call_set_using_ntp_sync:
2119
 * @proxy: A #DateTimeMechanismProxy.
2120
 * @is_using_ntp: Argument to pass with the method invocation.
2121
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2122
 * @error: Return location for error or %NULL.
2123
 *
2124
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetUsingNtp">SetUsingNtp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2125
 *
2126
 * See date_time_mechanism_call_set_using_ntp() for the asynchronous version of this method.
2127
 *
2128
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2129
 */
2130
gboolean
2131
date_time_mechanism_call_set_using_ntp_sync (
2132
    DateTimeMechanism *proxy,
2133
    gboolean is_using_ntp,
2134
    GCancellable *cancellable,
2135
    GError **error)
2136
{
2137
  GVariant *_ret;
2138
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2139
    "SetUsingNtp",
2140
    g_variant_new ("(b)",
2141
                   is_using_ntp),
2142
    G_DBUS_CALL_FLAGS_NONE,
2143
    -1,
2144
    cancellable,
2145
    error);
2146
  if (_ret == NULL)
2147
    goto _out;
2148
  g_variant_get (_ret,
2149
                 "()");
2150
  g_variant_unref (_ret);
2151
_out:
2152
  return _ret != NULL;
2153
}
2154
2155
/**
2156
 * date_time_mechanism_call_can_set_using_ntp:
2157
 * @proxy: A #DateTimeMechanismProxy.
2158
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2159
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2160
 * @user_data: User data to pass to @callback.
2161
 *
2162
 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetUsingNtp">CanSetUsingNtp()</link> D-Bus method on @proxy.
2163
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2164
 * You can then call date_time_mechanism_call_can_set_using_ntp_finish() to get the result of the operation.
2165
 *
2166
 * See date_time_mechanism_call_can_set_using_ntp_sync() for the synchronous, blocking version of this method.
2167
 */
2168
void
2169
date_time_mechanism_call_can_set_using_ntp (
2170
    DateTimeMechanism *proxy,
2171
    GCancellable *cancellable,
2172
    GAsyncReadyCallback callback,
2173
    gpointer user_data)
2174
{
2175
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2176
    "CanSetUsingNtp",
2177
    g_variant_new ("()"),
2178
    G_DBUS_CALL_FLAGS_NONE,
2179
    -1,
2180
    cancellable,
2181
    callback,
2182
    user_data);
2183
}
2184
2185
/**
2186
 * date_time_mechanism_call_can_set_using_ntp_finish:
2187
 * @proxy: A #DateTimeMechanismProxy.
2188
 * @out_value: (out): Return location for return parameter or %NULL to ignore.
2189
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_call_can_set_using_ntp().
2190
 * @error: Return location for error or %NULL.
2191
 *
2192
 * Finishes an operation started with date_time_mechanism_call_can_set_using_ntp().
2193
 *
2194
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2195
 */
2196
gboolean
2197
date_time_mechanism_call_can_set_using_ntp_finish (
2198
    DateTimeMechanism *proxy,
2199
    gint *out_value,
2200
    GAsyncResult *res,
2201
    GError **error)
2202
{
2203
  GVariant *_ret;
2204
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2205
  if (_ret == NULL)
2206
    goto _out;
2207
  g_variant_get (_ret,
2208
                 "(i)",
2209
                 out_value);
2210
  g_variant_unref (_ret);
2211
_out:
2212
  return _ret != NULL;
2213
}
2214
2215
/**
2216
 * date_time_mechanism_call_can_set_using_ntp_sync:
2217
 * @proxy: A #DateTimeMechanismProxy.
2218
 * @out_value: (out): Return location for return parameter or %NULL to ignore.
2219
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2220
 * @error: Return location for error or %NULL.
2221
 *
2222
 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetUsingNtp">CanSetUsingNtp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2223
 *
2224
 * See date_time_mechanism_call_can_set_using_ntp() for the asynchronous version of this method.
2225
 *
2226
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2227
 */
2228
gboolean
2229
date_time_mechanism_call_can_set_using_ntp_sync (
2230
    DateTimeMechanism *proxy,
2231
    gint *out_value,
2232
    GCancellable *cancellable,
2233
    GError **error)
2234
{
2235
  GVariant *_ret;
2236
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2237
    "CanSetUsingNtp",
2238
    g_variant_new ("()"),
2239
    G_DBUS_CALL_FLAGS_NONE,
2240
    -1,
2241
    cancellable,
2242
    error);
2243
  if (_ret == NULL)
2244
    goto _out;
2245
  g_variant_get (_ret,
2246
                 "(i)",
2247
                 out_value);
2248
  g_variant_unref (_ret);
2249
_out:
2250
  return _ret != NULL;
2251
}
2252
2253
/**
2254
 * date_time_mechanism_complete_set_timezone:
2255
 * @object: A #DateTimeMechanism.
2256
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2257
 *
2258
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTimezone">SetTimezone()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2259
 *
2260
 * This method will free @invocation, you cannot use it afterwards.
2261
 */
2262
void
2263
date_time_mechanism_complete_set_timezone (
2264
    DateTimeMechanism *object,
2265
    GDBusMethodInvocation *invocation)
2266
{
2267
  g_dbus_method_invocation_return_value (invocation,
2268
    g_variant_new ("()"));
2269
}
2270
2271
/**
2272
 * date_time_mechanism_complete_get_timezone:
2273
 * @object: A #DateTimeMechanism.
2274
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2275
 * @timezone: Parameter to return.
2276
 *
2277
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetTimezone">GetTimezone()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2278
 *
2279
 * This method will free @invocation, you cannot use it afterwards.
2280
 */
2281
void
2282
date_time_mechanism_complete_get_timezone (
2283
    DateTimeMechanism *object,
2284
    GDBusMethodInvocation *invocation,
2285
    const gchar *timezone)
2286
{
2287
  g_dbus_method_invocation_return_value (invocation,
2288
    g_variant_new ("(s)",
2289
                   timezone));
2290
}
2291
2292
/**
2293
 * date_time_mechanism_complete_can_set_timezone:
2294
 * @object: A #DateTimeMechanism.
2295
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2296
 * @value: Parameter to return.
2297
 *
2298
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTimezone">CanSetTimezone()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2299
 *
2300
 * This method will free @invocation, you cannot use it afterwards.
2301
 */
2302
void
2303
date_time_mechanism_complete_can_set_timezone (
2304
    DateTimeMechanism *object,
2305
    GDBusMethodInvocation *invocation,
2306
    gint value)
2307
{
2308
  g_dbus_method_invocation_return_value (invocation,
2309
    g_variant_new ("(i)",
2310
                   value));
2311
}
2312
2313
/**
2314
 * date_time_mechanism_complete_set_date:
2315
 * @object: A #DateTimeMechanism.
2316
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2317
 *
2318
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetDate">SetDate()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2319
 *
2320
 * This method will free @invocation, you cannot use it afterwards.
2321
 */
2322
void
2323
date_time_mechanism_complete_set_date (
2324
    DateTimeMechanism *object,
2325
    GDBusMethodInvocation *invocation)
2326
{
2327
  g_dbus_method_invocation_return_value (invocation,
2328
    g_variant_new ("()"));
2329
}
2330
2331
/**
2332
 * date_time_mechanism_complete_set_time:
2333
 * @object: A #DateTimeMechanism.
2334
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2335
 *
2336
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetTime">SetTime()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2337
 *
2338
 * This method will free @invocation, you cannot use it afterwards.
2339
 */
2340
void
2341
date_time_mechanism_complete_set_time (
2342
    DateTimeMechanism *object,
2343
    GDBusMethodInvocation *invocation)
2344
{
2345
  g_dbus_method_invocation_return_value (invocation,
2346
    g_variant_new ("()"));
2347
}
2348
2349
/**
2350
 * date_time_mechanism_complete_can_set_time:
2351
 * @object: A #DateTimeMechanism.
2352
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2353
 * @value: Parameter to return.
2354
 *
2355
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetTime">CanSetTime()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2356
 *
2357
 * This method will free @invocation, you cannot use it afterwards.
2358
 */
2359
void
2360
date_time_mechanism_complete_can_set_time (
2361
    DateTimeMechanism *object,
2362
    GDBusMethodInvocation *invocation,
2363
    gint value)
2364
{
2365
  g_dbus_method_invocation_return_value (invocation,
2366
    g_variant_new ("(i)",
2367
                   value));
2368
}
2369
2370
/**
2371
 * date_time_mechanism_complete_adjust_time:
2372
 * @object: A #DateTimeMechanism.
2373
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2374
 *
2375
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.AdjustTime">AdjustTime()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2376
 *
2377
 * This method will free @invocation, you cannot use it afterwards.
2378
 */
2379
void
2380
date_time_mechanism_complete_adjust_time (
2381
    DateTimeMechanism *object,
2382
    GDBusMethodInvocation *invocation)
2383
{
2384
  g_dbus_method_invocation_return_value (invocation,
2385
    g_variant_new ("()"));
2386
}
2387
2388
/**
2389
 * date_time_mechanism_complete_get_hardware_clock_using_utc:
2390
 * @object: A #DateTimeMechanism.
2391
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2392
 * @is_using_utc: Parameter to return.
2393
 *
2394
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetHardwareClockUsingUtc">GetHardwareClockUsingUtc()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2395
 *
2396
 * This method will free @invocation, you cannot use it afterwards.
2397
 */
2398
void
2399
date_time_mechanism_complete_get_hardware_clock_using_utc (
2400
    DateTimeMechanism *object,
2401
    GDBusMethodInvocation *invocation,
2402
    gboolean is_using_utc)
2403
{
2404
  g_dbus_method_invocation_return_value (invocation,
2405
    g_variant_new ("(b)",
2406
                   is_using_utc));
2407
}
2408
2409
/**
2410
 * date_time_mechanism_complete_set_hardware_clock_using_utc:
2411
 * @object: A #DateTimeMechanism.
2412
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2413
 *
2414
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetHardwareClockUsingUtc">SetHardwareClockUsingUtc()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2415
 *
2416
 * This method will free @invocation, you cannot use it afterwards.
2417
 */
2418
void
2419
date_time_mechanism_complete_set_hardware_clock_using_utc (
2420
    DateTimeMechanism *object,
2421
    GDBusMethodInvocation *invocation)
2422
{
2423
  g_dbus_method_invocation_return_value (invocation,
2424
    g_variant_new ("()"));
2425
}
2426
2427
/**
2428
 * date_time_mechanism_complete_get_using_ntp:
2429
 * @object: A #DateTimeMechanism.
2430
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2431
 * @can_use_ntp: Parameter to return.
2432
 * @is_using_ntp: Parameter to return.
2433
 *
2434
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.GetUsingNtp">GetUsingNtp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2435
 *
2436
 * This method will free @invocation, you cannot use it afterwards.
2437
 */
2438
void
2439
date_time_mechanism_complete_get_using_ntp (
2440
    DateTimeMechanism *object,
2441
    GDBusMethodInvocation *invocation,
2442
    gboolean can_use_ntp,
2443
    gboolean is_using_ntp)
2444
{
2445
  g_dbus_method_invocation_return_value (invocation,
2446
    g_variant_new ("(bb)",
2447
                   can_use_ntp,
2448
                   is_using_ntp));
2449
}
2450
2451
/**
2452
 * date_time_mechanism_complete_set_using_ntp:
2453
 * @object: A #DateTimeMechanism.
2454
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2455
 *
2456
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.SetUsingNtp">SetUsingNtp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2457
 *
2458
 * This method will free @invocation, you cannot use it afterwards.
2459
 */
2460
void
2461
date_time_mechanism_complete_set_using_ntp (
2462
    DateTimeMechanism *object,
2463
    GDBusMethodInvocation *invocation)
2464
{
2465
  g_dbus_method_invocation_return_value (invocation,
2466
    g_variant_new ("()"));
2467
}
2468
2469
/**
2470
 * date_time_mechanism_complete_can_set_using_ntp:
2471
 * @object: A #DateTimeMechanism.
2472
 * @invocation: (transfer full): A #GDBusMethodInvocation.
2473
 * @value: Parameter to return.
2474
 *
2475
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-DateTimeMechanism.CanSetUsingNtp">CanSetUsingNtp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2476
 *
2477
 * This method will free @invocation, you cannot use it afterwards.
2478
 */
2479
void
2480
date_time_mechanism_complete_can_set_using_ntp (
2481
    DateTimeMechanism *object,
2482
    GDBusMethodInvocation *invocation,
2483
    gint value)
2484
{
2485
  g_dbus_method_invocation_return_value (invocation,
2486
    g_variant_new ("(i)",
2487
                   value));
2488
}
2489
2490
/* ------------------------------------------------------------------------ */
2491
2492
/**
2493
 * DateTimeMechanismProxy:
2494
 *
2495
 * The #DateTimeMechanismProxy structure contains only private data and should only be accessed using the provided API.
2496
 */
2497
2498
/**
2499
 * DateTimeMechanismProxyClass:
2500
 * @parent_class: The parent class.
2501
 *
2502
 * Class structure for #DateTimeMechanismProxy.
2503
 */
2504
2505
static void
2506
date_time_mechanism_proxy_iface_init (DateTimeMechanismIface *iface)
2507
{
2508
}
2509
2510
#define date_time_mechanism_proxy_get_type date_time_mechanism_proxy_get_type
2511
G_DEFINE_TYPE_WITH_CODE (DateTimeMechanismProxy, date_time_mechanism_proxy, G_TYPE_DBUS_PROXY,
2512
                         G_IMPLEMENT_INTERFACE (TYPE_DATE_TIME_MECHANISM, date_time_mechanism_proxy_iface_init));
2513
#undef date_time_mechanism_proxy_get_type
2514
2515
static void
2516
date_time_mechanism_proxy_get_property (GObject      *object,
2517
  guint         prop_id,
2518
  GValue       *value,
2519
  GParamSpec   *pspec)
2520
{
2521
}
2522
2523
static void
2524
date_time_mechanism_proxy_set_property (GObject      *object,
2525
  guint         prop_id,
2526
  const GValue *value,
2527
  GParamSpec   *pspec)
2528
{
2529
}
2530
2531
static void
2532
date_time_mechanism_proxy_g_signal (GDBusProxy *proxy,
2533
  const gchar *sender_name,
2534
  const gchar *signal_name,
2535
  GVariant *parameters)
2536
{
2537
  _ExtendedGDBusSignalInfo *info;
2538
  GVariantIter iter;
2539
  GVariant *child;
2540
  GValue *paramv;
2541
  guint num_params;
2542
  guint n;
2543
  guint signal_id;
2544
  info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_date_time_mechanism_interface_info, signal_name);
2545
  if (info == NULL)
2546
    return;
2547
  num_params = g_variant_n_children (parameters);
2548
  paramv = g_new0 (GValue, num_params + 1);
2549
  g_value_init (&paramv[0], TYPE_DATE_TIME_MECHANISM);
2550
  g_value_set_object (&paramv[0], proxy);
2551
  g_variant_iter_init (&iter, parameters);
2552
  n = 1;
2553
  while ((child = g_variant_iter_next_value (&iter)) != NULL)
2554
    {
2555
      _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2556
      if (arg_info->use_gvariant)
2557
        {
2558
          g_value_init (&paramv[n], G_TYPE_VARIANT);
2559
          g_value_set_variant (&paramv[n], child);
2560
          n++;
2561
        }
2562
      else
2563
        g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2564
      g_variant_unref (child);
2565
    }
2566
  signal_id = g_signal_lookup (info->signal_name, TYPE_DATE_TIME_MECHANISM);
2567
  g_signal_emitv (paramv, signal_id, 0, NULL);
2568
  for (n = 0; n < num_params + 1; n++)
2569
    g_value_unset (&paramv[n]);
2570
  g_free (paramv);
2571
}
2572
2573
static void
2574
date_time_mechanism_proxy_g_properties_changed (GDBusProxy *proxy,
2575
  GVariant *changed_properties,
2576
  const gchar *const *invalidated_properties)
2577
{
2578
  guint n;
2579
  const gchar *key;
2580
  GVariantIter *iter;
2581
  _ExtendedGDBusPropertyInfo *info;
2582
  g_variant_get (changed_properties, "a{sv}", &iter);
2583
  while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2584
    {
2585
      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_date_time_mechanism_interface_info, key);
2586
      if (info != NULL)
2587
        g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2588
    }
2589
  g_variant_iter_free (iter);
2590
  for (n = 0; invalidated_properties[n] != NULL; n++)
2591
    {
2592
      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_date_time_mechanism_interface_info, invalidated_properties[n]);
2593
      if (info != NULL)
2594
        g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2595
    }
2596
}
2597
2598
static void
2599
date_time_mechanism_proxy_init (DateTimeMechanismProxy *proxy)
2600
{
2601
  g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), date_time_mechanism_interface_info ());
2602
}
2603
2604
static void
2605
date_time_mechanism_proxy_class_init (DateTimeMechanismProxyClass *klass)
2606
{
2607
  GObjectClass *gobject_class;
2608
  GDBusProxyClass *proxy_class;
2609
2610
  gobject_class = G_OBJECT_CLASS (klass);
2611
  gobject_class->get_property = date_time_mechanism_proxy_get_property;
2612
  gobject_class->set_property = date_time_mechanism_proxy_set_property;
2613
2614
  proxy_class = G_DBUS_PROXY_CLASS (klass);
2615
  proxy_class->g_signal = date_time_mechanism_proxy_g_signal;
2616
  proxy_class->g_properties_changed = date_time_mechanism_proxy_g_properties_changed;
2617
2618
}
2619
2620
/**
2621
 * date_time_mechanism_proxy_new:
2622
 * @connection: A #GDBusConnection.
2623
 * @flags: Flags from the #GDBusProxyFlags enumeration.
2624
 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2625
 * @object_path: An object path.
2626
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2627
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2628
 * @user_data: User data to pass to @callback.
2629
 *
2630
 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-DateTimeMechanism.top_of_page">org.gnome.SettingsDaemon.DateTimeMechanism</link>. See g_dbus_proxy_new() for more details.
2631
 *
2632
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2633
 * You can then call date_time_mechanism_proxy_new_finish() to get the result of the operation.
2634
 *
2635
 * See date_time_mechanism_proxy_new_sync() for the synchronous, blocking version of this constructor.
2636
 */
2637
void
2638
date_time_mechanism_proxy_new (
2639
    GDBusConnection     *connection,
2640
    GDBusProxyFlags      flags,
2641
    const gchar         *name,
2642
    const gchar         *object_path,
2643
    GCancellable        *cancellable,
2644
    GAsyncReadyCallback  callback,
2645
    gpointer             user_data)
2646
{
2647
  g_async_initable_new_async (TYPE_DATE_TIME_MECHANISM_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.DateTimeMechanism", NULL);
2648
}
2649
2650
/**
2651
 * date_time_mechanism_proxy_new_finish:
2652
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_proxy_new().
2653
 * @error: Return location for error or %NULL
2654
 *
2655
 * Finishes an operation started with date_time_mechanism_proxy_new().
2656
 *
2657
 * Returns: (transfer full) (type DateTimeMechanismProxy): The constructed proxy object or %NULL if @error is set.
2658
 */
2659
DateTimeMechanism *
2660
date_time_mechanism_proxy_new_finish (
2661
    GAsyncResult        *res,
2662
    GError             **error)
2663
{
2664
  GObject *ret;
2665
  GObject *source_object;
2666
  source_object = g_async_result_get_source_object (res);
2667
  ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2668
  g_object_unref (source_object);
2669
  if (ret != NULL)
2670
    return DATE_TIME_MECHANISM (ret);
2671
  else
2672
    return NULL;
2673
}
2674
2675
/**
2676
 * date_time_mechanism_proxy_new_sync:
2677
 * @connection: A #GDBusConnection.
2678
 * @flags: Flags from the #GDBusProxyFlags enumeration.
2679
 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2680
 * @object_path: An object path.
2681
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2682
 * @error: Return location for error or %NULL
2683
 *
2684
 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-DateTimeMechanism.top_of_page">org.gnome.SettingsDaemon.DateTimeMechanism</link>. See g_dbus_proxy_new_sync() for more details.
2685
 *
2686
 * The calling thread is blocked until a reply is received.
2687
 *
2688
 * See date_time_mechanism_proxy_new() for the asynchronous version of this constructor.
2689
 *
2690
 * Returns: (transfer full) (type DateTimeMechanismProxy): The constructed proxy object or %NULL if @error is set.
2691
 */
2692
DateTimeMechanism *
2693
date_time_mechanism_proxy_new_sync (
2694
    GDBusConnection     *connection,
2695
    GDBusProxyFlags      flags,
2696
    const gchar         *name,
2697
    const gchar         *object_path,
2698
    GCancellable        *cancellable,
2699
    GError             **error)
2700
{
2701
  GInitable *ret;
2702
  ret = g_initable_new (TYPE_DATE_TIME_MECHANISM_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.DateTimeMechanism", NULL);
2703
  if (ret != NULL)
2704
    return DATE_TIME_MECHANISM (ret);
2705
  else
2706
    return NULL;
2707
}
2708
2709
2710
/**
2711
 * date_time_mechanism_proxy_new_for_bus:
2712
 * @bus_type: A #GBusType.
2713
 * @flags: Flags from the #GDBusProxyFlags enumeration.
2714
 * @name: A bus name (well-known or unique).
2715
 * @object_path: An object path.
2716
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2717
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2718
 * @user_data: User data to pass to @callback.
2719
 *
2720
 * Like date_time_mechanism_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2721
 *
2722
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2723
 * You can then call date_time_mechanism_proxy_new_for_bus_finish() to get the result of the operation.
2724
 *
2725
 * See date_time_mechanism_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2726
 */
2727
void
2728
date_time_mechanism_proxy_new_for_bus (
2729
    GBusType             bus_type,
2730
    GDBusProxyFlags      flags,
2731
    const gchar         *name,
2732
    const gchar         *object_path,
2733
    GCancellable        *cancellable,
2734
    GAsyncReadyCallback  callback,
2735
    gpointer             user_data)
2736
{
2737
  g_async_initable_new_async (TYPE_DATE_TIME_MECHANISM_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.DateTimeMechanism", NULL);
2738
}
2739
2740
/**
2741
 * date_time_mechanism_proxy_new_for_bus_finish:
2742
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to date_time_mechanism_proxy_new_for_bus().
2743
 * @error: Return location for error or %NULL
2744
 *
2745
 * Finishes an operation started with date_time_mechanism_proxy_new_for_bus().
2746
 *
2747
 * Returns: (transfer full) (type DateTimeMechanismProxy): The constructed proxy object or %NULL if @error is set.
2748
 */
2749
DateTimeMechanism *
2750
date_time_mechanism_proxy_new_for_bus_finish (
2751
    GAsyncResult        *res,
2752
    GError             **error)
2753
{
2754
  GObject *ret;
2755
  GObject *source_object;
2756
  source_object = g_async_result_get_source_object (res);
2757
  ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2758
  g_object_unref (source_object);
2759
  if (ret != NULL)
2760
    return DATE_TIME_MECHANISM (ret);
2761
  else
2762
    return NULL;
2763
}
2764
2765
/**
2766
 * date_time_mechanism_proxy_new_for_bus_sync:
2767
 * @bus_type: A #GBusType.
2768
 * @flags: Flags from the #GDBusProxyFlags enumeration.
2769
 * @name: A bus name (well-known or unique).
2770
 * @object_path: An object path.
2771
 * @cancellable: (allow-none): A #GCancellable or %NULL.
2772
 * @error: Return location for error or %NULL
2773
 *
2774
 * Like date_time_mechanism_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2775
 *
2776
 * The calling thread is blocked until a reply is received.
2777
 *
2778
 * See date_time_mechanism_proxy_new_for_bus() for the asynchronous version of this constructor.
2779
 *
2780
 * Returns: (transfer full) (type DateTimeMechanismProxy): The constructed proxy object or %NULL if @error is set.
2781
 */
2782
DateTimeMechanism *
2783
date_time_mechanism_proxy_new_for_bus_sync (
2784
    GBusType             bus_type,
2785
    GDBusProxyFlags      flags,
2786
    const gchar         *name,
2787
    const gchar         *object_path,
2788
    GCancellable        *cancellable,
2789
    GError             **error)
2790
{
2791
  GInitable *ret;
2792
  ret = g_initable_new (TYPE_DATE_TIME_MECHANISM_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.DateTimeMechanism", NULL);
2793
  if (ret != NULL)
2794
    return DATE_TIME_MECHANISM (ret);
2795
  else
2796
    return NULL;
2797
}
2798
2799
2800
/* ------------------------------------------------------------------------ */
2801
2802
/**
2803
 * DateTimeMechanismSkeleton:
2804
 *
2805
 * The #DateTimeMechanismSkeleton structure contains only private data and should only be accessed using the provided API.
2806
 */
2807
2808
/**
2809
 * DateTimeMechanismSkeletonClass:
2810
 * @parent_class: The parent class.
2811
 *
2812
 * Class structure for #DateTimeMechanismSkeleton.
2813
 */
2814
2815
struct _DateTimeMechanismSkeletonPrivate
2816
{
2817
  GValueArray *properties;
2818
  GList *changed_properties;
2819
  GSource *changed_properties_idle_source;
2820
  GMainContext *context;
2821
  GMutex *lock;
2822
};
2823
2824
static void
2825
_date_time_mechanism_skeleton_handle_method_call (
2826
  GDBusConnection *connection,
2827
  const gchar *sender,
2828
  const gchar *object_path,
2829
  const gchar *interface_name,
2830
  const gchar *method_name,
2831
  GVariant *parameters,
2832
  GDBusMethodInvocation *invocation,
2833
  gpointer user_data)
2834
{
2835
  DateTimeMechanismSkeleton *skeleton = DATE_TIME_MECHANISM_SKELETON (user_data);
2836
  _ExtendedGDBusMethodInfo *info;
2837
  GVariantIter iter;
2838
  GVariant *child;
2839
  GValue *paramv;
2840
  guint num_params;
2841
  guint n;
2842
  guint signal_id;
2843
  GValue return_value = {0};
2844
  info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2845
  g_assert (info != NULL);
2846
  num_params = g_variant_n_children (parameters);
2847
  paramv = g_new0 (GValue, num_params + 2);
2848
  g_value_init (&paramv[0], TYPE_DATE_TIME_MECHANISM);
2849
  g_value_set_object (&paramv[0], skeleton);
2850
  g_value_init (&paramv[1], G_TYPE_DBUS_METHOD_INVOCATION);
2851
  g_value_set_object (&paramv[1], invocation);
2852
  g_variant_iter_init (&iter, parameters);
2853
  n = 2;
2854
  while ((child = g_variant_iter_next_value (&iter)) != NULL)
2855
    {
2856
      _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - 2];
2857
      if (arg_info->use_gvariant)
2858
        {
2859
          g_value_init (&paramv[n], G_TYPE_VARIANT);
2860
          g_value_set_variant (&paramv[n], child);
2861
          n++;
2862
        }
2863
      else
2864
        g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2865
      g_variant_unref (child);
2866
    }
2867
  signal_id = g_signal_lookup (info->signal_name, TYPE_DATE_TIME_MECHANISM);
2868
  g_value_init (&return_value, G_TYPE_BOOLEAN);
2869
  g_signal_emitv (paramv, signal_id, 0, &return_value);
2870
  if (!g_value_get_boolean (&return_value))
2871
    g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
2872
  g_value_unset (&return_value);
2873
  for (n = 0; n < num_params + 2; n++)
2874
    g_value_unset (&paramv[n]);
2875
  g_free (paramv);
2876
}
2877
2878
static GVariant *
2879
_date_time_mechanism_skeleton_handle_get_property (
2880
  GDBusConnection *connection,
2881
  const gchar *sender,
2882
  const gchar *object_path,
2883
  const gchar *interface_name,
2884
  const gchar *property_name,
2885
  GError **error,
2886
  gpointer user_data)
2887
{
2888
  DateTimeMechanismSkeleton *skeleton = DATE_TIME_MECHANISM_SKELETON (user_data);
2889
  GValue value = {0};
2890
  GParamSpec *pspec;
2891
  _ExtendedGDBusPropertyInfo *info;
2892
  GVariant *ret;
2893
  ret = NULL;
2894
  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_date_time_mechanism_interface_info, property_name);
2895
  g_assert (info != NULL);
2896
  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2897
  if (pspec == NULL)
2898
    {
2899
      g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2900
    }
2901
  else
2902
    {
2903
      g_value_init (&value, pspec->value_type);
2904
      g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2905
      ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2906
      g_value_unset (&value);
2907
    }
2908
  return ret;
2909
}
2910
2911
static gboolean
2912
_date_time_mechanism_skeleton_handle_set_property (
2913
  GDBusConnection *connection,
2914
  const gchar *sender,
2915
  const gchar *object_path,
2916
  const gchar *interface_name,
2917
  const gchar *property_name,
2918
  GVariant *variant,
2919
  GError **error,
2920
  gpointer user_data)
2921
{
2922
  DateTimeMechanismSkeleton *skeleton = DATE_TIME_MECHANISM_SKELETON (user_data);
2923
  GValue value = {0};
2924
  GParamSpec *pspec;
2925
  _ExtendedGDBusPropertyInfo *info;
2926
  gboolean ret;
2927
  ret = FALSE;
2928
  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_date_time_mechanism_interface_info, property_name);
2929
  g_assert (info != NULL);
2930
  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2931
  if (pspec == NULL)
2932
    {
2933
      g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2934
    }
2935
  else
2936
    {
2937
      if (info->use_gvariant)
2938
        g_value_set_variant (&value, variant);
2939
      else
2940
        g_dbus_gvariant_to_gvalue (variant, &value);
2941
      g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2942
      g_value_unset (&value);
2943
      ret = TRUE;
2944
    }
2945
  return ret;
2946
}
2947
2948
static const GDBusInterfaceVTable _date_time_mechanism_skeleton_vtable =
2949
{
2950
  _date_time_mechanism_skeleton_handle_method_call,
2951
  _date_time_mechanism_skeleton_handle_get_property,
2952
  _date_time_mechanism_skeleton_handle_set_property
2953
};
2954
2955
static GDBusInterfaceInfo *
2956
date_time_mechanism_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton)
2957
{
2958
  return date_time_mechanism_interface_info ();
2959
}
2960
2961
static GDBusInterfaceVTable *
2962
date_time_mechanism_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton)
2963
{
2964
  return (GDBusInterfaceVTable *) &_date_time_mechanism_skeleton_vtable;
2965
}
2966
2967
static GVariant *
2968
date_time_mechanism_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2969
{
2970
  DateTimeMechanismSkeleton *skeleton = DATE_TIME_MECHANISM_SKELETON (_skeleton);
2971
2972
  GVariantBuilder builder;
2973
  guint n;
2974
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2975
  if (_date_time_mechanism_interface_info.parent_struct.properties == NULL)
2976
    goto out;
2977
  for (n = 0; _date_time_mechanism_interface_info.parent_struct.properties[n] != NULL; n++)
2978
    {
2979
      GDBusPropertyInfo *info = _date_time_mechanism_interface_info.parent_struct.properties[n];
2980
      if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2981
        {
2982
          GVariant *value;
2983
          value = _date_time_mechanism_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.gnome.SettingsDaemon.DateTimeMechanism", info->name, NULL, skeleton);
2984
          if (value != NULL)
2985
            {
2986
              if (g_variant_is_floating (value))
2987
                g_variant_ref_sink (value);
2988
              g_variant_builder_add (&builder, "{sv}", info->name, value);
2989
              g_variant_unref (value);
2990
            }
2991
        }
2992
    }
2993
out:
2994
  return g_variant_builder_end (&builder);
2995
}
2996
2997
static void
2998
date_time_mechanism_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2999
{
3000
}
3001
3002
static void
3003
date_time_mechanism_skeleton_iface_init (DateTimeMechanismIface *iface)
3004
{
3005
}
3006
3007
#define date_time_mechanism_skeleton_get_type date_time_mechanism_skeleton_get_type
3008
G_DEFINE_TYPE_WITH_CODE (DateTimeMechanismSkeleton, date_time_mechanism_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3009
                         G_IMPLEMENT_INTERFACE (TYPE_DATE_TIME_MECHANISM, date_time_mechanism_skeleton_iface_init));
3010
#undef date_time_mechanism_skeleton_get_type
3011
3012
static void
3013
date_time_mechanism_skeleton_finalize (GObject *object)
3014
{
3015
  DateTimeMechanismSkeleton *skeleton = DATE_TIME_MECHANISM_SKELETON (object);
3016
  g_list_foreach (skeleton->priv->changed_properties, (GFunc) _changed_property_free, NULL);
3017
  g_list_free (skeleton->priv->changed_properties);
3018
  if (skeleton->priv->changed_properties_idle_source != NULL)
3019
    g_source_destroy (skeleton->priv->changed_properties_idle_source);
3020
  if (skeleton->priv->context != NULL)
3021
    g_main_context_unref (skeleton->priv->context);
3022
  g_mutex_free (skeleton->priv->lock);
3023
  G_OBJECT_CLASS (date_time_mechanism_skeleton_parent_class)->finalize (object);
3024
}
3025
3026
static void
3027
date_time_mechanism_skeleton_init (DateTimeMechanismSkeleton *skeleton)
3028
{
3029
  skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DATE_TIME_MECHANISM_SKELETON, DateTimeMechanismSkeletonPrivate);
3030
  skeleton->priv->lock = g_mutex_new ();
3031
  skeleton->priv->context = g_main_context_get_thread_default ();
3032
  if (skeleton->priv->context != NULL)
3033
    g_main_context_ref (skeleton->priv->context);
3034
}
3035
3036
static void
3037
date_time_mechanism_skeleton_class_init (DateTimeMechanismSkeletonClass *klass)
3038
{
3039
  GObjectClass *gobject_class;
3040
  GDBusInterfaceSkeletonClass *skeleton_class;
3041
3042
  g_type_class_add_private (klass, sizeof (DateTimeMechanismSkeletonPrivate));
3043
3044
  gobject_class = G_OBJECT_CLASS (klass);
3045
  gobject_class->finalize = date_time_mechanism_skeleton_finalize;
3046
3047
  skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3048
  skeleton_class->get_info = date_time_mechanism_skeleton_dbus_interface_get_info;
3049
  skeleton_class->get_properties = date_time_mechanism_skeleton_dbus_interface_get_properties;
3050
  skeleton_class->flush = date_time_mechanism_skeleton_dbus_interface_flush;
3051
  skeleton_class->get_vtable = date_time_mechanism_skeleton_dbus_interface_get_vtable;
3052
}
3053
3054
/**
3055
 * date_time_mechanism_skeleton_new:
3056
 *
3057
 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-DateTimeMechanism.top_of_page">org.gnome.SettingsDaemon.DateTimeMechanism</link>.
3058
 *
3059
 * Returns: (transfer full) (type DateTimeMechanismSkeleton): The skeleton object.
3060
 */
3061
DateTimeMechanism *
3062
date_time_mechanism_skeleton_new (void)
3063
{
3064
  return DATE_TIME_MECHANISM (g_object_new (TYPE_DATE_TIME_MECHANISM_SKELETON, NULL));
3065
}
3066
(-)a/panels/datetime/dtm.h (+475 lines)
Line 0 Link Here
1
/*
2
 * Generated by gdbus-codegen 2.29.5. DO NOT EDIT.
3
 *
4
 * The license of this code is the same as for the source it was derived from.
5
 */
6
7
#ifndef __DTM_H__
8
#define __DTM_H__
9
10
#include <gio/gio.h>
11
12
G_BEGIN_DECLS
13
14
15
/* ------------------------------------------------------------------------ */
16
/* Declarations for org.gnome.SettingsDaemon.DateTimeMechanism */
17
18
#define TYPE_DATE_TIME_MECHANISM (date_time_mechanism_get_type ())
19
#define DATE_TIME_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DATE_TIME_MECHANISM, DateTimeMechanism))
20
#define IS_DATE_TIME_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DATE_TIME_MECHANISM))
21
#define DATE_TIME_MECHANISM_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_DATE_TIME_MECHANISM, DateTimeMechanism))
22
23
struct _DateTimeMechanism;
24
typedef struct _DateTimeMechanism DateTimeMechanism;
25
typedef struct _DateTimeMechanismIface DateTimeMechanismIface;
26
27
struct _DateTimeMechanismIface
28
{
29
  GTypeInterface parent_iface;
30
31
  gboolean (*handle_adjust_time) (
32
    DateTimeMechanism *object,
33
    GDBusMethodInvocation *invocation,
34
    gint64 seconds_to_add);
35
36
  gboolean (*handle_can_set_time) (
37
    DateTimeMechanism *object,
38
    GDBusMethodInvocation *invocation);
39
40
  gboolean (*handle_can_set_timezone) (
41
    DateTimeMechanism *object,
42
    GDBusMethodInvocation *invocation);
43
44
  gboolean (*handle_can_set_using_ntp) (
45
    DateTimeMechanism *object,
46
    GDBusMethodInvocation *invocation);
47
48
  gboolean (*handle_get_hardware_clock_using_utc) (
49
    DateTimeMechanism *object,
50
    GDBusMethodInvocation *invocation);
51
52
  gboolean (*handle_get_timezone) (
53
    DateTimeMechanism *object,
54
    GDBusMethodInvocation *invocation);
55
56
  gboolean (*handle_get_using_ntp) (
57
    DateTimeMechanism *object,
58
    GDBusMethodInvocation *invocation);
59
60
  gboolean (*handle_set_date) (
61
    DateTimeMechanism *object,
62
    GDBusMethodInvocation *invocation,
63
    guint day,
64
    guint month,
65
    guint year);
66
67
  gboolean (*handle_set_hardware_clock_using_utc) (
68
    DateTimeMechanism *object,
69
    GDBusMethodInvocation *invocation,
70
    gboolean is_using_utc);
71
72
  gboolean (*handle_set_time) (
73
    DateTimeMechanism *object,
74
    GDBusMethodInvocation *invocation,
75
    gint64 seconds_since_epoch);
76
77
  gboolean (*handle_set_timezone) (
78
    DateTimeMechanism *object,
79
    GDBusMethodInvocation *invocation,
80
    const gchar *tz);
81
82
  gboolean (*handle_set_using_ntp) (
83
    DateTimeMechanism *object,
84
    GDBusMethodInvocation *invocation,
85
    gboolean is_using_ntp);
86
87
};
88
89
GType date_time_mechanism_get_type (void) G_GNUC_CONST;
90
91
GDBusInterfaceInfo *date_time_mechanism_interface_info (void);
92
93
94
/* D-Bus method call completion functions: */
95
void date_time_mechanism_complete_set_timezone (
96
    DateTimeMechanism *object,
97
    GDBusMethodInvocation *invocation);
98
99
void date_time_mechanism_complete_get_timezone (
100
    DateTimeMechanism *object,
101
    GDBusMethodInvocation *invocation,
102
    const gchar *timezone);
103
104
void date_time_mechanism_complete_can_set_timezone (
105
    DateTimeMechanism *object,
106
    GDBusMethodInvocation *invocation,
107
    gint value);
108
109
void date_time_mechanism_complete_set_date (
110
    DateTimeMechanism *object,
111
    GDBusMethodInvocation *invocation);
112
113
void date_time_mechanism_complete_set_time (
114
    DateTimeMechanism *object,
115
    GDBusMethodInvocation *invocation);
116
117
void date_time_mechanism_complete_can_set_time (
118
    DateTimeMechanism *object,
119
    GDBusMethodInvocation *invocation,
120
    gint value);
121
122
void date_time_mechanism_complete_adjust_time (
123
    DateTimeMechanism *object,
124
    GDBusMethodInvocation *invocation);
125
126
void date_time_mechanism_complete_get_hardware_clock_using_utc (
127
    DateTimeMechanism *object,
128
    GDBusMethodInvocation *invocation,
129
    gboolean is_using_utc);
130
131
void date_time_mechanism_complete_set_hardware_clock_using_utc (
132
    DateTimeMechanism *object,
133
    GDBusMethodInvocation *invocation);
134
135
void date_time_mechanism_complete_get_using_ntp (
136
    DateTimeMechanism *object,
137
    GDBusMethodInvocation *invocation,
138
    gboolean can_use_ntp,
139
    gboolean is_using_ntp);
140
141
void date_time_mechanism_complete_set_using_ntp (
142
    DateTimeMechanism *object,
143
    GDBusMethodInvocation *invocation);
144
145
void date_time_mechanism_complete_can_set_using_ntp (
146
    DateTimeMechanism *object,
147
    GDBusMethodInvocation *invocation,
148
    gint value);
149
150
151
152
/* D-Bus method calls: */
153
void date_time_mechanism_call_set_timezone (
154
    DateTimeMechanism *proxy,
155
    const gchar *tz,
156
    GCancellable *cancellable,
157
    GAsyncReadyCallback callback,
158
    gpointer user_data);
159
160
gboolean date_time_mechanism_call_set_timezone_finish (
161
    DateTimeMechanism *proxy,
162
    GAsyncResult *res,
163
    GError **error);
164
165
gboolean date_time_mechanism_call_set_timezone_sync (
166
    DateTimeMechanism *proxy,
167
    const gchar *tz,
168
    GCancellable *cancellable,
169
    GError **error);
170
171
void date_time_mechanism_call_get_timezone (
172
    DateTimeMechanism *proxy,
173
    GCancellable *cancellable,
174
    GAsyncReadyCallback callback,
175
    gpointer user_data);
176
177
gboolean date_time_mechanism_call_get_timezone_finish (
178
    DateTimeMechanism *proxy,
179
    gchar **out_timezone,
180
    GAsyncResult *res,
181
    GError **error);
182
183
gboolean date_time_mechanism_call_get_timezone_sync (
184
    DateTimeMechanism *proxy,
185
    gchar **out_timezone,
186
    GCancellable *cancellable,
187
    GError **error);
188
189
void date_time_mechanism_call_can_set_timezone (
190
    DateTimeMechanism *proxy,
191
    GCancellable *cancellable,
192
    GAsyncReadyCallback callback,
193
    gpointer user_data);
194
195
gboolean date_time_mechanism_call_can_set_timezone_finish (
196
    DateTimeMechanism *proxy,
197
    gint *out_value,
198
    GAsyncResult *res,
199
    GError **error);
200
201
gboolean date_time_mechanism_call_can_set_timezone_sync (
202
    DateTimeMechanism *proxy,
203
    gint *out_value,
204
    GCancellable *cancellable,
205
    GError **error);
206
207
void date_time_mechanism_call_set_date (
208
    DateTimeMechanism *proxy,
209
    guint day,
210
    guint month,
211
    guint year,
212
    GCancellable *cancellable,
213
    GAsyncReadyCallback callback,
214
    gpointer user_data);
215
216
gboolean date_time_mechanism_call_set_date_finish (
217
    DateTimeMechanism *proxy,
218
    GAsyncResult *res,
219
    GError **error);
220
221
gboolean date_time_mechanism_call_set_date_sync (
222
    DateTimeMechanism *proxy,
223
    guint day,
224
    guint month,
225
    guint year,
226
    GCancellable *cancellable,
227
    GError **error);
228
229
void date_time_mechanism_call_set_time (
230
    DateTimeMechanism *proxy,
231
    gint64 seconds_since_epoch,
232
    GCancellable *cancellable,
233
    GAsyncReadyCallback callback,
234
    gpointer user_data);
235
236
gboolean date_time_mechanism_call_set_time_finish (
237
    DateTimeMechanism *proxy,
238
    GAsyncResult *res,
239
    GError **error);
240
241
gboolean date_time_mechanism_call_set_time_sync (
242
    DateTimeMechanism *proxy,
243
    gint64 seconds_since_epoch,
244
    GCancellable *cancellable,
245
    GError **error);
246
247
void date_time_mechanism_call_can_set_time (
248
    DateTimeMechanism *proxy,
249
    GCancellable *cancellable,
250
    GAsyncReadyCallback callback,
251
    gpointer user_data);
252
253
gboolean date_time_mechanism_call_can_set_time_finish (
254
    DateTimeMechanism *proxy,
255
    gint *out_value,
256
    GAsyncResult *res,
257
    GError **error);
258
259
gboolean date_time_mechanism_call_can_set_time_sync (
260
    DateTimeMechanism *proxy,
261
    gint *out_value,
262
    GCancellable *cancellable,
263
    GError **error);
264
265
void date_time_mechanism_call_adjust_time (
266
    DateTimeMechanism *proxy,
267
    gint64 seconds_to_add,
268
    GCancellable *cancellable,
269
    GAsyncReadyCallback callback,
270
    gpointer user_data);
271
272
gboolean date_time_mechanism_call_adjust_time_finish (
273
    DateTimeMechanism *proxy,
274
    GAsyncResult *res,
275
    GError **error);
276
277
gboolean date_time_mechanism_call_adjust_time_sync (
278
    DateTimeMechanism *proxy,
279
    gint64 seconds_to_add,
280
    GCancellable *cancellable,
281
    GError **error);
282
283
void date_time_mechanism_call_get_hardware_clock_using_utc (
284
    DateTimeMechanism *proxy,
285
    GCancellable *cancellable,
286
    GAsyncReadyCallback callback,
287
    gpointer user_data);
288
289
gboolean date_time_mechanism_call_get_hardware_clock_using_utc_finish (
290
    DateTimeMechanism *proxy,
291
    gboolean *out_is_using_utc,
292
    GAsyncResult *res,
293
    GError **error);
294
295
gboolean date_time_mechanism_call_get_hardware_clock_using_utc_sync (
296
    DateTimeMechanism *proxy,
297
    gboolean *out_is_using_utc,
298
    GCancellable *cancellable,
299
    GError **error);
300
301
void date_time_mechanism_call_set_hardware_clock_using_utc (
302
    DateTimeMechanism *proxy,
303
    gboolean is_using_utc,
304
    GCancellable *cancellable,
305
    GAsyncReadyCallback callback,
306
    gpointer user_data);
307
308
gboolean date_time_mechanism_call_set_hardware_clock_using_utc_finish (
309
    DateTimeMechanism *proxy,
310
    GAsyncResult *res,
311
    GError **error);
312
313
gboolean date_time_mechanism_call_set_hardware_clock_using_utc_sync (
314
    DateTimeMechanism *proxy,
315
    gboolean is_using_utc,
316
    GCancellable *cancellable,
317
    GError **error);
318
319
void date_time_mechanism_call_get_using_ntp (
320
    DateTimeMechanism *proxy,
321
    GCancellable *cancellable,
322
    GAsyncReadyCallback callback,
323
    gpointer user_data);
324
325
gboolean date_time_mechanism_call_get_using_ntp_finish (
326
    DateTimeMechanism *proxy,
327
    gboolean *out_can_use_ntp,
328
    gboolean *out_is_using_ntp,
329
    GAsyncResult *res,
330
    GError **error);
331
332
gboolean date_time_mechanism_call_get_using_ntp_sync (
333
    DateTimeMechanism *proxy,
334
    gboolean *out_can_use_ntp,
335
    gboolean *out_is_using_ntp,
336
    GCancellable *cancellable,
337
    GError **error);
338
339
void date_time_mechanism_call_set_using_ntp (
340
    DateTimeMechanism *proxy,
341
    gboolean is_using_ntp,
342
    GCancellable *cancellable,
343
    GAsyncReadyCallback callback,
344
    gpointer user_data);
345
346
gboolean date_time_mechanism_call_set_using_ntp_finish (
347
    DateTimeMechanism *proxy,
348
    GAsyncResult *res,
349
    GError **error);
350
351
gboolean date_time_mechanism_call_set_using_ntp_sync (
352
    DateTimeMechanism *proxy,
353
    gboolean is_using_ntp,
354
    GCancellable *cancellable,
355
    GError **error);
356
357
void date_time_mechanism_call_can_set_using_ntp (
358
    DateTimeMechanism *proxy,
359
    GCancellable *cancellable,
360
    GAsyncReadyCallback callback,
361
    gpointer user_data);
362
363
gboolean date_time_mechanism_call_can_set_using_ntp_finish (
364
    DateTimeMechanism *proxy,
365
    gint *out_value,
366
    GAsyncResult *res,
367
    GError **error);
368
369
gboolean date_time_mechanism_call_can_set_using_ntp_sync (
370
    DateTimeMechanism *proxy,
371
    gint *out_value,
372
    GCancellable *cancellable,
373
    GError **error);
374
375
376
377
/* ---- */
378
379
#define TYPE_DATE_TIME_MECHANISM_PROXY (date_time_mechanism_proxy_get_type ())
380
#define DATE_TIME_MECHANISM_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DATE_TIME_MECHANISM_PROXY, DateTimeMechanismProxy))
381
#define DATE_TIME_MECHANISM_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DATE_TIME_MECHANISM_PROXY, DateTimeMechanismProxyClass))
382
#define DATE_TIME_MECHANISM_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DATE_TIME_MECHANISM_PROXY, DateTimeMechanismProxyClass))
383
#define IS_DATE_TIME_MECHANISM_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DATE_TIME_MECHANISM_PROXY))
384
#define IS_DATE_TIME_MECHANISM_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DATE_TIME_MECHANISM_PROXY))
385
386
typedef struct _DateTimeMechanismProxy DateTimeMechanismProxy;
387
typedef struct _DateTimeMechanismProxyClass DateTimeMechanismProxyClass;
388
typedef struct _DateTimeMechanismProxyPrivate DateTimeMechanismProxyPrivate;
389
390
struct _DateTimeMechanismProxy
391
{
392
  /*< private >*/
393
  GDBusProxy parent_instance;
394
  DateTimeMechanismProxyPrivate *priv;
395
};
396
397
struct _DateTimeMechanismProxyClass
398
{
399
  GDBusProxyClass parent_class;
400
};
401
402
GType date_time_mechanism_proxy_get_type (void) G_GNUC_CONST;
403
404
void date_time_mechanism_proxy_new (
405
    GDBusConnection     *connection,
406
    GDBusProxyFlags      flags,
407
    const gchar         *name,
408
    const gchar         *object_path,
409
    GCancellable        *cancellable,
410
    GAsyncReadyCallback  callback,
411
    gpointer             user_data);
412
DateTimeMechanism *date_time_mechanism_proxy_new_finish (
413
    GAsyncResult        *res,
414
    GError             **error);
415
DateTimeMechanism *date_time_mechanism_proxy_new_sync (
416
    GDBusConnection     *connection,
417
    GDBusProxyFlags      flags,
418
    const gchar         *name,
419
    const gchar         *object_path,
420
    GCancellable        *cancellable,
421
    GError             **error);
422
423
void date_time_mechanism_proxy_new_for_bus (
424
    GBusType             bus_type,
425
    GDBusProxyFlags      flags,
426
    const gchar         *name,
427
    const gchar         *object_path,
428
    GCancellable        *cancellable,
429
    GAsyncReadyCallback  callback,
430
    gpointer             user_data);
431
DateTimeMechanism *date_time_mechanism_proxy_new_for_bus_finish (
432
    GAsyncResult        *res,
433
    GError             **error);
434
DateTimeMechanism *date_time_mechanism_proxy_new_for_bus_sync (
435
    GBusType             bus_type,
436
    GDBusProxyFlags      flags,
437
    const gchar         *name,
438
    const gchar         *object_path,
439
    GCancellable        *cancellable,
440
    GError             **error);
441
442
443
/* ---- */
444
445
#define TYPE_DATE_TIME_MECHANISM_SKELETON (date_time_mechanism_skeleton_get_type ())
446
#define DATE_TIME_MECHANISM_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DATE_TIME_MECHANISM_SKELETON, DateTimeMechanismSkeleton))
447
#define DATE_TIME_MECHANISM_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DATE_TIME_MECHANISM_SKELETON, DateTimeMechanismSkeletonClass))
448
#define DATE_TIME_MECHANISM_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DATE_TIME_MECHANISM_SKELETON, DateTimeMechanismSkeletonClass))
449
#define IS_DATE_TIME_MECHANISM_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DATE_TIME_MECHANISM_SKELETON))
450
#define IS_DATE_TIME_MECHANISM_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DATE_TIME_MECHANISM_SKELETON))
451
452
typedef struct _DateTimeMechanismSkeleton DateTimeMechanismSkeleton;
453
typedef struct _DateTimeMechanismSkeletonClass DateTimeMechanismSkeletonClass;
454
typedef struct _DateTimeMechanismSkeletonPrivate DateTimeMechanismSkeletonPrivate;
455
456
struct _DateTimeMechanismSkeleton
457
{
458
  /*< private >*/
459
  GDBusInterfaceSkeleton parent_instance;
460
  DateTimeMechanismSkeletonPrivate *priv;
461
};
462
463
struct _DateTimeMechanismSkeletonClass
464
{
465
  GDBusInterfaceSkeletonClass parent_class;
466
};
467
468
GType date_time_mechanism_skeleton_get_type (void) G_GNUC_CONST;
469
470
DateTimeMechanism *date_time_mechanism_skeleton_new (void);
471
472
473
G_END_DECLS
474
475
#endif /* __DTM_H__ */
(-)a/panels/datetime/org.gnome.controlcenter.datetime.policy.in (-21 lines)
Lines 1-21 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE policyconfig PUBLIC
3
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
4
 "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
5
6
<policyconfig>
7
  <vendor>The GNOME Project</vendor>
8
  <vendor_url>http://www.gnome.org/</vendor_url>
9
10
  <action id="org.gnome.controlcenter.datetime.configure">
11
    <_description>Change system time and date settings</_description>
12
    <_message>To change time or date settings, you need to authenticate.</_message>
13
    <defaults>
14
      <allow_any>no</allow_any>
15
      <allow_inactive>no</allow_inactive>
16
      <allow_active>auth_admin_keep</allow_active>
17
    </defaults>
18
    <annotate key="org.freedesktop.policykit.imply">org.freedesktop.timedate1.set-time org.freedesktop.timedate1.set-timezone org.freedesktop.timedate1.set-local-rtc org.freedesktop.timedate1.set-ntp</annotate>
19
  </action>
20
21
</policyconfig>
(-)a/panels/datetime/set-timezone.c (+479 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
 *
3
 * Copyright (C) 2007 David Zeuthen <david@fubar.dk>
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 *
19
 */
20
21
#ifdef HAVE_CONFIG_H
22
#  include "config.h"
23
#endif
24
25
#include <stdlib.h>
26
#include <stdio.h>
27
#include <fcntl.h>
28
#include <unistd.h>
29
#include <string.h>
30
#include <sys/wait.h>
31
32
#include <dbus/dbus-glib.h>
33
#include <dbus/dbus-glib-lowlevel.h>
34
35
#include "set-timezone.h"
36
37
38
static DBusGConnection *
39
get_system_bus (GError **err)
40
{
41
        GError          *error;
42
        static DBusGConnection *bus = NULL;
43
44
	if (bus == NULL) {
45
        	error = NULL;
46
        	bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
47
        	if (bus == NULL) {
48
			g_propagate_error (err, error);
49
		}
50
        }
51
52
        return bus;
53
}
54
55
#define CACHE_VALIDITY_SEC 2
56
57
typedef  void (*CanDoFunc) (gint value);
58
59
static void
60
notify_can_do (DBusGProxy     *proxy,
61
	       DBusGProxyCall *call,
62
	       void           *user_data)
63
{
64
	CanDoFunc callback = user_data;
65
	GError *error = NULL;
66
	gint value;
67
68
	if (dbus_g_proxy_end_call (proxy, call,
69
				   &error,
70
				   G_TYPE_INT, &value,
71
				   G_TYPE_INVALID)) {
72
		callback (value);
73
	}
74
}
75
76
static void
77
refresh_can_do (const gchar *action, CanDoFunc callback)
78
{
79
        DBusGConnection *bus;
80
        DBusGProxy      *proxy;
81
82
        bus = get_system_bus (NULL);
83
        if (bus == NULL)
84
                return;
85
86
	proxy = dbus_g_proxy_new_for_name (bus,
87
					   "org.gnome.SettingsDaemon.DateTimeMechanism",
88
					   "/",
89
					   "org.gnome.SettingsDaemon.DateTimeMechanism");
90
91
	dbus_g_proxy_begin_call_with_timeout (proxy,
92
					      action,
93
					      notify_can_do,
94
					      callback, NULL,
95
					      INT_MAX,
96
					      G_TYPE_INVALID);
97
}
98
99
static gint   settimezone_cache = 0;
100
static time_t settimezone_stamp = 0;
101
102
static void
103
update_can_settimezone (gint res)
104
{
105
	settimezone_cache = res;
106
	time (&settimezone_stamp);
107
}
108
109
gint
110
can_set_system_timezone (void)
111
{
112
	time_t          now;
113
114
	time (&now);
115
	if (ABS (now - settimezone_stamp) > CACHE_VALIDITY_SEC) {
116
		refresh_can_do ("CanSetTimezone", update_can_settimezone);
117
		settimezone_stamp = now;
118
	}
119
120
	return settimezone_cache;
121
}
122
123
static gint   settime_cache = 0;
124
static time_t settime_stamp = 0;
125
126
static void
127
update_can_settime (gint res)
128
{
129
	settime_cache = res;
130
	time (&settime_stamp);
131
}
132
133
gint
134
can_set_system_time (void)
135
{
136
	time_t now;
137
138
	time (&now);
139
	if (ABS (now - settime_stamp) > CACHE_VALIDITY_SEC) {
140
		refresh_can_do ("CanSetTime", update_can_settime);
141
		settime_stamp = now;
142
	}
143
144
	return settime_cache;
145
}
146
147
static gint   usingntp_cache = 0;
148
static time_t usingntp_stamp = 0;
149
150
static void
151
update_can_usingntp (gint res)
152
{
153
	usingntp_cache = res;
154
	time (&usingntp_stamp);
155
}
156
157
gint
158
can_set_using_ntp (void)
159
{
160
	time_t now;
161
162
	time (&now);
163
	if (ABS (now - usingntp_stamp) > CACHE_VALIDITY_SEC) {
164
		refresh_can_do ("CanSetUsingNtp", update_can_usingntp);
165
		settime_stamp = now;
166
	}
167
168
	return usingntp_cache;
169
}
170
171
typedef struct {
172
	gint ref_count;
173
        gchar *call;
174
	gint64 time;
175
	gchar *tz;
176
	gboolean using_ntp;
177
	GFunc callback;
178
	gpointer data;
179
	GDestroyNotify notify;
180
} SetTimeCallbackData;
181
182
static void
183
free_data (gpointer d)
184
{
185
	SetTimeCallbackData *data = d;
186
187
	data->ref_count--;
188
	if (data->ref_count == 0) {
189
		if (data->notify)
190
			data->notify (data->data);
191
		g_free (data->tz);
192
		g_free (data);
193
	}
194
}
195
196
static void
197
set_time_notify (DBusGProxy     *proxy,
198
		 DBusGProxyCall *call,
199
		 void           *user_data)
200
{
201
	SetTimeCallbackData *data = user_data;
202
	GError *error = NULL;
203
204
	if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID)) {
205
		if (data->callback)
206
			data->callback (data->data, NULL);
207
	}
208
	else {
209
		if (error->domain == DBUS_GERROR &&
210
		    error->code == DBUS_GERROR_NO_REPLY) {
211
			/* these errors happen because dbus doesn't
212
			 * use monotonic clocks
213
			 */	
214
			g_warning ("ignoring no-reply error when setting time");
215
			g_error_free (error);
216
			if (data->callback)
217
				data->callback (data->data, NULL);
218
		}
219
		else {
220
			if (data->callback)
221
				data->callback (data->data, error);
222
			else
223
				g_error_free (error);
224
		}		
225
	}
226
}
227
228
static void
229
set_time_async (SetTimeCallbackData *data)
230
{
231
        DBusGConnection *bus;
232
        DBusGProxy      *proxy;
233
	GError          *err = NULL;
234
235
        bus = get_system_bus (&err);
236
        if (bus == NULL) {
237
		if (err) {
238
			if (data->callback)
239
				data->callback (data->data, err);
240
			g_clear_error (&err);
241
		}
242
		return;
243
	}
244
245
	proxy = dbus_g_proxy_new_for_name (bus,
246
					   "org.gnome.SettingsDaemon.DateTimeMechanism",
247
					   "/",
248
					   "org.gnome.SettingsDaemon.DateTimeMechanism");
249
250
	data->ref_count++;
251
	if (strcmp (data->call, "SetTime") == 0)
252
		dbus_g_proxy_begin_call_with_timeout (proxy,
253
						      "SetTime",
254
						      set_time_notify,
255
						      data, free_data,
256
						      INT_MAX,
257
						      /* parameters: */
258
						      G_TYPE_INT64, data->time,
259
						      G_TYPE_INVALID,
260
						      /* return values: */
261
						      G_TYPE_INVALID);
262
	else if (strcmp (data->call, "SetTimezone") == 0)
263
		dbus_g_proxy_begin_call_with_timeout (proxy,
264
						      "SetTimezone",
265
						      set_time_notify,
266
						      data, free_data,
267
						      INT_MAX,
268
						      /* parameters: */
269
						      G_TYPE_STRING, data->tz,
270
						      G_TYPE_INVALID,
271
						      /* return values: */
272
						      G_TYPE_INVALID);
273
	else if (strcmp (data->call, "SetUsingNtp") == 0)
274
		dbus_g_proxy_begin_call_with_timeout (proxy,
275
						      "SetUsingNtp",
276
						      set_time_notify,
277
						      data, free_data,
278
						      INT_MAX,
279
						      /* parameters: */
280
						      G_TYPE_BOOLEAN, data->using_ntp,
281
						      G_TYPE_INVALID,
282
						      /* return values: */
283
						      G_TYPE_INVALID);
284
}
285
286
void
287
set_system_time_async (gint64         time,
288
		       GFunc          callback,
289
		       gpointer       d,
290
		       GDestroyNotify notify)
291
{
292
	SetTimeCallbackData *data;
293
294
	if (time == -1)
295
		return;
296
297
	data = g_new0 (SetTimeCallbackData, 1);
298
	data->ref_count = 1;
299
	data->call = "SetTime";
300
	data->time = time;
301
	data->tz = NULL;
302
	data->callback = callback;
303
	data->data = d;
304
	data->notify = notify;
305
306
	set_time_async (data);
307
	free_data (data);
308
}
309
310
void
311
set_system_timezone_async (const gchar    *tz,
312
			   GFunc           callback,
313
			   gpointer        d,
314
			   GDestroyNotify  notify)
315
{
316
	SetTimeCallbackData *data;
317
318
	g_return_if_fail (tz != NULL);
319
320
	data = g_new0 (SetTimeCallbackData, 1);
321
	data->ref_count = 1;
322
	data->call = "SetTimezone";
323
	data->time = -1;
324
	data->tz = g_strdup (tz);
325
	data->callback = callback;
326
	data->data = d;
327
	data->notify = notify;
328
329
	set_time_async (data);
330
	free_data (data);
331
}
332
333
/* get timezone */
334
335
typedef struct
336
{
337
  GetTimezoneFunc callback;
338
  GDestroyNotify notify;
339
340
  gpointer data;
341
342
} GetTimezoneData;
343
344
static void
345
get_timezone_destroy_notify (GetTimezoneData *data)
346
{
347
	if (data->notify && data->data)
348
		data->notify (data);
349
350
	g_free (data);
351
}
352
353
static void
354
get_timezone_notify (DBusGProxy     *proxy,
355
		     DBusGProxyCall *call,
356
		     void           *user_data)
357
{
358
	GError *error = NULL;
359
	gboolean retval;
360
	gchar *string = NULL;
361
	GetTimezoneData *data = user_data;
362
363
	retval = dbus_g_proxy_end_call (proxy, call, &error,
364
					G_TYPE_STRING, &string,
365
					G_TYPE_INVALID);
366
367
	if (data->callback) {
368
		if (!retval) {
369
			data->callback (data->data, NULL, error);
370
			g_error_free (error);
371
		}
372
		else {
373
			data->callback (data->data, string, NULL);
374
			g_free (string);
375
		}
376
	}
377
}
378
379
void
380
get_system_timezone_async (GetTimezoneFunc callback,
381
			   gpointer        user_data,
382
			   GDestroyNotify  notify)
383
{
384
	DBusGConnection *bus;
385
	DBusGProxy      *proxy;
386
	GetTimezoneData *data;
387
	GError          *error = NULL;
388
389
	bus = get_system_bus (&error);
390
	if (bus == NULL) {
391
		if (error) {
392
			if (callback)
393
				callback (user_data, NULL, error);
394
			g_clear_error (&error);
395
		}
396
		return;
397
398
        }
399
400
	data = g_new0 (GetTimezoneData, 1);
401
	data->data = user_data;
402
	data->notify = notify;
403
	data->callback = callback;
404
405
	proxy = dbus_g_proxy_new_for_name (bus,
406
					   "org.gnome.SettingsDaemon.DateTimeMechanism",
407
					   "/",
408
					   "org.gnome.SettingsDaemon.DateTimeMechanism");
409
410
	dbus_g_proxy_begin_call (proxy,
411
				 "GetTimezone",
412
				 get_timezone_notify,
413
				 data,
414
				 (GDestroyNotify) get_timezone_destroy_notify,
415
				 /* parameters: */
416
				 G_TYPE_INVALID,
417
				 /* return values: */
418
				 G_TYPE_STRING,
419
				 G_TYPE_INVALID);
420
421
}
422
423
gboolean
424
get_using_ntp (void)
425
{
426
	static gboolean is_using_cache = FALSE;
427
	static time_t   last_refreshed = 0;
428
	time_t          now;
429
        DBusGConnection *bus;
430
        DBusGProxy      *proxy;
431
432
	time (&now);
433
	if (ABS (now - last_refreshed) > CACHE_VALIDITY_SEC) {
434
		gboolean cu, iu;
435
		bus = get_system_bus (NULL);
436
		if (bus == NULL)
437
			return FALSE;
438
439
		proxy = dbus_g_proxy_new_for_name (bus,
440
						   "org.gnome.SettingsDaemon.DateTimeMechanism",
441
						   "/",
442
						   "org.gnome.SettingsDaemon.DateTimeMechanism");
443
444
445
		if (dbus_g_proxy_call (proxy,
446
				       "GetUsingNtp",
447
				       NULL,
448
				       G_TYPE_INVALID,
449
				       G_TYPE_BOOLEAN, &cu,
450
				       G_TYPE_BOOLEAN, &iu,
451
				       G_TYPE_INVALID)) {
452
			is_using_cache = iu;
453
			last_refreshed = now;
454
		}
455
	}
456
457
	return is_using_cache;
458
}
459
460
void
461
set_using_ntp_async (gboolean        using_ntp,
462
	             GFunc           callback,
463
	             gpointer        d,
464
	             GDestroyNotify  notify)
465
{
466
	SetTimeCallbackData *data;
467
468
	data = g_new0 (SetTimeCallbackData, 1);
469
	data->ref_count = 1;
470
	data->call = "SetUsingNtp";
471
	data->time = -1;
472
	data->using_ntp = using_ntp;
473
	data->callback = callback;
474
	data->data = d;
475
	data->notify = notify;
476
477
	set_time_async (data);
478
	free_data (data);
479
}
(-)a/panels/datetime/set-timezone.h (+57 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
 *
3
 * Copyright (C) 2007 David Zeuthen <david@fubar.dk>
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 *
19
 */
20
21
#ifndef __SET_SYSTEM_TIMEZONE_H__
22
23
#include <config.h>
24
25
#include <glib.h>
26
#include <time.h>
27
28
typedef void (*GetTimezoneFunc) (gpointer     data,
29
                                 const gchar *timezone,
30
                                 GError      *error);
31
void     get_system_timezone_async   (GetTimezoneFunc callback,
32
                                      gpointer        data,
33
                                      GDestroyNotify  notify);
34
35
gint     can_set_system_timezone (void);
36
37
gint     can_set_system_time     (void);
38
39
gint     can_set_using_ntp       (void);
40
41
void     set_system_time_async   (gint64         time,
42
                                  GFunc          callback,
43
                                  gpointer       data,
44
                                  GDestroyNotify notify);
45
46
void     set_system_timezone_async   (const gchar    *tz,
47
                                      GFunc           callback,
48
                                      gpointer        data,
49
                                      GDestroyNotify  notify);
50
51
gboolean get_using_ntp               (void);
52
53
void     set_using_ntp_async         (gboolean        using_ntp,
54
                                      GFunc           callback,
55
                                      gpointer        data,
56
                                      GDestroyNotify  notify);
57
#endif
(-)a/panels/datetime/timedated1-interface.xml (-27 lines)
Lines 1-27 Link Here
1
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
2
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
3
<node>
4
 <interface name="org.freedesktop.timedate1">
5
  <property name="Timezone" type="s" access="read"/>
6
  <property name="LocalRTC" type="b" access="read"/>
7
  <property name="NTP" type="b" access="read"/>
8
  <method name="SetTime">
9
   <arg name="usec_utc" type="x" direction="in"/>
10
   <arg name="relative" type="b" direction="in"/>
11
   <arg name="user_interaction" type="b" direction="in"/>
12
  </method>
13
  <method name="SetTimezone">
14
   <arg name="timezone" type="s" direction="in"/>
15
   <arg name="user_interaction" type="b" direction="in"/>
16
  </method>
17
  <method name="SetLocalRTC">
18
   <arg name="local_rtc" type="b" direction="in"/>
19
   <arg name="fix_system" type="b" direction="in"/>
20
   <arg name="user_interaction" type="b" direction="in"/>
21
  </method>
22
  <method name="SetNTP">
23
   <arg name="use_ntp" type="b" direction="in"/>
24
   <arg name="user_interaction" type="b" direction="in"/>
25
  </method>
26
 </interface>
27
</node>
(-)a/po/POTFILES.in (-2 lines)
Lines 18-24 panels/common/gdm-languages.c Link Here
18
[type: gettext/glade]panels/common/language-chooser.ui
18
[type: gettext/glade]panels/common/language-chooser.ui
19
[type: gettext/glade]panels/datetime/datetime.ui
19
[type: gettext/glade]panels/datetime/datetime.ui
20
panels/datetime/gnome-datetime-panel.desktop.in.in
20
panels/datetime/gnome-datetime-panel.desktop.in.in
21
panels/datetime/org.gnome.controlcenter.datetime.policy.in
22
panels/display/cc-display-panel.c
21
panels/display/cc-display-panel.c
23
[type: gettext/glade]panels/display/display-capplet.ui
22
[type: gettext/glade]panels/display/display-capplet.ui
24
panels/display/gnome-display-panel.desktop.in.in
23
panels/display/gnome-display-panel.desktop.in.in
25
- 

Return to bug 796055