sync with sylpheed 0.7.0cvs36
authorPaul Mangan <paul@claws-mail.org>
Wed, 6 Feb 2002 10:17:44 +0000 (10:17 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 6 Feb 2002 10:17:44 +0000 (10:17 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/addr_compl.c
src/addressbook.c
src/folderview.c
src/imap.c
src/prefs_common.c

index fbf4f29..feba135 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-02-06
+
+       * src/imap.c: imap_copy_msgs_with_dest(): fixed a bug on traversing
+         list.
+       * src/prefs_common.c: made the key binding setting separate dialog.
+       * src/addressbook.c: addressbook_format_address(): add "" around
+         the display name if it contains comma (thanks to Satoshi Watanabe).
+       * src/addr_compl.c: get_complete_address(): add "" around the
+         display name if it contains comma.
+         get_address_from_edit(): handle the quotation character correctly.
+
 2002-02-05
 
        * src/compose.c: compose_exec_ext_editor_real(): replaced
index 8d915bf..42aaf4b 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-06 [paul]      0.7.0claws50
+
+       * sync with sylpheed 0.7.0cvs36
+               see ChangeLog entry 2002-02-06
+
 2002-02-05 [paul]
 
        * po/es.po
index e5d9047..9b05033 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-06
+
+       * src/imap.c: imap_copy_msgs_with_dest(): ¥ê¥¹¥È¤Î¥È¥é¥Ð¡¼¥¹»þ¤Î
+         ¥Ð¥°¤ò½¤Àµ¡£
+       * src/prefs_common.c: ¥­¡¼¥Ð¥¤¥ó¥É¤ÎÀßÄê¤òÊÌ¥À¥¤¥¢¥í¥°¤Ë¤·¤¿¡£
+       * src/addressbook.c: addressbook_format_address(): É½¼¨Ì¾¤Ë¥«¥ó¥Þ
+         ¤¬´Þ¤Þ¤ì¤Æ¤¤¤ì¤Ð "" ¤òÄɲ乤ë¤è¤¦¤Ë¤·¤¿(ÅÏÉô¤µ¤ó thanks)¡£
+       * src/addr_compl.c: get_complete_address(): É½¼¨Ì¾¤Ë¥«¥ó¥Þ¤¬´Þ¤Þ¤ì¤Æ
+         ¤¤¤ì¤Ð "" ¤òÄɲ乤ë¤è¤¦¤Ë¤·¤¿¡£
+         get_address_from_edit(): °úÍÑʸ»ú¤òÀµ¤·¤¯°·¤¦¤è¤¦¤Ë¤·¤¿¡£
+
 2002-02-05
 
        * src/compose.c: compose_exec_ext_editor_real(): g_strsplit() ¤ò
index fbcf7a9..608bee6 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws49
+EXTRA_VERSION=claws50
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index a028d4b..2b8a284 100644 (file)
@@ -155,6 +155,8 @@ static gint add_address(const gchar *name, const gchar *address)
 
        if (!name || !address) return -1;
 
+       debug_print( "completion: add_address: %s - %s\n", name, address );
+
        ae = g_new0(address_entry, 1);
        ce1 = g_new0(completion_entry, 1),
        ce2 = g_new0(completion_entry, 1);
@@ -217,8 +219,13 @@ gchar *get_address_from_edit(GtkEntry *entry, gint *start_pos)
        wchar_t *wtext;
        wchar_t *wp;
        wchar_t rfc_mail_sep;
+       wchar_t quote;
+       gboolean in_quote = FALSE;
        gchar *str;
 
+       if (mbtowc(&rfc_mail_sep, ",", 1) < 0) return NULL;
+       if (mbtowc(&quote, "\"", 1) < 0) return NULL;
+
        edit_text = gtk_entry_get_text(entry);
        if (edit_text == NULL) return NULL;
 
@@ -227,14 +234,13 @@ gchar *get_address_from_edit(GtkEntry *entry, gint *start_pos)
 
        cur_pos = gtk_editable_get_position(GTK_EDITABLE(entry));
 
-       if (mbtowc(&rfc_mail_sep, ",", 1) < 0) {
-               g_free(wtext);
-               return NULL;
-       }
-
        /* scan for a separator. doesn't matter if walk points at null byte. */
-       for (wp = wtext + cur_pos; wp > wtext && *wp != rfc_mail_sep; wp--)
-               ;
+       for (wp = wtext + cur_pos; wp > wtext; wp--) {
+               if (!in_quote && *wp == rfc_mail_sep)
+                       break;
+               if (*wp == quote)
+                       in_quote ^= TRUE;
+       }
 
        /* have something valid */
        if (wcslen(wp) == 0) {
@@ -242,7 +248,7 @@ gchar *get_address_from_edit(GtkEntry *entry, gint *start_pos)
                return NULL;
        }
 
-#define IS_VALID_CHAR(x)       (iswalnum(x) || ((x) > 0x7f))
+#define IS_VALID_CHAR(x)       (iswalnum(x) || (x) == quote || ((x) > 0x7f))
 
        /* now scan back until we hit a valid character */
        for (; *wp && !IS_VALID_CHAR(*wp); wp++)
@@ -329,22 +335,27 @@ guint complete_address(const gchar *str)
 gchar *get_complete_address(gint index)
 {
        const address_entry *p;
-       
+       gchar *address = NULL;
+
        if (index < g_completion_count) {
                if (index == 0)
-                       return g_strdup(g_completion_prefix);
+                       address = g_strdup(g_completion_prefix);
                else {
                        /* get something from the unique addresses */
                        p = (address_entry *)g_slist_nth_data
                                (g_completion_addresses, index - 1);
-                       if (p == NULL)
-                               return NULL;
-                       else
-                               return g_strdup_printf
-                                       ("%s <%s>", p->name, p->address);
+                       if (p != NULL) {
+                               if (strchr_with_skip_quote(p->name, '"', ','))
+                                       address = g_strdup_printf
+                                               ("\"%s\" <%s>", p->name, p->address);
+                               else
+                                       address = g_strdup_printf
+                                               ("%s <%s>", p->name, p->address);
+                       }
                }
-       } else
-               return NULL;
+       }
+
+       return address;
 }
 
 gchar *get_next_complete_address(void)
index 26309b1..e78144f 100644 (file)
@@ -383,8 +383,8 @@ static GtkItemFactoryEntry addressbook_entries[] =
        {N_("/_Address/_Edit"),         "<alt>Return",  addressbook_edit_address_cb,    0, NULL},
        {N_("/_Address/_Delete"),       NULL,           addressbook_delete_address_cb,  0, NULL},
        {N_("/_Tools/---"),             NULL,           NULL, 0, "<Separator>"},
-       {N_("/_Tools/Import _LDIF"),    NULL,           addressbook_import_ldif_cb,     0, NULL},
-       {N_("/_Tools/Import M_utt"),    NULL,           addressbook_import_mutt_cb,     0, NULL},
+       {N_("/_Tools/Import _LDIF file"), NULL,         addressbook_import_ldif_cb,     0, NULL},
+       {N_("/_Tools/Import M_utt file"), NULL,         addressbook_import_mutt_cb,     0, NULL},
        {N_("/_Help"),                  NULL,           NULL, 0, "<LastBranch>"},
        {N_("/_Help/_About"),           NULL,           about_show, 0, NULL}
 };
@@ -395,7 +395,7 @@ static GtkItemFactoryEntry addressbook_entries[] =
        {N_("/_Tools/Import _Mozilla"), NULL,           NULL,                           0, NULL},
        {N_("/_Tools/Import _vCard"),   NULL,           NULL,                           0, NULL},
        {N_("/_Tools/---"),             NULL,           NULL, 0, "<Separator>"},
-       {N_("/_Tools/Export _LDIF"),    NULL,           NULL,                           0, NULL},
+       {N_("/_Tools/Export _LDIF file"), NULL,         NULL,                           0, NULL},
        {N_("/_Tools/Export v_Card"),   NULL,           NULL,                           0, NULL},
 */
 
@@ -447,18 +447,18 @@ void addressbook_open(Compose *target)
                addressbook_load_tree();
                gtk_ctree_select(GTK_CTREE(addrbook.ctree),
                                 GTK_CTREE_NODE(GTK_CLIST(addrbook.ctree)->row_list));
-       }
-       else {
+       } else
                gtk_widget_hide(addrbook.window);
-       }
 
        gtk_widget_show_all(addrbook.window);
+
        addressbook_set_target_compose(target);
 }
 
 void addressbook_set_target_compose(Compose *target)
 {
        addrbook.target_compose = target;
+
        addressbook_button_set_sensitive();
 }
 
@@ -1029,7 +1029,10 @@ gchar *addressbook_format_address( AddrItemObject * aio ) {
        }
        if( address ) {
                if( name ) {
-                       buf = g_strdup_printf( "%s <%s>", name, address );
+                       if( strchr_with_skip_quote( name, '"', ',' ) )
+                               buf = g_strdup_printf( "\"%s\" <%s>", name, address );
+                       else
+                               buf = g_strdup_printf( "%s <%s>", name, address );
                }
                else {
                        buf = g_strdup( address );
index 6628c07..23a7ad0 100644 (file)
@@ -2320,9 +2320,13 @@ static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
        }
 
        if (acceptable) {
-               gtk_signal_handler_block_by_func(GTK_OBJECT(widget),GTK_SIGNAL_FUNC(folderview_selected), folderview);
+               gtk_signal_handler_block_by_func
+                       (GTK_OBJECT(widget),
+                        GTK_SIGNAL_FUNC(folderview_selected), folderview);
                gtk_ctree_select(GTK_CTREE(widget), node);
-               gtk_signal_handler_unblock_by_func(GTK_OBJECT(widget),GTK_SIGNAL_FUNC(folderview_selected), folderview);
+               gtk_signal_handler_unblock_by_func
+                       (GTK_OBJECT(widget),
+                        GTK_SIGNAL_FUNC(folderview_selected), folderview);
                gdk_drag_status(context, 
                                        (context->actions == GDK_ACTION_COPY ?
                                        GDK_ACTION_COPY : GDK_ACTION_MOVE) , time);
@@ -2372,7 +2376,7 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                        case GDK_ACTION_DEFAULT:
                        default:
                if (src_item->folder->type != item->folder->type ||
-                   (src_item->folder->type == F_IMAP &&
+                   (item->folder->type == F_IMAP &&
                     src_item->folder != item->folder))
                        summary_copy_selected_to(folderview->summaryview, item);
                else
index e9ea649..ad9e1bc 100644 (file)
@@ -770,7 +770,7 @@ gint imap_copy_msgs_with_dest(Folder *folder, FolderItem *dest,
                        (folder, dest, msglist, FALSE);
 
        for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)msglist->data;
+               msginfo = (MsgInfo *)cur->data;
                ret = imap_copy_msg(folder, dest, msginfo);
                if (ret != 0) break;
        }
index fedc570..d4847c0 100644 (file)
@@ -199,7 +199,6 @@ static struct Interface {
        GtkWidget *checkbtn_addaddrbyclick;
        GtkWidget *optmenu_recvdialog;
        GtkWidget *optmenu_nextunreadmsgdialog;
-       GtkWidget *keybind_combo;
 } interface;
 
 static struct Other {
@@ -222,6 +221,11 @@ static struct MessageColorButtons {
        GtkWidget *tgt_folder_btn;
 } color_buttons;
 
+static struct KeybindDialog {
+       GtkWidget *window;
+       GtkWidget *combo;
+} keybind;
+
 static GtkWidget *quote_desc_win;
 static GtkWidget *font_sel_win;
 static guint font_sel_conn_id; 
@@ -779,6 +783,15 @@ static void prefs_font_selection_key_pressed       (GtkWidget      *widget,
                                                 GdkEventKey    *event,
                                                 gpointer        data);
 static void prefs_font_selection_ok            (GtkButton      *button, GtkEntry *entry);
+
+static void prefs_keybind_select               (void);
+static gint prefs_keybind_deleted              (GtkWidget      *widget,
+                                                GdkEventAny    *event,
+                                                gpointer        data);
+static void prefs_keybind_key_pressed          (GtkWidget      *widget,
+                                                GdkEventKey    *event,
+                                                gpointer        data);
+static void prefs_keybind_cancel               (void);
 static void prefs_keybind_apply_clicked                (GtkWidget      *widget);
 
 static gint prefs_common_deleted       (GtkWidget      *widget,
@@ -2347,13 +2360,10 @@ static void prefs_interface_create(void)
        GtkWidget *menuitem;
 
        GtkWidget *frame_addr;
-        GtkWidget *vbox_addr;
+       GtkWidget *vbox_addr;
        GtkWidget *checkbtn_addaddrbyclick;
 
-       GtkWidget *keybind_frame;
-       GtkWidget *keybind_label;
-       GtkWidget *keybind_combo;
-       GtkWidget *keybind_btn;
+       GtkWidget *button_keybind;
 
        GtkWidget *hbox2;
        GtkWidget *optmenu_nextunreadmsgdialog;
@@ -2483,48 +2493,15 @@ static void prefs_interface_create(void)
 
        gtk_option_menu_set_menu (GTK_OPTION_MENU (recvdialog_optmenu), recvdialog_optmenu_menu);     */
 
-PACK_FRAME(vbox1, keybind_frame, _("Shortcut key"));
-
-       vbox2 = gtk_vbox_new (FALSE, 8);
-       gtk_widget_show (vbox2);
-       gtk_container_add (GTK_CONTAINER (keybind_frame), vbox2);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
-
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
-
-       keybind_label = gtk_label_new
-               (_("Select the preset key bindings.\n"
-                  "You can also modify each menu's shortcuts by pressing\n"
-                  "any key(s) when placing the mouse pointer on the item."));
-       gtk_widget_show (keybind_label);
-       gtk_box_pack_start (GTK_BOX (hbox1), keybind_label, FALSE, FALSE, 0);
-       gtk_label_set_justify (GTK_LABEL (keybind_label), GTK_JUSTIFY_LEFT);
-
-       hbox1 = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
-
-       keybind_combo = gtk_combo_new ();
-       gtk_widget_show (keybind_combo);
-       gtk_box_pack_start (GTK_BOX (hbox1), keybind_combo, TRUE, TRUE, 0);
-       gtkut_combo_set_items (GTK_COMBO (keybind_combo),
-                              _("Default"),
-                              "Mew / Wanderlust",
-                              "Mutt",
-                              _("Old Sylpheed"),
-                              NULL);
-       gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (keybind_combo)->entry),
-                               FALSE);
-
-       keybind_btn = gtk_button_new_with_label(_(" Apply "));
-       gtk_widget_show (keybind_btn);
-       gtk_box_pack_end (GTK_BOX (hbox1), keybind_btn, FALSE, TRUE, 0);
-       gtk_signal_connect (GTK_OBJECT (keybind_btn), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_keybind_apply_clicked),
-                           NULL);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
 
+       button_keybind = gtk_button_new_with_label (_(" Set key bindings... "));
+       gtk_widget_show (button_keybind);
+       gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
+       gtk_signal_connect (GTK_OBJECT (button_keybind), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_keybind_select), NULL);
        /* interface.checkbtn_emacs          = checkbtn_emacs; */
        interface.checkbtn_openunread         = checkbtn_openunread;
        interface.checkbtn_openinbox          = checkbtn_openinbox;
@@ -2532,7 +2509,6 @@ PACK_FRAME(vbox1, keybind_frame, _("Shortcut key"));
        interface.optmenu_recvdialog          = optmenu_recvdialog;
        interface.checkbtn_addaddrbyclick     = checkbtn_addaddrbyclick;
        interface.optmenu_nextunreadmsgdialog = optmenu_nextunreadmsgdialog;
-       interface.keybind_combo               = keybind_combo;
 }
 
 static void prefs_other_create(void)
@@ -3456,14 +3432,110 @@ static void prefs_font_selection_ok(GtkButton *button, GtkEntry *entry)
        gtk_widget_hide(font_sel_win);
 }
 
+static void prefs_keybind_select(void)
+{
+       GtkWidget *window;
+       GtkWidget *vbox1;
+       GtkWidget *hbox1;
+       GtkWidget *label;
+       GtkWidget *combo;
+       GtkWidget *confirm_area;
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
+
+       window = gtk_window_new (GTK_WINDOW_DIALOG);
+       gtk_container_set_border_width (GTK_CONTAINER (window), 8);
+       gtk_window_set_title (GTK_WINDOW (window), _("Key bindings"));
+       gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
+       gtk_window_set_modal (GTK_WINDOW (window), TRUE);
+       gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
+       manage_window_set_transient (GTK_WINDOW (window));
+
+       vbox1 = gtk_vbox_new (FALSE, VSPACING);
+       gtk_container_add (GTK_CONTAINER (window), vbox1);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
+
+       label = gtk_label_new
+               (_("Select the preset of key bindings.\n"
+                  "You can also modify each menu's shortcuts by pressing\n"
+                  "any key(s) when placing the mouse pointer on the item."));
+       gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
+       gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
+
+       combo = gtk_combo_new ();
+       gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
+       gtkut_combo_set_items (GTK_COMBO (combo),
+                              _("Default"),
+                              "Mew / Wanderlust",
+                              "Mutt",
+                              _("Old Sylpheed"),
+                              NULL);
+       gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
+
+       gtkut_button_set_create (&confirm_area, &ok_btn, _("OK"),
+                                &cancel_btn, _("Cancel"), NULL, NULL);
+       gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0);
+       gtk_widget_grab_default (ok_btn);
+
+       gtk_signal_connect (GTK_OBJECT (window), "focus_in_event",
+                           GTK_SIGNAL_FUNC (manage_window_focus_in), NULL);
+       gtk_signal_connect (GTK_OBJECT (window), "focus_out_event",
+                           GTK_SIGNAL_FUNC (manage_window_focus_out), NULL);
+       gtk_signal_connect (GTK_OBJECT (window), "delete_event",
+                           GTK_SIGNAL_FUNC (prefs_keybind_deleted), NULL);
+       gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
+                           GTK_SIGNAL_FUNC (prefs_keybind_key_pressed), NULL);
+       gtk_signal_connect (GTK_OBJECT (ok_btn), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_keybind_apply_clicked),
+                           NULL);
+       gtk_signal_connect (GTK_OBJECT (cancel_btn), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_keybind_cancel),
+                           NULL);
+
+       gtk_widget_show_all(window);
+
+       keybind.window = window;
+       keybind.combo = combo;
+}
+
+static void prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event,
+                                     gpointer data)
+{
+       if (event && event->keyval == GDK_Escape)
+               prefs_keybind_cancel();
+}
+
+static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event,
+                                 gpointer data)
+{
+       prefs_keybind_cancel();
+       return TRUE;
+}
+
+static void prefs_keybind_cancel(void)
+{
+       gtk_widget_destroy(keybind.window);
+       keybind.window = NULL;
+       keybind.combo = NULL;
+}
+
 static void prefs_keybind_apply_clicked(GtkWidget *widget)
 {
-       GtkEntry *entry = GTK_ENTRY(GTK_COMBO(interface.keybind_combo)->entry);
+       GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry);
        gchar *text;
        gchar *rc_str;
 
        static gchar *default_menurc =
-               "(menu-path \"<Main>/File/Empty trash\" \"<shift>D\")\n"
+               "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
                "(menu-path \"<Main>/File/Save as...\" \"<control>S\")\n"
                "(menu-path \"<Main>/File/Print...\" \"\")\n"
                "(menu-path \"<Main>/File/Exit\" \"<control>Q\")\n"
@@ -3741,6 +3813,10 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 
        gtk_item_factory_parse_rc_string(empty_menurc);
        gtk_item_factory_parse_rc_string(rc_str);
+
+       gtk_widget_destroy(keybind.window);
+       keybind.window = NULL;
+       keybind.combo = NULL;
 }
 
 static void prefs_common_charset_set_data_from_optmenu(PrefParam *pparam)