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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Feb 26 18:44:20 EET 2007
Author: moimart
Date: 2007-02-26 18:44:19 +0200 (Mon, 26 Feb 2007)
New Revision: 10219

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.h:
        - Exported enum for TreeModel.
        * libhildondesktop/hildon-desktop-notification-manager.c:
        - Added support for icons. If a path is supplied get the icon from
        there, if not try to get a default one from theme.
	* ChangeLog updated.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-02-26 16:08:20 UTC (rev 10218)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-02-26 16:44:19 UTC (rev 10219)
@@ -1,5 +1,13 @@
 2007-02-26  Moises Martinez  <moises.martinez at nokia.com>
+	
+	* libhildondesktop/hildon-desktop-notification-manager.h:
+	- Exported enum for TreeModel.
+	* libhildondesktop/hildon-desktop-notification-manager.c:
+	- Added support for icons. If a path is supplied get the icon from
+	there, if not try to get a default one from theme.
 
+2007-02-26  Moises Martinez  <moises.martinez at nokia.com>
+
 	* libhildondesktop/libhildondesktop.h: Added missing headers.
 	* libhildondesktop/libhildondesktop.pc.in: Requires dbus-glib-1
 

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-26 16:08:20 UTC (rev 10218)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c	2007-02-26 16:44:19 UTC (rev 10219)
@@ -42,20 +42,6 @@
 
 #define HILDON_DESKTOP_NOTIFICATION_MANAGER_ICON_SIZE  48
 
-enum 
-{
-  COL_APPNAME,
-  COL_ID,
-  COL_ICON_NAME,
-  COL_ICON,
-  COL_SUMMARY,
-  COL_BODY,
-  COL_ACTIONS,
-  COL_HINTS,
-  COL_TIMEOUT
-};
-
-
 static void
 hildon_desktop_notification_manager_init (HildonDesktopNotificationManager *nm)
 {
@@ -165,26 +151,55 @@
                                         	    DBusGMethodInvocation *context)
 {
   GtkTreeIter iter,*iter_timeout;
+  GError *error = NULL;
+  GdkPixbuf *pixbuf = NULL;
+  GtkIconTheme *icon_theme;
 
+  if (!g_str_equal (icon, ""))
+  {
+    if (g_file_test (icon, G_FILE_TEST_EXISTS))
+    {
+      pixbuf = gdk_pixbuf_new_from_file (icon, &error);
 
-  gtk_list_store_append (GTK_LIST_STORE (nm),
-		  	 &iter);
+      if (error)
+      {
+        pixbuf = NULL; /* Tt'd be already NULL */
+	g_warning ("Notification Manager %s:",error->message);
+        g_error_free (error);
+      }
+    }
+    else
+    {	    
+      icon_theme = gtk_icon_theme_get_default ();
+      pixbuf = gtk_icon_theme_load_icon (icon_theme,
+                                         icon,
+                                         32,
+                                         GTK_ICON_LOOKUP_NO_SVG,
+	                                 &error);
 
+      if (error)
+      {
+	pixbuf = NULL; /* Tt'd be already NULL */
+	g_warning ("Notification Manager %s:",error->message);
+        g_error_free (error);
+      }
+    }
+  }
+
+  gtk_list_store_append (GTK_LIST_STORE (nm), &iter);
   gtk_list_store_set (GTK_LIST_STORE (nm),
 		      &iter,
-		      COL_APPNAME, app_name,
-		      COL_ID, id,
-		      COL_ICON_NAME, icon,
-		      COL_ICON, NULL,
-		      COL_SUMMARY, summary,
-		      COL_BODY, body,
-		      COL_ACTIONS, actions,
-		      COL_HINTS, hints,
-		      COL_TIMEOUT, timeout,
+		      HD_NM_COL_APPNAME, app_name,
+		      HD_NM_COL_ID, id,
+		      HD_NM_COL_ICON_NAME, icon,
+		      HD_NM_COL_ICON, pixbuf,
+		      HD_NM_COL_SUMMARY, summary,
+		      HD_NM_COL_BODY, body,
+		      HD_NM_COL_ACTIONS, actions,
+		      HD_NM_COL_HINTS, hints,
+		      HD_NM_COL_TIMEOUT, timeout,
 		      -1);
 
-   
-
   if (timeout > 0)
   {
     iter_timeout = g_new0 (GtkTreeIter, 1);

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-26 16:08:20 UTC (rev 10218)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h	2007-02-26 16:44:19 UTC (rev 10219)
@@ -34,6 +34,19 @@
 
 G_BEGIN_DECLS
 
+enum 
+{
+  HD_NM_COL_APPNAME,
+  HD_NM_COL_ID,
+  HD_NM_COL_ICON_NAME,
+  HD_NM_COL_ICON,
+  HD_NM_COL_SUMMARY,
+  HD_NM_COL_BODY,
+  HD_NM_COL_ACTIONS,
+  HD_NM_COL_HINTS,
+  HD_NM_COL_TIMEOUT
+};
+
 typedef struct _HildonDesktopNotificationManager HildonDesktopNotificationManager;
 typedef struct _HildonDesktopNotificationManagerClass HildonDesktopNotificationManagerClass;
 typedef struct _HildonDesktopNotificationManagerPrivate HildonDesktopNotificationManagerPrivate;


More information about the maemo-commits mailing list