2006-02-09 [wwp] 2.0.0cvs40
[claws.git] / src / editaddress.c
index 56d0cc277c345400ded378a52515bbc4c5ecc955..53823a73f91a31cde3aa27d56a06d5533eac1e67 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -313,7 +313,7 @@ static ItemEMail *edit_person_email_edit( gboolean *error, ItemEMail *email ) {
                *error = FALSE;
        }
        else {
-               edit_person_status_show( _( "An E-Mail address must be supplied." ) );
+               edit_person_status_show( _( "An Email address must be supplied." ) );
        }
 
        g_free( sEmail );
@@ -531,6 +531,18 @@ static void edit_person_attrib_add( gpointer data ) {
        }
 }
 
+/*!
+ *\brief       Save Gtk object size to prefs dataset
+ */
+static void edit_person_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.addressbookeditpersonwin_width = allocation->width;
+       prefs_common.addressbookeditpersonwin_height = allocation->height;
+}
+
 static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        GtkWidget *window;
        GtkWidget *vbox;
@@ -541,9 +553,9 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        GtkWidget *cancel_btn;
        GtkWidget *hsbox;
        GtkWidget *statusbar;
+       static GdkGeometry geometry;
 
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       gtk_widget_set_size_request(window, EDITPERSON_WIDTH, EDITPERSON_HEIGHT );
        /* gtk_container_set_border_width(GTK_CONTAINER(window), 0); */
        gtk_window_set_title(GTK_WINDOW(window), _("Edit Person Data"));
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
@@ -551,6 +563,9 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(edit_person_delete_event),
                         cancelled);
+       g_signal_connect(G_OBJECT(window), "size_allocate",
+                        G_CALLBACK(edit_person_size_allocate_cb),
+                       cancelled);
        g_signal_connect(G_OBJECT(window), "key_press_event",
                         G_CALLBACK(edit_person_key_pressed),
                         cancelled);
@@ -578,8 +593,8 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
 
        /* Button panel */
-       gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK,
-                                     &cancel_btn, GTK_STOCK_CANCEL,
+       gtkut_stock_button_set_create(&hbbox, &cancel_btn, GTK_STOCK_CANCEL,
+                                     &ok_btn, GTK_STOCK_OK,
                                      NULL, NULL);
        gtk_box_pack_end(GTK_BOX(vnbox), hbbox, FALSE, FALSE, 0);
        gtk_widget_grab_default(ok_btn);
@@ -593,6 +608,16 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
 
        gtk_widget_show_all(vbox);
 
+       if (!geometry.min_height) {
+               geometry.min_width = EDITPERSON_WIDTH;
+               geometry.min_height = EDITPERSON_HEIGHT;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(window, prefs_common.addressbookeditpersonwin_width,
+                                   prefs_common.addressbookeditpersonwin_height);
+
        personeditdlg.window     = window;
        personeditdlg.notebook   = notebook;
        personeditdlg.ok_btn     = ok_btn;
@@ -618,7 +643,7 @@ static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
        gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
 
-       label = gtk_label_new( pageLbl );
+       label = gtk_label_new_with_mnemonic( pageLbl );
        gtk_widget_show( label );
        gtk_notebook_set_tab_label(
                GTK_NOTEBOOK( personeditdlg.notebook ),
@@ -731,7 +756,7 @@ static void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
        gchar *titles[ EMAIL_N_COLS ];
        gint i;
 
-       titles[ EMAIL_COL_EMAIL   ] = _("E-Mail Address");
+       titles[ EMAIL_COL_EMAIL   ] = _("Email Address");
        titles[ EMAIL_COL_ALIAS   ] = _("Alias");
        titles[ EMAIL_COL_REMARKS ] = _("Remarks");
 
@@ -740,7 +765,7 @@ static void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
        gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
 
-       label = gtk_label_new( pageLbl );
+       label = gtk_label_new_with_mnemonic( pageLbl );
        gtk_widget_show( label );
        gtk_notebook_set_tab_label(
                GTK_NOTEBOOK( personeditdlg.notebook ),
@@ -779,7 +804,7 @@ static void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
 
        /* First row */
        top = 0;
-       label = gtk_label_new(_("E-Mail Address"));
+       label = gtk_label_new(_("Email Address"));
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
@@ -933,7 +958,7 @@ static void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl )
        gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
 
-       label = gtk_label_new( pageLbl );
+       label = gtk_label_new_with_mnemonic( pageLbl );
        gtk_widget_show( label );
        gtk_notebook_set_tab_label(
                GTK_NOTEBOOK( personeditdlg.notebook ),
@@ -1042,9 +1067,9 @@ static void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl )
 
 static void addressbook_edit_person_create( gboolean *cancelled ) {
        addressbook_edit_person_dialog_create( cancelled );
-       addressbook_edit_person_page_basic( PAGE_BASIC, _( "User Data" ) );
-       addressbook_edit_person_page_email( PAGE_EMAIL, _( "E-Mail Addresses" ) );
-       addressbook_edit_person_page_attrib( PAGE_ATTRIBUTES, _( "Other Attributes" ) );
+       addressbook_edit_person_page_basic( PAGE_BASIC, _( "_User Data" ) );
+       addressbook_edit_person_page_email( PAGE_EMAIL, _( "_Email Addresses" ) );
+       addressbook_edit_person_page_attrib( PAGE_ATTRIBUTES, _( "O_ther Attributes" ) );
        gtk_widget_show_all( personeditdlg.window );
 }