]> git.0d.be Git - empathy.git/blob - src/cc-empathy-accounts-panel.c
Updated Polish translation
[empathy.git] / src / cc-empathy-accounts-panel.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2  *
3  * Copyright (C) 2010 Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include "config.h"
21
22 #include <stdlib.h>
23 #include <stdio.h>
24
25 #include <gtk/gtk.h>
26 #include <gio/gio.h>
27 #include <glib/gi18n-lib.h>
28
29 #include <gconf/gconf-client.h>
30
31 #include "cc-empathy-accounts-panel.h"
32 #include "cc-empathy-accounts-page.h"
33
34 #define CC_EMPATHY_ACCOUNTS_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_EMPATHY_ACCOUNTS_PANEL, CcEmpathyAccountsPanelPrivate))
35
36 struct CcEmpathyAccountsPanelPrivate
37 {
38   CcPage *empathy_accounts_page;
39 };
40
41 G_DEFINE_DYNAMIC_TYPE (CcEmpathyAccountsPanel, cc_empathy_accounts_panel, CC_TYPE_PANEL)
42
43 static void
44 setup_panel (CcEmpathyAccountsPanel *panel)
45 {
46   panel->priv->empathy_accounts_page = cc_empathy_accounts_page_new ();
47
48   gtk_container_add (GTK_CONTAINER (panel),
49       GTK_WIDGET (panel->priv->empathy_accounts_page));
50
51   gtk_widget_show (GTK_WIDGET (panel->priv->empathy_accounts_page));
52
53   g_object_set (panel,
54       "current-page", panel->priv->empathy_accounts_page,
55       NULL);
56 }
57
58 static GObject *
59 cc_empathy_accounts_panel_constructor (GType type,
60     guint n_construct_properties,
61     GObjectConstructParam *construct_properties)
62 {
63   CcEmpathyAccountsPanel *empathy_accounts_panel;
64
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));
68
69   g_object_set (empathy_accounts_panel,
70       "display-name", _("Messaging and VoIP Accounts"),
71       "id", "empathy-accounts.desktop",
72       NULL);
73
74   setup_panel (empathy_accounts_panel);
75
76   return G_OBJECT (empathy_accounts_panel);
77 }
78
79 static void
80 cc_empathy_accounts_panel_finalize (GObject *object)
81 {
82   CcEmpathyAccountsPanel *empathy_accounts_panel;
83
84   g_return_if_fail (object != NULL);
85   g_return_if_fail (CC_IS_EMPATHY_ACCOUNTS_PANEL (object));
86
87   empathy_accounts_panel = CC_EMPATHY_ACCOUNTS_PANEL (object);
88
89   g_return_if_fail (empathy_accounts_panel->priv != NULL);
90
91   g_object_unref (empathy_accounts_panel->priv->empathy_accounts_page);
92
93   G_OBJECT_CLASS (cc_empathy_accounts_panel_parent_class)->finalize (object);
94 }
95
96 static void
97 cc_empathy_accounts_panel_class_init (CcEmpathyAccountsPanelClass *klass)
98 {
99   GObjectClass  *object_class = G_OBJECT_CLASS (klass);
100
101   object_class->constructor = cc_empathy_accounts_panel_constructor;
102   object_class->finalize = cc_empathy_accounts_panel_finalize;
103
104   g_type_class_add_private (klass, sizeof (CcEmpathyAccountsPanelPrivate));
105 }
106
107 static void
108 cc_empathy_accounts_panel_class_finalize (CcEmpathyAccountsPanelClass *klass)
109 {
110 }
111
112 static void
113 cc_empathy_accounts_panel_init (CcEmpathyAccountsPanel *panel)
114 {
115   GConfClient *client;
116
117   panel->priv = CC_EMPATHY_ACCOUNTS_PANEL_GET_PRIVATE (panel);
118
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);
125 }
126
127 void
128 cc_empathy_accounts_panel_register (GIOModule *module)
129 {
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);
133 }