From cff9059380f748309b628041b55abad159aab4d6 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 15 Jan 2001 07:34:27 +0000 Subject: Work on the ETableConfigurator. Pick up where Chris left. Work on the ETableConfigurator. Pick up where Chris left. A lot more changes to come in the short future. 2001-01-15 Miguel de Icaza * e-table-config.c (config_group_info_update): Simplify signature. (config_sort_info_update): Simplify signature. (config_fields_info_update): Implement. (e_table_config_construct): Hook up field change spec. * e-table-header-item.c (config_destroyed): Add new utility function. * e-table-config.c (config_group_info_update): Simpify routine by using g_string. Show a message if there is no grouping. * e-table-config.c: Made e-table-config dialog be a GnomePropertyBox. * e-table-header-item.c (ethi_popup_customize_view): Use the new api. * e-table-config.c (config_sort_info_update): Simplify this routine. Fix bug that was not showing "unsorted" state. (setup_gui): Load XML user interface here. (config_init): Use Glade instead of manually coded user interface. (e_table_config_raise): New api call. 2001-01-14 Miguel de Icaza * e-table-config.h: Change parent to be a GtkObject from GnomeDialog. svn path=/trunk/; revision=7495 --- widgets/table/e-table-config.c | 417 +++++++++--------- widgets/table/e-table-config.glade | 825 +++++++++++++++++------------------ widgets/table/e-table-config.glade.h | 14 +- widgets/table/e-table-config.h | 35 +- widgets/table/e-table-header-item.c | 18 +- widgets/table/e-table-header-item.h | 2 +- widgets/table/e-table.c | 20 +- widgets/table/test-table.c | 4 +- 8 files changed, 674 insertions(+), 661 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 679c2d5b63..c0fa629019 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -10,303 +10,324 @@ #include #include -#include +#include +#include #include "e-table-config.h" #include "e-table-config-field.h" #include "gal/util/e-util.h" -#define PARENT_TYPE (gnome_dialog_get_type()) -static GnomeDialogClass *etco_parent_class; +#define PARENT_TYPE (gtk_object_get_type()) + +static GtkObjectClass *config_parent_class; static void -etco_destroy (GtkObject *object) +config_destroy (GtkObject *object) { - ETableConfig *etco = E_TABLE_CONFIG (object); - - if (etco->state) { - if (etco->sorting_changed_id) - gtk_signal_disconnect(GTK_OBJECT(etco->state->sort_info), etco->sorting_changed_id); - if (etco->grouping_changed_id) - gtk_signal_disconnect(GTK_OBJECT(etco->state->sort_info), etco->grouping_changed_id); - gtk_object_unref(GTK_OBJECT(etco->state)); + ETableConfig *config = E_TABLE_CONFIG (object); + + if (config->state) { + if (config->sorting_changed_id) + gtk_signal_disconnect(GTK_OBJECT(config->state->sort_info), config->sorting_changed_id); + if (config->grouping_changed_id) + gtk_signal_disconnect(GTK_OBJECT(config->state->sort_info), config->grouping_changed_id); + gtk_object_unref(GTK_OBJECT(config->state)); } - gtk_object_unref(GTK_OBJECT(etco->spec)); + gtk_object_unref(GTK_OBJECT(config->spec)); - GTK_OBJECT_CLASS (etco_parent_class)->destroy (object); + GTK_OBJECT_CLASS (config_parent_class)->destroy (object); } static void -etco_class_init (GtkObjectClass *klass) +config_class_init (GtkObjectClass *klass) { - etco_parent_class = gtk_type_class (PARENT_TYPE); + config_parent_class = gtk_type_class (PARENT_TYPE); - klass->destroy = etco_destroy; + klass->destroy = config_destroy; } static void -etco_clear_sort(GtkWidget *widget, ETableConfig *etco) +config_clear_sort (GtkWidget *widget, ETableConfig *config) { - etco->sort_dialog = NULL; - gtk_object_unref(GTK_OBJECT(etco)); + config->sort_dialog = NULL; + gtk_object_unref(GTK_OBJECT(config)); } static void -etco_clear_group(GtkWidget *widget, ETableConfig *etco) +config_clear_group (GtkWidget *widget, ETableConfig *config) { - etco->group_dialog = NULL; - gtk_object_unref(GTK_OBJECT(etco)); + config->group_dialog = NULL; + gtk_object_unref(GTK_OBJECT(config)); } static void -etco_sort_config_show(GtkWidget *widget, ETableConfig *etco) +config_sort_config_show (GtkWidget *widget, ETableConfig *config) { - if (etco->sort_dialog) - gdk_window_raise(GTK_WIDGET(etco->sort_dialog)->window); + if (config->sort_dialog) + gdk_window_raise (GTK_WIDGET (config->sort_dialog)->window); else { GtkWidget *etcf; - etco->sort_dialog = gnome_dialog_new(_("Sort"), + config->sort_dialog = gnome_dialog_new(_("Sort"), GNOME_STOCK_BUTTON_OK, NULL); - etcf = GTK_WIDGET(e_table_config_field_new(etco->spec, - etco->state->sort_info, + etcf = GTK_WIDGET(e_table_config_field_new(config->spec, + config->state->sort_info, FALSE)); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(etco->sort_dialog)->vbox), etcf, FALSE, FALSE, 0); - gnome_dialog_set_parent(GNOME_DIALOG(etco->sort_dialog), - GTK_WINDOW(etco)); + gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(config->sort_dialog)->vbox), etcf, FALSE, FALSE, 0); + gnome_dialog_set_parent(GNOME_DIALOG(config->sort_dialog), + GTK_WINDOW(config)); - gtk_signal_connect(GTK_OBJECT(etco->sort_dialog), "destroy", - GTK_SIGNAL_FUNC(etco_clear_sort), etco); - gtk_object_ref(GTK_OBJECT(etco)); + gtk_signal_connect(GTK_OBJECT(config->sort_dialog), "destroy", + GTK_SIGNAL_FUNC(config_clear_sort), config); + gtk_object_ref(GTK_OBJECT(config)); - gtk_signal_connect(GTK_OBJECT(etco->sort_dialog), "clicked", - GTK_SIGNAL_FUNC(gnome_dialog_close), etco); + gtk_signal_connect(GTK_OBJECT(config->sort_dialog), "clicked", + GTK_SIGNAL_FUNC(gnome_dialog_close), config); gtk_widget_show(GTK_WIDGET(etcf)); - gtk_widget_show(GTK_WIDGET(etco->sort_dialog)); + gtk_widget_show(GTK_WIDGET(config->sort_dialog)); } } static void -etco_group_config_show(GtkWidget *widget, ETableConfig *etco) +config_group_config_show(GtkWidget *widget, ETableConfig *config) { - if (etco->group_dialog) - gdk_window_raise(GTK_WIDGET(etco->group_dialog)->window); + if (config->group_dialog) + gdk_window_raise(GTK_WIDGET(config->group_dialog)->window); else { GtkWidget *etcf; - etco->group_dialog = gnome_dialog_new(_("Group"), + config->group_dialog = gnome_dialog_new(_("Group"), GNOME_STOCK_BUTTON_OK, NULL); - etcf = GTK_WIDGET(e_table_config_field_new(etco->spec, - etco->state->sort_info, + etcf = GTK_WIDGET(e_table_config_field_new(config->spec, + config->state->sort_info, TRUE)); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(etco->group_dialog)->vbox), etcf, FALSE, FALSE, 0); - gnome_dialog_set_parent(GNOME_DIALOG(etco->group_dialog), - GTK_WINDOW(etco)); + gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(config->group_dialog)->vbox), etcf, FALSE, FALSE, 0); + gnome_dialog_set_parent(GNOME_DIALOG(config->group_dialog), + GTK_WINDOW(config)); - gtk_signal_connect(GTK_OBJECT(etco->group_dialog), "destroy", - GTK_SIGNAL_FUNC(etco_clear_group), etco); - gtk_signal_connect(GTK_OBJECT(etco->group_dialog), "clicked", - GTK_SIGNAL_FUNC(gnome_dialog_close), etco); - gtk_object_ref(GTK_OBJECT(etco)); + gtk_signal_connect(GTK_OBJECT(config->group_dialog), "destroy", + GTK_SIGNAL_FUNC(config_clear_group), config); + gtk_signal_connect(GTK_OBJECT(config->group_dialog), "clicked", + GTK_SIGNAL_FUNC(gnome_dialog_close), config); + gtk_object_ref(GTK_OBJECT(config)); gtk_widget_show(GTK_WIDGET(etcf)); - gtk_widget_show(GTK_WIDGET(etco->group_dialog)); + gtk_widget_show(GTK_WIDGET(config->group_dialog)); } } static void -etco_sort_info_update(ETableSortInfo *info, ETableConfig *etco) +config_sort_info_update (ETableConfig *config) { - int count; - int i; - gchar **strings; - gchar *substrings[3]; - int stringcount = 0; - gchar *string; + ETableSortInfo *info = config->state->sort_info; + GString *res; + int count, i; - count = e_table_sort_info_sorting_get_count(info); - strings = g_new(gchar *, count + 1); + count = e_table_sort_info_sorting_get_count (info); + res = g_string_new (""); for (i = 0; i < count; i++) { - ETableSortColumn col = e_table_sort_info_sorting_get_nth(info, i); + ETableSortColumn col = e_table_sort_info_sorting_get_nth (info, i); ETableColumnSpecification **column; - substrings[0] = NULL; - - for (column = etco->spec->columns; *column; column++) { + for (column = config->spec->columns; *column; column++) { if (col.column == (*column)->model_col) { - substrings[0] = (*column)->title_; + g_string_append (res, (*column)->title_); + g_string_append_c (res, ' '); + g_string_append ( + res, + col.ascending ? + _("(Ascending)") : _("(Descending)")); break; } } - - if (substrings[0]) { - substrings[1] = col.ascending ? _("(Ascending)") : _("(Descending)"); - substrings[2] = NULL; - strings[stringcount++] = g_strjoinv(" ", substrings); - } - } - strings[stringcount] = NULL; - string = g_strjoinv(", ", strings); - - for (i = 0; strings[i]; i++) { - g_free(strings[i]); } - gtk_label_set_text(GTK_LABEL(etco->sort_label), string); - g_free(string); + if (res->str [0] == 0) + g_string_append (res, _("Not sorted")); + + gtk_label_set_text (GTK_LABEL(config->sort_label), res->str); + g_string_free (res, TRUE); } static void -etco_group_info_update(ETableSortInfo *info, ETableConfig *etco) +config_group_info_update (ETableConfig *config) { - int count; - int i; - gchar **strings; - gchar *substrings[3]; - int stringcount = 0; - gchar *string; + ETableSortInfo *info = config->state->sort_info; + GString *res; + int count, i; - count = e_table_sort_info_grouping_get_count(info); - strings = g_new(gchar *, count + 1); + count = e_table_sort_info_grouping_get_count (info); + res = g_string_new (""); for (i = 0; i < count; i++) { - ETableSortColumn col = e_table_sort_info_grouping_get_nth(info, i); + ETableSortColumn col = e_table_sort_info_grouping_get_nth (info, i); ETableColumnSpecification **column; - substrings[0] = NULL; - - for (column = etco->spec->columns; *column; column++) { + for (column = config->spec->columns; *column; column++) { if (col.column == (*column)->model_col) { - substrings[0] = (*column)->title_; - break; + g_string_append (res, (*column)->title_); + g_string_append_c (res, ' '); + g_string_append ( + res, + col.ascending ? + _("(Ascending)") : _("(Descending)")); } } - - if (substrings[0]) { - substrings[1] = col.ascending ? _("(Ascending)") : _("(Descending)"); - substrings[2] = NULL; - strings[stringcount++] = g_strjoinv(" ", substrings); - } } - strings[stringcount] = NULL; - string = g_strjoinv(", ", strings); + if (res->str [0] == 0) + g_string_append (res, _("No grouping")); + + gtk_label_set_text (GTK_LABEL (config->group_label), res->str); + g_string_free (res, TRUE); +} + +static void +config_fields_info_update (ETableConfig *config) +{ + ETableColumnSpecification **column; + GString *res = g_string_new (""); - for (i = 0; strings[i]; i++) { - g_free(strings[i]); + for (column = config->spec->columns; *column; *column++){ + g_string_append (res, (*column)->title_); + if (column [1]) + g_string_append (res, ", "); } - gtk_label_set_text(GTK_LABEL(etco->group_label), string); - g_free(string); + gtk_label_set_text (GTK_LABEL (config->fields_label), res->str); + g_string_free (res, TRUE); +} + +static void +apply_changes (ETableConfig *config) +{ + /* Do apply changes here */ +} + +static void +dialog_destroyed (GtkObject *dialog, ETableConfig *config) +{ + gtk_object_destroy (GTK_OBJECT (config)); } static void -etco_init (ETableConfig *etco) +setup_gui (ETableConfig *config) { - GtkWidget *frame; - GtkWidget *table; GtkWidget *sort_button; GtkWidget *group_button; + GladeXML *gui = glade_xml_new ( + ETABLE_GLADEDIR "/e-table-config.glade", NULL); + + config->dialog_toplevel = glade_xml_get_widget ( + gui, "e-table-config"); - gtk_window_set_title(GTK_WINDOW(etco), _("View Summary")); - gnome_dialog_append_buttons(GNOME_DIALOG(etco), - GNOME_STOCK_BUTTON_OK, - NULL); - gnome_dialog_set_default(GNOME_DIALOG(etco), 0); - - frame = gtk_frame_new(_("Description")); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(etco)->vbox), frame, FALSE, FALSE, 0); - - table = gtk_table_new(2, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - gtk_table_set_col_spacings(GTK_TABLE(table), 6); - gtk_container_add(GTK_CONTAINER(frame), table); - gtk_container_set_border_width(GTK_CONTAINER(table), 6); - - sort_button = gtk_button_new_with_label(_("Sort...")); - gtk_table_attach(GTK_TABLE(table), - sort_button, - 0, 1, 0, 1, - GTK_FILL, - GTK_FILL, - 0, 0); - - group_button = gtk_button_new_with_label(_("Group By...")); - gtk_table_attach(GTK_TABLE(table), - group_button, - 0, 1, 1, 2, - GTK_FILL, - GTK_FILL, - 0, 0); - - etco->sort_label = gtk_label_new(""); - gtk_table_attach(GTK_TABLE(table), - etco->sort_label, - 1, 2, 0, 1, - GTK_FILL | GTK_EXPAND, - GTK_FILL, - 0, 0); - - etco->group_label = gtk_label_new(""); - gtk_table_attach(GTK_TABLE(table), - etco->group_label, - 1, 2, 1, 2, - GTK_FILL | GTK_EXPAND, - GTK_FILL, - 0, 0); - - gtk_signal_connect(GTK_OBJECT(sort_button), "clicked", - GTK_SIGNAL_FUNC(etco_sort_config_show), etco); - gtk_signal_connect(GTK_OBJECT(group_button), "clicked", - GTK_SIGNAL_FUNC(etco_group_config_show), etco); - - gtk_widget_show(etco->group_label); - gtk_widget_show(etco->sort_label); - gtk_widget_show(group_button); - gtk_widget_show(sort_button); - gtk_widget_show(table); - gtk_widget_show(frame); - - etco->sorting_changed_id = 0; - etco->grouping_changed_id = 0; + gtk_notebook_set_show_tabs ( + GTK_NOTEBOOK (GNOME_PROPERTY_BOX ( + config->dialog_toplevel)->notebook), + FALSE); + + gtk_signal_connect ( + GTK_OBJECT (config->dialog_toplevel), "apply", + GTK_SIGNAL_FUNC (apply_changes), config); + + config->dialog_show_fields = glade_xml_get_widget ( + gui, "dialog-show-fields"); + config->dialog_group_by = glade_xml_get_widget ( + gui, "dialog-group-by"); + config->dialog_sort = glade_xml_get_widget ( + gui, "dialog-sort"); + + config->sort_label = glade_xml_get_widget ( + gui, "label-sort"); + config->group_label = glade_xml_get_widget ( + gui, "label-group"); + config->fields_label = glade_xml_get_widget ( + gui, "label-fields"); + + sort_button = glade_xml_get_widget (gui, "button-sort"); + gtk_signal_connect( + GTK_OBJECT(sort_button), "clicked", + GTK_SIGNAL_FUNC (config_sort_config_show), config); + + group_button = glade_xml_get_widget (gui, "button-group"); + gtk_signal_connect( + GTK_OBJECT(group_button), "clicked", + GTK_SIGNAL_FUNC (config_group_config_show), config); + + gtk_signal_connect ( + GTK_OBJECT (config->dialog_toplevel), "destroy", + GTK_SIGNAL_FUNC (dialog_destroyed), config); + + gtk_object_unref (GTK_OBJECT (gui)); } -E_MAKE_TYPE(e_table_config, "ETableConfig", ETableConfig, etco_class_init, etco_init, PARENT_TYPE); +static void +config_init (ETableConfig *config) +{ + glade_gnome_init (); + setup_gui (config); -GtkWidget * -e_table_config_new (ETableSpecification *spec, - ETableState *state) + config->sorting_changed_id = 0; + config->grouping_changed_id = 0; +} + +E_MAKE_TYPE(e_table_config, "ETableConfig", ETableConfig, config_class_init, config_init, PARENT_TYPE); + +ETableConfig * +e_table_config_new (const char *header, + ETableSpecification *spec, + ETableState *state) { - ETableConfig *etco = gtk_type_new (E_TABLE_CONFIG_TYPE); + ETableConfig *config = gtk_type_new (E_TABLE_CONFIG_TYPE); - e_table_config_construct(etco, spec, state); + if (e_table_config_construct (config, config, spec, state) == NULL){ + gtk_object_destroy (GTK_OBJECT (config)); + return NULL; + } - return GTK_WIDGET(etco); + gtk_widget_show (config->dialog_toplevel); + return E_TABLE_CONFIG (config); } -GtkWidget * -e_table_config_construct (ETableConfig *etco, +ETableConfig * +e_table_config_construct (ETableConfig *config, + const char *header, ETableSpecification *spec, ETableState *state) { - etco->spec = spec; - etco->state = state; - - if (etco->spec) - gtk_object_ref(GTK_OBJECT(etco->spec)); - if (etco->state) - gtk_object_ref(GTK_OBJECT(etco->state)); - - etco->sorting_changed_id = gtk_signal_connect(GTK_OBJECT(etco->state->sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC(etco_sort_info_update), etco); - etco->grouping_changed_id = gtk_signal_connect(GTK_OBJECT(etco->state->sort_info), "group_info_changed", - GTK_SIGNAL_FUNC(etco_group_info_update), etco); - - etco_sort_info_update(etco->state->sort_info, etco); - etco_group_info_update(etco->state->sort_info, etco); - - return GTK_WIDGET(etco); + config->spec = spec; + config->state = state; + + if (config->spec) + gtk_object_ref (GTK_OBJECT(config->spec)); + if (config->state) + gtk_object_ref (GTK_OBJECT(config->state)); + + /* + * FIXME: + * + * Are we going to allow async changes to the ETable? If so, + * we are in for some more work than required + * + */ + config->sorting_changed_id = gtk_signal_connect ( + GTK_OBJECT(config->state->sort_info), "sort_info_changed", + GTK_SIGNAL_FUNC(config_sort_info_update), config); + config->grouping_changed_id = gtk_signal_connect ( + GTK_OBJECT(config->state->sort_info), "group_info_changed", + GTK_SIGNAL_FUNC (config_group_info_update), config); + + config_sort_info_update (config); + config_group_info_update (config); + config_fields_info_update (config); + + return E_TABLE_CONFIG (config); } +void +e_table_config_raise (ETableConfig *config) +{ + gdk_window_raise (GTK_WIDGET (config->dialog_toplevel)->window); +} diff --git a/widgets/table/e-table-config.glade b/widgets/table/e-table-config.glade index 3cc9c0e8e7..ba1c151322 100644 --- a/widgets/table/e-table-config.glade +++ b/widgets/table/e-table-config.glade @@ -19,9 +19,9 @@ GnomeDialog - e-table-config + dialog-show-fields False - View Summary + Show Fields GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -34,11 +34,11 @@ GtkVBox GnomeDialog:vbox - dialog-vbox2 + dialog-vbox3 False - 0 + 8 - 0 + 4 True True @@ -46,9 +46,9 @@ GtkHButtonBox GnomeDialog:action_area - dialog-action_area2 + dialog-action_area3 GTK_BUTTONBOX_END - 0 + 8 85 27 7 @@ -62,7 +62,7 @@ GtkButton - button12 + button20 True True GNOME_STOCK_BUTTON_OK @@ -70,7 +70,7 @@ GtkButton - button14 + button22 True True GNOME_STOCK_BUTTON_CANCEL @@ -78,12 +78,10 @@ - GtkFrame - top-frame - 2 - - 0 - GTK_SHADOW_ETCHED_IN + GtkVBox + vbox2 + False + 6 0 True @@ -92,476 +90,150 @@ GtkTable - table1 - 2 - 3 - 3 - False - 2 - 4 + table2 + 1 + 5 + True + 6 + 6 + + 0 + False + True + GtkLabel - label2 - - GTK_JUSTIFY_CENTER + label-available + + GTK_JUSTIFY_LEFT False 0 0.5 0 0 + table-1 - 2 - 3 + 0 + 2 0 1 0 0 - False + True False False False True - False + True GtkLabel - label3 - - GTK_JUSTIFY_CENTER + label-displayed + + GTK_JUSTIFY_LEFT False 0 0.5 0 0 + table-2 - 2 - 3 - 1 - 2 + 3 + 5 + 0 + 1 0 0 - False + True False False False True - False + True + - - GtkLabel - label4 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 2 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - + + GtkTable + table3 + 1 + 5 + True + 6 + 6 + + 0 + True + True + - GtkButton - button15 - True - True - - clicked - on_fields_clicked - Tue, 03 Oct 2000 22:11:12 GMT - - - GTK_RELIEF_NORMAL + GtkVBox + vbox4 + False + 6 0 - 1 + 2 0 1 0 0 - False - False + True + True False False True - False + True - - - GtkButton - button18 - True - True - - clicked - on_sort_clicked - Tue, 03 Oct 2000 22:10:58 GMT - - - GTK_RELIEF_NORMAL - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - + + GtkScrolledWindow + scrolledwindow1 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + - - GtkButton - button16 - True - True - - clicked - on_group_by_clicked - Tue, 03 Oct 2000 22:10:50 GMT - - - GTK_RELIEF_NORMAL - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - + + GtkViewport + viewport1 + GTK_SHADOW_IN + + + GtkButton + table-1 + True + + GTK_RELIEF_NORMAL + + + - GtkLabel - label5 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 + GtkVBox + vbox5 + False + 6 - 1 - 2 + 3 + 5 0 1 0 0 - False - False - False - False - True - True - - - - - GtkLabel - label6 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label7 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - - - - - GnomeDialog - dialog-show-fields - False - Show Fields - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox3 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area3 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button20 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button22 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkVBox - vbox2 - False - 6 - - 0 - True - True - - - - GtkTable - table2 - 1 - 5 - True - 6 - 6 - - 0 - False - True - - - - GtkLabel - label-available - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - table-1 - - 0 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - True - - - - - GtkLabel - label-displayed - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - table-2 - - 3 - 5 - 0 - 1 - 0 - 0 - True - False - False - False - True - True - - - - - - GtkTable - table3 - 1 - 5 - True - 6 - 6 - - 0 - True - True - - - - GtkVBox - vbox4 - False - 6 - - 0 - 2 - 0 - 1 - 0 - 0 - True - True - False - False - True - True - - - - GtkScrolledWindow - scrolledwindow1 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - - - - GtkViewport - viewport1 - GTK_SHADOW_IN - - - GtkButton - table-1 - True - - GTK_RELIEF_NORMAL - - - - - - - GtkVBox - vbox5 - False - 6 - - 3 - 5 - 0 - 1 - 0 - 0 - True - True + True + True False False True @@ -1997,4 +1669,305 @@ Full Name, Company, + + GnomePropertyBox + e-table-config + GTK_WIN_POS_NONE + False + False + False + False + + + GtkNotebook + GnomePropertyBox:notebook + notebook1 + False + True + GTK_POS_TOP + False + 2 + 2 + False + + 0 + True + True + + + + GtkFrame + top-frame + 2 + + 0 + GTK_SHADOW_ETCHED_IN + + + GtkTable + table1 + 2 + 3 + 3 + False + 2 + 4 + + + GtkLabel + label2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label4 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkButton + button15 + True + True + + clicked + on_fields_clicked + Tue, 03 Oct 2000 22:11:12 GMT + + + GTK_RELIEF_NORMAL + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkButton + button-sort + True + True + + clicked + on_sort_clicked + Tue, 03 Oct 2000 22:10:58 GMT + + + GTK_RELIEF_NORMAL + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkButton + button-group + True + True + + clicked + on_group_by_clicked + Tue, 03 Oct 2000 22:10:50 GMT + + + GTK_RELIEF_NORMAL + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label-group + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + True + + + + + GtkLabel + label-sort + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 2 + 3 + 0 + 0 + True + False + False + False + True + True + + + + + GtkLabel + label-fields + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + True + + + + + + + GtkLabel + Notebook:tab + label20 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + diff --git a/widgets/table/e-table-config.glade.h b/widgets/table/e-table-config.glade.h index de73232529..bed862eaac 100644 --- a/widgets/table/e-table-config.glade.h +++ b/widgets/table/e-table-config.glade.h @@ -4,15 +4,6 @@ * DO NOT compile it as part of your application. */ -gchar *s = N_("View Summary"); -gchar *s = N_("Description"); -gchar *s = N_("_Fields..."); -gchar *s = N_("_Sort..."); -gchar *s = N_("_Group By..."); -gchar *s = N_("Icon, Attachment, Flag Status,\n" - "Full Name, Company, "); -gchar *s = N_("None"); -gchar *s = N_("File As (ascending)"); gchar *s = N_("Show Fields"); gchar *s = N_("A_vailable Fields:"); gchar *s = N_("Sh_ow these fields in order:"); @@ -55,3 +46,8 @@ gchar *s = N_("Sort Items By"); gchar *s = N_("File By"); gchar *s = N_("Ascending"); gchar *s = N_("Descending"); +gchar *s = N_("Description"); +gchar *s = N_("_Fields..."); +gchar *s = N_("_Sort..."); +gchar *s = N_("_Group By..."); +gchar *s = N_("label20"); diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h index ddae3f1497..4b444636d7 100644 --- a/widgets/table/e-table-config.h +++ b/widgets/table/e-table-config.h @@ -13,14 +13,26 @@ #define E_IS_TABLE_CONFIG_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CONFIG_TYPE)) typedef struct { - GnomeDialog base; - + GtkObject parent; + + /* + * Our various dialog boxes + */ + GtkWidget *dialog_toplevel; + GtkWidget *dialog_show_fields; + GtkWidget *dialog_group_by; + GtkWidget *dialog_sort; + + /* + * The state we manipulate + */ ETableSpecification *spec; ETableState *state; GtkWidget *sort_label; GtkWidget *group_label; - + GtkWidget *fields_label; + GtkWidget *sort_dialog; GtkWidget *group_dialog; @@ -29,14 +41,17 @@ typedef struct { } ETableConfig; typedef struct { - GnomeDialogClass parent_class; + GtkObjectClass parent_class; } ETableConfigClass; -GtkType e_table_config_get_type (void); -GtkWidget *e_table_config_new (ETableSpecification *spec, - ETableState *state); -GtkWidget *e_table_config_construct (ETableConfig *etco, - ETableSpecification *spec, - ETableState *state); +GtkType e_table_config_get_type (void); +ETableConfig *e_table_config_new (const char *header, + ETableSpecification *spec, + ETableState *state); +ETableConfig *e_table_config_construct (ETableConfig *etco, + const char *header, + ETableSpecification *spec, + ETableState *state); +void e_table_config_raise (ETableConfig *config); #endif /* _E_TABLE_CONFIG_H */ diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index cbb236cca0..e67b83edb5 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1185,6 +1185,12 @@ ethi_popup_format_columns(GtkWidget *widget, EthiHeaderInfo *info) { } +static void +config_destroyed (GtkObject *object, ETableHeaderItem *ethi) +{ + ethi->config = NULL; +} + static void ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info) { @@ -1192,15 +1198,15 @@ ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info) ETableState *state; if (ethi->config) - gdk_window_raise(GTK_WIDGET(ethi->config)->window); + e_table_config_raise (E_TABLE_CONFIG (ethi->config)); else { state = e_table_get_state_object(ethi->table); - ethi->config = e_table_config_new(ethi->table->spec, - state); - gtk_signal_connect(GTK_OBJECT(ethi->config), "clicked", - GTK_SIGNAL_FUNC(gnome_dialog_close), ethi); - gtk_widget_show(ethi->config); + ethi->config = e_table_config_new ( + _("Configuring view: FIXME"), + ethi->table->spec, state); + gtk_signal_connect (GTK_OBJECT (ethi->config), "destroy", + GTK_SIGNAL_FUNC (config_destroyed), ethi); } } diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index b029d58280..1c2941c602 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -62,7 +62,7 @@ typedef struct { /* For adding fields. */ ETableHeader *full_header; ETable *table; - GtkWidget *config; + void *config; } ETableHeaderItem; typedef struct { diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 2d2303def1..eec3f44735 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -373,12 +373,13 @@ group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et GdkEventButton click; switch (key->keyval) { case GDK_Page_Down: - gtk_adjustment_set_value(gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)), - CLAMP(gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value + - (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20), - 0, - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->upper - - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size)); + gtk_adjustment_set_value( + gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)), + CLAMP(gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value + + (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20), + 0, + gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->upper - + gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size)); click.type = GDK_BUTTON_PRESS; click.window = GTK_LAYOUT (et->table_canvas)->bin_window; click.send_event = key->send_event; @@ -392,9 +393,10 @@ group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et return_val = 1; break; case GDK_Page_Up: - gtk_adjustment_set_value(gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)), - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value - - (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20)); + gtk_adjustment_set_value( + gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)), + gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value - + (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20)); click.type = GDK_BUTTON_PRESS; click.window = GTK_LAYOUT (et->table_canvas)->bin_window; click.send_event = key->send_event; diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c index 1dcba363fa..314df1000e 100644 --- a/widgets/table/test-table.c +++ b/widgets/table/test-table.c @@ -9,8 +9,8 @@ #include #include #include -#include "gal/e-util/e-cursors.h" -#include "gal/e-util/e-canvas.h" +#include "gal/widgets/e-cursors.h" +#include "gal/widgets/e-canvas.h" #include "e-table-simple.h" #include "e-table-header.h" #include "e-table-header-item.h" -- cgit v1.2.3