[maemo-commits] [maemo-commits] r10201 - in projects/haf/trunk/hildon-desktop: . libhildonwm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Feb 26 14:06:15 EET 2007
- Previous message: [maemo-commits] r10200 - projects/haf/tags/fontconfig
- Next message: [maemo-commits] r10202 - projects/haf/trunk/hildon-base-lib/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jobi Date: 2007-02-26 14:06:14 +0200 (Mon, 26 Feb 2007) New Revision: 10201 Removed: projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.c projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.h Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am projects/haf/trunk/hildon-desktop/libhildonwm/hd-keys.c projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watchable-app.c projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watched-window.c projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c projects/haf/trunk/hildon-desktop/libhildonwm/libhildonwm.pc.in Log: 2007-02-26 Johan Bilien <johan.bilien at nokia.com> * libhildonwm/hd-keys.c: Use DBus directly for sending message to MCE. * libhildonwm/osso-manager.[ch]: Removed unused file * libhildonwm/Makefile.am, libhildonwm/libhildonwm.pc.in: libhildonwm doesn't depend on libosso anymore Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-02-26 12:06:14 UTC (rev 10201) @@ -1,7 +1,10 @@ -2007-02-26 Lucas Rocha <lucas.rocha at nokia.com> +2007-02-26 Johan Bilien <johan.bilien at nokia.com> - * src/hn-app-button.c: return TRUE on button press handler to fix - miss-behavior when clicking on app button. + * libhildonwm/hd-keys.c: Use DBus directly for sending message + to MCE. + * libhildonwm/osso-manager.[ch]: Removed unused file + * libhildonwm/Makefile.am, libhildonwm/libhildonwm.pc.in: + libhildonwm doesn't depend on libosso anymore 2007-02-23 Moises Martinez <moises.martinez at nokia.com> Modified: projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am 2007-02-26 12:06:14 UTC (rev 10201) @@ -11,8 +11,7 @@ hd-wm-watchable-app.h \ hd-wm-watched-window-view.h \ hd-wm-watched-window.h \ - hd-wm.h \ - osso-manager.h + hd-wm.h EXTRA_DIST = .empty @@ -21,10 +20,10 @@ $(HILDON_CFLAGS) \ $(GCONF_CFLAGS) \ $(GNOME_VFS_CFLAGS) \ - $(OSSO_CFLAGS) \ $(LIBXML_CFLAGS) \ $(XLIBS_CFLAGS) \ $(XTEST_CFLAGS) \ + $(DBUS_CFLAGS) \ -DLOCALEDIR=\"$(localedir)\" \ -DDESKTOPENTRYDIR=\"$(hildondesktopentrydir)\" @@ -49,16 +48,15 @@ hd-wm-watched-window.c \ hd-wm-watched-window-view.c \ hd-wm-watchable-app.c \ - hd-entry-info.c \ - osso-manager.c + hd-entry-info.c libhildonwm_la_LIBADD = \ - $(OSSO_LIBS) \ $(HILDON_LIBS) \ $(HILDONBASELIB_LIBS) \ $(GCONF_LIBS) \ $(GNOME_VFS_LIBS) \ $(XLIBS_LIBS) \ - $(XTEST_LIBS) + $(XTEST_LIBS) \ + $(DBUS_LIBS) CLEANFILES = *~ Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-keys.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/hd-keys.c 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-keys.c 2007-02-26 12:06:14 UTC (rev 10201) @@ -25,13 +25,15 @@ #include "hd-keys.h" #include "hd-wm.h" #include "hd-wm-watched-window.h" -#include "osso-manager.h" #include <X11/keysymdef.h> #include <X11/keysym.h> #include <X11/extensions/XTest.h> #include <glib.h> +#define DBUS_API_SUBJECT_TO_CHANGE +#include <dbus/dbus.h> + /** The MCE DBus service */ #define MCE_SERVICE "com.nokia.mce" @@ -158,29 +160,34 @@ hd_keys_action_power (HDKeysConfig *keys, gpointer *user_data) { -#ifdef HAVE_LIBOSSO - osso_rpc_t retval; + DBusConnection *connection; + DBusError error; + DBusMessage *msg = NULL; + gboolean long_press = GPOINTER_TO_INT(user_data); - osso_context_t * osso_context = - get_context(osso_manager_singleton_get_instance()); - - gboolean long_press = GPOINTER_TO_INT(user_data); - - if (!osso_context || - OSSO_OK != osso_rpc_run_system (osso_context, - MCE_SERVICE, - MCE_REQUEST_PATH, - MCE_REQUEST_IF, - MCE_TRIGGER_POWERKEY_EVENT_REQ, - &retval, - DBUS_TYPE_BOOLEAN, long_press, - DBUS_TYPE_INVALID)) - { - g_warning ("Unable to toggle Power menu"); - } -#else - g_warning ("Power key shortcut presses"); -#endif + dbus_error_init (&error); + connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); + + if (dbus_error_is_set (&error)) + { + g_warning ("Could not acquire the DBus system bus: %s", error.message); + dbus_error_free (&error); + return; + } + + g_return_if_fail (connection); + + msg = dbus_message_new_method_call (MCE_SERVICE, + MCE_REQUEST_PATH, + MCE_REQUEST_IF, + MCE_TRIGGER_POWERKEY_EVENT_REQ); + + dbus_message_append_args (msg, + DBUS_TYPE_BOOLEAN, + long_press, + DBUS_TYPE_INVALID); + + dbus_connection_send (connection, msg, NULL); } struct Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watchable-app.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watchable-app.c 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watchable-app.c 2007-02-26 12:06:14 UTC (rev 10201) @@ -47,8 +47,9 @@ #include "hd-wm-watchable-app.h" #include "hd-wm-watched-window.h" #include "hd-entry-info.h" -#include "osso-manager.h" +#define SERVICE_PREFIX "com.nokia." + typedef char HDWMWatchableAppFlags; typedef enum Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watched-window.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watched-window.c 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm-watched-window.c 2007-02-26 12:06:14 UTC (rev 10201) @@ -48,7 +48,6 @@ #include "hd-wm-watched-window-view.h" #include "hd-wm-watchable-app.h" #include "hd-entry-info.h" -#include "osso-manager.h" #define _(o) o Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c 2007-02-26 12:06:14 UTC (rev 10201) @@ -64,7 +64,6 @@ #include "hd-wm-watched-window-view.h" #include "hd-wm-memory.h" #include "hd-entry-info.h" -#include "osso-manager.h" #include "hd-wm-marshalers.h" @@ -102,6 +101,17 @@ #define HOME_LONG_PRESS "sig_home_key_pressed_long_ind" #define HOME_PRESS "sig_home_key_pressed_ind" +/* DBus identifier lengths */ +#define SERVICE_NAME_LEN 255 +#define PATH_NAME_LEN 255 +#define INTERFACE_NAME_LEN 255 +#define TMP_NAME_LEN 255 + +/* DBus OSSO default path */ +#define OSSO_BUS_ROOT "com.nokia" +#define OSSO_BUS_ROOT_PATH "/com/nokia" +#define OSSO_BUS_TOP "top_application" + #define LAUNCH_SUCCESS_TIMEOUT 20 #define HD_WM_GET_PRIVATE(o) \ Modified: projects/haf/trunk/hildon-desktop/libhildonwm/libhildonwm.pc.in =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/libhildonwm.pc.in 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/libhildonwm.pc.in 2007-02-26 12:06:14 UTC (rev 10201) @@ -6,7 +6,7 @@ Name: libhildonwm Description: Hildon WM Lib -Requires: hildon-1 libxml-2.0 x11 xtst libosso +Requires: hildon-1 libxml-2.0 x11 xtst Version: @VERSION@ -Libs: -L${libdir} -lhildonwm -lX11 -lXtst -losso +Libs: -L${libdir} -lhildonwm -lX11 -lXtst Cflags: -I${includedir} Deleted: projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.c 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.c 2007-02-26 12:06:14 UTC (rev 10201) @@ -1,161 +0,0 @@ -/* - * This file is part of maemo-af-desktop - * - * Copyright (C) 2005 Nokia Corporation. - * - * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * 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 - * - */ - - -/* - * - * @file osso-manager.c - * - */ - - -/* System includes */ -#include <glib.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> - -#define DBUS_API_SUBJECT_TO_CHANGE -#include <dbus/dbus.h> - -/* hildon includes */ -#include "osso-manager.h" - - - -static int start_osso(osso_manager_t *man, GMainContext *context); -#ifdef HAVE_LIBOSSO -static int osso_callback(const gchar *interface, - const gchar *method, - GArray *arguments, - gpointer data, - osso_rpc_t *retval); -#endif - - -static int start_osso(osso_manager_t *man, GMainContext *context) -{ -#ifdef HAVE_LIBOSSO - if (man->osso != NULL) - return -1; - - man->osso = osso_initialize(TASKNAV,TASKNAV_VERSION,FALSE,NULL); - - if (!man->osso) - { - g_warning ("Could not initialize osso from task nav. DBUS running ?"); - - return -1; - - } - osso_rpc_set_default_cb_f(man->osso,(osso_rpc_cb_f*)osso_callback,man); -#endif - return 0; -} - - -osso_manager_t *osso_manager_singleton_get_instance( void ) -{ - static osso_manager_t *instance =NULL; - - - if (!instance) - { - instance = g_malloc0(sizeof(osso_manager_t)); - - instance->methods = g_array_new(FALSE,TRUE,sizeof(osso_method)); - - if (start_osso(instance, NULL)) - { - g_warning ("Could not connect to osso"); - return NULL; - } - } - - - return instance; -} - -#ifdef HAVE_LIBOSSO -static int osso_callback(const gchar *interface, - const gchar *method, - GArray *arguments, - gpointer data, - osso_rpc_t *retval) -{ - - osso_manager_t *man; - int n; - - man = (osso_manager_t *)data; - - retval->type = DBUS_TYPE_INVALID; - - - - for ( n=0;n< man->methods->len;n++) - { - osso_method *met; - met = &g_array_index(man->methods,osso_method,n); - if (!strncmp(method,met->name,METHOD_NAME_LEN)) - { - - if (met->method(arguments,met->data) == OSSO_ERROR) - { - retval->type = DBUS_TYPE_STRING; /* err */ - retval->value.s = "Error in callback method!\n"; - g_warning ("Callback method %s failed\n",method); - return OSSO_ERROR; - } - break; - } - } - - - if (n == man->methods->len) - { - retval->type = DBUS_TYPE_STRING; /* err */ - retval->value.s = "Unknown method called!\n"; - - return OSSO_ERROR; - } - - retval->type = DBUS_TYPE_INT32; - retval->value.i = 0; - - return OSSO_OK; -} -#endif - -void add_method_cb(osso_manager_t *man,const gchar *name, - tasknav_cb_f *method,gpointer data) -{ - osso_method met; - - g_snprintf(met.name,METHOD_NAME_LEN,"%s",name); - met.method = method; - met.data = data; - - g_array_append_val(man->methods,met); -} - Deleted: projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.h =================================================================== --- projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.h 2007-02-26 11:55:00 UTC (rev 10200) +++ projects/haf/trunk/hildon-desktop/libhildonwm/osso-manager.h 2007-02-26 12:06:14 UTC (rev 10201) @@ -1,118 +0,0 @@ -/* - * This file is part of maemo-af-desktop - * - * Copyright (C) 2005 Nokia Corporation. - * - * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * 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 - * - */ - -/** -* @file osso-manager.h -*/ - -#ifndef OSSO_MANAGER_H -#define OSSO_MANAGER_H - -#ifdef HAVE_LIBOSSO -#include <libosso.h> -#endif -#include <X11/Xlib.h> - -#define APP_NAME_LEN 64 - -#define OSSO_BUS_ROOT "com.nokia" -#define OSSO_BUS_ROOT_PATH "/com/nokia" -#define OSSO_BUS_TOP "top_application" - -#define TASKNAV "tasknav" -#define TASKNAV_VERSION "0.1" - -#define METHOD_NAME_LEN 64 - -#define SERVICE_PREFIX "com.nokia." - -#define SERVICE_NAME_LEN 255 -#define PATH_NAME_LEN 255 -#define INTERFACE_NAME_LEN 255 -#define TMP_NAME_LEN 255 - -#define DBUS_BUF_SIZE 128 - -typedef struct osso_manager osso_manager_t; - -G_BEGIN_DECLS - -struct osso_manager { -#ifdef HAVE_LIBOSSO - osso_context_t *osso; -#endif - GArray *methods; - Window window; -}; - - - -/** Call back function pointer type used by plugins to listen to - * the messages from DBUS. - * - * @param arguments The argument table from DBUS as specified un - * libosso.h - * @param data The data pointer passed to the add_method_cb - * - * @return 0 on success, -1 on error - */ -typedef int (tasknav_cb_f)(GArray *arguments, gpointer data); - -typedef struct osso_method { - gchar name[METHOD_NAME_LEN]; - tasknav_cb_f *method; - gpointer data; -} osso_method; - -typedef struct { - gchar name[APP_NAME_LEN]; -} app_name_t; - - - - -/** Returns a global instance of the osso manager. - * - */ -osso_manager_t *osso_manager_singleton_get_instance( void ); - -/** Used by plugins to add a listener method for DBUS - * messags. - * @param manager Osso manager as returned by - * osso_manager_singleton_get_instance - * @param methodname The name of the method visible to the - * DBUS - * @param method A pointer to the callback method to call. - * @param data A data pointer to be passed to the method called - */ -void add_method_cb(osso_manager_t *manager, - const gchar *methodname, - tasknav_cb_f *method, - gpointer data); - - -/** Getter for the osso context */ - -G_END_DECLS - -#endif /* OSSO_MANAGER_H */
- Previous message: [maemo-commits] r10200 - projects/haf/tags/fontconfig
- Next message: [maemo-commits] r10202 - projects/haf/trunk/hildon-base-lib/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]