diff options
author | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-12-03 03:18:21 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-12-03 03:18:21 +0800 |
commit | 1bcdb2c524ef136e173842a13aba04b764fd9752 (patch) | |
tree | af6c64bdaa731a2b783263597e4be6f21eefdfce /mail | |
parent | 8f446ab62628c20b9e745f2a9bcea520ab578b9d (diff) | |
download | gsoc2013-evolution-1bcdb2c524ef136e173842a13aba04b764fd9752.tar gsoc2013-evolution-1bcdb2c524ef136e173842a13aba04b764fd9752.tar.gz gsoc2013-evolution-1bcdb2c524ef136e173842a13aba04b764fd9752.tar.bz2 gsoc2013-evolution-1bcdb2c524ef136e173842a13aba04b764fd9752.tar.lz gsoc2013-evolution-1bcdb2c524ef136e173842a13aba04b764fd9752.tar.xz gsoc2013-evolution-1bcdb2c524ef136e173842a13aba04b764fd9752.tar.zst gsoc2013-evolution-1bcdb2c524ef136e173842a13aba04b764fd9752.zip |
fixed some mem leaks in my code
svn path=/trunk/; revision=23586
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-folder-tree-model.c | 51 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 18 |
2 files changed, 17 insertions, 52 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index e9819346be..05c92c6297 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -396,18 +396,16 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite { GtkTreeRowReference *uri_row, *path_row; unsigned int unread; - EAccount *account; GtkTreePath *path; GtkTreeIter sub; gboolean load; - char *node; load = !fi->child && (fi->flags & CAMEL_FOLDER_CHILDREN) && !(fi->flags & CAMEL_FOLDER_NOINFERIORS); path = gtk_tree_model_get_path ((GtkTreeModel *) model, iter); uri_row = gtk_tree_row_reference_new ((GtkTreeModel *) model, path); path_row = gtk_tree_row_reference_copy (uri_row); - /*gtk_tree_path_free (path);*/ + gtk_tree_path_free (path); g_hash_table_insert (model->uri_hash, g_strdup (fi->url), uri_row); g_hash_table_insert (si->path_hash, g_strdup (fi->path), path_row); @@ -424,8 +422,6 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite COL_BOOL_LOAD_SUBDIRS, load, -1); - node = fi->path; - if (fi->child) { fi = fi->child; @@ -447,21 +443,6 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite COL_UINT_UNREAD, 0, -1); } -#if 0 - /* FIXME: need to somehow get access to the appropriate treeview widget... */ - if ((account = mail_config_get_account_by_name (si->display_name))) - node = g_strdup_printf ("%s:%s", account->uid, node); - else - node = g_strdup_printf ("%s:%s", si->display_name, node); - - if (g_hash_table_lookup (priv->expanded, node)) { - printf ("expanding node '%s'\n", node); - gtk_tree_view_expand_to_path (priv->treeview, path); - } - - gtk_tree_path_free (path); - g_free (node); -#endif } @@ -630,8 +611,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con GtkTreeRowReference *row; GtkTreeIter root, iter; GtkTreePath *path; - EAccount *account; - char *node, *uri; + char *uri; g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model)); g_return_if_fail (CAMEL_IS_STORE (store)); @@ -681,34 +661,16 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con gtk_tree_store_append ((GtkTreeStore *) model, &iter, &root); gtk_tree_store_set ((GtkTreeStore *) model, &iter, COL_STRING_DISPLAY_NAME, _("Loading..."), - COL_POINTER_CAMEL_STORE, store, - COL_STRING_FOLDER_PATH, "/", - COL_BOOL_LOAD_SUBDIRS, TRUE, + COL_POINTER_CAMEL_STORE, NULL, + COL_STRING_FOLDER_PATH, NULL, + COL_BOOL_LOAD_SUBDIRS, FALSE, COL_BOOL_IS_STORE, FALSE, - COL_STRING_URI, uri, + COL_STRING_URI, NULL, COL_UINT_UNREAD, 0, -1); g_free (uri); -#if 0 - /* FIXME: how to do this now that it is being done in the - * model instead of the tree widget code??? need to somehow - * get access to the appropriate treeview widget... */ - if ((account = mail_config_get_account_by_name (display_name))) - node = g_strdup_printf ("%s:/", account->uid); - else - node = g_strdup_printf ("%s:/", display_name); - - if (g_hash_table_lookup (priv->expanded, node)) { - path = gtk_tree_model_get_path ((GtkTreeModel *) model, &iter); - gtk_tree_view_expand_to_path (priv->treeview, path); - gtk_tree_path_free (path); - } - - g_free (node); -#endif - /* listen to store events */ #define CAMEL_CALLBACK(func) ((CamelObjectEventHookFunc) func) si->created_id = camel_object_hook_event (store, "folder_created", CAMEL_CALLBACK (folder_created_cb), model); @@ -839,6 +801,7 @@ em_folder_tree_model_set_expanded (EMFolderTreeModel *model, const char *key, gb static void expanded_save (gpointer key, gpointer value, FILE *fp) { + /* FIXME: don't save nodes that don't exist in the tree anymore... */ if (!GPOINTER_TO_INT (value)) return; diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 32c1828765..82c7d90aba 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -316,27 +316,27 @@ em_folder_tree_destroy (GtkObject *obj) struct _EMFolderTreePrivate *priv = ((EMFolderTree *) obj)->priv; if (priv->ddr != 0) { - g_signal_handler_disconnect (obj, priv->ddr); + g_signal_handler_disconnect (priv->model, priv->ddr); priv->ddr = 0; } if (priv->rdp != 0) { - g_signal_handler_disconnect (obj, priv->rdp); + g_signal_handler_disconnect (priv->model, priv->rdp); priv->rdp = 0; } if (priv->rd != 0) { - g_signal_handler_disconnect (obj, priv->rd); + g_signal_handler_disconnect (priv->model, priv->rd); priv->rd = 0; } if (priv->ddg != 0) { - g_signal_handler_disconnect (obj, priv->ddg); + g_signal_handler_disconnect (priv->model, priv->ddg); priv->ddg = 0; } if (priv->ddd != 0) { - g_signal_handler_disconnect (obj, priv->ddd); + g_signal_handler_disconnect (priv->model, priv->ddd); priv->ddd = 0; } @@ -411,7 +411,6 @@ em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model) } - static void drop_uid_list (EMFolderTree *emft, CamelFolder *dest, gboolean move, GtkSelectionData *selection, CamelException *ex) { @@ -822,6 +821,7 @@ em_folder_tree_new (void) model = em_folder_tree_model_new (mail_component_peek_base_directory (mail_component_peek ())); emft = (EMFolderTree *) em_folder_tree_new_with_model (model); + g_object_unref (model); priv = emft->priv; priv->ddr = g_signal_connect (model, "drag-data-received", G_CALLBACK (drag_data_received_cb), emft); @@ -852,14 +852,15 @@ get_store_by_name (CamelStore *store, struct _EMFolderTreeModelStoreInfo *si, st } static void -expand_node (char *key, gpointer value, EMFolderTree *emft) +expand_node (const char *key, gpointer value, EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; struct _EMFolderTreeModelStoreInfo *si; GtkTreeRowReference *row; GtkTreePath *path; EAccount *account; - char *id, *p; + const char *p; + char *id; if (!(p = strchr (key, ':'))) return; @@ -905,6 +906,7 @@ expand_node (char *key, gpointer value, EMFolderTree *emft) gtk_tree_path_free (path); } + GtkWidget * em_folder_tree_new_with_model (EMFolderTreeModel *model) { |