aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-01-16 04:07:10 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-01-16 04:07:10 +0800
commitcd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d (patch)
treedb968151fa3005c021e5275ca0e091a413096d79
parentb093f39bc8d1b5bab0eafb855ce2da819b93b21a (diff)
downloadgsoc2013-evolution-cd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d.tar
gsoc2013-evolution-cd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d.tar.gz
gsoc2013-evolution-cd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d.tar.bz2
gsoc2013-evolution-cd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d.tar.lz
gsoc2013-evolution-cd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d.tar.xz
gsoc2013-evolution-cd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d.tar.zst
gsoc2013-evolution-cd15b7e2dae9f3f2d74e3ec3de7f1d460545ff0d.zip
Make the model sorted. Fixes bug #52888.
2004-01-15 Jeffrey Stedfast <fejj@ximian.com> * em-folder-tree-model.c (em_folder_tree_model_new): Make the model sorted. Fixes bug #52888. svn path=/trunk/; revision=24254
-rw-r--r--mail/ChangeLog3
-rw-r--r--mail/em-folder-tree-model.c45
2 files changed, 39 insertions, 9 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index f7ad4954df..42ecb6aead 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,8 @@
2004-01-15 Jeffrey Stedfast <fejj@ximian.com>
+ * em-folder-tree-model.c (em_folder_tree_model_new): Make the
+ model sorted. Fixes bug #52888.
+
* em-folder-browser.c (emfb_list_built): Don't select the first
unread mesg in the case where no mesg was previously
selected. Fixes bug #52887 until we are able to add a user
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 549195d5ca..68375023da 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -251,6 +251,12 @@ tree_model_iface_init (GtkTreeModelIface *iface)
}
static void
+tree_sortable_iface_init (GtkTreeSortableIface *iface)
+{
+ ;
+}
+
+static void
tree_drag_dest_iface_init (GtkTreeDragDestIface *iface)
{
iface->drag_data_received = model_drag_data_received;
@@ -441,20 +447,26 @@ model_drag_data_received (GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, Gt
GtkTreeIter iter;
char *path;
+ d(printf ("model_drag_data_received\n"));
+
/* this means we are receiving no data */
if (!selection->data || selection->length == -1)
return FALSE;
- if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, dest_path))
+ if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, dest_path)) {
+ d(printf ("\tfailed to get row\n"));
return FALSE;
+ }
gtk_tree_model_get ((GtkTreeModel *) model, &iter,
COL_POINTER_CAMEL_STORE, &store,
COL_STRING_FOLDER_PATH, &path, -1);
/* make sure user isn't try to drop on a placeholder row */
- if (path == NULL)
+ if (path == NULL) {
+ d(printf ("\tdropped on a placeholder row?\n"));
return FALSE;
+ }
full_name = path[0] == '/' ? path + 1 : path;
@@ -469,19 +481,19 @@ model_drag_data_received (GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, Gt
if (selection->target == gdk_atom_intern ("x-uid-list", FALSE)) {
/* import a list of uids from another evo folder */
drop_uid_list (folder, move, selection, &ex);
- d(printf ("* dropped a x-uid-list\n"));
+ d(printf ("\t* dropped a x-uid-list\n"));
} else if (selection->target == gdk_atom_intern ("x-folder", FALSE)) {
/* copy or move (aka rename) a folder */
drop_folder (folder, move, selection, &ex);
- d(printf ("* dropped a x-folder\n"));
+ d(printf ("\t* dropped a x-folder\n"));
} else if (selection->target == gdk_atom_intern ("message/rfc822", FALSE)) {
/* import a message/rfc822 stream */
drop_message_rfc822 (folder, selection, &ex);
- d(printf ("* dropped a message/rfc822\n"));
+ d(printf ("\t* dropped a message/rfc822\n"));
} else if (selection->target == gdk_atom_intern ("text/uri-list", FALSE)) {
/* import an mbox, maildir, or mh folder? */
drop_text_uri_list (folder, selection, &ex);
- d(printf ("* dropped a text/uri-list\n"));
+ d(printf ("\t* dropped a text/uri-list\n"));
} else {
g_assert_not_reached ();
}
@@ -503,27 +515,39 @@ model_row_drop_possible (GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, Gtk
gboolean is_store;
GtkTreeIter iter;
+ d(printf ("model_row_drop_possible\n"));
+
if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, dest_path))
return FALSE;
gtk_tree_model_get ((GtkTreeModel *) model, &iter, COL_BOOL_IS_STORE, &is_store, -1);
if (selection->target == gdk_atom_intern ("x-uid-list", FALSE)) {
- if (is_store)
+ if (is_store) {
+ d(printf ("\tcan't drop x-uid-list on a store\n"));
return FALSE;
+ }
+ d(printf ("\tcan drop x-uid-list\n"));
return TRUE;
} else if (selection->target == gdk_atom_intern ("x-folder", FALSE)) {
+ d(printf ("\tcan drop x-folder\n"));
return TRUE;
} else if (selection->target == gdk_atom_intern ("message/rfc822", FALSE)) {
- if (is_store)
+ if (is_store) {
+ d(printf ("\tcan't drop message/rfc822 on a store\n"));
return FALSE;
+ }
+ d(printf ("\tcan drop message/rfc822\n"));
return TRUE;
} else if (selection->target == gdk_atom_intern ("text/uri-list", FALSE)) {
- if (is_store)
+ if (is_store) {
+ d(printf ("\tcan't drop text/uri-list on a store\n"));
return FALSE;
+ }
+ d(printf ("\tcan drop text/uri-list\n"));
return TRUE;
} else {
g_assert_not_reached ();
@@ -715,6 +739,9 @@ em_folder_tree_model_new (const char *evolution_dir)
model = g_object_new (EM_TYPE_FOLDER_TREE_MODEL, NULL);
gtk_tree_store_set_column_types ((GtkTreeStore *) model, NUM_COLUMNS, col_types);
+ gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) model,
+ GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+ GTK_SORT_ASCENDING);
filename = g_build_filename (evolution_dir, "mail", "config", "folder-tree.state", NULL);
em_folder_tree_model_load_state (model, filename);