diff options
author | Federico Mena Quintero <federico@novell.com> | 2010-05-10 19:50:24 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@novell.com> | 2010-05-10 19:56:12 -0500 |
commit | cfe3fadb4cb42c0ab23421443b2116ad8cef6e66 (patch) | |
tree | 91d3f6d344c8c7c8367d51f98284f8a7272b67b7 | |
parent | 19d13099a6e1a55aacdea8aae696d3ebc394faf2 (diff) | |
download | evolution-data-server-cfe3fadb4cb42c0ab23421443b2116ad8cef6e66.tar.gz |
Put the name selector's section labels in the same row as the treeviews
This lets us save one whole row per destination section.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
-rw-r--r-- | libedataserverui/e-name-selector-dialog.c | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c index d38ed9236..f5eedd8aa 100644 --- a/libedataserverui/e-name-selector-dialog.c +++ b/libedataserverui/e-name-selector-dialog.c @@ -42,7 +42,7 @@ typedef struct { gchar *name; - GtkTable *section_table; + GtkBox *section_box; GtkLabel *label; GtkButton *transfer_button; GtkButton *remove_button; @@ -73,6 +73,7 @@ struct _ENameSelectorDialogPrivate { guint destination_index; GSList *user_query_fields; + GtkSizeGroup *dest_label_size_group; }; static void search_changed (ENameSelectorDialog *name_selector_dialog); @@ -217,6 +218,10 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog) name_selector_dialog->priv->button_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /* Create size group for destination labels */ + + priv->dest_label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /* Set up contacts view */ column = gtk_tree_view_column_new (); @@ -337,6 +342,7 @@ e_name_selector_dialog_finalize (GObject *object) g_array_free (priv->sections, TRUE); g_object_unref (priv->button_size_group); + g_object_unref (priv->dest_label_size_group); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (e_name_selector_dialog_parent_class)->finalize (object); @@ -587,6 +593,7 @@ static gint add_section (ENameSelectorDialog *name_selector_dialog, const gchar *name, const gchar *pretty_name, EDestinationStore *destination_store) { + ENameSelectorDialogPrivate *priv; Section section; GtkWidget *vbox; GtkWidget *alignment; @@ -594,15 +601,18 @@ add_section (ENameSelectorDialog *name_selector_dialog, SelData *data; GtkTreeSelection *selection; gchar *text; + GtkWidget *hbox; g_assert (name != NULL); g_assert (pretty_name != NULL); g_assert (E_IS_DESTINATION_STORE (destination_store)); + priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog); + memset (§ion, 0, sizeof (Section)); section.name = g_strdup (name); - section.section_table = GTK_TABLE (gtk_table_new (2, 2, FALSE)); + section.section_box = GTK_BOX (gtk_hbox_new (FALSE, 12)); section.label = GTK_LABEL (gtk_label_new_with_mnemonic (pretty_name)); section.transfer_button = GTK_BUTTON (gtk_button_new()); section.remove_button = GTK_BUTTON (gtk_button_new()); @@ -632,33 +642,10 @@ add_section (ENameSelectorDialog *name_selector_dialog, g_signal_connect(section.remove_button, "clicked", G_CALLBACK (remove_button_clicked), data); - /* Toplevel table for the section - * - * | label - * ---------+------------- - * [add] | +---------+ - * [remove] | | | - * | +---------+ - */ - - gtk_table_set_row_spacings (section.section_table, 0); - gtk_table_set_col_spacings (section.section_table, 12); - - /* Title label */ - - gtk_misc_set_alignment (GTK_MISC (section.label), 0.0, 0.5); - gtk_table_attach (section.section_table, GTK_WIDGET (section.label), 1, 2, 0, 1, - GTK_EXPAND | GTK_FILL, - 0, - 0, 0); - /* Alignment and vbox for the add/remove buttons */ alignment = gtk_alignment_new (0.5, 0.0, 0.0, 0.0); - gtk_table_attach (section.section_table, alignment, 0, 1, 1, 2, - 0, - GTK_EXPAND | GTK_FILL, - 0, 0); + gtk_box_pack_start (section.section_box, alignment, FALSE, FALSE, 0); vbox = gtk_vbox_new (TRUE, 6); gtk_container_add (GTK_CONTAINER (alignment), vbox); @@ -672,13 +659,24 @@ add_section (ENameSelectorDialog *name_selector_dialog, setup_section_button (name_selector_dialog, section.remove_button, 0.5, _("_Remove"), "gtk-go-back", TRUE); gtk_widget_set_sensitive (GTK_WIDGET (section.remove_button), FALSE); + /* Hbox for label and scrolled window. This is a separate hbox, instead + * of just using the section.section_box directly, as it has a different + * spacing. + */ + + hbox = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (section.section_box, hbox, TRUE, TRUE, 0); + + /* Title label */ + + gtk_size_group_add_widget (priv->dest_label_size_group, GTK_WIDGET (section.label)); + + gtk_misc_set_alignment (GTK_MISC (section.label), 0.0, 0.0); + gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (section.label), FALSE, FALSE, 0); + /* Treeview in a scrolled window */ scrollwin = gtk_scrolled_window_new (NULL, NULL); - gtk_table_attach (section.section_table, scrollwin, 1, 2, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - 0, 0); - + gtk_box_pack_start (GTK_BOX (hbox), scrollwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (scrollwin), GTK_WIDGET (section.destination_view)); @@ -701,12 +699,11 @@ add_section (ENameSelectorDialog *name_selector_dialog, /* Done! */ - gtk_widget_show_all (GTK_WIDGET (section.section_table)); + gtk_widget_show_all (GTK_WIDGET (section.section_box)); - /* Pack this section's table into the dialog */ - gtk_box_pack_start ( - name_selector_dialog->priv->destination_box, - GTK_WIDGET (section.section_table), TRUE, TRUE, 0); + /* Pack this section's box into the dialog */ + gtk_box_pack_start (name_selector_dialog->destination_box, + GTK_WIDGET (section.section_box), TRUE, TRUE, 0); g_array_append_val (name_selector_dialog->priv->sections, section); @@ -728,7 +725,7 @@ free_section (ENameSelectorDialog *name_selector_dialog, gint n) name_selector_dialog->priv->sections, Section, n); g_free (section->name); - gtk_widget_destroy (GTK_WIDGET (section->section_table)); + gtk_widget_destroy (GTK_WIDGET (section->section_box)); } static void |