2008-08-21 [colin] 3.5.0cvs67
authorColin Leroy <colin@colino.net>
Thu, 21 Aug 2008 15:52:46 +0000 (15:52 +0000)
committerColin Leroy <colin@colino.net>
Thu, 21 Aug 2008 15:52:46 +0000 (15:52 +0000)
* src/compose.c
* src/compose.h
Add a compose preference for auto-indent
* src/mainwindow.c
* src/summaryview.c
Make colorlabel accels a bit less hacky

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/compose.h
src/mainwindow.c
src/summaryview.c

index b54278d..49b77a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-08-21 [colin]     3.5.0cvs67
+
+       * src/compose.c
+       * src/compose.h
+               Add a compose preference for auto-indent
+       * src/mainwindow.c
+       * src/summaryview.c
+               Make colorlabel accels a bit less hacky
+
 2008-08-21 [colin]     3.5.0cvs66
 
        * src/compose.c
index dfd1b81..78816c6 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.466 -r 1.382.2.467 src/compose.c;  ) > 3.5.0cvs64.patchset
 ( cvs diff -u -r 1.382.2.467 -r 1.382.2.468 src/compose.c;  ) > 3.5.0cvs65.patchset
 ( cvs diff -u -r 1.382.2.468 -r 1.382.2.469 src/compose.c;  cvs diff -u -r 1.204.2.176 -r 1.204.2.177 src/prefs_common.c;  cvs diff -u -r 1.103.2.111 -r 1.103.2.112 src/prefs_common.h;  cvs diff -u -r 1.1.2.16 -r 1.1.2.17 src/prefs_wrapping.c;  ) > 3.5.0cvs66.patchset
+( cvs diff -u -r 1.382.2.469 -r 1.382.2.470 src/compose.c;  cvs diff -u -r 1.50.2.49 -r 1.50.2.50 src/compose.h;  cvs diff -u -r 1.274.2.268 -r 1.274.2.269 src/mainwindow.c;  cvs diff -u -r 1.395.2.382 -r 1.395.2.383 src/summaryview.c;  ) > 3.5.0cvs67.patchset
index d2d8787..5f5e75b 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=5
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=66
+EXTRA_VERSION=67
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 94bdd11..5daa602 100644 (file)
@@ -423,6 +423,8 @@ static void compose_find_cb         (GtkAction      *action,
                                         gpointer        data);
 static void compose_toggle_autowrap_cb (GtkToggleAction *action,
                                         gpointer        data);
+static void compose_toggle_autoindent_cb(GtkToggleAction *action,
+                                        gpointer        data);
 
 static void compose_toggle_ruler_cb    (GtkToggleAction *action,
                                         gpointer        data);
@@ -649,6 +651,7 @@ static GtkActionEntry compose_entries[] =
 static GtkToggleActionEntry compose_toggle_entries[] =
 {
        {"Edit/AutoWrap",               NULL, N_("Aut_o wrapping"), "<shift><control>L", NULL, G_CALLBACK(compose_toggle_autowrap_cb) }, /* TOGGLE */
+       {"Edit/AutoIndent",             NULL, N_("Follow _indentation"), NULL, NULL, G_CALLBACK(compose_toggle_autoindent_cb) }, /* TOGGLE */
        {"Options/Sign",                NULL, N_("Si_gn"), NULL, NULL, G_CALLBACK(compose_toggle_sign_cb) }, /* Toggle */
        {"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 */
@@ -1959,6 +1962,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
        int priority = PRIORITY_NORMAL;
        MsgInfo *replyinfo = NULL, *fwdinfo = NULL;
        gboolean autowrap = prefs_common.autowrap;
+       gboolean autoindent = prefs_common.auto_indent;
 
        g_return_val_if_fail(msginfo != NULL, NULL);
        g_return_val_if_fail(msginfo->folder != NULL, NULL);
@@ -2024,6 +2028,11 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
                        param = atoi(&queueheader_buf[strlen("X-Claws-Auto-Wrapping:")]);
                        autowrap = param;
                }
+               if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf, 
+                                            sizeof(queueheader_buf), "X-Claws-Auto-Indent:")) {
+                       param = atoi(&queueheader_buf[strlen("X-Claws-Auto-Indent:")]);
+                       autoindent = param;
+               }
                 if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf, 
                                             sizeof(queueheader_buf), "X-Claws-Privacy-System:")) {
                         privacy_system = g_strdup(&queueheader_buf[strlen("X-Claws-Privacy-System:")]);
@@ -2078,6 +2087,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
        compose = compose_create(account, msginfo->folder, COMPOSE_REEDIT, batch);
 
        cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoWrap", autowrap);
+       cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoIndent", autoindent);
        compose->autowrap = autowrap;
        compose->replyinfo = replyinfo;
        compose->fwdinfo = fwdinfo;
@@ -4135,7 +4145,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
                                modified = TRUE;
                                gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
                                compose->automatic_break = FALSE;
-                               if (itemized_len && prefs_common.auto_indent) {
+                               if (itemized_len && compose->autoindent) {
                                        gtk_text_buffer_insert(buffer, &break_pos, itemized_chars, -1);
                                        if (!item_continuation)
                                                gtk_text_buffer_insert(buffer, &break_pos, "  ", 2);
@@ -4145,7 +4155,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
                                modified = TRUE;
                                gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
                                compose->automatic_break = FALSE;
-                               if (itemized_len && prefs_common.auto_indent) {
+                               if (itemized_len && compose->autoindent) {
                                        gtk_text_buffer_insert(buffer, &break_pos, itemized_chars, -1);
                                        if (!item_continuation)
                                                gtk_text_buffer_insert(buffer, &break_pos, "  ", 2);
@@ -4155,7 +4165,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
                        /* remove trailing spaces */
                        cur = break_pos;
                        rem_item_len = itemized_len;
-                       while (prefs_common.auto_indent && rem_item_len-- > 0)
+                       while (compose->autoindent && rem_item_len-- > 0)
                                gtk_text_iter_backward_char(&cur);
                        gtk_text_iter_backward_char(&cur);
 
@@ -5038,7 +5048,7 @@ static gint compose_redirect_write_to_file(Compose *compose, FILE *fdest)
                "X-Claws-End-Special-Headers:",                 "X-Claws-Account-Id:",
                "X-Sylpheed-Privacy",   "X-Sylpheed-Sign:",     "X-Sylpheed-Encrypt",
                "X-Sylpheed-End-Special-Headers:",              "X-Sylpheed-Account-Id:",
-               "X-Claws-Auto-Wrapping:",
+               "X-Claws-Auto-Wrapping:", "X-Claws-Auto-Indent:",
                NULL
                };
        if ((fp = g_fopen(compose->redirect_filename, "rb")) == NULL) {
@@ -5621,6 +5631,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
        }
 
        err |= (fprintf(fp, "X-Claws-Auto-Wrapping:%d\n", compose->autowrap) < 0);
+       err |= (fprintf(fp, "X-Claws-Auto-Indent:%d\n", compose->autoindent) < 0);
 
        /* end of headers */
        err |= (fprintf(fp, "X-Claws-End-Special-Headers: 1\n") < 0);
@@ -6846,6 +6857,7 @@ static Compose *compose_create(PrefsAccount *account,
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "WrapPara", "Edit/WrapPara", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "WrapAllLines", "Edit/WrapAllLines", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "AutoWrap", "Edit/AutoWrap", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "AutoIndent", "Edit/AutoIndent", GTK_UI_MANAGER_MENUITEM)
 
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Separator3", "Edit/---", GTK_UI_MANAGER_SEPARATOR)
 
@@ -7201,7 +7213,7 @@ static Compose *compose_create(PrefsAccount *account,
        compose->boundary    = NULL;
 
        compose->autowrap       = prefs_common.autowrap;
-
+       compose->autoindent     = prefs_common.auto_indent;
        compose->use_signing    = FALSE;
        compose->use_encryption = FALSE;
        compose->privacy_system = NULL;
@@ -7265,6 +7277,7 @@ static Compose *compose_create(PrefsAccount *account,
        compose_select_account(compose, account, TRUE);
 
        cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoWrap", prefs_common.autowrap);
+       cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoIndent", prefs_common.auto_indent);
 
        if (account->set_autocc && account->auto_cc && mode != COMPOSE_REEDIT)
                compose_entry_append(compose, account->auto_cc, COMPOSE_CC);
@@ -8986,6 +8999,7 @@ gboolean compose_draft (gpointer data, guint action)
        }
 
        err |= (fprintf(fp, "X-Claws-Auto-Wrapping:%d\n", compose->autowrap) < 0);
+       err |= (fprintf(fp, "X-Claws-Auto-Indent:%d\n", compose->autoindent) < 0);
 
        /* end of headers */
        err |= (fprintf(fp, "X-Claws-End-Special-Headers: 1\n") < 0);
@@ -9991,6 +10005,13 @@ static void compose_toggle_autowrap_cb(GtkToggleAction *action,
        compose->autowrap = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
 }
 
+static void compose_toggle_autoindent_cb(GtkToggleAction *action,
+                                        gpointer        data)
+{
+       Compose *compose = (Compose *)data;
+       compose->autoindent = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+}
+
 static void compose_toggle_sign_cb(GtkToggleAction *action, gpointer data)
 {
        Compose *compose = (Compose *)data;
index 98e5da6..3a26db9 100644 (file)
@@ -158,6 +158,7 @@ struct _Compose
        gchar   *boundary;
 
        gboolean autowrap;
+       gboolean autoindent;
 
        gboolean use_to;
        gboolean use_cc;
index cab1691..e73380b 100644 (file)
@@ -1062,10 +1062,10 @@ static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refr
        g_object_set_data(G_OBJECT(item), "mainwin", mainwin);
        gtk_widget_show(item);
 
-       gtk_widget_add_accelerator(item, "activate", 
-                                  gtk_ui_manager_get_accel_group(mainwin->ui_manager), 
-                                  GDK_0, GDK_CONTROL_MASK,
-                                  GTK_ACCEL_LOCKED | GTK_ACCEL_VISIBLE);
+       accel_path = g_strdup_printf("<ClawsColorLabels>/None");
+       gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
+       g_free(accel_path);
+       gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_0, GDK_CONTROL_MASK);
 
        item = gtk_menu_item_new();
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
@@ -1084,12 +1084,9 @@ static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refr
                gtk_widget_show(item);
                accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i);
                gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
-               g_free(accel_path);
                if (i < 9)
-                       gtk_widget_add_accelerator(item, "activate", 
-                                  gtk_ui_manager_get_accel_group(mainwin->ui_manager), 
-                                  GDK_1+i, GDK_CONTROL_MASK,
-                                  GTK_ACCEL_LOCKED | GTK_ACCEL_VISIBLE);
+                       gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
+               g_free(accel_path);
        }
        gtk_widget_show(menu);
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
index ea1fa26..a32b510 100644 (file)
@@ -5731,6 +5731,7 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
        GtkWidget *menu;
        GtkWidget *item;
        gint i;
+       gchar *accel_path = NULL;
 
        label_menuitem = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/SummaryViewPopup/ColorLabel");
        g_signal_connect(G_OBJECT(label_menuitem), "activate",
@@ -5740,6 +5741,9 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
 
        menu = gtk_menu_new();
 
+       gtk_menu_set_accel_group (GTK_MENU (menu), 
+               gtk_ui_manager_get_accel_group(mainwindow_get_mainwindow()->ui_manager));
+
        /* create sub items. for the menu item activation callback we pass the
         * index of label_colors[] as data parameter. for the None color we
         * pass an invalid (high) value. also we attach a data pointer so we
@@ -5753,6 +5757,11 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
        g_object_set_data(G_OBJECT(item), "summaryview", summaryview);
        gtk_widget_show(item);
 
+       accel_path = g_strdup_printf("<ClawsColorLabels>/None");
+       gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
+       g_free(accel_path);
+       gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_0, GDK_CONTROL_MASK);
+
        item = gtk_menu_item_new();
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
        gtk_widget_show(item);
@@ -5768,6 +5777,11 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
                g_object_set_data(G_OBJECT(item), "summaryview",
                                  summaryview);
                gtk_widget_show(item);
+               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i);
+               gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
+               if (i < 9)
+                       gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
+               g_free(accel_path);
        }
 
        gtk_widget_show(menu);