diff options
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/gui/contact-editor/contact-editor.ui | 214 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 179 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.h | 3 |
3 files changed, 334 insertions, 62 deletions
diff --git a/addressbook/gui/contact-editor/contact-editor.ui b/addressbook/gui/contact-editor/contact-editor.ui index 964ce434c2..51fc9c9e29 100644 --- a/addressbook/gui/contact-editor/contact-editor.ui +++ b/addressbook/gui/contact-editor/contact-editor.ui @@ -78,6 +78,7 @@ <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> + <property name="orientation">vertical</property> <child internal-child="action_area"> <object class="GtkHButtonBox" id="dialog-action_area1"> <property name="visible">True</property> @@ -135,11 +136,24 @@ <property name="scrollable">False</property> <property name="enable_popup">False</property> <child> + + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkViewport" id="viewport1"> + <property name="visible">True</property> + <property name="resize_mode">queue</property> + + <child> <object class="GtkVBox" id="vbox33"> <property name="border_width">12</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">1</property> + <property name="orientation">vertical</property> <child> <object class="GtkHBox" id="hbox55"> <property name="visible">True</property> @@ -417,6 +431,7 @@ <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">10</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame65"> <property name="visible">True</property> @@ -424,7 +439,7 @@ <property name="label_yalign">0.5</property> <property name="shadow_type">GTK_SHADOW_NONE</property> <child> - <object class="GtkTable" id="table85"> + <object class="GtkTable" id="email-table"> <property name="border_width">12</property> <property name="visible">True</property> <property name="n_rows">3</property> @@ -620,29 +635,72 @@ </object> </child> <child type="label"> - <object class="GtkLabel" id="label400"> - <property name="visible">True</property> - <property name="label" translatable="yes">Email</property> - <property name="use_underline">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> + <object class="GtkHBox" id="hbox561"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">4</property> + <child> + <object class="GtkLabel" id="label400"> + <property name="visible">True</property> + <property name="label" translatable="yes">Email</property> + <property name="use_underline">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-mail-expand"> + <property name="width_request">20</property> + <property name="height_request">20</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + <child> + <object class="GtkArrow" id="arrow-mail-expand"> + <property name="visible">True</property> + <property name="arrow_type">GTK_ARROW_RIGHT</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </object> + </child> + <child internal-child="accessible"> + <object class="AtkObject" id="a11y-button-mail-expand1"> + <property name="AtkObject::accessible_name" translatable="yes">Telephone</property> + </object> + </child> + </object> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </object> + </child> </object> <packing> - <property name="padding">0</property> + <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> @@ -652,6 +710,7 @@ <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame64"> <property name="visible">True</property> @@ -664,6 +723,7 @@ <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> + <property name="orientation">vertical</property> <child> <object class="GtkTable" id="table84"> <property name="visible">True</property> @@ -1080,7 +1140,7 @@ </packing> </child> <child> - <object class="GtkEntry" id="entry-im-name-2"> + <object class="GtkEntry" id="entry-im-name-3"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> @@ -1099,7 +1159,7 @@ </packing> </child> <child> - <object class="GtkEntry" id="entry-im-name-3"> + <object class="GtkEntry" id="entry-im-name-2"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> @@ -1152,7 +1212,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="combobox-im-service-2"> + <object class="GtkComboBox" id="combobox-im-service-3"> <property name="visible">True</property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> @@ -1167,7 +1227,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="combobox-im-service-3"> + <object class="GtkComboBox" id="combobox-im-service-2"> <property name="visible">True</property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> @@ -1234,6 +1294,12 @@ </packing> </child> </object> + + </child> + </object> + </child> + + </object> <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> @@ -1258,12 +1324,24 @@ <property name="angle">0</property> </object> </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow-size-leader"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkViewport" id="viewport2"> + <property name="visible">True</property> + <property name="resize_mode">queue</property> + <child> - <object class="GtkVBox" id="vbox35"> + <object class="GtkVBox" id="vbox-size-leader"> <property name="border_width">12</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">12</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame67"> <property name="visible">True</property> @@ -1508,6 +1586,13 @@ </object> </child> <child type="label"> + <object class="GtkHBox" id="hbox5617"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">4</property> + <child> + + <object class="GtkLabel" id="label410"> <property name="visible">True</property> <property name="label" translatable="yes">Web Addresses</property> @@ -1527,7 +1612,40 @@ <attribute name="weight" value="bold"/> </attributes> </object> - </child> + </child> + <child> + <object class="GtkButton" id="button-web-expand"> + <property name="width_request">20</property> + <property name="height_request">20</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + <child> + <object class="GtkArrow" id="arrow-web-expand"> + <property name="visible">True</property> + <property name="arrow_type">GTK_ARROW_RIGHT</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </object> + </child> + <child internal-child="accessible"> + <object class="AtkObject" id="a11y-button-web-expand1"> + <property name="AtkObject::accessible_name" translatable="yes">Web addresses</property> + </object> + </child> + </object> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </object> + </child> </object> <packing> <property name="padding">0</property> @@ -1881,10 +1999,9 @@ </packing> </child> <child> - <object class="GtkFrame" id="frame69"> + <object class="GtkExpander" id="expander-personal-misc"> <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> + <property name="can_focus">True</property> <property name="shadow_type">GTK_SHADOW_NONE</property> <child> <object class="GtkTable" id="table89"> @@ -2126,11 +2243,18 @@ </packing> </child> </object> + + </child> + </object> + </child> + + </object> <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> </packing> </child> + <child type="tab"> <object class="GtkLabel" id="label422"> <property name="visible">True</property> @@ -2151,10 +2275,24 @@ </object> </child> <child> + + <object class="GtkScrolledWindow" id="scrolledwindow3"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkViewport" id="viewport3"> + <property name="visible">True</property> + <property name="resize_mode">queue</property> + + <child> + <object class="GtkVBox" id="vbox39"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame72"> <property name="border_width">6</property> @@ -2910,12 +3048,10 @@ </packing> </child> <child> - <object class="GtkFrame" id="frame78"> + <object class="GtkExpander" id="expander-address-other"> <property name="border_width">6</property> <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="can_focus">True</property> <child> <object class="GtkAlignment" id="alignment7"> <property name="border_width">6</property> @@ -3287,6 +3423,13 @@ </packing> </child> </object> + + </child> + </object> + </child> + + </object> + <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> @@ -3316,6 +3459,7 @@ <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame79"> <property name="border_width">6</property> diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 2807b9e149..f8cae86762 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -742,15 +742,6 @@ init_email_record_location (EContactEditor *editor, gint record) } static void -init_email (EContactEditor *editor) -{ - gint i; - - for (i = 1; i <= EMAIL_SLOTS; i++) - init_email_record_location (editor, i); -} - -static void fill_in_email_record (EContactEditor *editor, gint record, const gchar *address, gint location) { GtkWidget *location_combo_box; @@ -1144,24 +1135,95 @@ set_attributes_named (EVCard *vcard, const gchar *attr_name, GList *attr_list) } static void -expand_phone (EContactEditor *editor, gboolean expanded) +set_arrow_image (EContactEditor *editor, + const char *arrow_widget, + gboolean expanded) { - GtkWidget *phone_ext_table; - GtkWidget *phone_ext_arrow; + GtkWidget *arrow; - phone_ext_table = e_builder_get_widget (editor->builder, "table-phone-extended"); - phone_ext_arrow = e_builder_get_widget (editor->builder, "arrow-phone-expand"); + arrow = e_builder_get_widget (editor->builder, arrow_widget); + if (expanded) + gtk_arrow_set (GTK_ARROW (arrow), GTK_ARROW_DOWN, GTK_SHADOW_NONE); + else + gtk_arrow_set (GTK_ARROW (arrow), GTK_ARROW_RIGHT, GTK_SHADOW_NONE); +} - if (expanded) { - gtk_arrow_set (GTK_ARROW (phone_ext_arrow), GTK_ARROW_DOWN, GTK_SHADOW_NONE); - gtk_widget_show (phone_ext_table); - } else { - gtk_arrow_set (GTK_ARROW (phone_ext_arrow), GTK_ARROW_RIGHT, GTK_SHADOW_NONE); - gtk_widget_hide (phone_ext_table); +static void +expand_widget_list (EContactEditor *editor, + const char **widget_names, + gboolean expanded) +{ + int i; + for (i = 0; widget_names[i]; i++) + gtk_widget_set_visible ( + e_builder_get_widget (editor->builder, widget_names[i]), + expanded); +} + +static void +expand_web (EContactEditor *editor, gboolean expanded) +{ + const char *names[] = { + "label-videourl", "label-fburl", + "entry-videourl", "entry-fburl", + NULL + }; + set_arrow_image (editor, "arrow-phone-expand", expanded); + expand_widget_list (editor, names, expanded); +} + +static void +expand_phone (EContactEditor *editor, gboolean expanded) +{ + const char *names[] = { + "entry-phone-2", "combobox-phone-2", + "entry-phone-4", "combobox-phone-4", + "table-phone-extended", NULL + }; + set_arrow_image (editor, "arrow-phone-expand", expanded); + expand_widget_list (editor, names, expanded); +} + +static void +expand_mail (EContactEditor *editor, gboolean expanded) +{ + GtkTable *table; + GtkWidget *check; + const char *names[] = { + "entry-email-2", "combobox-email-2", + "entry-email-3", "combobox-email-3", + "entry-email-4", "combobox-email-4", + NULL + }; + set_arrow_image (editor, "arrow-mail-expand", expanded); + expand_widget_list (editor, names, expanded); + + /* move 'use html mail' into position */ + check = e_builder_get_widget (editor->builder, "checkbutton-htmlmail"); + table = GTK_TABLE (e_builder_get_widget (editor->builder, "email-table")); + if (check != NULL && table != NULL) { + g_object_ref (G_OBJECT (check)); + gtk_container_remove (GTK_CONTAINER (check->parent), check); + if (expanded) + gtk_table_attach_defaults (table, check, 0, 4, 2, 3); + else + gtk_table_attach_defaults (table, check, 2, 4, 0, 1); + g_object_unref (G_OBJECT (check)); } } static void +init_email (EContactEditor *editor) +{ + gint i; + + for (i = 1; i <= EMAIL_SLOTS; i++) + init_email_record_location (editor, i); + + expand_mail (editor, !editor->compress_ui); +} + +static void fill_in_phone_record (EContactEditor *editor, gint record, const gchar *phone, gint phone_type) { GtkWidget *phone_type_combo_box; @@ -1458,6 +1520,11 @@ init_im_record_service (EContactEditor *editor, gint record) service_combo_box = e_builder_get_widget (editor->builder, widget_name); g_free (widget_name); + if (editor->compress_ui && record > 2) { + gtk_widget_hide (name_entry); + gtk_widget_hide (service_combo_box); + } + init_item_sensitiveable_combo_box (GTK_COMBO_BOX (service_combo_box)); store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (service_combo_box))); @@ -1739,6 +1806,17 @@ sensitize_im (EContactEditor *editor) } static void +init_personal (EContactEditor *editor) +{ + gtk_expander_set_expanded ( + GTK_EXPANDER (e_builder_get_widget (editor->builder, + "expander-personal-misc")), + !editor->compress_ui); + + expand_web (editor, !editor->compress_ui); +} + +static void init_address_textview (EContactEditor *editor, gint record) { gchar *textview_name; @@ -1785,6 +1863,11 @@ init_address (EContactEditor *editor) for (i = 0; i < ADDRESS_SLOTS; i++) init_address_record (editor, i); + + gtk_expander_set_expanded ( + GTK_EXPANDER (e_builder_get_widget (editor->builder, + "expander-address-other")), + !editor->compress_ui); } static void @@ -2586,11 +2669,22 @@ sensitize_all (EContactEditor *editor) static void init_all (EContactEditor *editor) { - init_simple (editor); - init_email (editor); - init_phone (editor); - init_im (editor); - init_address (editor); + GtkRequisition tab_req; + + init_simple (editor); + init_email (editor); + init_phone (editor); + init_im (editor); + init_personal (editor); + init_address (editor); + + /* with so many scrolled windows, we need to + do some manual sizing */ + gtk_widget_size_request ( + e_builder_get_widget (editor->builder, "vbox-size-leader"), &tab_req); + gtk_widget_set_size_request ( + e_builder_get_widget (editor->builder, "scrolledwindow-size-leader"), + tab_req.width, tab_req.height + 8); } static void @@ -3372,15 +3466,41 @@ setup_tab_order(GtkBuilder *builder) } static void +expand_web_toggle (EContactEditor *ce) +{ + GtkWidget *widget; + + widget = e_builder_get_widget (ce->builder, "label-videourl"); +#if GTK_CHECK_VERSION(2,19,7) + expand_web (ce, !gtk_widget_get_visible (widget)); +#else + expand_web (ce, !GTK_WIDGET_VISIBLE (widget)); +#endif +} + +static void expand_phone_toggle (EContactEditor *ce) { GtkWidget *phone_ext_table; phone_ext_table = e_builder_get_widget (ce->builder, "table-phone-extended"); #if GTK_CHECK_VERSION(2,19,7) - expand_phone (ce, gtk_widget_get_visible (phone_ext_table) ? FALSE : TRUE); + expand_phone (ce, !gtk_widget_get_visible (phone_ext_table)); +#else + expand_phone (ce, !GTK_WIDGET_VISIBLE (phone_ext_table)); +#endif +} + +static void +expand_mail_toggle (EContactEditor *ce) +{ + GtkWidget *mail; + + mail = e_builder_get_widget (ce->builder, "entry-email-4"); +#if GTK_CHECK_VERSION(2,19,7) + expand_mail (ce, !gtk_widget_get_visible (mail)); #else - expand_phone (ce, GTK_WIDGET_VISIBLE (phone_ext_table) ? FALSE : TRUE); + expand_mail (ce, !GTK_WIDGET_VISIBLE (mail)); #endif } @@ -3402,6 +3522,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor) e_contact_editor->target_editable = TRUE; e_contact_editor->fullname_dialog = NULL; e_contact_editor->categories_dialog = NULL; + e_contact_editor->compress_ui = e_shell_get_express_mode (e_shell_get_default ()); e_contact_editor->load_source_id = 0; e_contact_editor->load_book = NULL; @@ -3441,8 +3562,12 @@ e_contact_editor_init (EContactEditor *e_contact_editor) g_signal_connect (widget, "clicked", G_CALLBACK (file_cancel_cb), e_contact_editor); widget = e_builder_get_widget (e_contact_editor->builder, "button-help"); g_signal_connect (widget, "clicked", G_CALLBACK (show_help_cb), e_contact_editor); + widget = e_builder_get_widget (e_contact_editor->builder, "button-web-expand"); + g_signal_connect_swapped (widget, "clicked", G_CALLBACK (expand_web_toggle), e_contact_editor); widget = e_builder_get_widget (e_contact_editor->builder, "button-phone-expand"); g_signal_connect_swapped (widget, "clicked", G_CALLBACK (expand_phone_toggle), e_contact_editor); + widget = e_builder_get_widget (e_contact_editor->builder, "button-mail-expand"); + g_signal_connect_swapped (widget, "clicked", G_CALLBACK (expand_mail_toggle), e_contact_editor); widget = e_builder_get_widget (e_contact_editor->builder, "entry-fullname"); if (widget) diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index 5079f1a0ee..b41324c270 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -84,6 +84,9 @@ struct _EContactEditor /* Whether an image is changed */ guint image_changed : 1; + /* Whether to try to reduce space used */ + guint compress_ui : 1; + EList *writable_fields; EList *required_fields; |