gchar *local_account_name;
gchar *visible_account_id;
+ gchar *mailbox;
ModestFolderViewStyle style;
ModestFolderViewCellStyle cell_style;
priv->style = MODEST_FOLDER_VIEW_STYLE_SHOW_ALL;
priv->cur_folder_store = NULL;
priv->visible_account_id = NULL;
+ priv->mailbox = NULL;
priv->folder_to_select = NULL;
priv->outbox_deleted_handler = 0;
priv->reexpand = TRUE;
g_free (priv->local_account_name);
g_free (priv->visible_account_id);
+ g_free (priv->mailbox);
if (priv->conf_key_signal) {
g_signal_handler_disconnect (modest_runtime_get_conf (),
/* Clear the current visible account_id */
modest_folder_view_set_account_id_of_visible_server_account (self, NULL);
+ modest_folder_view_set_mailbox (self, NULL);
/* Call the restore method, this will set the new visible account */
modest_widget_memory_restore (modest_runtime_get_conf(), G_OBJECT(self),
gboolean found = FALSE;
gboolean cleared = FALSE;
ModestTnyFolderRules rules = 0;
+ gchar *fname;
g_return_val_if_fail (MODEST_IS_FOLDER_VIEW (data), FALSE);
priv = MODEST_FOLDER_VIEW_GET_PRIVATE (data);
gtk_tree_model_get (model, iter,
+ NAME_COLUMN, &fname,
TYPE_COLUMN, &type,
INSTANCE_COLUMN, &instance,
-1);
happen when the model is being modified while it's being
drawn. This could occur for example when moving folders
using drag&drop */
- if (!instance)
+ if (!instance) {
+ g_free (fname);
return FALSE;
+ }
if (TNY_IS_ACCOUNT (instance)) {
TnyAccount *acc = TNY_ACCOUNT (instance);
strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
/* Show only the visible account id */
if (priv->visible_account_id) {
- if (strcmp (account_id, priv->visible_account_id))
- retval = FALSE;
+ if (strcmp (account_id, priv->visible_account_id)) {
+ retval = FALSE;
+ } else if (priv->mailbox) {
+ if (!g_str_has_prefix (fname, priv->mailbox)) {
+ retval = FALSE;
+ }
+ }
}
}
g_object_unref (account);
/* Free */
g_object_unref (instance);
+ g_free (fname);
return retval;
}
priv->list_to_move = list;
}
+
+void
+modest_folder_view_set_mailbox (ModestFolderView *self, const gchar *mailbox)
+{
+ ModestFolderViewPrivate *priv;
+
+ g_return_if_fail (MODEST_IS_FOLDER_VIEW (self));
+ priv = MODEST_FOLDER_VIEW_GET_PRIVATE (self);
+
+ if (priv->mailbox)
+ g_free (priv->mailbox);
+
+ priv->mailbox = g_strdup (mailbox);
+}
const gchar *account_id);
/**
+ * modest_folder_view_set_visible_mailbox:
+ * @self: a #ModestFolderView
+ * @account_id: the remote account mailbox to show
+ *
+ * if set an account id to filter, this filters also to show only
+ * folders of a specific mailbox.
+ **/
+void modest_folder_view_set_mailbox (ModestFolderView *self,
+ const gchar *mailbox);
+
+/**
* modest_folder_view_get_account_id_of_visible_server_account:
* @self: a #ModestFolderView
*