[maemo-commits] [maemo-commits] r12597 - in projects/haf/trunk/hildon-desktop: . debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Jul 2 16:14:37 EEST 2007
- Previous message: [maemo-commits] r12596 - projects/haf/tags/hildon-fm
- Next message: [maemo-commits] r12598 - in projects/haf/trunk/hildon-desktop: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: lucasr Date: 2007-07-02 16:14:24 +0300 (Mon, 02 Jul 2007) New Revision: 12597 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/configure.ac projects/haf/trunk/hildon-desktop/debian/control projects/haf/trunk/hildon-desktop/src/Makefile.am projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c Log: 2007-07-02 Lucas Rocha <lucas.rocha at nokia.com> * src/Makefile.am, configure.ac: added optional dependency on mce-dev to be used by the led pattern handling on switcher menu. * debian/control: added build dependency on mce-dev. * src/hd-switcher-menu.c (hd_switcher_menu_set_led_pattern, hd_switcher_menu_update_open, hd_switcher_menu_update_close): added support for "led-pattern" hint. If the hint is set, a D-Bus message is sent to MCE service for led pattern activation/deactivation. Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-07-02 12:56:07 UTC (rev 12596) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-07-02 13:14:24 UTC (rev 12597) @@ -1,3 +1,13 @@ +2007-07-02 Lucas Rocha <lucas.rocha at nokia.com> + + * src/Makefile.am, configure.ac: added optional dependency on mce-dev + to be used by the led pattern handling on switcher menu. + * debian/control: added build dependency on mce-dev. + * src/hd-switcher-menu.c (hd_switcher_menu_set_led_pattern, + hd_switcher_menu_update_open, hd_switcher_menu_update_close): added + support for "led-pattern" hint. If the hint is set, a D-Bus message is + sent to MCE service for led pattern activation/deactivation. + 2007-07-02 Johan Bilien <johan.bilien at nokia.com> * configure.ac: 0.0.20 Modified: projects/haf/trunk/hildon-desktop/configure.ac =================================================================== --- projects/haf/trunk/hildon-desktop/configure.ac 2007-07-02 12:56:07 UTC (rev 12596) +++ projects/haf/trunk/hildon-desktop/configure.ac 2007-07-02 13:14:24 UTC (rev 12597) @@ -146,6 +146,12 @@ AC_SUBST(HILDON_LIBS) AC_SUBST(HILDON_CFLAGS) +PKG_CHECK_MODULES(MCE, + [mce], + AC_DEFINE(HAVE_MCE, [], [Whether mce is present on the system]), + [AC_MSG_NOTICE([mce not present.])]) +AC_SUBST(MCE_CFLAGS) + PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6) AC_SUBST(GTK_LIBS) AC_SUBST(GTK_CFLAGS) Modified: projects/haf/trunk/hildon-desktop/debian/control =================================================================== --- projects/haf/trunk/hildon-desktop/debian/control 2007-07-02 12:56:07 UTC (rev 12596) +++ projects/haf/trunk/hildon-desktop/debian/control 2007-07-02 13:14:24 UTC (rev 12597) @@ -2,7 +2,7 @@ Section: x11 Priority: optional Maintainer: Johan Bilien <johan.bilien at nokia.com> -Build-Depends: debhelper (>= 4.0.0), libhildon1-dev | hildon-libs-dev, pkg-config, libosso-dev (>= 0.9.19), libosso-gnomevfs2-dev, osso-af-settings, libhildonfm2-dev | hildon-fm-dev, libhildonhelp-dev | libosso-help-dev, libxtst-dev, libxml2-dev, osso-esd-dev, libxdamage-dev, libxcomposite-dev, libsqlite3-dev +Build-Depends: debhelper (>= 4.0.0), libhildon1-dev | hildon-libs-dev, pkg-config, libosso-dev (>= 0.9.19), libosso-gnomevfs2-dev, osso-af-settings, libhildonfm2-dev | hildon-fm-dev, libhildonhelp-dev | libosso-help-dev, libxtst-dev, libxml2-dev, osso-esd-dev, libxdamage-dev, libsqlite3-dev, mce-dev Standards-Version: 3.6.0 Package: hildon-desktop Modified: projects/haf/trunk/hildon-desktop/src/Makefile.am =================================================================== --- projects/haf/trunk/hildon-desktop/src/Makefile.am 2007-07-02 12:56:07 UTC (rev 12596) +++ projects/haf/trunk/hildon-desktop/src/Makefile.am 2007-07-02 13:14:24 UTC (rev 12597) @@ -14,6 +14,7 @@ $(HILDON_FM_CFLAGS) \ $(OSSO_CFLAGS) \ $(HILDON_HELP_CFLAGS) \ + $(MCE_CFLAGS) \ $(GCONF_CFLAGS) \ $(LIBXML_CFLAGS) \ $(GNOME_VFS_CFLAGS) \ Modified: projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c =================================================================== --- projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c 2007-07-02 12:56:07 UTC (rev 12596) +++ projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c 2007-07-02 13:14:24 UTC (rev 12597) @@ -41,12 +41,18 @@ #include <X11/Xutil.h> #include <X11/Xatom.h> +#include <dbus/dbus.h> + #ifdef HAVE_LIBHILDON #include <hildon/hildon-note.h> #else #include <hildon-widgets/hildon-note.h> #endif +#ifdef HAVE_MCE +#include <mce/dbus-names.h> +#endif + #include <gtk/gtkimage.h> #include <libhildondesktop/hildon-desktop-popup-window.h> #include <libhildondesktop/hildon-desktop-popup-menu.h> @@ -390,8 +396,76 @@ return TRUE; } +#ifdef HAVE_MCE +static void +hd_switcher_menu_set_led_pattern (const gchar *pattern, gboolean activate) +{ + DBusConnection *sys_conn = dbus_bus_get (DBUS_BUS_SYSTEM, NULL); + + g_return_if_fail (pattern != NULL); + + DBusMessage *message = + dbus_message_new_method_call (MCE_SERVICE, + MCE_REQUEST_PATH, + MCE_REQUEST_IF, + (activate ? MCE_ACTIVATE_LED_PATTERN : + MCE_DEACTIVATE_LED_PATTERN)); + + dbus_message_append_args (message, + DBUS_TYPE_STRING, &pattern, + DBUS_TYPE_INVALID); + + dbus_message_set_no_reply (message, TRUE); + + dbus_connection_send (sys_conn, message, NULL); + dbus_connection_flush (sys_conn); + + dbus_message_unref (message); + dbus_connection_unref (sys_conn); +} +#endif + +static void +hd_switcher_menu_update_open (HildonDesktopPopupWindow *window, + HDSwitcherMenu *switcher) +{ +#ifdef HAVE_MCE + GList *children, *l; + + children = hildon_desktop_popup_menu_get_children (switcher->priv->menu_notifications); + + for (l = children; l != NULL; l = g_list_next (l)) + { + if (HD_IS_SWITCHER_MENU_ITEM (l->data)) + { + GtkTreeIter iter; + GHashTable *hints; + GValue *hint; + + guint id = + hd_switcher_menu_item_get_notification_id (HD_SWITCHER_MENU_ITEM (l->data)); + + if (hildon_desktop_notification_manager_find_by_id (switcher->nm, id, &iter)) + { + gtk_tree_model_get (GTK_TREE_MODEL (switcher->nm), + &iter, + HD_NM_COL_HINTS, &hints, + -1); + + hint = g_hash_table_lookup (hints, "led-pattern"); + + if (hint) + hd_switcher_menu_set_led_pattern (g_value_get_string (hint), FALSE); + } + } + } +#endif + + hd_switcher_menu_scroll_to (window, switcher); +} + static void -hd_switcher_menu_update_open (HildonDesktopPopupWindow *window, HDSwitcherMenu *switcher) +hd_switcher_menu_update_close (HildonDesktopPopupWindow *window, HDSwitcherMenu *switcher) { GList *children = NULL, *l; @@ -572,7 +646,7 @@ g_signal_connect (switcher->priv->popup_window, "popdown-window", - G_CALLBACK (hd_switcher_menu_update_open), + G_CALLBACK (hd_switcher_menu_update_close), (gpointer)switcher); g_signal_connect (switcher->priv->menu_applications, @@ -592,7 +666,7 @@ g_signal_connect (switcher->priv->popup_window, "popup-window", - G_CALLBACK (hd_switcher_menu_scroll_to), + G_CALLBACK (hd_switcher_menu_update_open), (gpointer)switcher); g_signal_connect (switcher->hdwm, @@ -1139,10 +1213,6 @@ adj = hildon_desktop_popup_menu_get_adjustment (switcher->priv->menu_notifications); gtk_adjustment_set_value (adj, adj->upper - adj->page_size); -/* if (adj->upper > adj->page_size) - gtk_adjustment_set_value (adj, adj->upper - adj->page_size); - else - gtk_adjustment_set_value (adj, adj->upper);*/ } static void @@ -1725,6 +1795,15 @@ sample_id); } +#ifdef HAVE_MCE + hint = g_hash_table_lookup (hints, "led-pattern"); + + if (hint) + { + hd_switcher_menu_set_led_pattern (g_value_get_string (hint), TRUE); + } +#endif + /* if (switcher->priv->last_iter_added == NULL) hd_switcher_menu_notification_deleted_cb
- Previous message: [maemo-commits] r12596 - projects/haf/tags/hildon-fm
- Next message: [maemo-commits] r12598 - in projects/haf/trunk/hildon-desktop: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]