diff options
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-table-config.c | 417 | ||||
-rw-r--r-- | widgets/table/e-table-config.glade | 629 | ||||
-rw-r--r-- | widgets/table/e-table-config.glade.h | 14 | ||||
-rw-r--r-- | widgets/table/e-table-config.h | 35 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 18 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table.c | 20 | ||||
-rw-r--r-- | widgets/table/test-table.c | 4 |
8 files changed, 576 insertions, 563 deletions
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 <config.h> #include <stdlib.h> -#include <gnome.h> +#include <libgnomeui/gnome-dialog.h> +#include <glade/glade.h> #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,334 +19,6 @@ <widget> <class>GnomeDialog</class> - <name>e-table-config</name> - <visible>False</visible> - <title>View Summary</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox2</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area2</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>0</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button12</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button14</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>top-frame</name> - <border_width>2</border_width> - <label>Description</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>2</border_width> - <rows>3</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label2</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label3</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label4</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button15</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <signal> - <name>clicked</name> - <handler>on_fields_clicked</handler> - <last_modification_time>Tue, 03 Oct 2000 22:11:12 GMT</last_modification_time> - </signal> - <label>_Fields...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button18</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <signal> - <name>clicked</name> - <handler>on_sort_clicked</handler> - <last_modification_time>Tue, 03 Oct 2000 22:10:58 GMT</last_modification_time> - </signal> - <label>_Sort...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button16</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <signal> - <name>clicked</name> - <handler>on_group_by_clicked</handler> - <last_modification_time>Tue, 03 Oct 2000 22:10:50 GMT</last_modification_time> - </signal> - <label>_Group By...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>Icon, Attachment, Flag Status, -Full Name, Company, </label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label6</name> - <label>None</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label7</name> - <label>File As (ascending)</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - </widget> - </widget> -</widget> - -<widget> - <class>GnomeDialog</class> <name>dialog-show-fields</name> <visible>False</visible> <title>Show Fields</title> @@ -1997,4 +1669,305 @@ Full Name, Company, </label> </widget> </widget> +<widget> + <class>GnomePropertyBox</class> + <name>e-table-config</name> + <position>GTK_WIN_POS_NONE</position> + <modal>False</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>False</allow_grow> + <auto_shrink>False</auto_shrink> + + <widget> + <class>GtkNotebook</class> + <child_name>GnomePropertyBox:notebook</child_name> + <name>notebook1</name> + <show_tabs>False</show_tabs> + <show_border>True</show_border> + <tab_pos>GTK_POS_TOP</tab_pos> + <scrollable>False</scrollable> + <tab_hborder>2</tab_hborder> + <tab_vborder>2</tab_vborder> + <popup_enable>False</popup_enable> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkFrame</class> + <name>top-frame</name> + <border_width>2</border_width> + <label>Description</label> + <label_xalign>0</label_xalign> + <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + + <widget> + <class>GtkTable</class> + <name>table1</name> + <border_width>2</border_width> + <rows>3</rows> + <columns>3</columns> + <homogeneous>False</homogeneous> + <row_spacing>2</row_spacing> + <column_spacing>4</column_spacing> + + <widget> + <class>GtkLabel</class> + <name>label2</name> + <label></label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label3</name> + <label></label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label4</name> + <label></label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button15</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>on_fields_clicked</handler> + <last_modification_time>Tue, 03 Oct 2000 22:11:12 GMT</last_modification_time> + </signal> + <label>_Fields...</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-sort</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>on_sort_clicked</handler> + <last_modification_time>Tue, 03 Oct 2000 22:10:58 GMT</last_modification_time> + </signal> + <label>_Sort...</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-group</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>on_group_by_clicked</handler> + <last_modification_time>Tue, 03 Oct 2000 22:10:50 GMT</last_modification_time> + </signal> + <label>_Group By...</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label-group</name> + <label></label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label-sort</name> + <label></label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label-fields</name> + <label></label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>label20</name> + <label>label20</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + </widget> +</widget> + </GTK-Interface> 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 @@ -1186,21 +1186,27 @@ 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) { ETableHeaderItem *ethi = info->ethi; 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 <stdio.h> #include <string.h> #include <gnome.h> -#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" |