return retval;
}
+typedef struct _ForeachFolderInfo {
+ gchar *needle;
+ gboolean found;
+} ForeachFolderInfo;
+
+static gboolean
+foreach_folder_with_id (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ ForeachFolderInfo *info;
+ GObject *instance;
+
+ info = (ForeachFolderInfo *) data;
+ gtk_tree_model_get (model, iter,
+ INSTANCE_COLUMN, &instance,
+ -1);
+
+ if (TNY_IS_FOLDER (instance)) {
+ const gchar *id;
+ gchar *collate;
+ id = tny_folder_get_id (TNY_FOLDER (instance));
+ if (id) {
+ collate = g_utf8_collate_key (id, -1);
+ info->found = !strcmp (info->needle, collate);
+ g_free (collate);
+ }
+ }
+
+ return info->found;
+
+}
+
+
static gboolean
has_folder_with_id (ModestFolderView *self, const gchar *id)
{
- return FALSE;
+ GtkTreeModel *model;
+ ForeachFolderInfo info = {NULL, FALSE};
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
+ info.needle = g_utf8_collate_key (id, -1);
+
+ gtk_tree_model_foreach (model, foreach_folder_with_id, &info);
+ g_free (info.needle);
+
+ return info.found;
}
static gboolean
const gchar *last_bar;
gchar *string_to_match;
last_bar = g_strrstr (b_id, "/");
- if (!last_bar)
+ if (last_bar)
+ last_bar++;
+ else
last_bar = b_id;
string_to_match = g_strconcat (a_id, "/", last_bar, NULL);
retval = has_folder_with_id (self, string_to_match);
}
g_object_unref (instance);
}
+ g_object_unref (iterator);
return retval;
}