* Fixes several memory leaks
[modest] / src / maemo / modest-msg-edit-window.c
index 954c222..d322a21 100644 (file)
@@ -1000,6 +1000,8 @@ pixbuf_from_stream (TnyStream *stream, const gchar *mime_type, guint64 *stream_s
                readed = tny_stream_read (TNY_STREAM (stream), (char *) read_buffer, 128);
                size += readed;
                if (!gdk_pixbuf_loader_write (loader, read_buffer, readed, &error)) {
+                       if (error)
+                               g_free (error);
                        break;
                }
        }
@@ -1893,8 +1895,12 @@ modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self,
        
        text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), self);
        
+       g_free (buffer_format);
        g_free (current_format);
 
+       /* Check dimming rules */
+       modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (self));
+       modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
 }
 
 static void
@@ -2157,7 +2163,8 @@ modest_msg_edit_window_insert_image (ModestMsgEditWindow *window)
        modest_maemo_utils_setup_images_filechooser (GTK_FILE_CHOOSER (dialog));
 
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
-                                    GTK_WINDOW (dialog));
+                                    GTK_WINDOW (dialog),
+                                    GTK_WINDOW (window));
 
        response = gtk_dialog_run (GTK_DIALOG (dialog));
        switch (response) {
@@ -2271,7 +2278,7 @@ modest_msg_edit_window_offer_attach_file (ModestMsgEditWindow *window)
        dialog = hildon_file_chooser_dialog_new (GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_OPEN);
        gtk_window_set_title (GTK_WINDOW (dialog), _("mcen_ti_select_attachment_title"));
        gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
-       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), GTK_WINDOW (window));
 
        response = gtk_dialog_run (GTK_DIALOG (dialog));
        switch (response) {
@@ -2822,6 +2829,7 @@ modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window,
                        break;
                }
                modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window));
+               modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (window));
                text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), window);
        }
 }
@@ -2849,7 +2857,7 @@ modest_msg_edit_window_select_font (ModestMsgEditWindow *window)
        
        dialog = hildon_font_selection_dialog_new (GTK_WINDOW (window), NULL);
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr(),
-                                    GTK_WINDOW(dialog));
+                                    GTK_WINDOW(dialog), GTK_WINDOW (window));
 
        /* First we get the currently selected font information */
        wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), &oldfmt, TRUE);
@@ -2885,6 +2893,8 @@ modest_msg_edit_window_select_font (ModestMsgEditWindow *window)
                      "family-set", !oldfmt.cs.font,
                      NULL);
 
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
+                                    GTK_WINDOW (dialog), GTK_WINDOW (window));
        gtk_widget_show_all (dialog);
        priv->font_dialog = dialog;
        response = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -2974,7 +2984,6 @@ modest_msg_edit_window_undo (ModestMsgEditWindow *window)
 
        modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window));
        modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (window));
-
 }
 
 void
@@ -3540,7 +3549,7 @@ modest_msg_edit_window_set_draft (ModestMsgEditWindow *window,
                }
                priv->msg_uid = modest_tny_folder_get_header_unique_id (header);
                if (GTK_WIDGET_REALIZED (window))
-                       modest_window_mgr_register_window (mgr, MODEST_WINDOW (window));
+                       modest_window_mgr_register_window (mgr, MODEST_WINDOW (window), NULL);
        }
 
        priv->draft_msg = draft;
@@ -3555,7 +3564,7 @@ text_buffer_apply_tag (GtkTextBuffer *buffer, GtkTextTag *tag,
        ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (userdata);
        gchar *tag_name;
 
-       if (tag == NULL+13) return;
+       if (tag == NULL) return;
        g_object_get (G_OBJECT (tag), "name", &tag_name, NULL);
        if ((tag_name != NULL) && (g_str_has_prefix (tag_name, "image-tag-replace-"))) {
                replace_with_images (window, priv->images);