* fix all compiler warnings (when using gtk/ frontend)
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 2 Feb 2007 13:18:17 +0000 (13:18 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 2 Feb 2007 13:18:17 +0000 (13:18 +0000)
* fix remaing _get_current leaks
* remove unuses modest_tny_msg_find_nth_part

pmo-trunk-r783

src/modest-account-mgr-helpers.c
src/modest-mail-operation.c
src/modest-tny-msg.c
src/modest-tny-msg.h
src/widgets/modest-folder-view.c
src/widgets/modest-header-view-render.c

index 57ba232..74766fd 100644 (file)
@@ -273,6 +273,7 @@ modest_account_mgr_get_tny_account (ModestAccountMgr *self, const gchar* account
                account = TNY_ACCOUNT(tny_iterator_get_current(iter));
                if (strcmp (tny_account_get_id (account), server_account) == 0)
                        break;
+               g_object_unref (G_OBJECT(account));
        }
        
        g_object_unref (G_OBJECT(iter));
index 2012d79..59d3509 100644 (file)
@@ -494,10 +494,11 @@ folder_refresh_cb (TnyFolder *folder, gboolean canceled, GError **err, gpointer
                g_object_unref (G_OBJECT (list));
                g_slice_free (RefreshFolderAsyncHelper, helper);
        } else {
-               tny_folder_refresh_async (TNY_FOLDER (tny_iterator_get_current (helper->iter)),
-                                         folder_refresh_cb,
+               TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (helper->iter));
+               tny_folder_refresh_async (folder, folder_refresh_cb,
                                          status_update_cb, 
                                          helper);
+               g_object_unref (G_OBJECT(folder));
        }
        g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, NULL);
 }
@@ -509,7 +510,8 @@ update_folders_cb (TnyFolderStore *folder_store, TnyList *list, GError **err, gp
        ModestMailOperation *self;
        ModestMailOperationPrivate *priv;
        RefreshFolderAsyncHelper *helper;
-
+       TnyFolder *folder;
+       
        self  = MODEST_MAIL_OPERATION (user_data);
        priv  = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
 
@@ -530,10 +532,10 @@ update_folders_cb (TnyFolderStore *folder_store, TnyList *list, GError **err, gp
        helper->canceled = 0;
 
        /* Async refresh folders */
-       tny_folder_refresh_async (TNY_FOLDER (tny_iterator_get_current (helper->iter)),
-                                 folder_refresh_cb,
-                                 status_update_cb, 
-                                 helper);
+       folder = TNY_FOLDER (tny_iterator_get_current (helper->iter));
+       tny_folder_refresh_async (folder, folder_refresh_cb,
+                                 status_update_cb, helper);
+       g_object_unref (G_OBJECT(folder));
 }
 
 gboolean
index 9cd96a4..7f796a8 100644 (file)
@@ -142,33 +142,5 @@ TnyMimePart*
 modest_tny_msg_find_body_part (TnyMsg *msg, gboolean want_html)
 {
        return modest_tny_msg_find_body_part_from_mime_part (TNY_MIME_PART(msg),
-                                                                    want_html);
-}
-
-
-TnyMimePart *
-modest_tny_msg_find_nth_part (TnyMsg *msg, gint index)
-{
-       TnyMimePart *part;
-       TnyList *parts;
-       TnyIterator *iter;
-
-       g_return_val_if_fail (msg, NULL);
-       g_return_val_if_fail (index > 0, NULL);
-               
-       parts = TNY_LIST(tny_simple_list_new());
-       tny_mime_part_get_parts (TNY_MIME_PART(msg), parts);
-       iter  = tny_list_create_iterator (parts);
-
-       part = NULL;
-       
-       if (!tny_iterator_is_done(iter)) {
-               tny_iterator_nth (iter, index);
-               part = TNY_MIME_PART(tny_iterator_get_current (iter));
-       }
-
-       g_object_unref (G_OBJECT(iter));
-       g_object_unref (G_OBJECT(parts));
-
-       return part;
+                                                            want_html);
 }
index edfcdd5..1a696a0 100644 (file)
@@ -44,19 +44,6 @@ TnyMimePart *modest_tny_msg_find_body_part (TnyMsg * self, gboolean want_html);
 
 
 /**
- * modest_tny_msg_get_nth_part:
- * @self: a message
- * @index: number (1-based) of the part to retrieve
- * 
- * search for the nth (mime) part in the message
- * 
- * Returns: the TnyMsgMimePart for the found part, or NULL if no
- * matching part is foundi; must be unref'd
- */
-TnyMimePart* modest_tny_msg_find_nth_part (TnyMsg *msg, gint index);
-
-
-/**
  * modest_tny_msg_find_body:
  * @self: 
  * @want_html: 
index 0e7204f..9bdb0df 100644 (file)
@@ -194,7 +194,7 @@ static GdkPixbuf*
 get_cached_icon (const gchar *name)
 {
        GError *err = NULL;
-       GdkPixbuf *pixbuf;
+       gpointer pixbuf;
        gpointer orig_key;
        static GHashTable *icon_cache = NULL;
        
@@ -204,8 +204,8 @@ get_cached_icon (const gchar *name)
                icon_cache = modest_cache_mgr_get_cache (modest_runtime_get_cache_mgr(),
                                                         MODEST_CACHE_MGR_CACHE_TYPE_PIXBUF);
        
-       if (!icon_cache || !g_hash_table_lookup_extended (icon_cache, name, &orig_key,(gpointer*)&pixbuf)) {
-               pixbuf = gdk_pixbuf_new_from_file (name, &err);
+       if (!icon_cache || !g_hash_table_lookup_extended (icon_cache, name, &orig_key, &pixbuf)) {
+               pixbuf = (gpointer)gdk_pixbuf_new_from_file (name, &err);
                if (!pixbuf) {
                        g_printerr ("modest: error in icon factory while loading '%s': %s\n",
                                    name, err->message);
@@ -216,7 +216,7 @@ get_cached_icon (const gchar *name)
                if (icon_cache)
                        g_hash_table_insert (icon_cache, g_strdup(name),(gpointer)pixbuf);
        }
-       return pixbuf;
+       return GDK_PIXBUF(pixbuf);
 }
 
 
index f4292a5..b5aeace 100644 (file)
@@ -39,7 +39,7 @@ static GdkPixbuf*
 get_cached_icon (const gchar *name)
 {
        GError *err = NULL;
-       GdkPixbuf *pixbuf;
+       gpointer pixbuf;
        gpointer orig_key;
        static GHashTable *icon_cache = NULL;
        
@@ -49,8 +49,8 @@ get_cached_icon (const gchar *name)
                icon_cache = modest_cache_mgr_get_cache (modest_runtime_get_cache_mgr(),
                                                         MODEST_CACHE_MGR_CACHE_TYPE_PIXBUF);
        
-       if (!icon_cache || !g_hash_table_lookup_extended (icon_cache, name, &orig_key,(gpointer*)&pixbuf)) {
-               pixbuf = gdk_pixbuf_new_from_file (name, &err);
+       if (!icon_cache || !g_hash_table_lookup_extended (icon_cache, name, &orig_key,&pixbuf)) {
+               pixbuf = (gpointer)gdk_pixbuf_new_from_file (name, &err);
                if (!pixbuf) {
                        g_printerr ("modest: error in icon factory while loading '%s': %s\n",
                                    name, err->message);
@@ -61,7 +61,7 @@ get_cached_icon (const gchar *name)
                if (icon_cache)
                        g_hash_table_insert (icon_cache, g_strdup(name),(gpointer)pixbuf);
        }
-       return pixbuf;
+       return GDK_PIXBUF(pixbuf);
 }