Version bump (2.5-2)
[ukeyboard.git] / monitor / monitor.c
blob48ce90cf3a7d2e831e94a033497cdb1d95b29586
1 /*
2 * Copyright (c) 2010 Roman Moravcik <roman.moravcik@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #include <string.h>
19 #include <gtk/gtk.h>
20 #include <hildon/hildon.h>
22 #include <gconf/gconf.h>
23 #include <gconf/gconf-client.h>
25 #include "../cpanel/prefs.h"
26 #include "monitor.h"
28 #define GETTEXT_PACKAGE "osso-applet-textinput"
29 #include <glib/gi18n-lib.h>
31 #define MONITOR_STATUS_MENU_ITEM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj, MONITOR_TYPE_STATUS_MENU_ITEM, MonitorStatusMenuItemPrivate))
33 struct _MonitorStatusMenuItemPrivate
35 GConfClient *conf;
38 HD_DEFINE_PLUGIN_MODULE (MonitorStatusMenuItem, monitor_status_menu_item, HD_TYPE_STATUS_MENU_ITEM);
40 static void
41 monitor_status_menu_item_class_finalize (MonitorStatusMenuItemClass *klass)
45 static void
46 monitor_status_menu_item_finalize (GObject *object)
48 MonitorStatusMenuItem *item = MONITOR_STATUS_MENU_ITEM (object);
49 MonitorStatusMenuItemPrivate *priv = item->priv;
51 if(priv->conf) {
52 g_object_unref (G_OBJECT (priv->conf));
53 priv->conf = NULL;
56 G_OBJECT_CLASS (monitor_status_menu_item_parent_class)->finalize (object);
59 static void
60 monitor_status_menu_item_class_init (MonitorStatusMenuItemClass *klass)
62 GObjectClass *object_class = G_OBJECT_CLASS (klass);
64 object_class->finalize = monitor_status_menu_item_finalize;
66 g_type_class_add_private (klass, sizeof (MonitorStatusMenuItemPrivate));
69 static void
70 monitor_status_menu_item_init (MonitorStatusMenuItem *item)
72 MonitorStatusMenuItemPrivate *priv;
74 priv = item->priv = MONITOR_STATUS_MENU_ITEM_GET_PRIVATE (item);
76 priv->conf = gconf_client_get_default ();
77 if (!priv->conf) {
78 /* FIXME: error? */
80 gconf_client_add_dir (priv->conf, IM_CONF_DIR, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);