[gnome-settings-daemon] Add an updates plugin to integrate with PackageKit



commit 229cbf2b08341d5cd571daa6bf0996091a4272a0
Author: Richard Hughes <richard hughsie com>
Date:   Tue Feb 15 15:37:16 2011 +0000

    Add an updates plugin to integrate with PackageKit

 configure.ac                                       |   31 ++
 data/Makefile.am                                   |    4 +
 ...ttings-daemon.plugins.updates.gschema.xml.in.in |    9 +
 plugins/Makefile.am                                |    6 +
 plugins/updates/Makefile.am                        |   43 +++
 plugins/updates/gsd-updates-manager.c              |  306 ++++++++++++++++++++
 plugins/updates/gsd-updates-manager.h              |   57 ++++
 plugins/updates/gsd-updates-plugin.c               |  106 +++++++
 plugins/updates/gsd-updates-plugin.h               |   59 ++++
 plugins/updates/updates.gnome-settings-plugin.in   |    8 +
 po/POTFILES.in                                     |    1 +
 po/POTFILES.skip                                   |    1 +
 12 files changed, 631 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6c2c227..753341e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -269,6 +269,34 @@ AC_SUBST(PULSE_LIBS)
 
 
 dnl ==============================================
+dnl PackageKit section
+dnl ==============================================
+
+have_packagekit=true
+AC_ARG_ENABLE(packagekit,
+  AC_HELP_STRING([--disable-packagekit],
+                 [turn off PackageKit support]),
+       [case "${enableval}" in
+               yes) WANT_PACKAGEKIT=yes ;;
+               no)  WANT_PACKAGEKIT=no ;;
+               *) AC_MSG_ERROR(bad value ${enableval} for --disable-packagekit) ;;
+       esac],
+       [WANT_PACKAGEKIT=yes]) dnl Default value
+
+if test x$WANT_PACKAGEKIT = xyes ; then
+       PK_REQUIRED_VERSION=0.6.4
+       PKG_CHECK_MODULES(PACKAGEKIT, glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION,
+             [have_packagekit=true
+              AC_DEFINE(HAVE_PACKAGEKIT, 1, [Define if PackageKit should be used])],
+             [have_packagekit=false])
+fi
+AM_CONDITIONAL(HAVE_PACKAGEKIT, test "x$have_packagekit" = "xtrue")
+
+AC_SUBST(PACKAGEKIT_CFLAGS)
+AC_SUBST(PACKAGEKIT_LIBS)
+
+
+dnl ==============================================
 dnl smartcard section
 dnl ==============================================
 have_smartcard_support=false
@@ -486,6 +514,7 @@ plugins/mouse/Makefile
 plugins/print-notifications/Makefile
 plugins/smartcard/Makefile
 plugins/sound/Makefile
+plugins/updates/Makefile
 plugins/wacom/Makefile
 plugins/xrandr/Makefile
 plugins/xsettings/Makefile
@@ -500,6 +529,7 @@ data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in
 data/org.gnome.settings-daemon.peripherals.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in
+data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in
 data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in
@@ -534,6 +564,7 @@ echo "
 
         Libnotify support:        ${have_libnotify}
         PulseAudio support:       ${have_pulse}
+        PackageKit support:       ${have_packagekit}
         Smartcard support:        ${have_smartcard_support}
         GConf bridge support:     ${build_gconf_bridge}
         Cups support:             ${have_cups}
diff --git a/data/Makefile.am b/data/Makefile.am
index 8dae781..7e206ad 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -18,6 +18,10 @@ gsettings_SCHEMAS =							\
 	org.gnome.settings-daemon.peripherals.wacom.gschema.xml		\
 	org.gnome.settings-daemon.plugins.xrandr.gschema.xml
 
+if HAVE_PACKAGEKIT
+gsettings_SCHEMAS += org.gnome.settings-daemon.plugins.updates.gschema.xml
+endif
+
 @INTLTOOL_XML_NOMERGE_RULE@
 
 @GSETTINGS_RULES@
diff --git a/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in
new file mode 100644
index 0000000..44c694f
--- /dev/null
+++ b/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in
@@ -0,0 +1,9 @@
+<schemalist>
+  <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.updates" path="/org/gnome/settings-daemon/plugins/updates/">
+    <key name="active" type="b">
+      <default>true</default>
+      <_summary>Activation of this plugin</_summary>
+      <_description>Whether this plugin would be activated by gnome-settings-daemon or not</_description>
+    </key>
+  </schema>
+</schemalist>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 52143a2..a327a71 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -26,6 +26,12 @@ else
 disabled_plugins += gconf
 endif
 
+if HAVE_PACKAGEKIT
+enabled_plugins += updates
+else
+disabled_plugins += updates
+endif
+
 if SMARTCARD_SUPPORT
 enabled_plugins += smartcard
 else
diff --git a/plugins/updates/Makefile.am b/plugins/updates/Makefile.am
new file mode 100644
index 0000000..fd00290
--- /dev/null
+++ b/plugins/updates/Makefile.am
@@ -0,0 +1,43 @@
+plugin_LTLIBRARIES = \
+	libupdates.la
+
+libupdates_la_SOURCES = \
+	gsd-updates-plugin.h \
+	gsd-updates-plugin.c \
+	gsd-updates-manager.h \
+	gsd-updates-manager.c
+
+libupdates_la_CPPFLAGS = \
+	-I$(top_srcdir)/gnome-settings-daemon \
+	-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+	$(AM_CPPFLAGS)
+
+libupdates_la_CFLAGS = \
+	$(SETTINGS_PLUGIN_CFLAGS) \
+	$(GNOME_CFLAGS)	\
+	$(PACKAGEKIT_CFLAGS) \
+	-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
+	$(AM_CFLAGS)
+
+libupdates_la_LDFLAGS = \
+	$(GSD_PLUGIN_LDFLAGS)
+
+libupdates_la_LIBADD = \
+	$(SETTINGS_PLUGIN_LIBS)	\
+	$(PACKAGEKIT_LIBS)
+
+plugin_in_files = \
+	updates.gnome-settings-plugin.in
+
+plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
+
+EXTRA_DIST = \
+	$(plugin_in_files)
+
+CLEANFILES = \
+	$(plugin_DATA)
+
+DISTCLEANFILES = \
+	$(plugin_DATA)
+
+ GSD_INTLTOOL_PLUGIN_RULE@
diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c
new file mode 100644
index 0000000..3c69a31
--- /dev/null
+++ b/plugins/updates/gsd-updates-manager.c
@@ -0,0 +1,306 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Richard Hughes <richard hughsie com>
+ *
+ * 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.
+ *
+ */
+
+#include "config.h"
+
+#include <locale.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#ifdef HAVE_PACKAGEKIT
+#include <packagekit-glib2/packagekit.h>
+#endif
+
+#include "gsd-updates-manager.h"
+#include "gnome-settings-profile.h"
+
+#define GSD_UPDATES_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerPrivate))
+
+struct GsdUpdatesManagerPrivate
+{
+        GSettings *settings_http;
+        GSettings *settings_ftp;
+        PkControl *control;
+        guint      timeout;
+};
+
+static void gsd_updates_manager_class_init (GsdUpdatesManagerClass *klass);
+static void gsd_updates_manager_init (GsdUpdatesManager *updates_manager);
+static void gsd_updates_manager_finalize (GObject *object);
+
+G_DEFINE_TYPE (GsdUpdatesManager, gsd_updates_manager, G_TYPE_OBJECT)
+
+static gpointer manager_object = NULL;
+
+static gchar *
+get_proxy_http (GsdUpdatesManager *manager)
+{
+        gboolean ret;
+        gchar *host = NULL;
+        gchar *password = NULL;
+        gchar *proxy = NULL;
+        gchar *username = NULL;
+        GString *string = NULL;
+        guint port;
+
+        ret = g_settings_get_boolean (manager->priv->settings_http,
+                                      "enabled");
+        if (!ret)
+                goto out;
+
+        host = g_settings_get_string (manager->priv->settings_http,
+                                      "host");
+        if (host == NULL)
+                goto out;
+        port = g_settings_get_int (manager->priv->settings_http,
+                                   "port");
+
+        /* use an HTTP auth string? */
+        ret = g_settings_get_boolean (manager->priv->settings_http,
+                                      "use-authentication");
+        if (ret) {
+                username = g_settings_get_string (manager->priv->settings_http,
+                                                  "authentication-user");
+                password = g_settings_get_string (manager->priv->settings_http,
+                                                  "authentication-password");
+        }
+
+        /* make PackageKit proxy string */
+        string = g_string_new (host);
+        if (port > 0)
+                g_string_append_printf (string, ":%i", port);
+        if (username != NULL && password != NULL)
+                g_string_append_printf (string, "@%s:%s", username, password);
+        else if (username != NULL)
+                g_string_append_printf (string, "@%s", username);
+        else if (password != NULL)
+                g_string_append_printf (string, "@:%s", password);
+        proxy = g_string_free (string, FALSE);
+out:
+        g_free (host);
+        g_free (username);
+        g_free (password);
+        return proxy;
+}
+
+static gchar *
+get_proxy_ftp (GsdUpdatesManager *manager)
+{
+        gboolean ret;
+        gchar *host = NULL;
+        gchar *proxy = NULL;
+        GString *string = NULL;
+        guint port;
+
+        ret = g_settings_get_boolean (manager->priv->settings_http,
+                                      "enabled");
+        if (!ret)
+                goto out;
+
+        host = g_settings_get_string (manager->priv->settings_http,
+                                      "host");
+        if (host == NULL)
+                goto out;
+        port = g_settings_get_int (manager->priv->settings_http,
+                                   "port");
+
+        /* make PackageKit proxy string */
+        string = g_string_new (host);
+        if (port > 0)
+                g_string_append_printf (string, ":%i", port);
+        proxy = g_string_free (string, FALSE);
+out:
+        g_free (host);
+        return proxy;
+}
+
+
+static void
+set_proxy_cb (GObject *object, GAsyncResult *res, gpointer user_data)
+{
+        gboolean ret;
+        GError *error = NULL;
+        PkControl *control = PK_CONTROL (object);
+
+        /* get the result */
+        ret = pk_control_set_proxy_finish (control, res, &error);
+        if (!ret) {
+                g_warning ("failed to set proxies: %s", error->message);
+                g_error_free (error);
+        }
+}
+
+static void
+reload_proxy_settings (GsdUpdatesManager *manager)
+{
+        gchar *proxy_http;
+        gchar *proxy_ftp;
+
+        proxy_http = get_proxy_http (manager);
+        proxy_ftp = get_proxy_ftp (manager);
+
+        /* send to daemon */
+        pk_control_set_proxy_async (manager->priv->control,
+                                    proxy_http,
+                                    proxy_ftp,
+                                    NULL,
+                                    set_proxy_cb,
+                                    manager);
+
+        g_free (proxy_http);
+        g_free (proxy_ftp);
+}
+
+static void
+settings_changed_cb (GSettings         *settings,
+                     const char        *key,
+                     GsdUpdatesManager *manager)
+{
+        reload_proxy_settings (manager);
+}
+
+gboolean
+gsd_updates_manager_start (GsdUpdatesManager *manager,
+                           GError **error)
+{
+
+        /* use PackageKit */
+        manager->priv->control = pk_control_new ();
+
+        /* get http settings */
+        manager->priv->settings_http = g_settings_new ("org.gnome.system.proxy.http");
+        g_signal_connect (manager->priv->settings_http, "changed",
+                          G_CALLBACK (settings_changed_cb), manager);
+
+        /* get ftp settings */
+        manager->priv->settings_ftp = g_settings_new ("org.gnome.system.proxy.ftp");
+        g_signal_connect (manager->priv->settings_ftp, "changed",
+                          G_CALLBACK (settings_changed_cb), manager);
+
+        /* coldplug */
+        reload_proxy_settings (manager);
+
+        g_debug ("Starting updates manager");
+
+        return TRUE;
+}
+
+void
+gsd_updates_manager_stop (GsdUpdatesManager *manager)
+{
+        g_debug ("Stopping updates manager");
+
+        if (manager->priv->settings_http != NULL) {
+                g_object_unref (manager->priv->settings_http);
+                manager->priv->settings_http = NULL;
+        }
+        if (manager->priv->settings_ftp != NULL) {
+                g_object_unref (manager->priv->settings_ftp);
+                manager->priv->settings_ftp = NULL;
+        }
+        if (manager->priv->control != NULL) {
+                g_object_unref (manager->priv->control);
+                manager->priv->control = NULL;
+        }
+
+        if (manager->priv->timeout) {
+                g_source_remove (manager->priv->timeout);
+                manager->priv->timeout = 0;
+        }
+}
+
+static GObject *
+gsd_updates_manager_constructor (
+                GType type,
+                guint n_construct_properties,
+                GObjectConstructParam *construct_properties)
+{
+        GsdUpdatesManager *m;
+        GsdUpdatesManagerClass *klass;
+
+        klass = GSD_UPDATES_MANAGER_CLASS (g_type_class_peek (GSD_TYPE_UPDATES_MANAGER));
+
+        m = GSD_UPDATES_MANAGER (G_OBJECT_CLASS (gsd_updates_manager_parent_class)->constructor (
+                                                           type,
+                                                           n_construct_properties,
+                                                           construct_properties));
+
+        return G_OBJECT (m);
+}
+
+static void
+gsd_updates_manager_dispose (GObject *object)
+{
+        GsdUpdatesManager *manager;
+
+        manager = GSD_UPDATES_MANAGER (object);
+
+        gsd_updates_manager_stop (manager);
+
+        G_OBJECT_CLASS (gsd_updates_manager_parent_class)->dispose (object);
+}
+
+static void
+gsd_updates_manager_class_init (GsdUpdatesManagerClass *klass)
+{
+        GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+        object_class->constructor = gsd_updates_manager_constructor;
+        object_class->dispose = gsd_updates_manager_dispose;
+        object_class->finalize = gsd_updates_manager_finalize;
+
+        g_type_class_add_private (klass, sizeof (GsdUpdatesManagerPrivate));
+}
+
+static void
+gsd_updates_manager_init (GsdUpdatesManager *manager)
+{
+        manager->priv = GSD_UPDATES_MANAGER_GET_PRIVATE (manager);
+}
+
+static void
+gsd_updates_manager_finalize (GObject *object)
+{
+        GsdUpdatesManager *updates_manager;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GSD_IS_UPDATES_MANAGER (object));
+
+        updates_manager = GSD_UPDATES_MANAGER (object);
+
+        g_return_if_fail (updates_manager->priv);
+
+        G_OBJECT_CLASS (gsd_updates_manager_parent_class)->finalize (object);
+}
+
+GsdUpdatesManager *
+gsd_updates_manager_new (void)
+{
+        if (manager_object) {
+                g_object_ref (manager_object);
+        } else {
+                manager_object = g_object_new (GSD_TYPE_UPDATES_MANAGER, NULL);
+                g_object_add_weak_pointer (manager_object, (gpointer *) &manager_object);
+        }
+
+        return GSD_UPDATES_MANAGER (manager_object);
+}
diff --git a/plugins/updates/gsd-updates-manager.h b/plugins/updates/gsd-updates-manager.h
new file mode 100644
index 0000000..b090872
--- /dev/null
+++ b/plugins/updates/gsd-updates-manager.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Richard Hughes <richard hughsie com>
+ *
+ * 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 __GSD_UPDATES_MANAGER_H
+#define __GSD_UPDATES_MANAGER_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_UPDATES_MANAGER         (gsd_updates_manager_get_type ())
+#define GSD_UPDATES_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManager))
+#define GSD_UPDATES_MANAGER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerClass))
+#define GSD_IS_UPDATES_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_UPDATES_MANAGER))
+#define GSD_IS_UPDATES_MANAGER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_UPDATES_MANAGER))
+#define GSD_UPDATES_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerClass))
+
+typedef struct GsdUpdatesManagerPrivate GsdUpdatesManagerPrivate;
+
+typedef struct
+{
+        GObject parent;
+        GsdUpdatesManagerPrivate *priv;
+} GsdUpdatesManager;
+
+typedef struct
+{
+        GObjectClass parent_class;
+} GsdUpdatesManagerClass;
+
+GType gsd_updates_manager_get_type (void) G_GNUC_CONST;
+
+GsdUpdatesManager *gsd_updates_manager_new (void);
+gboolean gsd_updates_manager_start (GsdUpdatesManager *manager, GError **error);
+void gsd_updates_manager_stop (GsdUpdatesManager *manager);
+
+G_END_DECLS
+
+#endif /* __GSD_UPDATES_MANAGER_H */
diff --git a/plugins/updates/gsd-updates-plugin.c b/plugins/updates/gsd-updates-plugin.c
new file mode 100644
index 0000000..2252f72
--- /dev/null
+++ b/plugins/updates/gsd-updates-plugin.c
@@ -0,0 +1,106 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Richard Hughes <richard hughsie com>
+ *
+ * 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, 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.
+ *
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+#include <gmodule.h>
+
+#include "gnome-settings-plugin.h"
+#include "gsd-updates-plugin.h"
+#include "gsd-updates-manager.h"
+
+struct GsdUpdatesPluginPrivate {
+        GsdUpdatesManager *manager;
+};
+
+#define GSD_UPDATES_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPluginPrivate))
+
+GNOME_SETTINGS_PLUGIN_REGISTER (GsdUpdatesPlugin, gsd_updates_plugin)
+
+static void
+gsd_updates_plugin_init (GsdUpdatesPlugin *plugin)
+{
+        plugin->priv = GSD_UPDATES_PLUGIN_GET_PRIVATE (plugin);
+
+        g_debug ("GsdUpdatesPlugin initializing");
+
+        plugin->priv->manager = gsd_updates_manager_new ();
+}
+
+static void
+gsd_updates_plugin_finalize (GObject *object)
+{
+        GsdUpdatesPlugin *plugin;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GSD_IS_UPDATES_PLUGIN (object));
+
+        g_debug ("GsdUpdatesPlugin finalizing");
+
+        plugin = GSD_UPDATES_PLUGIN (object);
+
+        g_return_if_fail (plugin->priv != NULL);
+
+        if (plugin->priv->manager != NULL)
+                g_object_unref (plugin->priv->manager);
+
+        G_OBJECT_CLASS (gsd_updates_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (GnomeSettingsPlugin *plugin)
+{
+        GError *error = NULL;
+
+        g_debug ("Activating updates plugin");
+
+        if (!gsd_updates_manager_start (GSD_UPDATES_PLUGIN (plugin)->priv->manager, &error)) {
+                g_warning ("Unable to start updates manager: %s", error->message);
+                g_error_free (error);
+        }
+}
+
+static void
+impl_deactivate (GnomeSettingsPlugin *plugin)
+{
+        g_debug ("Deactivating updates plugin");
+        gsd_updates_manager_stop (GSD_UPDATES_PLUGIN (plugin)->priv->manager);
+}
+
+static void
+gsd_updates_plugin_class_init (GsdUpdatesPluginClass *klass)
+{
+        GObjectClass *object_class = G_OBJECT_CLASS (klass);
+        GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass);
+
+        object_class->finalize = gsd_updates_plugin_finalize;
+
+        plugin_class->activate = impl_activate;
+        plugin_class->deactivate = impl_deactivate;
+
+        g_type_class_add_private (klass, sizeof (GsdUpdatesPluginPrivate));
+}
+
+static void
+gsd_updates_plugin_class_finalize (GsdUpdatesPluginClass *klass)
+{
+}
+
diff --git a/plugins/updates/gsd-updates-plugin.h b/plugins/updates/gsd-updates-plugin.h
new file mode 100644
index 0000000..da1b8be
--- /dev/null
+++ b/plugins/updates/gsd-updates-plugin.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Richard Hughes <richard hughsie com>
+ *
+ * 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, 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 __GSD_UPDATES_PLUGIN_H__
+#define __GSD_UPDATES_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gmodule.h>
+
+#include "gnome-settings-plugin.h"
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_UPDATES_PLUGIN                (gsd_updates_plugin_get_type ())
+#define GSD_UPDATES_PLUGIN(o)                  (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPlugin))
+#define GSD_UPDATES_PLUGIN_CLASS(k)            (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPluginClass))
+#define GSD_IS_UPDATES_PLUGIN(o)               (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_UPDATES_PLUGIN))
+#define GSD_IS_UPDATES_PLUGIN_CLASS(k)         (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_UPDATES_PLUGIN))
+#define GSD_UPDATES_PLUGIN_GET_CLASS(o)        (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPluginClass))
+
+typedef struct GsdUpdatesPluginPrivate GsdUpdatesPluginPrivate;
+
+typedef struct
+{
+        GnomeSettingsPlugin parent;
+        GsdUpdatesPluginPrivate *priv;
+} GsdUpdatesPlugin;
+
+typedef struct
+{
+        GnomeSettingsPluginClass parent_class;
+} GsdUpdatesPluginClass;
+
+GType gsd_updates_plugin_get_type (void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* __GSD_UPDATES_PLUGIN_H__ */
diff --git a/plugins/updates/updates.gnome-settings-plugin.in b/plugins/updates/updates.gnome-settings-plugin.in
new file mode 100644
index 0000000..c8389a2
--- /dev/null
+++ b/plugins/updates/updates.gnome-settings-plugin.in
@@ -0,0 +1,8 @@
+[GNOME Settings Plugin]
+Module=updates
+IAge=0
+_Name=Updates
+_Description=Updates plugin
+Authors=Richard Hughes
+Copyright=Copyright © 2011
+Website=
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 35a56d1..b896f80 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,6 +9,7 @@ data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in
 data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
 data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
 data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in.in
+data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in
 data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in.in
 data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in.in
 data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index cca1528..4d927ff 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -13,6 +13,7 @@ data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in
+data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in
 data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in



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