summaryrefslogtreecommitdiff
path: root/ubuntu-online-accounts
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-13 12:21:00 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-24 16:20:03 +0200
commite0edcddf9c31b788844b294aa94b7cd181c6662f (patch)
treedeadec0966528adb4ff5ef4cc2168b9106a79271 /ubuntu-online-accounts
parent03e6158d3cfb683e4c837de9c2d54cfe8cb4515a (diff)
add account-plugin-widget
https://bugzilla.gnome.org/show_bug.cgi?id=680448
Diffstat (limited to 'ubuntu-online-accounts')
-rw-r--r--ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c145
-rw-r--r--ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.h76
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 00000000..c19207a2
--- /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 00000000..17963e65
--- /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__*/