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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon May 7 14:20:35 EEST 2007
Author: lucasr
Date: 2007-05-07 14:20:34 +0300 (Mon, 07 May 2007)
New Revision: 11484

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
   projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml
   projects/haf/trunk/hildon-desktop/src/hd-desktop.c
Log:
2007-05-07  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-desktop.c: watch notification with system.note.infoprint and
	system.note.dialog instead of system.note_dialog and
	system.note_infoprint.
	* libhildondesktop/hildon-desktop-notification-manager.[ch], 
	libhildondesktop/notification-manager.xml: added SystemNoteDialog
	and SystemNoteInfoprint D-Bus methods to be used by libosso. Check if
	the actions list is valid and don't use in case it's invalid.


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-07 10:49:45 UTC (rev 11483)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-07 11:20:34 UTC (rev 11484)
@@ -1,3 +1,13 @@
+2007-05-07  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-desktop.c: watch notification with system.note.infoprint and
+	system.note.dialog instead of system.note_dialog and
+	system.note_infoprint.
+	* libhildondesktop/hildon-desktop-notification-manager.[ch], 
+	libhildondesktop/notification-manager.xml: added SystemNoteDialog
+	and SystemNoteInfoprint D-Bus methods to be used by libosso. Check if
+	the actions list is valid and don't use in case it's invalid.
+
 2007-05-07  Johan Bilien  <johan.bilien at nokia.com>
 
 	* src/hd-home-window.c:

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c	2007-05-07 10:49:45 UTC (rev 11483)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c	2007-05-07 11:20:34 UTC (rev 11484)
@@ -298,6 +298,8 @@
   GdkPixbuf *pixbuf = NULL;
   GtkIconTheme *icon_theme;
   GHashTable *hints_copy;
+  gchar **actions_copy;
+  gboolean valid_actions = TRUE;
   gint i;
   
   if (!g_str_equal (icon, ""))
@@ -343,9 +345,9 @@
       if (nm->priv->current_id == G_MAXUINT)
         nm->priv->current_id = 0;
     }
-
+    
     /* Test if we have a valid list of actions */
-    for (i = 0; actions[i] != NULL; i += 2)
+    for (i = 0; actions && actions[i] != NULL; i += 2)
     {
       gchar *label = actions[i + 1];
       
@@ -353,10 +355,21 @@
       {
         g_warning ("Invalid action list: no label provided for action %s", actions[i]);
 
-        break;
+	valid_actions = FALSE;
+
+	break;
       }
     }
 
+    if (valid_actions)
+    {
+      actions_copy = g_strdupv (actions);
+    }
+    else
+    {
+      actions_copy = NULL;
+    }
+	      
     hints_copy = g_hash_table_new_full (g_str_hash, 
 	  		                g_str_equal,
 			                (GDestroyNotify) g_free,
@@ -372,7 +385,7 @@
 		        HD_NM_COL_ICON, pixbuf,
 		        HD_NM_COL_SUMMARY, summary,
 		        HD_NM_COL_BODY, body,
-		        HD_NM_COL_ACTIONS, g_strdupv (actions),
+		        HD_NM_COL_ACTIONS, actions_copy,
 		        HD_NM_COL_HINTS, hints_copy,
 		        HD_NM_COL_TIMEOUT, timeout,
 			HD_NM_COL_REMOVABLE, TRUE,
@@ -403,36 +416,85 @@
   return TRUE;
 }
 
-#if 0
 gboolean
-hildon_desktop_notification_manager_system_infoprint (HildonDesktopNotificationManager *nm,
-						      gchar *message,
-                                                      DBusGMethodInvocation *context)
+hildon_desktop_notification_manager_system_note_infoprint (HildonDesktopNotificationManager *nm,
+						           const gchar *message,
+                                                           DBusGMethodInvocation *context)
 {
   GHashTable *hints;
+  GValue *hint;
 
-  hints = 
-                                            const gchar           *app_name,
-                                            guint                  id,
-                                            const gchar           *icon,
-                                            const gchar           *summary,
-                                            const gchar           *body,
-                                            gchar                **actions,
-                                            GHashTable            *hints,
-                                            gint                   timeout, 
+  hints = g_hash_table_new_full (g_str_hash, 
+        		         g_str_equal,
+      		                NULL,
+      		                (GDestroyNotify) hint_value_free);
 
+  hint = g_new0 (GValue, 1);
+  hint = g_value_init (hint, G_TYPE_STRING);
+  g_value_set_string (hint, "system.note.infoprint");
+
+  g_hash_table_insert (hints, "category", hint);
+
+  hildon_desktop_notification_manager_notify (nm,
+					      "hildon-desktop",
+		  			      0,
+					      "qgn_note_infoprint",
+		  			      "System Note Infoprint",
+					      message,
+					      NULL,
+					      hints,
+					      3000,
+					      context);
+
+  g_hash_table_destroy (hints);
+
   return TRUE;
 }
 
 gboolean
-hildon_desktop_notification_manager_system_dialog (HildonDesktopNotificationManager *nm,
-						   gchar *message,
-						   guint32 type
-                                                   DBusGMethodInvocation *context)
+hildon_desktop_notification_manager_system_note_dialog (HildonDesktopNotificationManager *nm,
+						        const gchar *message,
+						        guint type,
+                                                        DBusGMethodInvocation *context)
 {
+  GHashTable *hints;
+  GValue *hint;
+
+  static const gchar *icon[4] = {
+      "qgn_note_gene_syswarning", /* OSSO_GN_WARNING */
+      "qgn_note_gene_syserror",   /* OSSO_GN_ERROR */
+      "qgn_note_info",            /* OSSO_GN_NOTICE */
+      "qgn_note_gene_wait"        /* OSSO_GN_WAIT */
+  };
+
+  g_debug ("ALOW ALOW ALOW ALOW");
+
+  hints = g_hash_table_new_full (g_str_hash, 
+        		         g_str_equal,
+      		                NULL,
+      		                (GDestroyNotify) hint_value_free);
+
+  hint = g_new0 (GValue, 1);
+  hint = g_value_init (hint, G_TYPE_STRING);
+  g_value_set_string (hint, "system.note.dialog");
+
+  g_hash_table_insert (hints, "category", hint);
+
+  hildon_desktop_notification_manager_notify (nm,
+					      "hildon-desktop",
+		  			      0,
+					      icon[type],
+		  			      "System Note Dialog",
+					      message,
+					      NULL,
+					      hints,
+					      3000,
+					      context);
+
+  g_hash_table_destroy (hints);
+  
   return TRUE;
 }
-#endif
 
 gboolean
 hildon_desktop_notification_manager_get_capabilities  (HildonDesktopNotificationManager *nm, gchar ***caps)

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h	2007-05-07 10:49:45 UTC (rev 11483)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h	2007-05-07 11:20:34 UTC (rev 11484)
@@ -93,6 +93,15 @@
                                                       		   gint                   timeout, 
                                                       		   DBusGMethodInvocation *context);
 
+gboolean   hildon_desktop_notification_manager_system_note_infoprint  (HildonDesktopNotificationManager *nm,
+								       const gchar           *message,
+								       DBusGMethodInvocation *context);
+
+gboolean   hildon_desktop_notification_manager_system_note_dialog (HildonDesktopNotificationManager *nm,
+								   const gchar           *message,
+								   guint                  type,
+								   DBusGMethodInvocation *context);
+
 gboolean   hildon_desktop_notification_manager_get_capabilities   (HildonDesktopNotificationManager *nm, 
                                                       		   gchar               ***caps);
 

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml	2007-05-07 10:49:45 UTC (rev 11483)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml	2007-05-07 11:20:34 UTC (rev 11484)
@@ -28,7 +28,6 @@
       <arg type="u" name="id" direction="in" />
     </method>
 
-    <!--
     <method name="SystemNoteInfoprint">
       <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="hildon_desktop_notification_manager_system_note_infoprint"/>
 
@@ -41,11 +40,12 @@
     <method name="SystemNoteDialog">
       <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="hildon_desktop_notification_manager_system_note_dialog"/>
 
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+
       <arg type="s" name="message" direction="in" />
       <arg type="u" name="type" direction="in" />
       <arg type="u" name="return_id" direction="out" />
     </method>
-    -->
     
     <method name="GetCapabilities">
       <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="hildon_desktop_notification_manager_get_capabilities"/>

Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-05-07 10:49:45 UTC (rev 11483)
+++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-05-07 11:20:34 UTC (rev 11484)
@@ -1450,7 +1450,7 @@
   hint = g_hash_table_lookup (hints, "category");
   hint_s = g_value_get_string (hint);
 
-  if (g_str_equal (hint_s, "system.note_infoprint")) 
+  if (g_str_equal (hint_s, "system.note.infoprint")) 
   {
     notification = hd_desktop_create_note_infoprint (summary, 
 		    				     body, 
@@ -1458,7 +1458,7 @@
 
     gtk_widget_show_all (notification);
   }
-  else if (g_str_equal (hint_s, "system.note_dialog")) 
+  else if (g_str_equal (hint_s, "system.note.dialog")) 
   {
     HDDesktopNotificationInfo *ninfo;
 
@@ -1704,7 +1704,7 @@
 hd_desktop_run (HDDesktop *desktop)
 {
   gchar *user_conf_dir;
-        
+  
   hd_desktop_load_containers (desktop);
 
   user_conf_dir = g_build_filename (g_get_home_dir (), 


More information about the maemo-commits mailing list