ModestConfNotificationId notification_id,
ModestFolderView *self);
+#ifndef MODEST_TOOLKIT_HILDON2
/* DnD functions */
static void on_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
guint time,
gpointer user_data);
-static void expand_root_items (ModestFolderView *self);
+static void setup_drag_and_drop (GtkTreeView *self);
+
+static void on_row_inserted_maybe_select_folder (GtkTreeModel *tree_model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ ModestFolderView *self);
static gint expand_row_timeout (gpointer data);
+#endif
-static void setup_drag_and_drop (GtkTreeView *self);
+static void expand_root_items (ModestFolderView *self);
static gboolean _clipboard_set_selected_data (ModestFolderView *folder_view,
gboolean delete);
static void _clear_hidding_filter (ModestFolderView *folder_view);
-#ifndef MODEST_TOOLKIT_HILDON2
-static void on_row_inserted_maybe_select_folder (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- ModestFolderView *self);
-#endif
-
static void on_display_name_changed (ModestAccountMgr *self,
const gchar *account,
gpointer user_data);
/* Build treeview */
add_columns (GTK_WIDGET (obj));
+#ifndef MODEST_TOOLKIT_HILDON2
/* Setup drag and drop */
setup_drag_and_drop (GTK_TREE_VIEW(obj));
+#endif
/* Connect signals */
g_signal_connect (G_OBJECT (obj),
modest_folder_view_update_model (MODEST_FOLDER_VIEW (self), account_store);
priv->reselect = FALSE;
+#ifndef MODEST_TOOLKIT_HILDON2
modest_folder_view_select_first_inbox_or_local (MODEST_FOLDER_VIEW (self));
+#endif
g_object_unref (G_OBJECT (device));
}
return same_account;
}
+#ifndef MODEST_TOOLKIT_HILDON2
/**
*
* Selects the first inbox or the local account in an idle
return FALSE;
}
+#endif
static void
on_account_changed (TnyAccountStore *account_store,
/* Refilter the model */
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
+#ifndef MODEST_TOOLKIT_HILDON2
/* Select the first INBOX if the currently selected folder
belongs to the account that is being deleted */
if (same_account && !MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (tny_account))
g_idle_add (on_idle_select_first_inbox_or_local, self);
+#endif
}
static void
/* Refilter the model */
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
+#ifndef MODEST_TOOLKIT_HILDON2
/* Select the first INBOX if the currently selected folder
belongs to the account that is being deleted */
if (same_account)
g_idle_add (on_idle_select_first_inbox_or_local, self);
+#endif
}
void
deathlock situation */
/* TODO: check if this is still the case */
priv->reselect = FALSE;
+#ifndef MODEST_TOOLKIT_HILDON2
modest_folder_view_select_first_inbox_or_local (self);
+#endif
/* Notify the display name observers */
g_signal_emit (G_OBJECT(self),
signals[FOLDER_DISPLAY_NAME_CHANGED_SIGNAL], 0,
g_object_unref (account);
}
- /* Get the accounts: */
- tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
- TNY_LIST (model),
- TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ALL) {
+ /* Get the accounts */
+ tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
+ TNY_LIST (model),
+ TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ } else {
+ if (priv->visible_account_id) {
+ TnyAccount *account;
+
+ /* Add local folders account */
+ account = modest_tny_account_store_get_local_folders_account ((ModestTnyAccountStore *) account_store);
+
+ if (account) {
+ tny_list_append (TNY_LIST (model), (GObject *) account);
+ g_object_unref (account);
+ }
+
+ account = modest_tny_account_store_get_mmc_folders_account ((ModestTnyAccountStore *) account_store);
+
+ if (account) {
+ tny_list_append (TNY_LIST (model), (GObject *) account);
+ g_object_unref (account);
+ }
+
+ /* Add visible account */
+ account = modest_tny_account_store_get_tny_account_by ((ModestTnyAccountStore *) account_store,
+ MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
+ priv->visible_account_id);
+ if (account) {
+ tny_list_append (TNY_LIST (model), (GObject *) account);
+ g_object_unref (account);
+ } else {
+ g_warning ("You need to set an account first");
+ g_object_unref (model);
+ return FALSE;
+ }
+ } else {
+ g_warning ("You need to set an account first");
+ g_object_unref (model);
+ return FALSE;
+ }
+ }
sortable = gtk_tree_model_sort_new_with_model (model);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
return cmp;
}
+#ifndef MODEST_TOOLKIT_HILDON2
/*****************************************************************************/
/* DRAG and DROP stuff */
/*****************************************************************************/
return folder;
}
-
/*
* This function is used by drag_data_received_cb to manage drag and
* drop of a header, i.e, and drag from the header view to the folder
}
/* Check if the get_data failed */
+#if GTK_CHECK_VERSION (2,14,0)
+ if ((selection_data == NULL) || (gtk_selection_data_get_length (selection_data) < 0))
+#else
if (selection_data == NULL || selection_data->length < 0)
+#endif
goto end;
/* Select the destination model */
/* Set up the folder view as a dnd destination. Set only the
highlight flag, otherwise gtk will have a different
behaviour */
-#ifdef MODEST_TOOLKIT_HILDON2
- return;
-#endif
gtk_drag_dest_set (GTK_WIDGET (self),
GTK_DEST_DEFAULT_HIGHLIGHT,
folder_view_drag_types,
G_CALLBACK (drag_drop_cb),
NULL);
}
+#endif
/*
* This function manages the navigation through the folders using the
model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
if (GTK_IS_TREE_MODEL_FILTER (model))
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
+ else
+ modest_folder_view_update_model(self,
+ (TnyAccountStore *) modest_runtime_get_account_store());
/* Save settings to gconf */
modest_widget_memory_save (modest_runtime_get_conf (), G_OBJECT(self),
return FALSE;
}
-
-
-
+#ifndef MODEST_TOOLKIT_HILDON2
void
modest_folder_view_select_first_inbox_or_local (ModestFolderView *self)
{
-#ifndef MODEST_TOOLKIT_HILDON2
GtkTreeModel *model;
GtkTreeIter iter, inbox_iter;
GtkTreeSelection *sel;
/* set focus */
gtk_widget_grab_focus (GTK_WIDGET(self));
-#endif
}
-
+#endif
/* recursive */
static gboolean
/* Set color */
attr_list = pango_attr_list_new ();
- if (!gtk_style_lookup_color (GTK_WIDGET (self)->style, "SecondaryTextColor", &style_color)) {
+
+ if (!gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "SecondaryTextColor", &style_color)) {
gdk_color_parse ("grey", &style_color);
}
attr = pango_attr_foreground_new (style_color.red, style_color.green, style_color.blue);
pango_attr_list_unref (attr_list);
}
- if (gtk_style_lookup_color (GTK_WIDGET (self)->style, "ActiveTextColor", &style_active_color)) {
+ if (gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "ActiveTextColor", &style_active_color)) {
priv->active_color = style_active_color;
} else {
gdk_color_parse ("000", &(priv->active_color));
activity);
}
#endif
+
+TnyList *
+modest_folder_view_get_model_tny_list (ModestFolderView *self)
+{
+ GtkTreeModel *model;
+ TnyList *ret_value;
+
+ ret_value = NULL;
+ model = NULL;
+
+ if (get_inner_models (MODEST_FOLDER_VIEW (self), NULL, NULL, (GtkTreeModel **) &model)) {
+ ret_value = TNY_LIST (model);
+ g_object_ref (ret_value);
+ }
+
+ return ret_value;
+
+}