From 5267503f4cfd2a682ba6590ab0cc5c7c9dc4feef Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Tue, 22 Jun 2004 22:40:38 +0000 Subject: Name the labels. 2004-06-22 Hans Petter Jansson * gui/contact-editor/contact-editor.glade: Name the labels. * gui/contact-editor/e-contact-editor.c (sensitize_email_record) (sensitize_phone_record) (sensitize_im_record) (sensitize_address_textview) (sensitize_address_field) (simple_field_map) (sensitize_simple_field): Make entries uneditable and labels insensitive, if field is disabled or read-only. svn path=/trunk/; revision=26464 --- .../gui/contact-editor/contact-editor.glade | 36 ++++----- addressbook/gui/contact-editor/e-contact-editor.c | 89 ++++++++++++++-------- 2 files changed, 74 insertions(+), 51 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index d843026036..1acbbac9ed 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -2554,7 +2554,7 @@ 6 - + True City: False @@ -2599,7 +2599,7 @@ - + True Zip/Postal Code: False @@ -2644,7 +2644,7 @@ - + True State/Province: False @@ -2689,7 +2689,7 @@ - + True Country: False @@ -2734,7 +2734,7 @@ - + True Address: False @@ -2815,7 +2815,7 @@ - + True PO Box: False @@ -2884,7 +2884,7 @@ 6 - + True City: False @@ -2929,7 +2929,7 @@ - + True State/Province: False @@ -2974,7 +2974,7 @@ - + True Zip/Postal Code: False @@ -3019,7 +3019,7 @@ - + True Country: False @@ -3064,7 +3064,7 @@ - + True Address: False @@ -3145,7 +3145,7 @@ - + True PO Box: False @@ -3214,7 +3214,7 @@ 6 - + True City: False @@ -3259,7 +3259,7 @@ - + True Address: False @@ -3304,7 +3304,7 @@ - + True State/Province: False @@ -3328,7 +3328,7 @@ - + True Zip/Postal Code: False @@ -3373,7 +3373,7 @@ - + True Country: False @@ -3475,7 +3475,7 @@ - + True PO Box: False diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 6728780e24..92a32ec958 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -962,7 +962,7 @@ sensitize_email_record (EContactEditor *editor, gint record, gboolean enabled) g_free (widget_name); gtk_widget_set_sensitive (location_option_menu, enabled); - gtk_widget_set_sensitive (email_entry, enabled); + gtk_editable_set_editable (GTK_EDITABLE (email_entry), enabled); } static void @@ -1265,7 +1265,7 @@ sensitize_phone_record (EContactEditor *editor, gint record, gboolean enabled) g_free (widget_name); gtk_widget_set_sensitive (phone_type_option_menu, enabled); - gtk_widget_set_sensitive (phone_entry, enabled); + gtk_editable_set_editable (GTK_EDITABLE (phone_entry), enabled); sensitize_phone_types (editor, phone_type_option_menu); } @@ -1556,7 +1556,7 @@ sensitize_im_record (EContactEditor *editor, gint record, gboolean enabled) #ifdef ENABLE_IM_LOCATION gtk_widget_set_sensitive (location_option_menu, enabled); #endif - gtk_widget_set_sensitive (name_entry, enabled); + gtk_editable_set_editable (GTK_EDITABLE (name_entry), enabled); } static void @@ -1776,28 +1776,40 @@ extract_address (EContactEditor *editor) static void sensitize_address_textview (EContactEditor *editor, gint record, gboolean enabled) { - gchar *textview_name; + gchar *widget_name; GtkWidget *textview; + GtkWidget *label; - textview_name = g_strdup_printf ("textview-%s-address", address_name [record]); - textview = glade_xml_get_widget (editor->gui, textview_name); - g_free (textview_name); + widget_name = g_strdup_printf ("textview-%s-address", address_name [record]); + textview = glade_xml_get_widget (editor->gui, widget_name); + g_free (widget_name); - gtk_widget_set_sensitive (textview, enabled); + widget_name = g_strdup_printf ("label-%s-address", address_name [record]); + label = glade_xml_get_widget (editor->gui, widget_name); + g_free (widget_name); + + gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), enabled); + gtk_widget_set_sensitive (label, enabled); } static void sensitize_address_field (EContactEditor *editor, gint record, const gchar *widget_field_name, gboolean enabled) { - gchar *entry_name; + gchar *widget_name; GtkWidget *entry; + GtkWidget *label; - entry_name = g_strdup_printf ("entry-%s-%s", address_name [record], widget_field_name); - entry = glade_xml_get_widget (editor->gui, entry_name); - g_free (entry_name); + widget_name = g_strdup_printf ("entry-%s-%s", address_name [record], widget_field_name); + entry = glade_xml_get_widget (editor->gui, widget_name); + g_free (widget_name); + + widget_name = g_strdup_printf ("label-%s-%s", address_name [record], widget_field_name); + label = glade_xml_get_widget (editor->gui, widget_name); + g_free (widget_name); - gtk_widget_set_sensitive (entry, enabled); + gtk_editable_set_editable (GTK_EDITABLE (entry), enabled); + gtk_widget_set_sensitive (label, enabled); } static void @@ -1844,61 +1856,61 @@ FieldMapping; static FieldMapping simple_field_map [] = { { "entry-homepage", E_CONTACT_HOMEPAGE_URL, TRUE, TRUE }, - { "accellabel-homepage", E_CONTACT_HOMEPAGE_URL, FALSE, FALSE }, + { "accellabel-homepage", E_CONTACT_HOMEPAGE_URL, FALSE, TRUE }, { "entry-jobtitle", E_CONTACT_TITLE, TRUE, TRUE }, - { "label-jobtitle", E_CONTACT_TITLE, FALSE, FALSE }, + { "label-jobtitle", E_CONTACT_TITLE, FALSE, TRUE }, { "entry-company", E_CONTACT_ORG, TRUE, TRUE }, - { "label-company", E_CONTACT_ORG, FALSE, FALSE }, + { "label-company", E_CONTACT_ORG, FALSE, TRUE }, { "entry-department", E_CONTACT_ORG_UNIT, TRUE, TRUE }, - { "label-department", E_CONTACT_ORG_UNIT, FALSE, FALSE }, + { "label-department", E_CONTACT_ORG_UNIT, FALSE, TRUE }, { "entry-profession", E_CONTACT_ROLE, TRUE, TRUE }, - { "label-profession", E_CONTACT_ROLE, FALSE, FALSE }, + { "label-profession", E_CONTACT_ROLE, FALSE, TRUE }, { "entry-manager", E_CONTACT_MANAGER, TRUE, TRUE }, - { "label-manager", E_CONTACT_MANAGER, FALSE, FALSE }, + { "label-manager", E_CONTACT_MANAGER, FALSE, TRUE }, { "entry-assistant", E_CONTACT_ASSISTANT, TRUE, TRUE }, - { "label-assistant", E_CONTACT_ASSISTANT, FALSE, FALSE }, + { "label-assistant", E_CONTACT_ASSISTANT, FALSE, TRUE }, { "entry-nickname", E_CONTACT_NICKNAME, TRUE, TRUE }, - { "label-nickname", E_CONTACT_NICKNAME, FALSE, FALSE }, + { "label-nickname", E_CONTACT_NICKNAME, FALSE, TRUE }, { "dateedit-birthday", E_CONTACT_BIRTH_DATE, TRUE, TRUE }, - { "label-birthday", E_CONTACT_BIRTH_DATE, FALSE, FALSE }, + { "label-birthday", E_CONTACT_BIRTH_DATE, FALSE, TRUE }, { "dateedit-anniversary", E_CONTACT_ANNIVERSARY, TRUE, TRUE }, - { "label-anniversary", E_CONTACT_ANNIVERSARY, FALSE, FALSE }, + { "label-anniversary", E_CONTACT_ANNIVERSARY, FALSE, TRUE }, { "entry-spouse", E_CONTACT_SPOUSE, TRUE, TRUE }, - { "label-spouse", E_CONTACT_SPOUSE, FALSE, FALSE }, + { "label-spouse", E_CONTACT_SPOUSE, FALSE, TRUE }, { "entry-office", E_CONTACT_OFFICE, TRUE, TRUE }, - { "label-office", E_CONTACT_OFFICE, FALSE, FALSE }, + { "label-office", E_CONTACT_OFFICE, FALSE, TRUE }, { "text-comments", E_CONTACT_NOTE, TRUE, TRUE }, - { "label-comments", E_CONTACT_NOTE, FALSE, FALSE }, + { "label-comments", E_CONTACT_NOTE, FALSE, TRUE }, { "entry-fullname", E_CONTACT_FULL_NAME, TRUE, TRUE }, - { "button-fullname", E_CONTACT_FULL_NAME, FALSE, FALSE }, + { "button-fullname", E_CONTACT_FULL_NAME, FALSE, TRUE }, { "entry-categories", E_CONTACT_CATEGORIES, TRUE, TRUE }, { "button-categories", E_CONTACT_CATEGORIES, FALSE, TRUE }, { "entry-weblog", E_CONTACT_BLOG_URL, TRUE, TRUE }, - { "label-weblog", E_CONTACT_BLOG_URL, FALSE, FALSE }, + { "label-weblog", E_CONTACT_BLOG_URL, FALSE, TRUE }, { "entry-caluri", E_CONTACT_CALENDAR_URI, TRUE, TRUE }, - { "label-caluri", E_CONTACT_CALENDAR_URI, FALSE, FALSE }, + { "label-caluri", E_CONTACT_CALENDAR_URI, FALSE, TRUE }, { "entry-fburl", E_CONTACT_FREEBUSY_URL, TRUE, TRUE }, - { "label-fburl", E_CONTACT_FREEBUSY_URL, FALSE, FALSE }, + { "label-fburl", E_CONTACT_FREEBUSY_URL, FALSE, TRUE }, { "entry-videourl", E_CONTACT_VIDEO_URL, TRUE, TRUE }, - { "label-videourl", E_CONTACT_VIDEO_URL, FALSE, FALSE }, + { "label-videourl", E_CONTACT_VIDEO_URL, FALSE, TRUE }, { "checkbutton-htmlmail", E_CONTACT_WANTS_HTML, TRUE, TRUE }, @@ -1907,7 +1919,7 @@ static FieldMapping simple_field_map [] = { { "combo-file-as", E_CONTACT_FILE_AS, FALSE, TRUE }, { "entry-file-as", E_CONTACT_FILE_AS, TRUE, TRUE }, - { "accellabel-fileas", E_CONTACT_FILE_AS, FALSE, FALSE }, + { "accellabel-fileas", E_CONTACT_FILE_AS, FALSE, TRUE }, }; static void @@ -2073,7 +2085,18 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) static void sensitize_simple_field (GtkWidget *widget, gboolean enabled) { - gtk_widget_set_sensitive (widget, enabled); + if (GTK_IS_ENTRY (widget)) + gtk_editable_set_editable (GTK_EDITABLE (widget), enabled); + else if (GTK_IS_TEXT_VIEW (widget)) + gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), enabled); + else if (E_IS_URL_ENTRY (widget)) { + GtkWidget *entry = e_url_entry_get_entry (E_URL_ENTRY (widget)); + gtk_editable_set_editable (GTK_EDITABLE (entry), enabled); + } + else if (E_IS_DATE_EDIT (widget)) + e_date_edit_set_editable (E_DATE_EDIT (widget), enabled); + else + gtk_widget_set_sensitive (widget, enabled); } static void -- cgit