GtkTreeModel *model,
const gchar *tny_folder_id);
-
+static gboolean modest_header_view_on_expose_event(
+ GtkTreeView *header_view,
+ GdkEventExpose *event,
+ gpointer user_data);
typedef enum {
HEADER_VIEW_NON_EMPTY,
G_CALLBACK (on_account_removed),
self);
+ g_signal_connect (self, "expose-event",
+ G_CALLBACK(modest_header_view_on_expose_event),
+ NULL);
+
return GTK_WIDGET(self);
}
return MODEST_HEADER_VIEW_GET_PRIVATE(self)->style;
}
+/* This is used to automatically select the first header if the user
+ * has not selected any header yet.
+ */
+static gboolean
+modest_header_view_on_expose_event(GtkTreeView *header_view,
+ GdkEventExpose *event,
+ gpointer user_data)
+{
+ GtkTreeSelection *sel;
+ GtkTreeModel *model;
+ GtkTreeIter tree_iter;
+
+ /* I'm invalidating this method because it causes an annoying
+ efect, the focus changes to the header view when selecting
+ a folder in the folder view because of this code and it
+ shouldn't. We need to find another way to set the passive
+ focus on it. Sergio. */
+ return FALSE;
+
+ model = gtk_tree_view_get_model(header_view);
+
+ sel = gtk_tree_view_get_selection(header_view);
+ if(!gtk_tree_selection_count_selected_rows(sel))
+ if (gtk_tree_model_get_iter_first(model, &tree_iter))
+ gtk_tree_selection_select_iter(sel, &tree_iter);
+
+ return FALSE;
+}
+
/*
* This function sets a sortable model in the header view. It's just
* used for developing purposes, because it only does a
/* Pick my reference. Nothing to do with the mail operation */
priv->folder = g_object_ref (folder);
- /* no message selected */
+ /* Clear the selection if exists */
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
+ gtk_tree_selection_unselect_all(selection);
g_signal_emit (G_OBJECT(self), signals[HEADER_SELECTED_SIGNAL], 0, NULL);
+ /* create the helper */
info = g_malloc0 (sizeof(SetFolderHelper));
info->header_view = self;
info->cb = callback;
info->user_data = user_data;
- /* bug 57631: Clear the selection if exists */
- selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
- gtk_tree_selection_unselect_all(selection);
-
/* Create the mail operation (source will be the parent widget) */
mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_RECEIVE, source);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
ModestHeaderViewPrivate *priv = NULL;
TnyFolderChangeChanged changed;
HeadersCountChangedHelper *helper = NULL;
+ TnyFolder *folder = NULL;
changed = tny_folder_change_get_changed (change);
view has changed before this call to the observer
happens */
priv = MODEST_HEADER_VIEW_GET_PRIVATE (MODEST_HEADER_VIEW (self));
- if (tny_folder_change_get_folder (change) != priv->folder)
- return;
+ folder = tny_folder_change_get_folder (change);
+ if (folder != priv->folder)
+ goto frees;
/* Check folder count */
if ((changed & TNY_FOLDER_CHANGE_CHANGED_ADDED_HEADERS) ||
helper = g_slice_new0 (HeadersCountChangedHelper);
helper->self = MODEST_HEADER_VIEW(self);
helper->change = g_object_ref(change);
-
- g_idle_add_full (G_PRIORITY_DEFAULT,
- idle_notify_headers_count_changed,
- helper,
- idle_notify_headers_count_changed_destroy);
+
+/* if (folder != NULL) */
+/* tny_folder_poke_status (folder); */
+
+ idle_notify_headers_count_changed (helper);
+ idle_notify_headers_count_changed_destroy (helper);
}
+
+ /* Free */
+ frees:
+ if (folder != NULL)
+ g_object_unref (folder);
}
gboolean