1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
3 * Copyright (C) 2010 Red Hat, Inc.
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <glib/gi18n-lib.h>
29 #include <gconf/gconf-client.h>
31 #include "cc-empathy-accounts-panel.h"
32 #include "cc-empathy-accounts-page.h"
34 #define CC_EMPATHY_ACCOUNTS_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_EMPATHY_ACCOUNTS_PANEL, CcEmpathyAccountsPanelPrivate))
36 struct CcEmpathyAccountsPanelPrivate
38 CcPage *empathy_accounts_page;
41 G_DEFINE_DYNAMIC_TYPE (CcEmpathyAccountsPanel, cc_empathy_accounts_panel, CC_TYPE_PANEL)
44 setup_panel (CcEmpathyAccountsPanel *panel)
46 panel->priv->empathy_accounts_page = cc_empathy_accounts_page_new ();
48 gtk_container_add (GTK_CONTAINER (panel),
49 GTK_WIDGET (panel->priv->empathy_accounts_page));
51 gtk_widget_show (GTK_WIDGET (panel->priv->empathy_accounts_page));
54 "current-page", panel->priv->empathy_accounts_page,
59 cc_empathy_accounts_panel_constructor (GType type,
60 guint n_construct_properties,
61 GObjectConstructParam *construct_properties)
63 CcEmpathyAccountsPanel *empathy_accounts_panel;
65 empathy_accounts_panel = CC_EMPATHY_ACCOUNTS_PANEL (
66 G_OBJECT_CLASS (cc_empathy_accounts_panel_parent_class)->constructor (
67 type, n_construct_properties, construct_properties));
69 g_object_set (empathy_accounts_panel,
70 "display-name", _("Messaging and VoIP Accounts"),
71 "id", "empathy-accounts.desktop",
74 setup_panel (empathy_accounts_panel);
76 return G_OBJECT (empathy_accounts_panel);
80 cc_empathy_accounts_panel_finalize (GObject *object)
82 CcEmpathyAccountsPanel *empathy_accounts_panel;
84 g_return_if_fail (object != NULL);
85 g_return_if_fail (CC_IS_EMPATHY_ACCOUNTS_PANEL (object));
87 empathy_accounts_panel = CC_EMPATHY_ACCOUNTS_PANEL (object);
89 g_return_if_fail (empathy_accounts_panel->priv != NULL);
91 g_object_unref (empathy_accounts_panel->priv->empathy_accounts_page);
93 G_OBJECT_CLASS (cc_empathy_accounts_panel_parent_class)->finalize (object);
97 cc_empathy_accounts_panel_class_init (CcEmpathyAccountsPanelClass *klass)
99 GObjectClass *object_class = G_OBJECT_CLASS (klass);
101 object_class->constructor = cc_empathy_accounts_panel_constructor;
102 object_class->finalize = cc_empathy_accounts_panel_finalize;
104 g_type_class_add_private (klass, sizeof (CcEmpathyAccountsPanelPrivate));
108 cc_empathy_accounts_panel_class_finalize (CcEmpathyAccountsPanelClass *klass)
113 cc_empathy_accounts_panel_init (CcEmpathyAccountsPanel *panel)
117 panel->priv = CC_EMPATHY_ACCOUNTS_PANEL_GET_PRIVATE (panel);
119 client = gconf_client_get_default ();
120 gconf_client_add_dir (client, "/desktop/gnome/peripherals/empathy_accounts",
121 GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
122 gconf_client_add_dir (client, "/desktop/gnome/interface",
123 GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
124 g_object_unref (client);
128 cc_empathy_accounts_panel_register (GIOModule *module)
130 cc_empathy_accounts_panel_register_type (G_TYPE_MODULE (module));
131 g_io_extension_point_implement (CC_PANEL_EXTENSION_POINT_NAME,
132 CC_TYPE_EMPATHY_ACCOUNTS_PANEL, "empathy-accounts", 10);