Fixed wrong german translation
authorChristoph Hohmann <reboot@gmx.ch>
Sun, 14 Oct 2001 22:24:42 +0000 (22:24 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Sun, 14 Oct 2001 22:24:42 +0000 (22:24 +0000)
applied wwp <subscript@free.fr>'s folder default account patch

ChangeLog.claws
configure.in
po/de.po
src/account.c
src/compose.c
src/prefs_folder_item.c
src/prefs_folder_item.h

index eed55006d39f6af2a03718bccb639e32f0b44b9e..4c51ae13095a477eaf414c34cbbe658ebe52689f 100644 (file)
@@ -1,3 +1,13 @@
+2001-10-15 [christoph] 0.6.3claws16
+
+       * src/account.c
+       * src/compose.c
+       * src/prefs_folder_item.[ch]
+               applied wwp <subscript@free.fr>'s folder
+               default account patch
+       * po/de.po
+               Fixed wrong translation
+
 2001-10-13 [alfons, christoph, melvin] 
                        0.6.3claws15
 
index 13d442afe48965862b6b4fe41c00ce66e2406326..9b052cb0cb02440986d919db468180e6d38ea5df 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws15
+EXTRA_VERSION=claws16
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index fe1962dd1084a3a4fa223c9f4a58393923ace4e3..e0530b422764471e24df566ff5aee555e5409ad1 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -385,7 +385,7 @@ msgstr "L
 
 #: src/addressbook.c:632
 msgid "Lookup"
-msgstr "Vorschau"
+msgstr "Suchen"
 
 #: src/addressbook.c:644 src/compose.c:1197 src/compose.c:3242
 #: src/headerview.c:55 src/summary_search.c:156
index acb875c20006798b8a4aa38eb7141e4791a9f1d0..2c6c673bc81c789937f18db7babd0aa00aff3736 100644 (file)
@@ -37,6 +37,7 @@
 #include "account.h"
 #include "prefs.h"
 #include "prefs_account.h"
+#include "prefs_folder_item.h"
 #include "compose.h"
 #include "manage_window.h"
 #include "inc.h"
@@ -572,12 +573,34 @@ static void account_edit_prefs(void)
        account_clist_set();
 }
 
+static void account_delete_references_recursive(const GNode *node, const gint account)
+{
+       /* the son */
+       if (node->data) {
+               FolderItem *item = node->data;
+               if (item->prefs) /* && item->prefs->stype == F_NORMAL */
+                       if (item->prefs->default_account == account) {
+                               item->prefs->enable_default_account = FALSE;
+                               item->prefs->default_account = 0;
+                               prefs_folder_item_save_config(item);
+                       }
+       }
+       /* its children (vertical dive) */
+       if (node->children)
+               account_delete_references_recursive(node->children, account);
+       /* its brothers (horizontal dive) */
+       if (node->next)
+               account_delete_references_recursive(node->next, account);
+}
+
 static void account_delete(void)
 {
        GtkCList *clist = GTK_CLIST(edit_account.clist);
        PrefsAccount *ac_prefs;
        gint row;
-
+       GList *list;
+       Folder *folder;
+       
        if (!clist->selection) return;
 
        if (alertpanel(_("Delete account"),
@@ -593,6 +616,14 @@ static void account_delete(void)
        }
        account_destroy(ac_prefs);
        account_clist_set();
+
+       debug_print(_("Removing deleted account references for all the folders...\n"));
+       list = folder_get_list();
+       for (; list != NULL; list = list->next) {
+               folder = FOLDER(list->data);
+               if (folder->node)  /* && folder->type == F_? */
+                       account_delete_references_recursive(folder->node, ac_prefs->account_id);
+       }
 }
 
 static void account_up(void)
index 375b23930370b46cef05dc50ed00224f9ab6c87d..bf88e88f78700198891d7fc216c8c0f8406a6775 100644 (file)
@@ -497,7 +497,21 @@ Compose * compose_new_with_folderitem(PrefsAccount *account, FolderItem *item)
 Compose * compose_generic_new(PrefsAccount *account, const gchar *to, FolderItem *item)
 {
        Compose *compose;
-
+       GList *cur_ac;
+       GList *account_list;
+       PrefsAccount *ac_prefs;
+
+       if (item && item->prefs->enable_default_account) {
+               /* get a PrefsAccount *pointer on the wished account */
+               account_list=account_get_list();
+               for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+                       ac_prefs = (PrefsAccount *)cur_ac->data;
+                       if (ac_prefs->account_id == item->prefs->default_account) {
+                               account = ac_prefs;
+                               break;
+                       }
+               }
+       }
        if (!account) account = cur_account;
        g_return_val_if_fail(account != NULL, NULL);
 
index 2818d7106c75736d2212558492f0d84b3670e81d..c10cced7f885a5038a45b2eb9b1475bf8879c38e 100644 (file)
@@ -26,6 +26,8 @@
 #include "folder.h"
 #include "prefs_folder_item.h"
 #include "summaryview.h"
+#include "menu.h"
+#include "account.h"
 #include "prefs.h"
 #include "manage_window.h"
 
@@ -40,6 +42,8 @@ struct PrefsFolderItemDialog
        GtkWidget *entry_default_to;
        GtkWidget *checkbtn_folder_chmod;
        GtkWidget *entry_folder_chmod;
+       GtkWidget *checkbtn_enable_default_account;
+       GtkWidget *optmenu_default_account;
 };
 
 static PrefParam param[] = {
@@ -74,6 +78,10 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"folder_chmod", "", &tmp_prefs.folder_chmod, P_INT,
         NULL, NULL, NULL},
+       {"enable_default_account", "", &tmp_prefs.enable_default_account, P_BOOL,
+        NULL, NULL, NULL},
+       {"default_account", NULL, &tmp_prefs.default_account, P_INT,
+        NULL, NULL, NULL},
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
 
@@ -82,6 +90,7 @@ void prefs_folder_item_cancel_cb(GtkWidget *widget, struct PrefsFolderItemDialog
 void prefs_folder_item_ok_cb(GtkWidget *widget, struct PrefsFolderItemDialog *dialog);
 void prefs_folder_item_default_to_cb(GtkWidget *widget, struct PrefsFolderItemDialog *dialog);
 void prefs_folder_item_folder_chmod_cb(GtkWidget *widget, struct PrefsFolderItemDialog *dialog);
+void prefs_folder_item_default_account_cb(GtkWidget *widget, struct PrefsFolderItemDialog *dialog);
 gint prefs_folder_item_chmod_mode(gchar *folder_chmod);
 
 void prefs_folder_item_read_config(FolderItem * item)
@@ -172,6 +181,8 @@ PrefsFolderItem * prefs_folder_item_new(void)
        tmp_prefs.default_to = NULL;
        tmp_prefs.enable_folder_chmod = FALSE;
        tmp_prefs.folder_chmod = 0;
+       tmp_prefs.enable_default_account = FALSE;
+       tmp_prefs.default_account = 0;
 
        * prefs = tmp_prefs;
        
@@ -235,7 +246,18 @@ void prefs_folder_item_create(FolderItem *item) {
        GtkWidget *entry_default_to;
        GtkWidget *checkbtn_folder_chmod;
        GtkWidget *entry_folder_chmod;
-
+       GtkWidget *hbox2;
+       GtkWidget *checkbtn_enable_default_account;
+       GtkWidget *optmenu_default_account;
+       GtkWidget *optmenu_default_account_menu;
+       GtkWidget *optmenu_default_account_menuitem;
+       GList *cur_ac;
+       GList *account_list;
+       PrefsAccount *ac_prefs;
+       GtkOptionMenu *optmenu;
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+       gint account_index, index;
        dialog = g_new0(struct PrefsFolderItemDialog, 1);
        dialog->item = item;
 
@@ -263,7 +285,7 @@ void prefs_folder_item_create(FolderItem *item) {
        /* Request Return Receipt */
        checkbtn_request_return_receipt = gtk_check_button_new_with_label(_("Request Return Receipt"));
        gtk_widget_show(checkbtn_request_return_receipt);
-       gtk_table_attach_defaults(GTK_TABLE(table), checkbtn_request_return_receipt, 0, 2, rowcount, rowcount + 1);
+       gtk_table_attach(GTK_TABLE(table), checkbtn_request_return_receipt, 0, 2, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
                                     item->ret_rcpt ? TRUE : FALSE);
 
@@ -272,7 +294,7 @@ void prefs_folder_item_create(FolderItem *item) {
        /* Default To */
        checkbtn_default_to = gtk_check_button_new_with_label(_("Default To: "));
        gtk_widget_show(checkbtn_default_to);
-       gtk_table_attach_defaults(GTK_TABLE(table), checkbtn_default_to, 0, 1, rowcount, rowcount + 1);
+       gtk_table_attach(GTK_TABLE(table), checkbtn_default_to, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to), item->prefs->enable_default_to);
        gtk_signal_connect(GTK_OBJECT(checkbtn_default_to), "toggled",
                            GTK_SIGNAL_FUNC(prefs_folder_item_default_to_cb), dialog);
@@ -289,7 +311,7 @@ void prefs_folder_item_create(FolderItem *item) {
        /* Folder chmod */
        checkbtn_folder_chmod = gtk_check_button_new_with_label(_("Folder chmod: "));
        gtk_widget_show(checkbtn_folder_chmod);
-       gtk_table_attach_defaults(GTK_TABLE(table), checkbtn_folder_chmod, 0, 1, rowcount, rowcount + 1);
+       gtk_table_attach(GTK_TABLE(table), checkbtn_folder_chmod, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_chmod), item->prefs->enable_folder_chmod);
        gtk_signal_connect(GTK_OBJECT(checkbtn_folder_chmod), "toggled",
@@ -309,6 +331,48 @@ void prefs_folder_item_create(FolderItem *item) {
        
        rowcount++;
 
+       /* Default account */
+       checkbtn_enable_default_account = gtk_check_button_new_with_label(_("Default account: "));
+       gtk_widget_show(checkbtn_enable_default_account);
+       gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_account, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_account), item->prefs->enable_default_account);
+       gtk_signal_connect(GTK_OBJECT(checkbtn_enable_default_account), "toggled",
+                           GTK_SIGNAL_FUNC(prefs_folder_item_default_account_cb), dialog);
+
+       optmenu_default_account = gtk_option_menu_new ();
+       gtk_widget_show (optmenu_default_account);
+       gtk_table_attach_defaults(GTK_TABLE(table), optmenu_default_account, 1, 2, rowcount, rowcount + 1);
+       optmenu_default_account_menu = gtk_menu_new ();
+
+       account_list = account_get_list();
+       account_index = 0;
+       index = 0;
+       for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+               ac_prefs = (PrefsAccount *)cur_ac->data;
+               MENUITEM_ADD (optmenu_default_account_menu, optmenu_default_account_menuitem,
+                                       ac_prefs->account_name?ac_prefs->account_name : _("Untitled"),
+                                       ac_prefs->account_id);
+               /* get the index for menu's set_history (sad method?) */
+               if (ac_prefs->account_id == item->prefs->default_account)
+                       account_index = index;
+               index++;                        
+       }
+
+       dialog->item->prefs->default_account=item->prefs->default_account;
+
+       optmenu=GTK_OPTION_MENU(optmenu_default_account);
+       gtk_option_menu_set_menu(optmenu, optmenu_default_account_menu);
+
+       gtk_option_menu_set_history(optmenu, account_index);
+
+       menu = gtk_option_menu_get_menu(optmenu);
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
+
+       gtk_widget_set_sensitive(optmenu_default_account, item->prefs->enable_default_account);
+
+       rowcount++;
+
        /* Ok and Cancle Buttons */
        gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
                                &cancel_btn, _("Cancel"), NULL, NULL);
@@ -326,6 +390,8 @@ void prefs_folder_item_create(FolderItem *item) {
        dialog->entry_default_to = entry_default_to;
        dialog->checkbtn_folder_chmod = checkbtn_folder_chmod;
        dialog->entry_folder_chmod = entry_folder_chmod;
+       dialog->checkbtn_enable_default_account = checkbtn_enable_default_account;
+       dialog->optmenu_default_account = optmenu_default_account;
 
        gtk_widget_show(window);
 }
@@ -346,6 +412,8 @@ void prefs_folder_item_delete_cb(GtkWidget *widget, GdkEventAny *event, struct P
 void prefs_folder_item_ok_cb(GtkWidget *widget, struct PrefsFolderItemDialog *dialog) {
        gchar *buf;
        PrefsFolderItem *prefs = dialog->item->prefs;
+       GtkWidget *menu;
+       GtkWidget *menuitem;
 
        prefs->request_return_receipt = 
            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_request_return_receipt));
@@ -363,6 +431,12 @@ void prefs_folder_item_ok_cb(GtkWidget *widget, struct PrefsFolderItemDialog *di
        prefs->folder_chmod = prefs_folder_item_chmod_mode(buf);
        g_free(buf);
 
+       prefs->enable_default_account = 
+           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_enable_default_account));
+       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->optmenu_default_account));
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       prefs->default_account = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(menuitem)));
+
        prefs_folder_item_save_config(dialog->item);
        prefs_folder_item_destroy(dialog);
 }
@@ -389,3 +463,7 @@ gint prefs_folder_item_chmod_mode(gchar *folder_chmod) {
 
        return newmode;
 }
+void prefs_folder_item_default_account_cb(GtkWidget *widget, struct PrefsFolderItemDialog *dialog) {
+       gtk_widget_set_sensitive(dialog->optmenu_default_account,
+           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_enable_default_account)));
+}
index e06ff6ff4892f91a7289df2ebbd892c9c6f01725..c62e7c425f80623a7ccdb370f139ae4b08561969 100644 (file)
@@ -49,6 +49,10 @@ struct _PrefsFolderItem {
        gchar *default_to;
        gboolean enable_folder_chmod;
        gint folder_chmod;
+/*WWP_BEGIN*/
+       gboolean enable_default_account;
+       gint default_account;
+/*WWP_END*/
 };
 
 typedef struct _PrefsFolderItem PrefsFolderItem;