From a8b75c6a2c0c0f0a7c96d698b282dd1900bf1aed Mon Sep 17 00:00:00 2001 From: Roman Moravcik Date: Thu, 6 May 2010 14:12:26 +0200 Subject: [PATCH] Added initial code of ukeyboard monitor (equivalent to hildon_im_keyboard_monitor.so) --- monitor/Makefile | 15 ++++++++ monitor/monitor.c | 81 +++++++++++++++++++++++++++++++++++++++ monitor/monitor.h | 53 +++++++++++++++++++++++++ monitor/ukeyboard-monitor.desktop | 5 +++ 4 files changed, 154 insertions(+) create mode 100644 monitor/Makefile create mode 100644 monitor/monitor.c create mode 100644 monitor/monitor.h create mode 100644 monitor/ukeyboard-monitor.desktop diff --git a/monitor/Makefile b/monitor/Makefile new file mode 100644 index 0000000..62809ef --- /dev/null +++ b/monitor/Makefile @@ -0,0 +1,15 @@ +all: libukeyboard-monitor.so + +libukeyboard-monitor.so: monitor.c + $(CC) -shared -Wall `pkg-config --cflags libhildondesktop-1` `pkg-config --libs libhildondesktop-1` -o $@ $< + +smlibdir = $(DESTDIR)`pkg-config libhildondesktop-1 --variable=hildondesktoplibdir` +smdeskdir = $(DESTDIR)`pkg-config libhildondesktop-1 --variable=hildonstatusmenudesktopentrydir` + +install: libukeyboard-monitor.so + install -d $(smlibdir) $(smdeskdir) + install libukeyboard-monitor.so $(smlibdir) + install -m 644 ukeyboard-monitor.desktop $(smdeskdir) + +clean: + rm -f *.o libukeyboard-monitor.so core diff --git a/monitor/monitor.c b/monitor/monitor.c new file mode 100644 index 0000000..48ce90c --- /dev/null +++ b/monitor/monitor.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2010 Roman Moravcik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#include +#include + +#include "../cpanel/prefs.h" +#include "monitor.h" + +#define GETTEXT_PACKAGE "osso-applet-textinput" +#include + +#define MONITOR_STATUS_MENU_ITEM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj, MONITOR_TYPE_STATUS_MENU_ITEM, MonitorStatusMenuItemPrivate)) + +struct _MonitorStatusMenuItemPrivate +{ + GConfClient *conf; +}; + +HD_DEFINE_PLUGIN_MODULE (MonitorStatusMenuItem, monitor_status_menu_item, HD_TYPE_STATUS_MENU_ITEM); + +static void +monitor_status_menu_item_class_finalize (MonitorStatusMenuItemClass *klass) +{ +} + +static void +monitor_status_menu_item_finalize (GObject *object) +{ + MonitorStatusMenuItem *item = MONITOR_STATUS_MENU_ITEM (object); + MonitorStatusMenuItemPrivate *priv = item->priv; + + if(priv->conf) { + g_object_unref (G_OBJECT (priv->conf)); + priv->conf = NULL; + } + + G_OBJECT_CLASS (monitor_status_menu_item_parent_class)->finalize (object); +} + +static void +monitor_status_menu_item_class_init (MonitorStatusMenuItemClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = monitor_status_menu_item_finalize; + + g_type_class_add_private (klass, sizeof (MonitorStatusMenuItemPrivate)); +} + +static void +monitor_status_menu_item_init (MonitorStatusMenuItem *item) +{ + MonitorStatusMenuItemPrivate *priv; + + priv = item->priv = MONITOR_STATUS_MENU_ITEM_GET_PRIVATE (item); + + priv->conf = gconf_client_get_default (); + if (!priv->conf) { + /* FIXME: error? */ + } + gconf_client_add_dir (priv->conf, IM_CONF_DIR, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); +} diff --git a/monitor/monitor.h b/monitor/monitor.h new file mode 100644 index 0000000..1b53497 --- /dev/null +++ b/monitor/monitor.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Roman Moravcik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MONITOR_STATUS_MENU_ITEM_H +#define MONITOR_STATUS_MENU_ITEM_H + +#include + +G_BEGIN_DECLS + +#define MONITOR_TYPE_STATUS_MENU_ITEM (monitor_status_menu_item_get_type ()) +#define MONITOR_STATUS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MONITOR_TYPE_STATUS_MENU_ITEM, MonitorStatusMenuItem)) +#define MONITOR_STATUS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MONITOR_TYPE_STATUS_MENU_ITEM, MonitorStatusMenuItemClass)) +#define MONITOR_IS_STATUS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MONITOR_TYPE_STATUS_MENU_ITEM)) +#define MONITOR_IS_STATUS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MONITOR_TYPE_STATUS_MENU_ITEM)) +#define MONITOR_STATUS_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MONITOR_TYPE_STATUS_MENU_ITEM, MonitorStatusMenuItemClass)) + +typedef struct _MonitorStatusMenuItem MonitorStatusMenuItem; +typedef struct _MonitorStatusMenuItemClass MonitorStatusMenuItemClass; +typedef struct _MonitorStatusMenuItemPrivate MonitorStatusMenuItemPrivate; + +struct _MonitorStatusMenuItem +{ + HDStatusMenuItem parent; + + MonitorStatusMenuItemPrivate *priv; +}; + +struct _MonitorStatusMenuItemClass +{ + HDStatusMenuItemClass parent; +}; + +GType monitor_status_menu_item_get_type (void); + +G_END_DECLS + +#endif + diff --git a/monitor/ukeyboard-monitor.desktop b/monitor/ukeyboard-monitor.desktop new file mode 100644 index 0000000..084a945 --- /dev/null +++ b/monitor/ukeyboard-monitor.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Name=Ukeyboard Monitor +Comment=Ukeyboard Monitor +Type=default +X-Path=libukeyboard-monitor.so -- 2.11.4.GIT