[maemo-commits] [maemo-commits] r13317 - in projects/haf/trunk/hildon-desktop: . libhildondesktop

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Aug 21 14:48:01 EEST 2007
Author: lucasr
Date: 2007-08-21 14:47:59 +0300 (Tue, 21 Aug 2007)
New Revision: 13317

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c
Log:
2007-08-21  Lucas Rocha  <lucas.rocha at nokia.com>

	* libhildondesktop/hildon-desktop-notification-manager.c
	(hildon_desktop_notification_manager_notify): validate main parameters
	summary, description and icon before adding/updating notifications
	in the model. Fixes NB#62162.


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-21 11:40:32 UTC (rev 13316)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-21 11:47:59 UTC (rev 13317)
@@ -1,5 +1,12 @@
 2007-08-21  Lucas Rocha  <lucas.rocha at nokia.com>
 
+	* libhildondesktop/hildon-desktop-notification-manager.c
+	(hildon_desktop_notification_manager_notify): validate main parameters
+	summary, description and icon before adding/updating notifications
+	in the model. Fixes NB#62162.
+
+2007-08-21  Lucas Rocha  <lucas.rocha at nokia.com>
+
 	* libhildondesktop/hildon-desktop-popup-menu.c
 	(hildon_desktop_menu_check_scroll_item,
 	hildon_desktop_popup_menu_scroll_to_selected,

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c	2007-08-21 11:40:32 UTC (rev 13316)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c	2007-08-21 11:47:59 UTC (rev 13317)
@@ -233,8 +233,7 @@
 
       if (error)
       {
-        pixbuf = NULL; /* It'd be already NULL */
-	g_warning ("Notification Manager %s:",error->message);
+	g_warning ("Notification icon not loaded: %s", error->message);
         g_error_free (error);
       }
     }
@@ -1073,6 +1072,7 @@
                                             DBusGMethodInvocation *context)
 {
   GtkTreeIter iter;
+  GdkPixbuf *pixbuf = NULL;
   GHashTable *hints_copy;
 #ifdef HAVE_SQLITE
   GValue *hint;
@@ -1081,7 +1081,19 @@
   gboolean valid_actions = TRUE;
   gboolean persistent = FALSE;
   gint i;
-  
+
+  g_return_val_if_fail (*icon != '\0', FALSE);
+  g_return_val_if_fail (summary != '\0', FALSE);
+  g_return_val_if_fail (body != '\0', FALSE);
+
+  pixbuf = hildon_desktop_notification_manager_get_icon (icon);
+
+  if (!pixbuf)
+  {
+    g_warning ("Notification icon not found. Ignoring this notification.");
+    return FALSE;
+  }
+    
 #ifdef HAVE_SQLITE
     hint = g_hash_table_lookup (hints, "persistent");
 
@@ -1130,7 +1142,7 @@
 		        HD_NM_COL_APPNAME, app_name,
 		        HD_NM_COL_ID, id,
 		        HD_NM_COL_ICON_NAME, icon,
-		        HD_NM_COL_ICON, hildon_desktop_notification_manager_get_icon (icon),
+		        HD_NM_COL_ICON, pixbuf,
 		        HD_NM_COL_SUMMARY, summary,
 		        HD_NM_COL_BODY, body,
 		        HD_NM_COL_ACTIONS, actions_copy,
@@ -1162,7 +1174,7 @@
     gtk_list_store_set (GTK_LIST_STORE (nm),
 		        &iter,
 			HD_NM_COL_ICON_NAME, icon,
-			HD_NM_COL_ICON, hildon_desktop_notification_manager_get_icon (icon),
+			HD_NM_COL_ICON, pixbuf,
 			HD_NM_COL_SUMMARY, summary,
 			HD_NM_COL_BODY, body,
 			HD_NM_COL_REMOVABLE, FALSE,


More information about the maemo-commits mailing list