[Gurlchecker-commits] r711 - in trunk: . src

esaracco at users.labs.libre-entreprise.org esaracco at users.labs.libre-entreprise.org
Fri Jan 22 08:29:28 CET 2010


Author: esaracco
Date: 2010-01-22 07:29:27 +0000 (Fri, 22 Jan 2010)
New Revision: 711

Modified:
   trunk/ChangeLog
   trunk/src/check.c
Log:
Do not display empty folders.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-01-22 07:06:57 UTC (rev 710)
+++ trunk/ChangeLog	2010-01-22 07:29:27 UTC (rev 711)
@@ -2,6 +2,7 @@
 
 	* Bookmarks check:
 
+	  - Do not display empty folders.
 	  - Ask confirmation before deleting a link.
 	  - Code cleaning.
 

Modified: trunk/src/check.c
===================================================================
--- trunk/src/check.c	2010-01-22 07:06:57 UTC (rev 710)
+++ trunk/src/check.c	2010-01-22 07:29:27 UTC (rev 711)
@@ -556,6 +556,7 @@
   return UC_PIXMAPS_DIR "/list_unknown.png";
 }
 
+
 static void
 uc_check_display_list_current_item (const UCLinkProperties * prop)
 {
@@ -573,6 +574,11 @@
   if (prop->link_type == LINK_TYPE_META || prop->to_delete)
     return;
 
+  // Do not display empty bookmarks folder
+  if (prop->link_type == LINK_TYPE_BOOKMARK_FOLDER &&
+      prop->childs == NULL)
+    return;
+
   lm_date = g_hash_table_lookup (prop->header, UC_LAST_MODIFIED);
   if (lm_date == NULL)
     lm_date = "-";
@@ -587,24 +593,21 @@
   gtk_tree_store_append (treestore, &c_iter, NULL);
 
   gtk_tree_store_set (treestore, &c_iter,
-		      UID_COLUMN, prop->uid,
-		      LINK_STATUS_ICON_COLUMN,
-		      prop->status_icon,
-		      LINK_ICON_COLUMN,
-		      prop->link_icon,
-		      SECURITY_ALERT_ICON_COLUMN,
-		      (uc_check_is_security_alert (prop)) ?
-		      security_alert_icon : empty_icon,
-		      W3C_ALERT_ICON_COLUMN,
-		      (uc_check_is_w3c_alert (prop)) ?
-		      w3c_alert_icon : empty_icon,
-		      ACTION_COLUMN, action->label,
-		      LABEL_COLUMN,
-		      label, URL_COLUMN, value, LM_COLUMN, lm_date, -1);
+    UID_COLUMN, prop->uid,
+    LINK_STATUS_ICON_COLUMN, prop->status_icon,
+    LINK_ICON_COLUMN, prop->link_icon,
+    SECURITY_ALERT_ICON_COLUMN,
+      (uc_check_is_security_alert (prop))?security_alert_icon:empty_icon,
+    W3C_ALERT_ICON_COLUMN,
+      (uc_check_is_w3c_alert (prop))?w3c_alert_icon:empty_icon,
+    ACTION_COLUMN, action->label,
+    LABEL_COLUMN, label,
+    URL_COLUMN, value,
+    LM_COLUMN, lm_date, -1);
 
   gtk_tree_view_get_cursor (treeview, &treepath, NULL);
 
-  if (!treepath)
+  if (treepath == NULL)
     treepath = gtk_tree_path_new_from_string ("0");
   else
     gtk_tree_path_next (treepath);
@@ -616,6 +619,7 @@
   g_free (label), label = NULL;
 }
 
+
 /**
  * uc_check_display_list:
  * @list: #GList of the links to display.
@@ -639,6 +643,7 @@
   guint32 pos = 0;
   GtkTreeIter c_iter;
 
+
   item = g_list_first (list);
   while (item != NULL)
     {
@@ -652,42 +657,43 @@
       if (prop->link_type == LINK_TYPE_META || prop->to_delete)
 	continue;
 
+      // Do not display empty bookmarks folder
+      if (prop->link_type == LINK_TYPE_BOOKMARK_FOLDER &&
+          prop->childs == NULL)
+        continue;
+
       /* here we build the treeview path to automatically select
        * a row according to the search result selection */
       g_free (prop->treeview_path), prop->treeview_path = NULL;
       prop->treeview_path = (prop->depth_level == 0) ?
 	g_strdup_printf ("%u", pos) : g_strdup_printf ("%s:%u", path, pos);
 
-      action = uc_application_get_urls_user_action (prop->user_action);
-
       lm_date = g_hash_table_lookup (prop->header, UC_LAST_MODIFIED);
       if (lm_date == NULL)
 	lm_date = "-";
 
-      label =
-	uc_utils_string_format4display (prop->label,
-					UC_LABEL_DISPLAY_MAX_LEN);
-      value =
-	uc_utils_string_format4display (prop->link_value,
-					UC_LABEL_DISPLAY_MAX_LEN);
+      action = uc_application_get_urls_user_action (prop->user_action);
 
-      gtk_tree_store_append (treestore, &c_iter, (prop->depth_level) ?
-			     &prop->parent->iter : NULL);
+      label = uc_utils_string_format4display (prop->label,
+                                              UC_LABEL_DISPLAY_MAX_LEN);
+      value = uc_utils_string_format4display (prop->link_value,
+                                              UC_LABEL_DISPLAY_MAX_LEN);
+
+      gtk_tree_store_append (treestore, &c_iter,
+        (prop->depth_level)?&prop->parent->iter:NULL);
+
       gtk_tree_store_set (treestore, &c_iter,
-			  UID_COLUMN, prop->uid,
-			  LINK_STATUS_ICON_COLUMN,
-			  prop->status_icon,
-			  LINK_ICON_COLUMN,
-			  prop->link_icon,
-			  SECURITY_ALERT_ICON_COLUMN,
-			  (uc_check_is_security_alert (prop)) ?
-			  security_alert_icon : empty_icon,
-			  W3C_ALERT_ICON_COLUMN,
-			  (uc_check_is_w3c_alert (prop)) ?
-			  w3c_alert_icon : empty_icon,
-			  ACTION_COLUMN, action->label,
-			  LABEL_COLUMN,
-			  label, URL_COLUMN, value, LM_COLUMN, lm_date, -1);
+        UID_COLUMN, prop->uid,
+        LINK_STATUS_ICON_COLUMN, prop->status_icon,
+        LINK_ICON_COLUMN, prop->link_icon,
+        SECURITY_ALERT_ICON_COLUMN,
+          (uc_check_is_security_alert (prop))?security_alert_icon:empty_icon,
+        W3C_ALERT_ICON_COLUMN,
+          (uc_check_is_w3c_alert (prop))?w3c_alert_icon:empty_icon,
+        ACTION_COLUMN, action->label,
+        LABEL_COLUMN, label,
+        URL_COLUMN, value,
+        LM_COLUMN, lm_date, -1);
 
       g_free (value), value = NULL;
       g_free (label), label = NULL;
@@ -701,6 +707,7 @@
     }
 }
 
+
 /**
  * uc_check_display_list_with_status:
  * @list: #GList of the links to display.



More information about the Gurlchecker-commits mailing list