[maemo-commits] [maemo-commits] r13149 - in projects/haf/trunk/libhildonmime: . debian libhildonmime tests

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Aug 13 14:28:57 EEST 2007
Author: martyn
Date: 2007-08-13 14:28:41 +0300 (Mon, 13 Aug 2007)
New Revision: 13149

Modified:
   projects/haf/trunk/libhildonmime/ChangeLog
   projects/haf/trunk/libhildonmime/configure.in
   projects/haf/trunk/libhildonmime/debian/changelog
   projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c
   projects/haf/trunk/libhildonmime/tests/test-all.c
Log:
	* configure.in: Bumped version.

	* libhildonmime/hildon-uri.c:  Make sure that the GSList* returned
	when getting actions has the default action as the TOP MOST action
	in the list, this fixes NB#62728.

	* tests/test-all.c: Add comment to add a test for this at some
	stage when we have more time.


Modified: projects/haf/trunk/libhildonmime/ChangeLog
===================================================================
--- projects/haf/trunk/libhildonmime/ChangeLog	2007-08-13 10:04:13 UTC (rev 13148)
+++ projects/haf/trunk/libhildonmime/ChangeLog	2007-08-13 11:28:41 UTC (rev 13149)
@@ -1,3 +1,14 @@
+2007-08-13  Martyn Russell  <martyn at imendio.com>
+
+	* configure.in: Bumped version.
+
+	* libhildonmime/hildon-uri.c:  Make sure that the GSList* returned
+	when getting actions has the default action as the TOP MOST action
+	in the list, this fixes NB#62728.
+
+	* tests/test-all.c: Add comment to add a test for this at some
+	stage when we have more time.
+
 2007-08-10  Martyn Russell  <martyn at imendio.com>
 
 	* Release 1.9.12.

Modified: projects/haf/trunk/libhildonmime/configure.in
===================================================================
--- projects/haf/trunk/libhildonmime/configure.in	2007-08-13 10:04:13 UTC (rev 13148)
+++ projects/haf/trunk/libhildonmime/configure.in	2007-08-13 11:28:41 UTC (rev 13149)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.52)
  
-AC_INIT(libhildonmime, 1.9.12)
+AC_INIT(libhildonmime, 1.9.13)
 AC_CONFIG_SRCDIR(libhildonmime/hildon-uri.c)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 

Modified: projects/haf/trunk/libhildonmime/debian/changelog
===================================================================
--- projects/haf/trunk/libhildonmime/debian/changelog	2007-08-13 10:04:13 UTC (rev 13148)
+++ projects/haf/trunk/libhildonmime/debian/changelog	2007-08-13 11:28:41 UTC (rev 13149)
@@ -1,3 +1,9 @@
+libhildonmime (1.9.13-1~unreleased) unstable; urgency=low
+
+  * Fixes: NB#62728, Default handling application for "sip" link is incorrect
+
+ -- Martyn Russell <martyn at imendio.com>  Fri, 17 Aug 2007 17:00:00 +0100
+
 libhildonmime (1.9.12-1) unstable; urgency=low
 
   * Updated the default application list so the chat-ui is default for xmpp schemes.
@@ -4,7 +10,7 @@
   * Fixes: NB#65400, libhildonmime won't build
 
  -- Martyn Russell <martyn at imendio.com>  Fri, 10 Aug 2007 17:00:00 +0100
-
+	
 libhildonmime (1.9.11-1) unstable; urgency=low
 
   * Fixes: NB#62728, Default handling application for "sip" link is incorrect

Modified: projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c
===================================================================
--- projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c	2007-08-13 10:04:13 UTC (rev 13148)
+++ projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c	2007-08-13 11:28:41 UTC (rev 13149)
@@ -63,8 +63,7 @@
 #define APP_LAUNCH_BANNER_METHOD              "app_launch_banner"
 
 
-#define DEBUG_MSG(x)  
-/* #define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n");  */
+ #define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n");  
 
 /* The ID is the group name in the desktop file for this
  * action, the domain is the translation domain used for the
@@ -1505,10 +1504,10 @@
 hildon_uri_get_actions (const gchar  *scheme,
 			GError      **error)
 {
-	GSList        *actions = NULL;
-	GSList        *desktop_files;
-	GSList        *l;
-	gchar         *filename;
+	GSList *actions = NULL;
+	GSList *desktop_files;
+	GSList *l;
+	gchar  *filename;
 
 	g_return_val_if_fail (scheme != NULL && scheme[0] != '\0', NULL);
 
@@ -1525,6 +1524,28 @@
 		}
 	}
 
+	/* Make sure the default action is the first item in the list */
+	DEBUG_MSG (("URI: Making sure default action is the top of the list..."));
+
+	if (actions && !hildon_uri_is_default_action (actions->data, NULL)) {
+		HildonURIAction *default_action;
+
+		for (l = actions->next; l; l = l->next) {
+			if (!hildon_uri_is_default_action (l->data, NULL)) {
+				continue;
+			}
+
+			DEBUG_MSG (("URI: Moving default action to the top of the list..."));
+
+			default_action = l->data;
+			
+			actions = g_slist_remove_link (actions, l);
+			g_slist_free1 (l);
+			
+			actions = g_slist_prepend (actions, default_action);
+		}
+	}
+
 	g_slist_foreach (desktop_files, (GFunc) g_free, NULL);
 	g_slist_free (desktop_files);
 	
@@ -1595,6 +1616,28 @@
 							 action_type, 
 							 mime_type);
 
+	/* Make sure the default action is the first item in the list */
+	DEBUG_MSG (("URI: Making sure default action is the top of the list..."));
+
+	if (actions && !hildon_uri_is_default_action_by_uri (uri_str, actions->data, NULL)) {
+		HildonURIAction *default_action;
+
+		for (l = actions->next; l; l = l->next) {
+			if (!hildon_uri_is_default_action_by_uri (uri_str, l->data, NULL)) {
+				continue;
+			}
+
+			DEBUG_MSG (("URI: Moving default action to the top of the list..."));
+
+			default_action = l->data;
+			
+			actions = g_slist_remove_link (actions, l);
+			g_slist_free1 (l);
+			
+			actions = g_slist_prepend (actions, default_action);
+		}
+	}
+
 	g_slist_foreach (desktop_files, (GFunc) g_free, NULL);
 	g_slist_free (desktop_files);
 	
@@ -1769,23 +1812,23 @@
  * Return: The %TRUE if it is the default action or %FALSE.
  **/
 gboolean
-hildon_uri_is_default_action_by_uri (const gchar      *uri,
+hildon_uri_is_default_action_by_uri (const gchar      *uri_str,
 				     HildonURIAction  *action,
 				     GError          **error)
 {
 	HildonURIAction *default_action;
-	gboolean       equal = FALSE;
+	gboolean         equal = FALSE;
 
-	g_return_val_if_fail (uri != NULL, FALSE);
+	g_return_val_if_fail (uri_str != NULL, FALSE);
 	g_return_val_if_fail (action != NULL, FALSE);
 
-	default_action = hildon_uri_get_default_action_by_uri (uri, error);
+	default_action = hildon_uri_get_default_action_by_uri (uri_str, error);
 
 	DEBUG_MSG (("URI: Checking desktop file is default by uri:'%s' for scheme:'%s':\n"
 		    "\tdefault_action:%p\n"
 		    "\tdefault_action->desktop_file:'%s'\n"
 		    "\taction->desktop_file:'%s'",
-		    uri,
+		    uri_str,
 		    action->scheme,
 		    default_action,
 		    default_action ? default_action->desktop_file : "",
@@ -1826,7 +1869,7 @@
 			    "\tmethod1:'%s'\n"
 			    "\tmethod2:'%s'\n"
 			    "\tEQUAL = %s",
-			    uri,
+			    uri_str,
 			    desktop_file1, desktop_file2,
 			    default_action->name, action->name,
 			    default_action->method, action->method,

Modified: projects/haf/trunk/libhildonmime/tests/test-all.c
===================================================================
--- projects/haf/trunk/libhildonmime/tests/test-all.c	2007-08-13 10:04:13 UTC (rev 13148)
+++ projects/haf/trunk/libhildonmime/tests/test-all.c	2007-08-13 11:28:41 UTC (rev 13149)
@@ -656,6 +656,11 @@
 		test_get_actions ();
 	}
 
+	/* FIXME: Add the following tests:
+	 * - Make sure the default action is the top action in the list 
+	 *   returned for _get_actions()
+	 */
+
 	test_failure_conditions ();
 	test_system_default_actions ();
 	test_local_default_actions ();


More information about the maemo-commits mailing list