* src/maemo/modest-main-window.c:
[modest] / src / maemo / modest-msg-edit-window.c
index f263baf..dd814c2 100644 (file)
@@ -1106,8 +1106,6 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre
        GdkPixbuf *window_icon = NULL;
        GtkAction *action;
        ModestConf *conf;
-       gboolean prefer_formatted;
-       gint file_format;
        ModestPair *account_pair = NULL;
 
        g_return_val_if_fail (msg, NULL);
@@ -1234,18 +1232,6 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre
        modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
                                               modest_conf_get_bool(modest_runtime_get_conf(), MODEST_CONF_SHOW_BCC, NULL));
 
-       /* Setup the file format */
-       conf = modest_runtime_get_conf ();
-       prefer_formatted = modest_conf_get_bool (conf, MODEST_CONF_PREFER_FORMATTED_TEXT, &error);
-       if (error) {
-               g_clear_error (&error);
-               file_format = MODEST_FILE_FORMAT_FORMATTED_TEXT;
-       } else
-               file_format = (prefer_formatted) ? 
-                       MODEST_FILE_FORMAT_FORMATTED_TEXT : 
-                       MODEST_FILE_FORMAT_PLAIN_TEXT;
-       modest_msg_edit_window_set_file_format (MODEST_MSG_EDIT_WINDOW (obj), file_format);
-
        update_paste_dimming (MODEST_MSG_EDIT_WINDOW (obj));
        priv->update_caption_visibility = TRUE;
 
@@ -3076,26 +3062,27 @@ update_copy_cut_dimming (ModestMsgEditWindow *window)
 {
        ModestWindowPrivate *parent_priv = NULL;
        ModestMsgEditWindowPrivate *priv = NULL;
-       GtkClipboard *clipboard = NULL;
        GtkAction *action = NULL;
        gboolean has_selection = FALSE;
        GtkWidget *focused = NULL;
-       gchar *selection = NULL;
 
        priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
        parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
-       clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
        focused = gtk_window_get_focus (GTK_WINDOW (window));
 
-       has_selection = gtk_clipboard_wait_for_targets (clipboard, NULL, NULL);
+       if (GTK_IS_TEXT_VIEW (focused)) {
+               GtkTextBuffer *buffer = NULL;
+               buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (focused));
+               has_selection = gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (buffer));
+       } else if (GTK_IS_EDITABLE (focused)) {
+               has_selection = gtk_editable_get_selection_bounds (GTK_EDITABLE (focused), NULL, NULL);
+       }
 
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/CutMenu");
        gtk_action_set_sensitive (action, (has_selection) && (!MODEST_IS_ATTACHMENTS_VIEW (focused)));
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/CopyMenu");
        gtk_action_set_sensitive (action, (has_selection) && (!MODEST_IS_ATTACHMENTS_VIEW (focused)));
 
-       if (selection != NULL) 
-               g_free(selection);
 }
 
 static void