aboutsummaryrefslogtreecommitdiff
path: root/libmap
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-02-22 11:22:17 -0500
committerMichael Terry <mike@mterry.name>2011-02-22 11:22:17 -0500
commit9265799709d7c1090ffef4082f4485c0d9a5c363 (patch)
treec2adad7a35e42cc1314d9717dc1b56f6ba93b68e /libmap
parent45b1165f77cab0ac8dc40ce7d605e32c697fb22d (diff)
downloadayatana-indicator-datetime-9265799709d7c1090ffef4082f4485c0d9a5c363.tar.gz
ayatana-indicator-datetime-9265799709d7c1090ffef4082f4485c0d9a5c363.tar.bz2
ayatana-indicator-datetime-9265799709d7c1090ffef4082f4485c0d9a5c363.zip
drop some unused code from libmap
Diffstat (limited to 'libmap')
-rw-r--r--libmap/datetime-module.c46
-rw-r--r--libmap/dt-lockbutton.c627
-rw-r--r--libmap/dt-lockbutton.h68
-rw-r--r--libmap/set-timezone.c481
-rw-r--r--libmap/set-timezone.h57
5 files changed, 0 insertions, 1279 deletions
diff --git a/libmap/datetime-module.c b/libmap/datetime-module.c
deleted file mode 100644
index 8217dc3..0000000
--- a/libmap/datetime-module.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2010 Intel, Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Author: Thomas Wood <thomas.wood@intel.com>
- *
- */
-
-#include <config.h>
-
-#include "cc-datetime-panel.h"
-
-#include <glib/gi18n-lib.h>
-
-#define GETTEXT_PACKAGE_TIMEZONES GETTEXT_PACKAGE "-timezones"
-
-void
-g_io_module_load (GIOModule *module)
-{
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- bindtextdomain (GETTEXT_PACKAGE_TIMEZONES, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE_TIMEZONES, "UTF-8");
-
- /* register the panel */
- cc_date_time_panel_register (module);
-}
-
-void
-g_io_module_unload (GIOModule *module)
-{
-}
diff --git a/libmap/dt-lockbutton.c b/libmap/dt-lockbutton.c
deleted file mode 100644
index ecf4c12..0000000
--- a/libmap/dt-lockbutton.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- * Copyright (C) 2010 Red Hat, Inc.
- * Author: Matthias Clasen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include "dt-lockbutton.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#define P_(s) s
-
-struct _DtLockButtonPrivate
-{
- GPermission *permission;
-
- gchar *text_lock;
- gchar *text_unlock;
- gchar *text_not_authorized;
-
- gchar *tooltip_lock;
- gchar *tooltip_unlock;
- gchar *tooltip_not_authorized;
-
- GtkWidget *box;
- GtkWidget *eventbox;
- GtkWidget *image;
- GtkWidget *button;
- GtkWidget *notebook;
-
- GtkWidget *label_lock;
- GtkWidget *label_unlock;
- GtkWidget *label_not_authorized;
-
- GCancellable *cancellable;
-
- gboolean constructed;
-};
-
-enum
-{
- PROP_0,
- PROP_PERMISSION,
- PROP_TEXT_LOCK,
- PROP_TEXT_UNLOCK,
- PROP_TEXT_NOT_AUTHORIZED,
- PROP_TOOLTIP_LOCK,
- PROP_TOOLTIP_UNLOCK,
- PROP_TOOLTIP_NOT_AUTHORIZED
-};
-
-static void update_state (DtLockButton *button);
-
-static void on_permission_changed (GPermission *permission,
- GParamSpec *pspec,
- gpointer user_data);
-
-static void on_clicked (GtkButton *button,
- gpointer user_data);
-
-static void on_button_press (GtkWidget *widget,
- GdkEventButton *event,
- gpointer user_data);
-
-G_DEFINE_TYPE (DtLockButton, dt_lock_button, GTK_TYPE_BIN);
-
-static void
-dt_lock_button_finalize (GObject *object)
-{
- DtLockButton *button = DT_LOCK_BUTTON (object);
- DtLockButtonPrivate *priv = button->priv;
-
- g_free (priv->text_lock);
- g_free (priv->text_unlock);
- g_free (priv->text_not_authorized);
-
- g_free (priv->tooltip_lock);
- g_free (priv->tooltip_unlock);
- g_free (priv->tooltip_not_authorized);
-
- if (priv->cancellable != NULL)
- {
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
- }
-
- g_signal_handlers_disconnect_by_func (priv->permission,
- on_permission_changed,
- button);
-
- g_object_unref (priv->permission);
-
- G_OBJECT_CLASS (dt_lock_button_parent_class)->finalize (object);
-}
-
-static void
-dt_lock_button_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- DtLockButton *button = DT_LOCK_BUTTON (object);
- DtLockButtonPrivate *priv = button->priv;
-
- switch (property_id)
- {
- case PROP_PERMISSION:
- g_value_set_object (value, priv->permission);
- break;
-
- case PROP_TEXT_LOCK:
- g_value_set_string (value, priv->text_lock);
- break;
-
- case PROP_TEXT_UNLOCK:
- g_value_set_string (value, priv->text_unlock);
- break;
-
- case PROP_TEXT_NOT_AUTHORIZED:
- g_value_set_string (value, priv->text_not_authorized);
- break;
-
- case PROP_TOOLTIP_LOCK:
- g_value_set_string (value, priv->tooltip_lock);
- break;
-
- case PROP_TOOLTIP_UNLOCK:
- g_value_set_string (value, priv->tooltip_unlock);
- break;
-
- case PROP_TOOLTIP_NOT_AUTHORIZED:
- g_value_set_string (value, priv->tooltip_not_authorized);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-dt_lock_button_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- DtLockButton *button = DT_LOCK_BUTTON (object);
- DtLockButtonPrivate *priv = button->priv;
-
- switch (property_id)
- {
- case PROP_PERMISSION:
- priv->permission = g_value_get_object (value);
- break;
-
- case PROP_TEXT_LOCK:
- g_free (priv->text_lock);
- priv->text_lock = g_value_dup_string (value);
- break;
-
- case PROP_TEXT_UNLOCK:
- g_free (priv->text_unlock);
- priv->text_unlock = g_value_dup_string (value);
- break;
-
- case PROP_TEXT_NOT_AUTHORIZED:
- g_free (priv->text_not_authorized);
- priv->text_not_authorized = g_value_dup_string (value);
- break;
-
- case PROP_TOOLTIP_LOCK:
- g_free (priv->tooltip_lock);
- priv->tooltip_lock = g_value_dup_string (value);
- break;
-
- case PROP_TOOLTIP_UNLOCK:
- g_free (priv->tooltip_unlock);
- priv->tooltip_unlock = g_value_dup_string (value);
- break;
-
- case PROP_TOOLTIP_NOT_AUTHORIZED:
- g_free (priv->tooltip_not_authorized);
- priv->tooltip_not_authorized = g_value_dup_string (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-
- if (priv->constructed)
- update_state (button);
-}
-
-static void
-dt_lock_button_init (DtLockButton *button)
-{
- button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button,
- DT_TYPE_LOCK_BUTTON,
- DtLockButtonPrivate);
-}
-
-static void
-dt_lock_button_constructed (GObject *object)
-{
- DtLockButton *button = DT_LOCK_BUTTON (object);
- DtLockButtonPrivate *priv = button->priv;
-
- priv->constructed = TRUE;
-
- g_signal_connect (priv->permission, "notify",
- G_CALLBACK (on_permission_changed), button);
-
- priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_container_add (GTK_CONTAINER (button), priv->box);
-
- priv->eventbox = gtk_event_box_new ();
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->eventbox), FALSE);
- gtk_container_add (GTK_CONTAINER (priv->box), priv->eventbox);
- gtk_widget_show (priv->eventbox);
-
- priv->image = gtk_image_new (); /* image is set in update_state() */
- gtk_container_add (GTK_CONTAINER (priv->eventbox), priv->image);
- gtk_widget_show (priv->image);
-
- priv->notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_widget_show (priv->notebook);
-
- priv->button = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (priv->button), priv->notebook);
- gtk_widget_show (priv->button);
-
- priv->label_lock = gtk_label_new (""); /* text is set in update_state */
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->label_lock, NULL);
- gtk_widget_show (priv->label_lock);
-
- priv->label_unlock = gtk_label_new ("");
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->label_unlock, NULL);
- gtk_widget_show (priv->label_unlock);
-
- priv->label_not_authorized = gtk_label_new ("");
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->label_not_authorized, NULL);
- gtk_widget_show (priv->label_not_authorized);
-
- gtk_box_pack_start (GTK_BOX (priv->box), priv->button, FALSE, FALSE, 0);
- gtk_widget_show (priv->button);
-
- g_signal_connect (priv->eventbox, "button-press-event",
- G_CALLBACK (on_button_press), button);
- g_signal_connect (priv->button, "clicked",
- G_CALLBACK (on_clicked), button);
-
- gtk_widget_set_no_show_all (priv->box, TRUE);
-
- update_state (button);
-
- if (G_OBJECT_CLASS (dt_lock_button_parent_class)->constructed != NULL)
- G_OBJECT_CLASS (dt_lock_button_parent_class)->constructed (object);
-}
-
-static void
-dt_lock_button_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- DtLockButtonPrivate *priv = DT_LOCK_BUTTON (widget)->priv;
-
- gtk_widget_get_preferred_width (priv->box, minimum, natural);
-}
-
-static void
-dt_lock_button_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- DtLockButtonPrivate *priv = DT_LOCK_BUTTON (widget)->priv;
-
- gtk_widget_get_preferred_height (priv->box, minimum, natural);
-}
-
-static void
-dt_lock_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- DtLockButtonPrivate *priv = DT_LOCK_BUTTON (widget)->priv;
- GtkRequisition requisition;
- GtkAllocation child_allocation;
-
- gtk_widget_set_allocation (widget, allocation);
- gtk_widget_get_preferred_size (priv->box, &requisition, NULL);
- child_allocation.x = allocation->x;
- child_allocation.y = allocation->y;
- child_allocation.width = requisition.width;
- child_allocation.height = requisition.height;
- gtk_widget_size_allocate (priv->box, &child_allocation);
-}
-
-static void
-dt_lock_button_class_init (DtLockButtonClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- gobject_class->finalize = dt_lock_button_finalize;
- gobject_class->get_property = dt_lock_button_get_property;
- gobject_class->set_property = dt_lock_button_set_property;
- gobject_class->constructed = dt_lock_button_constructed;
-
- widget_class->get_preferred_width = dt_lock_button_get_preferred_width;
- widget_class->get_preferred_height = dt_lock_button_get_preferred_height;
- widget_class->size_allocate = dt_lock_button_size_allocate;
-
- g_type_class_add_private (klass, sizeof (DtLockButtonPrivate));
-
- g_object_class_install_property (gobject_class, PROP_PERMISSION,
- g_param_spec_object ("permission",
- P_("Permission"),
- P_("The GPermission object controlling this button"),
- G_TYPE_PERMISSION,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_TEXT_LOCK,
- g_param_spec_string ("text-lock",
- P_("Lock Text"),
- P_("The text to display when prompting the user to lock"),
- _("Lock"),
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_TEXT_UNLOCK,
- g_param_spec_string ("text-unlock",
- P_("Unlock Text"),
- P_("The text to display when prompting the user to unlock"),
- _("Unlock"),
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_TEXT_NOT_AUTHORIZED,
- g_param_spec_string ("text-not-authorized",
- P_("Not Authorized Text"),
- P_("The text to display when prompting the user cannot obtain authorization"),
- _("Locked"),
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_TOOLTIP_LOCK,
- g_param_spec_string ("tooltip-lock",
- P_("Lock Tooltip"),
- P_("The tooltip to display when prompting the user to lock"),
- _("Dialog is unlocked.\nClick to prevent further changes"),
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_TOOLTIP_UNLOCK,
- g_param_spec_string ("tooltip-unlock",
- P_("Unlock Tooltip"),
- P_("The tooltip to display when prompting the user to unlock"),
- _("Dialog is locked.\nClick to make changes"),
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_TOOLTIP_NOT_AUTHORIZED,
- g_param_spec_string ("tooltip-not-authorized",
- P_("Not Authorized Tooltip"),
- P_("The tooltip to display when prompting the user cannot obtain authorization"),
- _("System policy prevents changes.\nContact your system administrator"),
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-}
-
-/**
- * dt_lock_button_new:
- * @permission: a #GPermission
- *
- * Creates a new lock button which reflects the @permission.
- *
- * Returns: a new #DtLockButton
- *
- * Since: 3.0
- */
-GtkWidget *
-dt_lock_button_new (GPermission *permission)
-{
- g_return_val_if_fail (permission != NULL, NULL);
-
- return GTK_WIDGET (g_object_new (DT_TYPE_LOCK_BUTTON,
- "permission", permission,
- NULL));
-}
-
-static void
-update_state (DtLockButton *button)
-{
- DtLockButtonPrivate *priv = button->priv;
- gint page;
- const gchar *tooltip;
- gboolean sensitive;
- gboolean visible;
- GIcon *icon;
-
- visible = TRUE;
- sensitive = TRUE;
-
- gtk_label_set_text (GTK_LABEL (priv->label_lock), priv->text_lock);
- gtk_label_set_text (GTK_LABEL (priv->label_unlock), priv->text_unlock);
- gtk_label_set_text (GTK_LABEL (priv->label_not_authorized), priv->text_not_authorized);
-
- if (g_permission_get_allowed (priv->permission))
- {
- if (g_permission_get_can_release (priv->permission))
- {
- page = 0;
- tooltip = priv->tooltip_lock;
- sensitive = TRUE;
- }
- else
- {
- page = 0;
- tooltip = "";
- visible = FALSE;
- }
- }
- else
- {
- if (g_permission_get_can_acquire (priv->permission))
- {
- page = 1;
- tooltip = button->priv->tooltip_unlock;
- sensitive = TRUE;
- }
- else
- {
- page = 2;
- tooltip = button->priv->tooltip_not_authorized;
- sensitive = FALSE;
- }
- }
-
- if (g_permission_get_allowed (priv->permission))
- {
- gchar *names[3];
-
- names[0] = "changes-allow-symbolic";
- names[1] = "changes-allow";
- names[2] = NULL;
- icon = g_themed_icon_new_from_names (names, -1);
- }
- else
- {
- gchar *names[3];
-
- names[0] = "changes-prevent-symbolic";
- names[1] = "changes-prevent";
- names[2] = NULL;
- icon = g_themed_icon_new_from_names (names, -1);
- }
-
- gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon, GTK_ICON_SIZE_BUTTON);
- g_object_unref (icon);
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page);
- gtk_widget_set_tooltip_markup (priv->box, tooltip);
-
- gtk_widget_set_sensitive (priv->box, sensitive);
-
- if (visible)
- gtk_widget_show (priv->box);
- else
- gtk_widget_hide (priv->box);
-}
-
-static void
-on_permission_changed (GPermission *permission,
- GParamSpec *pspec,
- gpointer user_data)
-{
- DtLockButton *button = DT_LOCK_BUTTON (user_data);
-
- update_state (button);
-}
-
-static void
-acquire_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- DtLockButton *button = DT_LOCK_BUTTON (user_data);
- DtLockButtonPrivate *priv = button->priv;
- GError *error;
-
- error = NULL;
- g_permission_acquire_finish (priv->permission, result, &error);
-
- if (error)
- {
- g_warning ("Error acquiring permission: %s", error->message);
- g_error_free (error);
- }
-
- g_object_unref (priv->cancellable);
- priv->cancellable = NULL;
-
- update_state (button);
-}
-
-static void
-release_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- DtLockButton *button = DT_LOCK_BUTTON (user_data);
- DtLockButtonPrivate *priv = button->priv;
- GError *error;
-
- error = NULL;
- g_permission_release_finish (priv->permission, result, &error);
-
- if (error)
- {
- g_warning ("Error releasing permission: %s", error->message);
- g_error_free (error);
- }
-
- g_object_unref (priv->cancellable);
- priv->cancellable = NULL;
-
- update_state (button);
-}
-
-static void
-handle_click (DtLockButton *button)
-{
- DtLockButtonPrivate *priv = button->priv;
-
- if (!g_permission_get_allowed (priv->permission) &&
- g_permission_get_can_acquire (priv->permission))
- {
- /* if we already have a pending interactive check, then do nothing */
- if (priv->cancellable != NULL)
- goto out;
-
- priv->cancellable = g_cancellable_new ();
-
- g_permission_acquire_async (priv->permission,
- priv->cancellable,
- acquire_cb,
- button);
- }
- else if (g_permission_get_allowed (priv->permission) &&
- g_permission_get_can_release (priv->permission))
- {
- /* if we already have a pending interactive check, then do nothing */
- if (priv->cancellable != NULL)
- goto out;
-
- priv->cancellable = g_cancellable_new ();
-
- g_permission_release_async (priv->permission,
- priv->cancellable,
- release_cb,
- button);
- }
-
- out: ;
-}
-
-static void
-on_clicked (GtkButton *_button,
- gpointer user_data)
-
-{
- handle_click (DT_LOCK_BUTTON (user_data));
-}
-
-static void
-on_button_press (GtkWidget *widget,
- GdkEventButton *event,
- gpointer user_data)
-{
- handle_click (DT_LOCK_BUTTON (user_data));
-}
-
-/**
- * dt_lock_button_get_permission:
- * @button: a #DtLockButton
- *
- * Obtains the #GPermission object that controls @button.
- *
- * Returns: the #GPermission of @button
- *
- * Since: 3.0
- */
-GPermission *
-dt_lock_button_get_permission (DtLockButton *button)
-{
- g_return_val_if_fail (DT_IS_LOCK_BUTTON (button), NULL);
-
- return button->priv->permission;
-}
-
diff --git a/libmap/dt-lockbutton.h b/libmap/dt-lockbutton.h
deleted file mode 100644
index adab0a7..0000000
--- a/libmap/dt-lockbutton.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2010 Red Hat, Inc.
- * Author: Matthias Clasen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __DT_LOCK_BUTTON_H__
-#define __DT_LOCK_BUTTON_H__
-
-#include <gtk/gtk.h>
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-#define DT_TYPE_LOCK_BUTTON (dt_lock_button_get_type ())
-#define DT_LOCK_BUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DT_TYPE_LOCK_BUTTON, DtLockButton))
-#define DT_LOCK_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DT_LOCK_BUTTON, DtLockButtonClass))
-#define DT_IS_LOCK_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DT_TYPE_LOCK_BUTTON))
-#define DT_IS_LOCK_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DT_TYPE_LOCK_BUTTON))
-#define DT_LOCK_BUTTON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DT_TYPE_LOCK_BUTTON, DtLockButtonClass))
-
-typedef struct _DtLockButton DtLockButton;
-typedef struct _DtLockButtonClass DtLockButtonClass;
-typedef struct _DtLockButtonPrivate DtLockButtonPrivate;
-
-struct _DtLockButton
-{
- GtkBin parent;
-
- DtLockButtonPrivate *priv;
-};
-
-struct _DtLockButtonClass
-{
- GtkBinClass parent_class;
-
- void (*reserved0) (void);
- void (*reserved1) (void);
- void (*reserved2) (void);
- void (*reserved3) (void);
- void (*reserved4) (void);
- void (*reserved5) (void);
- void (*reserved6) (void);
- void (*reserved7) (void);
-};
-
-GType dt_lock_button_get_type (void) G_GNUC_CONST;
-GtkWidget *dt_lock_button_new (GPermission *permission);
-GPermission *dt_lock_button_get_permission (DtLockButton *button);
-
-
-G_END_DECLS
-
-#endif /* __DT_LOCK_BUTTON_H__ */
diff --git a/libmap/set-timezone.c b/libmap/set-timezone.c
deleted file mode 100644
index 5aafced..0000000
--- a/libmap/set-timezone.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 David Zeuthen <david@fubar.dk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/wait.h>
-
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
-#include "set-timezone.h"
-
-
-static DBusGConnection *
-get_system_bus (GError **err)
-{
- GError *error;
- static DBusGConnection *bus = NULL;
-
- if (bus == NULL) {
- error = NULL;
- bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (bus == NULL) {
- g_propagate_error (err, error);
- }
- }
-
- return bus;
-}
-
-#define CACHE_VALIDITY_SEC 2
-
-typedef void (*CanDoFunc) (gint value);
-
-static void
-notify_can_do (DBusGProxy *proxy,
- DBusGProxyCall *call,
- void *user_data)
-{
- CanDoFunc callback = user_data;
- GError *error = NULL;
- gint value;
-
- if (dbus_g_proxy_end_call (proxy, call,
- &error,
- G_TYPE_INT, &value,
- G_TYPE_INVALID)) {
- callback (value);
- }
-}
-
-static void
-refresh_can_do (const gchar *action, CanDoFunc callback)
-{
- DBusGConnection *bus;
- DBusGProxy *proxy;
-
- bus = get_system_bus (NULL);
- if (bus == NULL)
- return;
-
- proxy = dbus_g_proxy_new_for_name (bus,
- "org.gnome.SettingsDaemon.DateTimeMechanism",
- "/",
- "org.gnome.SettingsDaemon.DateTimeMechanism");
-
- dbus_g_proxy_begin_call_with_timeout (proxy,
- action,
- notify_can_do,
- callback, NULL,
- INT_MAX,
- G_TYPE_INVALID);
-}
-
-static gint settimezone_cache = 0;
-static time_t settimezone_stamp = 0;
-
-static void
-update_can_settimezone (gint res)
-{
- settimezone_cache = res;
- time (&settimezone_stamp);
-}
-
-gint
-can_set_system_timezone (void)
-{
- time_t now;
-
- time (&now);
- if (ABS (now - settimezone_stamp) > CACHE_VALIDITY_SEC) {
- refresh_can_do ("CanSetTimezone", update_can_settimezone);
- settimezone_stamp = now;
- }
-
- return settimezone_cache;
-}
-
-static gint settime_cache = 0;
-static time_t settime_stamp = 0;
-
-static void
-update_can_settime (gint res)
-{
- settime_cache = res;
- time (&settime_stamp);
-}
-
-gint
-can_set_system_time (void)
-{
- time_t now;
-
- time (&now);
- if (ABS (now - settime_stamp) > CACHE_VALIDITY_SEC) {
- refresh_can_do ("CanSetTime", update_can_settime);
- settime_stamp = now;
- }
-
- return settime_cache;
-}
-
-static gint usingntp_cache = 0;
-static time_t usingntp_stamp = 0;
-
-static void
-update_can_usingntp (gint res)
-{
- usingntp_cache = res;
- time (&usingntp_stamp);
-}
-
-gint
-can_set_using_ntp (void)
-{
- time_t now;
-
- time (&now);
- if (ABS (now - usingntp_stamp) > CACHE_VALIDITY_SEC) {
- refresh_can_do ("CanSetUsingNtp", update_can_usingntp);
- settime_stamp = now;
- }
-
- return usingntp_cache;
-}
-
-typedef struct {
- gint ref_count;
- gchar *call;
- gint64 time;
- gchar *tz;
- gboolean using_ntp;
- GFunc callback;
- gpointer data;
- GDestroyNotify notify;
-} SetTimeCallbackData;
-
-static void
-free_data (gpointer d)
-{
- SetTimeCallbackData *data = d;
-
- data->ref_count--;
- if (data->ref_count == 0) {
- if (data->notify)
- data->notify (data->data);
- g_free (data->tz);
- g_free (data);
- }
-}
-
-static void
-set_time_notify (DBusGProxy *proxy,
- DBusGProxyCall *call,
- void *user_data)
-{
- SetTimeCallbackData *data = user_data;
- GError *error = NULL;
-
- if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID)) {
- if (data->callback)
- data->callback (data->data, NULL);
- }
- else {
- if (error->domain == DBUS_GERROR &&
- error->code == DBUS_GERROR_NO_REPLY) {
- /* these errors happen because dbus doesn't
- * use monotonic clocks
- */
- g_warning ("ignoring no-reply error when setting time");
- g_error_free (error);
- if (data->callback)
- data->callback (data->data, NULL);
- }
- else {
- if (data->callback)
- data->callback (data->data, error);
- else
- g_error_free (error);
- }
- }
-}
-
-static void
-set_time_async (SetTimeCallbackData *data)
-{
- DBusGConnection *bus;
- DBusGProxy *proxy;
- GError *err = NULL;
-
- bus = get_system_bus (&err);
- if (bus == NULL) {
- if (err) {
- if (data->callback)
- data->callback (data->data, err);
- g_clear_error (&err);
- }
- return;
- }
-
- proxy = dbus_g_proxy_new_for_name (bus,
- "org.gnome.SettingsDaemon.DateTimeMechanism",
- "/",
- "org.gnome.SettingsDaemon.DateTimeMechanism");
-
- data->ref_count++;
- if (strcmp (data->call, "SetTime") == 0)
- dbus_g_proxy_begin_call_with_timeout (proxy,
- "SetTime",
- set_time_notify,
- data, free_data,
- INT_MAX,
- /* parameters: */
- G_TYPE_INT64, data->time,
- G_TYPE_INVALID,
- /* return values: */
- G_TYPE_INVALID);
- else if (strcmp (data->call, "SetTimezone") == 0)
- dbus_g_proxy_begin_call_with_timeout (proxy,
- "SetTimezone",
- set_time_notify,
- data, free_data,
- INT_MAX,
- /* parameters: */
- G_TYPE_STRING, data->tz,
- G_TYPE_INVALID,
- /* return values: */
- G_TYPE_INVALID);
- else if (strcmp (data->call, "SetUsingNtp") == 0)
- dbus_g_proxy_begin_call_with_timeout (proxy,
- "SetUsingNtp",
- set_time_notify,
- data, free_data,
- INT_MAX,
- /* parameters: */
- G_TYPE_BOOLEAN, data->using_ntp,
- G_TYPE_INVALID,
- /* return values: */
- G_TYPE_INVALID);
-}
-
-void
-set_system_time_async (gint64 time,
- GFunc callback,
- gpointer d,
- GDestroyNotify notify)
-{
- SetTimeCallbackData *data;
-
- if (time == -1)
- return;
-
- data = g_new0 (SetTimeCallbackData, 1);
- data->ref_count = 1;
- data->call = "SetTime";
- data->time = time;
- data->tz = NULL;
- data->callback = callback;
- data->data = d;
- data->notify = notify;
-
- set_time_async (data);
- free_data (data);
-}
-
-void
-set_system_timezone_async (const gchar *tz,
- GFunc callback,
- gpointer d,
- GDestroyNotify notify)
-{
- SetTimeCallbackData *data;
-
- g_return_if_fail (tz != NULL);
-
- data = g_new0 (SetTimeCallbackData, 1);
- data->ref_count = 1;
- data->call = "SetTimezone";
- data->time = -1;
- data->tz = g_strdup (tz);
- data->callback = callback;
- data->data = d;
- data->notify = notify;
-
- set_time_async (data);
- free_data (data);
-}
-
-/* get timezone */
-
-typedef struct
-{
- GetTimezoneFunc callback;
- GDestroyNotify notify;
-
- gpointer data;
-
-} GetTimezoneData;
-
-static void
-get_timezone_destroy_notify (GetTimezoneData *data)
-{
- if (data->notify && data->data)
- data->notify (data);
-
- g_free (data);
-}
-
-static void
-get_timezone_notify (DBusGProxy *proxy,
- DBusGProxyCall *call,
- void *user_data)
-{
- GError *error = NULL;
- gboolean retval;
- gchar *string = NULL;
- GetTimezoneData *data = user_data;
-
- retval = dbus_g_proxy_end_call (proxy, call, &error,
- G_TYPE_STRING, &string,
- G_TYPE_INVALID);
-
- if (data->callback) {
- if (!retval) {
- data->callback (data->data, NULL, error);
- g_error_free (error);
- }
- else {
- data->callback (data->data, string, NULL);
- g_free (string);
- }
- }
-}
-
-void
-get_system_timezone_async (GetTimezoneFunc callback,
- gpointer user_data,
- GDestroyNotify notify)
-{
- DBusGConnection *bus;
- DBusGProxy *proxy;
- GetTimezoneData *data;
- GError *error = NULL;
-
- bus = get_system_bus (&error);
- if (bus == NULL) {
- if (error) {
- if (callback)
- callback (user_data, NULL, error);
- g_clear_error (&error);
- }
- return;
-
- }
-
- data = g_new0 (GetTimezoneData, 1);
- data->data = user_data;
- data->notify = notify;
- data->callback = callback;
-
- proxy = dbus_g_proxy_new_for_name (bus,
- "org.gnome.SettingsDaemon.DateTimeMechanism",
- "/",
- "org.gnome.SettingsDaemon.DateTimeMechanism");
-
- dbus_g_proxy_begin_call (proxy,
- "GetTimezone",
- get_timezone_notify,
- data,
- (GDestroyNotify) get_timezone_destroy_notify,
- /* parameters: */
- G_TYPE_INVALID,
- /* return values: */
- G_TYPE_STRING,
- G_TYPE_INVALID);
-
-}
-
-gboolean
-get_using_ntp (void)
-{
- static gboolean can_use_cache = FALSE;
- static gboolean is_using_cache = FALSE;
- static time_t last_refreshed = 0;
- time_t now;
- DBusGConnection *bus;
- DBusGProxy *proxy;
-
- time (&now);
- if (ABS (now - last_refreshed) > CACHE_VALIDITY_SEC) {
- gboolean cu, iu;
- bus = get_system_bus (NULL);
- if (bus == NULL)
- return FALSE;
-
- proxy = dbus_g_proxy_new_for_name (bus,
- "org.gnome.SettingsDaemon.DateTimeMechanism",
- "/",
- "org.gnome.SettingsDaemon.DateTimeMechanism");
-
-
- if (dbus_g_proxy_call (proxy,
- "GetUsingNtp",
- NULL,
- G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &cu,
- G_TYPE_BOOLEAN, &iu,
- G_TYPE_INVALID)) {
- can_use_cache = cu;
- is_using_cache = iu;
- last_refreshed = now;
- }
- }
-
- return is_using_cache;
-}
-
-void
-set_using_ntp_async (gboolean using_ntp,
- GFunc callback,
- gpointer d,
- GDestroyNotify notify)
-{
- SetTimeCallbackData *data;
-
- data = g_new0 (SetTimeCallbackData, 1);
- data->ref_count = 1;
- data->call = "SetUsingNtp";
- data->time = -1;
- data->using_ntp = using_ntp;
- data->callback = callback;
- data->data = d;
- data->notify = notify;
-
- set_time_async (data);
- free_data (data);
-}
diff --git a/libmap/set-timezone.h b/libmap/set-timezone.h
deleted file mode 100644
index 5e657e3..0000000
--- a/libmap/set-timezone.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 David Zeuthen <david@fubar.dk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __SET_SYSTEM_TIMEZONE_H__
-
-#include <config.h>
-
-#include <glib.h>
-#include <time.h>
-
-typedef void (*GetTimezoneFunc) (gpointer data,
- const gchar *timezone,
- GError *error);
-void get_system_timezone_async (GetTimezoneFunc callback,
- gpointer data,
- GDestroyNotify notify);
-
-gint can_set_system_timezone (void);
-
-gint can_set_system_time (void);
-
-gint can_set_using_ntp (void);
-
-void set_system_time_async (gint64 time,
- GFunc callback,
- gpointer data,
- GDestroyNotify notify);
-
-void set_system_timezone_async (const gchar *tz,
- GFunc callback,
- gpointer data,
- GDestroyNotify notify);
-
-gboolean get_using_ntp (void);
-
-void set_using_ntp_async (gboolean using_ntp,
- GFunc callback,
- gpointer data,
- GDestroyNotify notify);
-#endif