[maemo-commits] [maemo-commits] r10225 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Feb 27 14:24:45 EET 2007
- Previous message: [maemo-commits] r10224 - projects/haf/trunk/tarballs
- Next message: [maemo-commits] r10226 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: moimart Date: 2007-02-27 14:24:45 +0200 (Tue, 27 Feb 2007) New Revision: 10225 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h Log: * libhildondesktop/hildon-desktop-notification-manager.c: - Added support for assigning id and self-replacing of notifications. - Implemented close_notification_handler * ChangeLog updated. Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-02-27 12:17:05 UTC (rev 10224) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-02-27 12:24:45 UTC (rev 10225) @@ -1,3 +1,9 @@ +2007-02-27 Moises Martinez <moises.martinez at nokia.com> + + * libhildondesktop/hildon-desktop-notification-manager.c: + - Added support for assigning id and self-replacing of notifications. + - Implemented close_notification_handler + 2007-02-27 Lucas Rocha <lucas.rocha at nokia.com> * src/hn-app-button.c: translate the app name to show it in the app Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c 2007-02-27 12:17:05 UTC (rev 10224) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c 2007-02-27 12:24:45 UTC (rev 10225) @@ -42,6 +42,11 @@ #define HILDON_DESKTOP_NOTIFICATION_MANAGER_ICON_SIZE 48 +struct _HildonDesktopNotificationManagerPrivate +{ + guint current_id; +}; + static void hildon_desktop_notification_manager_init (HildonDesktopNotificationManager *nm) { @@ -52,7 +57,7 @@ GType _types[9] = { G_TYPE_STRING, - G_TYPE_INT, + G_TYPE_UINT, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, @@ -62,6 +67,10 @@ G_TYPE_INT }; + nm->priv = HILDON_DESKTOP_NOTIFICATION_MANAGER_GET_PRIVATE (nm); + + nm->priv->current_id = 0; + gtk_list_store_set_column_types (GTK_LIST_STORE (nm), 9, _types); @@ -112,6 +121,7 @@ static void hildon_desktop_notification_manager_class_init (HildonDesktopNotificationManagerClass *class) { + g_type_class_add_private (class, sizeof (HildonDesktopNotificationManagerPrivate)); } static gboolean @@ -127,6 +137,35 @@ return FALSE; } +static gboolean +hildon_desktop_notification_manager_find_by_id (HildonDesktopNotificationManager *nm, + guint id, + GtkTreeIter *return_iter) +{ + GtkTreeIter iter; + guint iter_id = 0; + + if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (nm), &iter)) + return FALSE; + + do + { + gtk_tree_model_get (GTK_TREE_MODEL (nm), + &iter, + HD_NM_COL_ID, + &iter_id, + -1); + if (iter_id == id) + { + *return_iter = iter; + return TRUE; + } + } + while (gtk_tree_model_iter_next (GTK_TREE_MODEL (nm), &iter)); + + return FALSE; +} + GtkListStore * hildon_desktop_notification_manager_get_singleton (void) { @@ -155,6 +194,14 @@ GdkPixbuf *pixbuf = NULL; GtkIconTheme *icon_theme; + if (id == 0) + { + id = ++nm->priv->current_id; + + if (nm->priv->current_id == G_MAXUINT) + nm->priv->current_id = 0; + } + if (!g_str_equal (icon, "")) { if (g_file_test (icon, G_FILE_TEST_EXISTS)) @@ -186,7 +233,9 @@ } } - gtk_list_store_append (GTK_LIST_STORE (nm), &iter); + if (!hildon_desktop_notification_manager_find_by_id (nm, id, &iter)) + gtk_list_store_append (GTK_LIST_STORE (nm), &iter); + gtk_list_store_set (GTK_LIST_STORE (nm), &iter, HD_NM_COL_APPNAME, app_name, @@ -249,7 +298,13 @@ guint id, GError **error) { - g_debug ("CALLING CLOSE NOTIFICATION"); + GtkTreeIter iter; - return TRUE; + if (hildon_desktop_notification_manager_find_by_id (nm,id,&iter)) + { + gtk_list_store_remove (GTK_LIST_STORE (nm), &iter); + return TRUE; + } + else + return FALSE; } Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h 2007-02-27 12:17:05 UTC (rev 10224) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h 2007-02-27 12:24:45 UTC (rev 10225) @@ -75,24 +75,24 @@ GtkListStore *hildon_desktop_notification_manager_get_singleton (void); gboolean hildon_desktop_notification_manager_notify_handler (HildonDesktopNotificationManager *nm, - const gchar *app_name, - guint id, - const gchar *icon, - const gchar *summary, - const gchar *body, - gchar **actions, - GHashTable *hints, - gint timeout, - DBusGMethodInvocation *context); + const gchar *app_name, + guint id, + const gchar *icon, + const gchar *summary, + const gchar *body, + gchar **actions, + GHashTable *hints, + gint timeout, + DBusGMethodInvocation *context); gboolean hildon_desktop_notification_manager_get_capabilities (HildonDesktopNotificationManager *nm, - gchar ***caps); + gchar ***caps); gboolean hildon_desktop_notification_manager_get_server_info (HildonDesktopNotificationManager *nm, - gchar **out_name, - gchar **out_vendor, - gchar **out_version, - gchar **out_spec_ver); + gchar **out_name, + gchar **out_vendor, + gchar **out_version, + gchar **out_spec_ver); gboolean hildon_desktop_notification_manager_close_notification_handler (HildonDesktopNotificationManager *nm, guint id, GError **error);
- Previous message: [maemo-commits] r10224 - projects/haf/trunk/tarballs
- Next message: [maemo-commits] r10226 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]