aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/em-folder-tree-model.c16
-rw-r--r--mail/em-folder-tree-model.h4
-rw-r--r--mail/em-folder-tree.c36
-rw-r--r--mail/em-marshal.list1
5 files changed, 68 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8cdf28dcb1..9bb351e24a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,16 @@
2003-12-02 Jeffrey Stedfast <fejj@ximian.com>
+ * em-folder-tree.c (em_folder_tree_new_with_model): Connect to the
+ loading row signal.
+ (loading_row_cb): Expand the path if needed.
+ (em_folder_tree_destroy): Disconnect from the loading-row signal.
+
+ * em-folder-tree-model.c (em_folder_tree_model_class_init): Define
+ the loading-row signal.
+ (em_folder_tree_model_set_folder_info): emit the loading-row signal.
+
+2003-12-02 Jeffrey Stedfast <fejj@ximian.com>
+
* em-folder-tree.c (em_folder_tree_new): Fixed to pass the
evolution dir into em_folder_tree_model_new().
(model_save_state): Removed.
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 8efbcce48d..563f53dce0 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -78,6 +78,7 @@ static gboolean model_drag_data_delete (GtkTreeDragSource *drag_source,
enum {
+ LOADING_ROW,
DRAG_DATA_RECEIVED,
ROW_DROP_POSSIBLE,
ROW_DRAGGABLE,
@@ -149,6 +150,17 @@ em_folder_tree_model_class_init (EMFolderTreeModelClass *klass)
object_class->finalize = em_folder_tree_model_finalize;
/* signals */
+ signals[LOADING_ROW] =
+ g_signal_new ("loading-row",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderTreeModelClass, loading_row),
+ NULL, NULL,
+ em_marshal_VOID__POINTER_POINTER,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
signals[DRAG_DATA_RECEIVED] =
g_signal_new ("drag-data-received",
G_OBJECT_CLASS_TYPE (object_class),
@@ -442,6 +454,10 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
COL_STRING_URI, NULL,
COL_UINT_UNREAD, 0,
-1);
+
+ path = gtk_tree_model_get_path ((GtkTreeModel *) model, iter);
+ g_signal_emit (model, signals[LOADING_ROW], 0, path, iter);
+ gtk_tree_path_free (path);
}
}
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index f06591bfbd..882b102d6e 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -89,6 +89,10 @@ struct _EMFolderTreeModelClass {
GtkTreeStoreClass parent_class;
/* signals */
+ void (* loading_row) (EMFolderTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter);
+
gboolean (* drag_data_received) (EMFolderTreeModel *model,
GtkTreePath *dest_path,
GtkSelectionData *selection_data);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 00692595b1..42ffcf0f1d 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -74,6 +74,8 @@ struct _EMFolderTreePrivate {
guint save_state_id;
+ guint loading_row_id;
+
/* dnd signal ids */
guint ddr, rdp, rd, ddg, ddd;
};
@@ -315,6 +317,11 @@ em_folder_tree_destroy (GtkObject *obj)
{
struct _EMFolderTreePrivate *priv = ((EMFolderTree *) obj)->priv;
+ if (priv->loading_row_id != 0) {
+ g_signal_handler_disconnect (priv->model, priv->loading_row_id);
+ priv->loading_row_id = 0;
+ }
+
if (priv->ddr != 0) {
g_signal_handler_disconnect (priv->model, priv->ddr);
priv->ddr = 0;
@@ -907,6 +914,33 @@ expand_node (const char *key, gpointer value, EMFolderTree *emft)
}
+static void
+loading_row_cb (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTreeIter *iter, EMFolderTree *emft)
+{
+ struct _EMFolderTreeModelStoreInfo *si;
+ CamelStore *store;
+ EAccount *account;
+ char *path, *key;
+
+ gtk_tree_model_get ((GtkTreeModel *) model, iter,
+ COL_STRING_FOLDER_PATH, &path,
+ COL_POINTER_CAMEL_STORE, &store,
+ -1);
+
+ si = g_hash_table_lookup (model->store_hash, store);
+ if ((account = mail_config_get_account_by_name (si->display_name))) {
+ key = g_strdup_printf ("%s:%s", account->uid, path);
+ } else {
+ key = g_strdup_printf ("%s:%s", si->display_name, path);
+ }
+
+ if (em_folder_tree_model_get_expanded (model, key))
+ gtk_tree_view_expand_to_path (emft->priv->treeview, tree_path);
+
+ g_free (key);
+}
+
+
GtkWidget *
em_folder_tree_new_with_model (EMFolderTreeModel *model)
{
@@ -919,6 +953,8 @@ em_folder_tree_new_with_model (EMFolderTreeModel *model)
/* FIXME: this sucks... */
g_hash_table_foreach (model->expanded, (GHFunc) expand_node, emft);
+ emft->priv->loading_row_id = g_signal_connect (model, "loading-row", G_CALLBACK (loading_row_cb), emft);
+
return (GtkWidget *) emft;
}
diff --git a/mail/em-marshal.list b/mail/em-marshal.list
index 4a19a91441..00fe377898 100644
--- a/mail/em-marshal.list
+++ b/mail/em-marshal.list
@@ -2,4 +2,5 @@ BOOLEAN:BOXED,POINTER,POINTER
BOOLEAN:POINTER,POINTER
VOID:STRING,STRING
BOOLEAN:POINTER
+VOID:POINTER,POINTER
VOID:POINTER