[empathy] add account-plugin-widget
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] add account-plugin-widget
- Date: Tue, 24 Jul 2012 14:37:39 +0000 (UTC)
commit e0edcddf9c31b788844b294aa94b7cd181c6662f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Jul 13 12:21:00 2012 +0200
add account-plugin-widget
https://bugzilla.gnome.org/show_bug.cgi?id=680448
.../cc-plugins/empathy-accounts-plugin-widget.c | 145 ++++++++++++++++++++
.../cc-plugins/empathy-accounts-plugin-widget.h | 76 ++++++++++
2 files changed, 221 insertions(+), 0 deletions(-)
---
diff --git a/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c b/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c
new file mode 100644
index 0000000..c19207a
--- /dev/null
+++ b/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c
@@ -0,0 +1,145 @@
+/*
+ * empathy-accounts-plugin-widget.c
+ *
+ * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "config.h"
+
+#include "empathy-accounts-plugin-widget.h"
+
+G_DEFINE_TYPE (EmpathyAccountsPluginWidget, empathy_accounts_plugin_widget, GTK_TYPE_BOX)
+
+enum
+{
+ PROP_ACCOUNT = 1,
+ N_PROPS
+};
+
+/*
+enum
+{
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+*/
+
+struct _EmpathyAccountsPluginWidgetPriv
+{
+ AgAccount *account;
+};
+
+static void
+empathy_accounts_plugin_widget_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyAccountsPluginWidget *self = EMPATHY_ACCOUNTS_PLUGIN_WIDGET (object);
+
+ switch (property_id)
+ {
+ case PROP_ACCOUNT:
+ g_value_set_object (value, self->priv->account);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+empathy_accounts_plugin_widget_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyAccountsPluginWidget *self = EMPATHY_ACCOUNTS_PLUGIN_WIDGET (object);
+
+ switch (property_id)
+ {
+ case PROP_ACCOUNT:
+ self->priv->account = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+empathy_accounts_plugin_widget_constructed (GObject *object)
+{
+ //EmpathyAccountsPluginWidget *self = EMPATHY_ACCOUNTS_PLUGIN_WIDGET (object);
+ void (*chain_up) (GObject *) =
+ ((GObjectClass *) empathy_accounts_plugin_widget_parent_class)->constructed;
+
+ if (chain_up != NULL)
+ chain_up (object);
+}
+
+static void
+empathy_accounts_plugin_widget_dispose (GObject *object)
+{
+ EmpathyAccountsPluginWidget *self = EMPATHY_ACCOUNTS_PLUGIN_WIDGET (object);
+ void (*chain_up) (GObject *) =
+ ((GObjectClass *) empathy_accounts_plugin_widget_parent_class)->dispose;
+
+ g_clear_object (&self->priv->account);
+
+ if (chain_up != NULL)
+ chain_up (object);
+}
+
+static void
+empathy_accounts_plugin_widget_class_init (
+ EmpathyAccountsPluginWidgetClass *klass)
+{
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+ GParamSpec *spec;
+
+ oclass->get_property = empathy_accounts_plugin_widget_get_property;
+ oclass->set_property = empathy_accounts_plugin_widget_set_property;
+ oclass->constructed = empathy_accounts_plugin_widget_constructed;
+ oclass->dispose = empathy_accounts_plugin_widget_dispose;
+
+ spec = g_param_spec_object ("account", "account",
+ "AgAccount",
+ AG_TYPE_ACCOUNT,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (oclass, PROP_ACCOUNT, spec);
+
+ g_type_class_add_private (klass, sizeof (EmpathyAccountsPluginWidgetPriv));
+}
+
+static void
+empathy_accounts_plugin_widget_init (EmpathyAccountsPluginWidget *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET, EmpathyAccountsPluginWidgetPriv);
+}
+
+GtkWidget *
+empathy_accounts_plugin_widget_new (AgAccount *account)
+{
+ return g_object_new (EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET,
+ "account", account,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ NULL);
+}
diff --git a/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.h b/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.h
new file mode 100644
index 0000000..17963e6
--- /dev/null
+++ b/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.h
@@ -0,0 +1,76 @@
+/*
+ * empathy-accounts-plugin-widget.h
+ *
+ * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#ifndef __EMPATHY_ACCOUNTS_PLUGIN_WIDGET_H__
+#define __EMPATHY_ACCOUNTS_PLUGIN_WIDGET_H__
+
+#include <gtk/gtk.h>
+
+#include <libaccounts-glib/ag-account.h>
+
+G_BEGIN_DECLS
+
+typedef struct _EmpathyAccountsPluginWidget EmpathyAccountsPluginWidget;
+typedef struct _EmpathyAccountsPluginWidgetClass EmpathyAccountsPluginWidgetClass;
+typedef struct _EmpathyAccountsPluginWidgetPriv EmpathyAccountsPluginWidgetPriv;
+
+struct _EmpathyAccountsPluginWidgetClass
+{
+ /*<private>*/
+ GtkBoxClass parent_class;
+};
+
+struct _EmpathyAccountsPluginWidget
+{
+ /*<private>*/
+ GtkBox parent;
+ EmpathyAccountsPluginWidgetPriv *priv;
+};
+
+GType empathy_accounts_plugin_widget_get_type (void);
+
+/* TYPE MACROS */
+#define EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET \
+ (empathy_accounts_plugin_widget_get_type ())
+#define EMPATHY_ACCOUNTS_PLUGIN_WIDGET(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET, \
+ EmpathyAccountsPluginWidget))
+#define EMPATHY_ACCOUNTS_PLUGIN_WIDGET_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET, \
+ EmpathyAccountsPluginWidgetClass))
+#define EMPATHY_IS_ACCOUNTS_PLUGIN_WIDGET(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET))
+#define EMPATHY_IS_ACCOUNTS_PLUGIN_WIDGET_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET))
+#define EMPATHY_ACCOUNTS_PLUGIN_WIDGET_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ EMPATHY_TYPE_ACCOUNTS_PLUGIN_WIDGET, \
+ EmpathyAccountsPluginWidgetClass))
+
+GtkWidget * empathy_accounts_plugin_widget_new (AgAccount *account);
+
+G_END_DECLS
+
+#endif /* #ifndef __EMPATHY_ACCOUNTS_PLUGIN_WIDGET_H__*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]