2011-11-13 [colin] 3.7.10cvs85
[claws.git] / src / compose.c
index 2211ea0e30b49a39c98df99e882f6d79f24b15c3..45a8bceacdb1256012223a7925009be6b4e28fd5 100644 (file)
 #include "codeconv.h"
 #include "utils.h"
 #include "gtkutils.h"
+#include "gtkshruler.h"
 #include "socket.h"
 #include "alertpanel.h"
 #include "manage_window.h"
-#if !GTK_CHECK_VERSION(2, 24, 0)
-#include "gtkshruler.h"
-#endif
 #include "folder.h"
 #include "addr_compl.h"
 #include "quote_fmt.h"
@@ -353,11 +351,9 @@ static void compose_add_field_list ( Compose *compose,
 
 /* callback functions */
 
-#if !GTK_CHECK_VERSION(2, 24, 0)
 static gboolean compose_edit_size_alloc (GtkEditable   *widget,
                                         GtkAllocation  *allocation,
                                         GtkSHRuler     *shruler);
-#endif
 static void account_activated          (GtkComboBox *optmenu,
                                         gpointer        data);
 static void attach_selected            (GtkTreeView    *tree_view, 
@@ -385,6 +381,8 @@ static void compose_insert_sig_cb   (GtkAction      *action,
 
 static void compose_close_cb           (GtkAction      *action,
                                         gpointer        data);
+static void compose_print_cb           (GtkAction      *action,
+                                        gpointer        data);
 
 static void compose_set_encoding_cb    (GtkAction      *action, GtkRadioAction *current, gpointer data);
 
@@ -441,10 +439,8 @@ static void compose_toggle_autowrap_cb     (GtkToggleAction *action,
 static void compose_toggle_autoindent_cb(GtkToggleAction *action,
                                         gpointer        data);
 
-#if !GTK_CHECK_VERSION(2, 24, 0)
 static void compose_toggle_ruler_cb    (GtkToggleAction *action,
                                         gpointer        data);
-#endif
 static void compose_toggle_sign_cb     (GtkToggleAction *action,
                                         gpointer        data);
 static void compose_toggle_encrypt_cb  (GtkToggleAction *action,
@@ -575,6 +571,8 @@ static GtkActionEntry compose_entries[] =
        /* {"Message/---",              NULL, "---" }, */
        {"Message/Save",                NULL, N_("_Save"), "<control>S", NULL, G_CALLBACK(compose_save_cb) }, /*COMPOSE_KEEP_EDITING*/
        /* {"Message/---",              NULL, "---" }, */
+       {"Message/Print",               NULL, N_("_Print"), NULL, NULL, G_CALLBACK(compose_print_cb) },
+       /* {"Message/---",              NULL, "---" }, */
        {"Message/Close",               NULL, N_("_Close"), "<control>W", NULL, G_CALLBACK(compose_close_cb) },
 
 /* Edit menu */
@@ -586,7 +584,7 @@ static GtkActionEntry compose_entries[] =
        {"Edit/Copy",                   NULL, N_("_Copy"), "<control>C", NULL, G_CALLBACK(compose_copy_cb) },
        {"Edit/Paste",                  NULL, N_("_Paste"), "<control>V", NULL, G_CALLBACK(compose_paste_cb) },
 
-       {"Edit/SpecialPaste",           NULL, N_("Special paste") },
+       {"Edit/SpecialPaste",           NULL, N_("_Special paste") },
        {"Edit/SpecialPaste/AsQuotation",       NULL, N_("as _quotation"), NULL, NULL, G_CALLBACK(compose_paste_as_quote_cb) },
        {"Edit/SpecialPaste/Wrapped",   NULL, N_("_wrapped"), NULL, NULL, G_CALLBACK(compose_paste_wrap_cb) },
        {"Edit/SpecialPaste/Unwrapped", NULL, N_("_unwrapped"), NULL, NULL, G_CALLBACK(compose_paste_no_wrap_cb) },
@@ -674,9 +672,7 @@ static GtkToggleActionEntry compose_toggle_entries[] =
        {"Options/Encrypt",             NULL, N_("_Encrypt"), NULL, NULL, G_CALLBACK(compose_toggle_encrypt_cb) }, /* Toggle */
        {"Options/RequestRetRcpt",      NULL, N_("_Request Return Receipt"), NULL, NULL, G_CALLBACK(compose_toggle_return_receipt_cb) }, /* TOGGLE */
        {"Options/RemoveReferences",    NULL, N_("Remo_ve references"), NULL, NULL, G_CALLBACK(compose_toggle_remove_refs_cb) }, /* TOGGLE */
-#if !GTK_CHECK_VERSION(2, 24, 0)
        {"Tools/ShowRuler",             NULL, N_("Show _ruler"), NULL, NULL, G_CALLBACK(compose_toggle_ruler_cb) }, /* Toggle */
-#endif
 };
 
 static GtkRadioActionEntry compose_radio_rm_entries[] =
@@ -797,9 +793,9 @@ static void compose_create_tags(GtkTextView *text, Compose *compose)
 #if !GTK_CHECK_VERSION(2, 24, 0)
        GdkColormap *cmap;
        gboolean success[8];
+       int i;
 #endif
        GdkColor color[8];
-       int i;
 
        buffer = gtk_text_view_get_buffer(text);
 
@@ -1592,7 +1588,8 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
 
        undo_block(compose->undostruct);
 #ifdef USE_ENCHANT
-               compose_set_dictionaries_from_folder_prefs(compose, msginfo->folder);
+       compose_set_dictionaries_from_folder_prefs(compose, msginfo->folder);
+       gtkaspell_block_check(compose->gtkaspell);
 #endif
 
        if (quote_mode == COMPOSE_QUOTE_FORCED ||
@@ -1628,10 +1625,6 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
                                          _("The body of the \"Reply\" template has an error at line %d."));
                compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
                quote_fmt_reset_vartable();
-#ifdef USE_ENCHANT
-               if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
-                       gtkaspell_highlight_all(compose->gtkaspell);
-#endif
        }
 
        if (MSG_IS_ENCRYPTED(compose->replyinfo->flags)) {
@@ -1651,6 +1644,11 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
 
        compose_wrap_all(compose);
 
+#ifdef USE_ENCHANT
+       if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
+               gtkaspell_highlight_all(compose->gtkaspell);
+       gtkaspell_unblock_check(compose->gtkaspell);
+#endif
        SIGNAL_UNBLOCK(textbuf);
        
        gtk_widget_grab_focus(compose->text);
@@ -1749,6 +1747,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                pref_get_unescaped_pref(tmp, msginfo->folder->prefs->forward_override_from_format);
 
 #ifdef USE_ENCHANT
+               gtkaspell_block_check(compose->gtkaspell);
                quote_fmt_init(full_msginfo, NULL, NULL, FALSE, compose->account, FALSE,
                                compose->gtkaspell);
 #else
@@ -1830,10 +1829,6 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                compose_attach_parts(compose, msginfo);
 
                procmsg_msginfo_free(full_msginfo);
-#ifdef USE_ENCHANT
-               if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
-                       gtkaspell_highlight_all(compose->gtkaspell);
-#endif
        }
 
        SIGNAL_BLOCK(textbuf);
@@ -1843,6 +1838,11 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
 
        compose_wrap_all(compose);
 
+#ifdef USE_ENCHANT
+       if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
+               gtkaspell_highlight_all(compose->gtkaspell);
+       gtkaspell_unblock_check(compose->gtkaspell);
+#endif
        SIGNAL_UNBLOCK(textbuf);
        
        cursor_pos = quote_fmt_get_cursor_pos();
@@ -2436,9 +2436,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
        cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/InsertSig", FALSE);
        cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit", FALSE);
        cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options", FALSE);
-#if !GTK_CHECK_VERSION(2, 24, 0)
        cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Tools/ShowRuler", FALSE);
-#endif
        cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Tools/Actions", FALSE);
        
        if (compose->toolbar->draft_btn)
@@ -2547,7 +2545,7 @@ void compose_entry_append(Compose *compose, const gchar *address,
 
 static void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
 {
-#if !GTK_CHECK_VERSION(2, 24, 0)
+#if !GTK_CHECK_VERSION(3, 0, 0)
        static GdkColor yellow;
        static GdkColor black;
        static gboolean yellow_initialised = FALSE;
@@ -2558,7 +2556,7 @@ static void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
        GSList *h_list;
        GtkEntry *entry;
                
-#if !GTK_CHECK_VERSION(2, 24, 0)
+#if !GTK_CHECK_VERSION(3, 0, 0)
        if (!yellow_initialised) {
                gdk_color_parse("#f5f6be", &yellow);
                gdk_color_parse("#000000", &black);
@@ -2573,7 +2571,7 @@ static void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
                entry = GTK_ENTRY(((ComposeHeaderEntry *)h_list->data)->entry);
                if (gtk_entry_get_text(entry) && 
                    !g_utf8_collate(gtk_entry_get_text(entry), mailto)) {
-#if !GTK_CHECK_VERSION(2, 24, 0)
+#if !GTK_CHECK_VERSION(3, 0, 0)
                        if (yellow_initialised) {
 #endif
                                gtk_widget_modify_base(
@@ -2582,7 +2580,7 @@ static void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
                                gtk_widget_modify_text(
                                        GTK_WIDGET(((ComposeHeaderEntry *)h_list->data)->entry),
                                        GTK_STATE_NORMAL, &black);
-#if !GTK_CHECK_VERSION(2, 24, 0)
+#if !GTK_CHECK_VERSION(3, 0, 0)
                        }
 #endif
                }
@@ -4565,7 +4563,7 @@ end:
                *par_iter = iter;
        undo_wrapping(compose->undostruct, FALSE);
        compose->autowrap = prev_autowrap;
-       
+
        return modified;
 }
 
@@ -5013,10 +5011,10 @@ gint compose_send(Compose *compose)
        }
        if (msgpath == NULL) {
                msgpath = folder_item_fetch_msg(folder, msgnum);
-               val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
+               val = procmsg_send_message_queue_with_lock(msgpath, &errstr, folder, msgnum, &queued_removed);
                g_free(msgpath);
        } else {
-               val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
+               val = procmsg_send_message_queue_with_lock(msgpath, &errstr, folder, msgnum, &queued_removed);
                claws_unlink(msgpath);
                g_free(msgpath);
        }
@@ -7084,15 +7082,12 @@ static Compose *compose_create(PrefsAccount *account,
        GtkWidget *paned;
 
        GtkWidget *edit_vbox;
-#if !GTK_CHECK_VERSION(2, 24, 0)
        GtkWidget *ruler_hbox;
        GtkWidget *ruler;
-#endif
        GtkWidget *scrolledwin;
        GtkWidget *text;
        GtkTextBuffer *buffer;
        GtkClipboard *clipboard;
-       CLAWS_TIP_DECL();
 
        UndoMain *undostruct;
 
@@ -7131,7 +7126,8 @@ static Compose *compose_create(PrefsAccount *account,
        window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "compose");
 
        gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
-       gtk_widget_set_size_request(window, -1, prefs_common.compose_height);
+       gtk_widget_set_size_request(window, prefs_common.compose_width,
+                                       prefs_common.compose_height);
 
        if (!geometry.max_width) {
                geometry.max_width = gdk_screen_width();
@@ -7199,6 +7195,8 @@ static Compose *compose_create(PrefsAccount *account,
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Separator2", "Message/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Save", "Message/Save", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Separator3", "Message/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Print", "Message/Print", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Separator4", "Message/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Close", "Message/Close", GTK_UI_MANAGER_MENUITEM)
 
 /* Edit menu */
@@ -7343,9 +7341,7 @@ static Compose *compose_create(PrefsAccount *account,
 /* phew. */
 
 /* Tools menu */
-#if !GTK_CHECK_VERSION(2, 24, 0)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools", "ShowRuler", "Tools/ShowRuler", GTK_UI_MANAGER_MENUITEM)
-#endif
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools", "Template", "Tools/Template", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools/Template", "PlaceHolder", "Tools/Template/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
@@ -7447,16 +7443,14 @@ static Compose *compose_create(PrefsAccount *account,
 
        gtk_box_pack_start(GTK_BOX(edit_vbox), subject_hbox, FALSE, FALSE, 0);
 
-#if !GTK_CHECK_VERSION(2, 24, 0)
        /* ruler */
        ruler_hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(edit_vbox), ruler_hbox, FALSE, FALSE, 0);
 
-       ruler = gtk_shruler_new();
-       gtk_ruler_set_range(GTK_RULER(ruler), 0.0, 100.0, 1.0, 100.0);
+       ruler = gtk_shruler_new(GTK_ORIENTATION_HORIZONTAL);
+       gtk_shruler_set_range(GTK_SHRULER(ruler), 0.0, 100.0, 1.0);
        gtk_box_pack_start(GTK_BOX(ruler_hbox), ruler, TRUE, TRUE,
                           BORDER_WIDTH);
-#endif
 
        /* text widget */
        scrolledwin = gtk_scrolled_window_new(NULL, NULL);
@@ -7466,7 +7460,6 @@ static Compose *compose_create(PrefsAccount *account,
        gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin),
                                            GTK_SHADOW_IN);
        gtk_box_pack_start(GTK_BOX(edit_vbox), scrolledwin, TRUE, TRUE, 0);
-       gtk_widget_set_size_request(scrolledwin, prefs_common.compose_width, -1);
 
        text = gtk_text_view_new();
        if (prefs_common.show_compose_margin) {
@@ -7480,11 +7473,9 @@ static Compose *compose_create(PrefsAccount *account,
        gtk_text_buffer_add_selection_clipboard(buffer, clipboard);
        
        gtk_container_add(GTK_CONTAINER(scrolledwin), text);
-#if !GTK_CHECK_VERSION(2, 24, 0)
        g_signal_connect_after(G_OBJECT(text), "size_allocate",
                               G_CALLBACK(compose_edit_size_alloc),
                               ruler);
-#endif
        g_signal_connect(G_OBJECT(buffer), "changed",
                         G_CALLBACK(compose_changed_cb), compose);
        g_signal_connect(G_OBJECT(text), "grab_focus",
@@ -7578,10 +7569,8 @@ static Compose *compose_create(PrefsAccount *account,
 
        compose->notebook      = notebook;
        compose->edit_vbox     = edit_vbox;
-#if !GTK_CHECK_VERSION(2, 24, 0)
        compose->ruler_hbox    = ruler_hbox;
        compose->ruler         = ruler;
-#endif
        compose->scrolledwin   = scrolledwin;
        compose->text          = text;
 
@@ -7700,12 +7689,10 @@ static Compose *compose_create(PrefsAccount *account,
 
        compose_list = g_list_append(compose_list, compose);
 
-#if !GTK_CHECK_VERSION(2, 24, 0)
        if (!prefs_common.show_ruler)
                gtk_widget_hide(ruler_hbox);
                
        cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Tools/ShowRuler", prefs_common.show_ruler);
-#endif
 
        /* Priority */
        compose->priority = PRIORITY_NORMAL;
@@ -8435,7 +8422,7 @@ static void compose_destroy(Compose *compose)
 #endif
 
        if (!compose->batch) {
-               gtk_widget_get_allocation(compose->scrolledwin, &allocation);
+               gtk_widget_get_allocation(compose->window, &allocation);
                prefs_common.compose_width = allocation.width;
                prefs_common.compose_height = allocation.height;
        }
@@ -9149,7 +9136,6 @@ static void compose_undo_state_changed(UndoMain *undostruct, gint undo_state,
  * includes "non-client" (windows-izm) in calculation, so this calculation
  * may not be accurate.
  */
-#if !GTK_CHECK_VERSION(2, 24, 0)
 static gboolean compose_edit_size_alloc(GtkEditable *widget,
                                        GtkAllocation *allocation,
                                        GtkSHRuler *shruler)
@@ -9164,14 +9150,12 @@ static gboolean compose_edit_size_alloc(GtkEditable *widget,
                        (allocation->width - allocation->x) / char_width;
 
                /* got the maximum */
-               gtk_ruler_set_range(GTK_RULER(shruler),
-                                   0.0, line_width_in_chars, 0,
-                                   /*line_width_in_chars*/ char_width);
+               gtk_shruler_set_range(GTK_SHRULER(shruler),
+                                   0.0, line_width_in_chars, 0);
        }
 
        return TRUE;
 }
-#endif
 
 typedef struct {
        gchar                   *header;
@@ -9843,6 +9827,15 @@ static void compose_close_cb(GtkAction *action, gpointer data)
        compose_close(compose);
 }
 
+static void compose_print_cb(GtkAction *action, gpointer data)
+{
+       Compose *compose = (Compose *) data;
+
+       compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE);
+       if (compose->targetinfo)
+               messageview_print(compose->targetinfo, FALSE, -1, -1, 0);
+}
+
 static void compose_set_encoding_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
 {
        gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current));
@@ -10013,7 +10006,7 @@ static void compose_cut_cb(GtkAction *action, gpointer data)
        Compose *compose = (Compose *)data;
        if (compose->focused_editable 
 #ifndef GENERIC_UMPC
-           && gtkut_widget_has_focus(compose->focused_editable)
+           && gtk_widget_has_focus(compose->focused_editable)
 #endif
            )
                entry_cut_clipboard(compose->focused_editable);
@@ -10024,7 +10017,7 @@ static void compose_copy_cb(GtkAction *action, gpointer data)
        Compose *compose = (Compose *)data;
        if (compose->focused_editable 
 #ifndef GENERIC_UMPC
-           && gtkut_widget_has_focus(compose->focused_editable)
+           && gtk_widget_has_focus(compose->focused_editable)
 #endif
            )
                entry_copy_clipboard(compose->focused_editable);
@@ -10037,14 +10030,14 @@ static void compose_paste_cb(GtkAction *action, gpointer data)
        GtkTextBuffer *buffer;
        BLOCK_WRAP();
        if (compose->focused_editable &&
-           gtkut_widget_has_focus(compose->focused_editable))
+           gtk_widget_has_focus(compose->focused_editable))
                entry_paste_clipboard(compose, compose->focused_editable, 
                                prefs_common.linewrap_pastes,
                                GDK_SELECTION_CLIPBOARD, NULL);
        UNBLOCK_WRAP();
 
 #ifdef USE_ENCHANT
-       if (gtkut_widget_has_focus(compose->text) &&
+       if (gtk_widget_has_focus(compose->text) &&
            compose->gtkaspell && 
             compose->gtkaspell->check_while_typing)
                gtkaspell_highlight_all(compose->gtkaspell);
@@ -10057,7 +10050,7 @@ static void compose_paste_as_quote_cb(GtkAction *action, gpointer data)
        gint wrap_quote = prefs_common.linewrap_quote;
        if (compose->focused_editable 
 #ifndef GENERIC_UMPC
-           && gtkut_widget_has_focus(compose->focused_editable)
+           && gtk_widget_has_focus(compose->focused_editable)
 #endif
            ) {
                /* let text_insert() (called directly or at a later time
@@ -10086,7 +10079,7 @@ static void compose_paste_no_wrap_cb(GtkAction *action, gpointer data)
        BLOCK_WRAP();
        if (compose->focused_editable 
 #ifndef GENERIC_UMPC
-           && gtkut_widget_has_focus(compose->focused_editable)
+           && gtk_widget_has_focus(compose->focused_editable)
 #endif
            )
                entry_paste_clipboard(compose, compose->focused_editable, FALSE,
@@ -10094,7 +10087,7 @@ static void compose_paste_no_wrap_cb(GtkAction *action, gpointer data)
        UNBLOCK_WRAP();
 
 #ifdef USE_ENCHANT
-       if (gtkut_widget_has_focus(compose->text) &&
+       if (gtk_widget_has_focus(compose->text) &&
            compose->gtkaspell && 
             compose->gtkaspell->check_while_typing)
                gtkaspell_highlight_all(compose->gtkaspell);
@@ -10109,7 +10102,7 @@ static void compose_paste_wrap_cb(GtkAction *action, gpointer data)
        BLOCK_WRAP();
        if (compose->focused_editable 
 #ifndef GENERIC_UMPC
-           && gtkut_widget_has_focus(compose->focused_editable)
+           && gtk_widget_has_focus(compose->focused_editable)
 #endif
            )
                entry_paste_clipboard(compose, compose->focused_editable, TRUE,
@@ -10117,7 +10110,7 @@ static void compose_paste_wrap_cb(GtkAction *action, gpointer data)
        UNBLOCK_WRAP();
 
 #ifdef USE_ENCHANT
-       if (gtkut_widget_has_focus(compose->text) &&
+       if (gtk_widget_has_focus(compose->text) &&
            compose->gtkaspell &&
             compose->gtkaspell->check_while_typing)
                gtkaspell_highlight_all(compose->gtkaspell);
@@ -10129,7 +10122,7 @@ static void compose_allsel_cb(GtkAction *action, gpointer data)
        Compose *compose = (Compose *)data;
        if (compose->focused_editable 
 #ifndef GENERIC_UMPC
-           && gtkut_widget_has_focus(compose->focused_editable)
+           && gtk_widget_has_focus(compose->focused_editable)
 #endif
            )
                entry_allsel(compose->focused_editable);
@@ -10433,7 +10426,7 @@ static void compose_advanced_action_cb(GtkAction *gaction, gpointer data)
                {textview_delete_to_line_end}
        };
 
-       if (!gtkut_widget_has_focus(GTK_WIDGET(text))) return;
+       if (!gtk_widget_has_focus(GTK_WIDGET(text))) return;
 
        if (action >= COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE &&
            action <= COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END) {
@@ -10593,7 +10586,6 @@ static void activate_privacy_system(Compose *compose, PrefsAccount *account, gbo
        compose_update_privacy_system_menu_item(compose, warn);
 }
 
-#if !GTK_CHECK_VERSION(2, 24, 0)
 static void compose_toggle_ruler_cb(GtkToggleAction *action, gpointer data)
 {
        Compose *compose = (Compose *)data;
@@ -10607,7 +10599,6 @@ static void compose_toggle_ruler_cb(GtkToggleAction *action, gpointer data)
                prefs_common.show_ruler = FALSE;
        }
 }
-#endif
 
 static void compose_attach_drag_received_cb (GtkWidget         *widget,
                                             GdkDragContext     *context,
@@ -11018,7 +11009,7 @@ static void compose_check_all(GtkAction *action, gpointer data)
        if (!compose->gtkaspell)
                return;
                
-       if (gtkut_widget_has_focus(compose->subject_entry))
+       if (gtk_widget_has_focus(compose->subject_entry))
                claws_spell_entry_check_all(
                        CLAWS_SPELL_ENTRY(compose->subject_entry));             
        else
@@ -11043,7 +11034,7 @@ static void compose_check_backwards(GtkAction *action, gpointer data)
                return;
        }
 
-       if (gtkut_widget_has_focus(compose->subject_entry))
+       if (gtk_widget_has_focus(compose->subject_entry))
                claws_spell_entry_check_backwards(
                        CLAWS_SPELL_ENTRY(compose->subject_entry));
        else
@@ -11058,7 +11049,7 @@ static void compose_check_forwards_go(GtkAction *action, gpointer data)
                return;
        }
 
-       if (gtkut_widget_has_focus(compose->subject_entry))
+       if (gtk_widget_has_focus(compose->subject_entry))
                claws_spell_entry_check_forwards_go(
                        CLAWS_SPELL_ENTRY(compose->subject_entry));
        else