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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue May 22 13:15:11 EEST 2007
Author: lucasr
Date: 2007-05-22 13:15:09 +0300 (Tue, 22 May 2007)
New Revision: 11745

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

	* src/hd-desktop.c,
	libhildondesktop/hildon-desktop-notification-manager.c: implement new
	kind of system note dialog with a progress bar.


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-22 05:31:04 UTC (rev 11744)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-22 10:15:09 UTC (rev 11745)
@@ -1,3 +1,9 @@
+2007-05-22  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-desktop.c,
+	libhildondesktop/hildon-desktop-notification-manager.c: implement new
+	kind of system note dialog with a progress bar.
+
 2007-05-15  Moises Martinez  <moises.martinez at nokia.com>
 
 	* src/hd-hung-app-handler.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-22 05:31:04 UTC (rev 11744)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c	2007-05-22 10:15:09 UTC (rev 11745)
@@ -121,8 +121,6 @@
   next_id = ++nm->priv->current_id;
 #endif
 
-  g_debug ("USANDO ID: %d", next_id);
-  
   if (nm->priv->current_id == G_MAXUINT)
     nm->priv->current_id = 0;
   
@@ -1144,12 +1142,15 @@
   GHashTable *hints;
   GValue *hint;
   gchar **actions;
+
+  g_return_val_if_fail (type >= 0 && type < 5, FALSE);
   
-  static const gchar *icon[4] = {
+  static const gchar *icon[5] = {
       "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 */
+      "qgn_note_gene_wait",       /* OSSO_GN_WAIT */
+      "qgn_note_gene_wait"        /* OSSO_GN_PROGRESS */
   };
 
   hints = g_hash_table_new_full (g_str_hash, 
@@ -1163,6 +1164,12 @@
 
   g_hash_table_insert (hints, "category", hint);
 
+  hint = g_new0 (GValue, 1);
+  hint = g_value_init (hint, G_TYPE_INT);
+  g_value_set_int (hint, type);
+
+  g_hash_table_insert (hints, "dialog-type", hint);
+
   if (!g_str_equal (label, ""))
   {
     GArray *actions_arr;
@@ -1191,7 +1198,7 @@
 					      message,
 					      actions,
 					      hints,
-					      3000,
+					      0,
 					      context);
 
   g_hash_table_destroy (hints);

Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-05-22 05:31:04 UTC (rev 11744)
+++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-05-22 10:15:09 UTC (rev 11745)
@@ -500,9 +500,12 @@
 
   if (!g_ascii_strcasecmp (filename, HD_DESKTOP_CONFIG_FILE))
   {
+    /* Disabling desktop conf file monitoing to avoid crashes for now */
+#if 0
     g_free (priv->config_file);
     priv->config_file = hd_desktop_get_conf_file_path (HD_DESKTOP_CONFIG_FILE);
     hd_desktop_load_containers (desktop);
+#endif
   } else {
     HDDesktopContainerInfo *info;
     GList *plugin_list = NULL;
@@ -550,9 +553,12 @@
 
   if (!g_ascii_strcasecmp (filename, HD_DESKTOP_CONFIG_FILE))
   {
+    /* Disabling desktop conf file monitoing to avoid crashes for now */
+#if 0
     g_free (priv->config_file);
     priv->config_file = hd_desktop_get_conf_file_path (HD_DESKTOP_CONFIG_FILE);
     hd_desktop_load_containers (desktop);
+#endif
   } else {
     HDDesktopContainerInfo *info;
     GList *plugin_list = NULL;
@@ -1094,19 +1100,52 @@
   }
 }
 
+static gboolean
+hd_desktop_pulsate_progress_bar (gpointer user_data)
+{
+  if (GTK_IS_PROGRESS_BAR (user_data)) 
+  {
+    gtk_progress_bar_pulse (GTK_PROGRESS_BAR (user_data));
+    return TRUE;
+  }
+  else
+  {
+    return FALSE;
+  }
+}
+
 static GtkWidget *
 hd_desktop_create_note_dialog (const gchar *summary, 
 			       const gchar *body, 
 			       const gchar *icon_name,
-			       gchar **actions)
+			       gint         dialog_type,
+			       gchar      **actions)
 {
   GtkWidget *note;
   gint i;
   
-  note = hildon_note_new_information_with_icon_name (NULL, 
-		  				     body, 
-						     icon_name);
+  /* If it's a progress dialog, add the progress bar */
+  if (dialog_type == 4)
+  {
+    GtkWidget *progressbar;
 
+    progressbar = gtk_progress_bar_new ();
+
+    gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progressbar));
+
+    note = hildon_note_new_cancel_with_progress_bar (NULL,
+                                                     body,
+                                                     progressbar);
+
+    g_timeout_add (100, hd_desktop_pulsate_progress_bar, progressbar);
+  }
+  else
+  {
+    note = hildon_note_new_information_with_icon_name (NULL, 
+  		  				       body, 
+  						       icon_name);
+  }
+  
   /* If there's a default action, get the label and set
    * the button text */
   for (i = 0; actions && actions[i] != NULL; i += 2)
@@ -1186,10 +1225,15 @@
   else if (g_str_equal (hint_s, "system.note.dialog")) 
   {
     HDDesktopNotificationInfo *ninfo;
-
+    gint dialog_type = 0;
+    
+    hint = g_hash_table_lookup (hints, "dialog-type");
+    dialog_type = g_value_get_int (hint);
+    
     notification = hd_desktop_create_note_dialog (summary, 
 		    				  body, 
 						  icon_name,
+						  dialog_type,
 						  actions);
 
     ninfo = g_new0 (HDDesktopNotificationInfo, 1); 


More information about the maemo-commits mailing list