diff options
author | Miguel de Icaza <miguel@gnu.org> | 2001-01-17 14:56:04 +0800 |
---|---|---|
committer | Miguel de Icaza <miguel@src.gnome.org> | 2001-01-17 14:56:04 +0800 |
commit | d645d1f2362a623b037cbfa09405e09b0f530c71 (patch) | |
tree | 300548e4e904c3852ebbf3259ad8de58ffef76a8 | |
parent | a57329a173148e4804fe09a196fb73f87e047a02 (diff) | |
download | gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar.gz gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar.bz2 gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar.lz gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar.xz gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar.zst gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.zip |
Load frames.
2001-01-16 Miguel de Icaza <miguel@gnu.org>
* e-table-config.c (configure_sort_dialog): Load frames.
* Kill e-table-config-field.c
* e-table-specification.c (e_table_specification_save_to_file):
Specify version to xmlNewDoc.
* e-table-state.c (e_table_state_save_to_string): Specify version
to xmlNewDoc.
* e-table-config.c (config_destroy): Destroy the copies. Unref
the originals.
(e_table_config_construct): Duplicate values of configuration
here.
(configure_sort_dialog): New function that populates the sort gtk
combo boxes.
* e-table.c (et_col_spec_to_col): Fixup use of title here. Do the
actual translation here.
* e-table-column-specification.c: Remove title_, it is now called
title. Translation needs to take place elsewhere, not here
* e-table-specification.c (e_table_specification_duplicate): Add
preconditions here.
(e_table_specification_save_to_node): ditto.
(e_table_specification_save_to_string): ditto.
(e_table_specification_save_to_file): ditto.
* e-table-state.c (e_table_state_duplicate): Implement.
* e-table-config.glade (dialog_sort): Change drop down menus to
use GtkComboText widgets.
* e-table-config.c (configure_dialog): New function, used to set
up dialogs.
svn path=/trunk/; revision=7563
-rw-r--r-- | widgets/table/e-table-column-specification.c | 20 | ||||
-rw-r--r-- | widgets/table/e-table-column-specification.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-config.c | 211 | ||||
-rw-r--r-- | widgets/table/e-table-config.glade | 340 | ||||
-rw-r--r-- | widgets/table/e-table-config.glade.h | 5 | ||||
-rw-r--r-- | widgets/table/e-table-config.h | 12 | ||||
-rw-r--r-- | widgets/table/e-table-specification.c | 26 | ||||
-rw-r--r-- | widgets/table/e-table-state.c | 65 | ||||
-rw-r--r-- | widgets/table/e-table-state.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table.c | 31 |
10 files changed, 344 insertions, 370 deletions
diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c index ddd0f0bfef..68c19188b1 100644 --- a/widgets/table/e-table-column-specification.c +++ b/widgets/table/e-table-column-specification.c @@ -23,7 +23,7 @@ static GtkObjectClass *etcs_parent_class; static void free_strings (ETableColumnSpecification *etcs) { - g_free(etcs->title_); + g_free(etcs->title); g_free(etcs->pixbuf); g_free(etcs->cell); g_free(etcs->compare); @@ -51,7 +51,7 @@ static void etcs_init (ETableColumnSpecification *specification) { specification->model_col = 0; - specification->title_ = g_strdup(""); + specification->title = g_strdup(""); specification->pixbuf = NULL; specification->expansion = 0; @@ -73,13 +73,13 @@ e_table_column_specification_new (void) } void -e_table_column_specification_load_from_node (ETableColumnSpecification *etcs, - const xmlNode *node) +e_table_column_specification_load_from_node (ETableColumnSpecification *etcs, + const xmlNode *node) { free_strings(etcs); etcs->model_col = e_xml_get_integer_prop_by_name(node, "model_col"); - etcs->title_ = e_xml_get_translated_string_prop_by_name(node, "_title"); + etcs->title = e_xml_get_string_prop_by_name(node, "_title"); etcs->pixbuf = e_xml_get_string_prop_by_name(node, "pixbuf"); etcs->expansion = e_xml_get_double_prop_by_name(node, "expansion"); @@ -89,13 +89,13 @@ e_table_column_specification_load_from_node (ETableColumnSpecification *etcs, etcs->cell = e_xml_get_string_prop_by_name(node, "cell"); etcs->compare = e_xml_get_string_prop_by_name(node, "compare"); - if (etcs->title_ == NULL) - etcs->title_ = g_strdup(""); + if (etcs->title == NULL) + etcs->title = g_strdup(""); } xmlNode * -e_table_column_specification_save_to_node (ETableColumnSpecification *specification, - xmlNode *parent) +e_table_column_specification_save_to_node (ETableColumnSpecification *specification, + xmlNode *parent) { xmlNode *node; if (parent) @@ -104,7 +104,7 @@ e_table_column_specification_save_to_node (ETableColumnSpecification *speci node = xmlNewNode(NULL, "ETableColumn"); e_xml_set_integer_prop_by_name(node, "model_col", specification->model_col); - e_xml_set_string_prop_by_name(node, "_title", specification->title_); + e_xml_set_string_prop_by_name(node, "_title", specification->title); e_xml_set_string_prop_by_name(node, "pixbuf", specification->pixbuf); e_xml_set_double_prop_by_name(node, "expansion", specification->expansion); diff --git a/widgets/table/e-table-column-specification.h b/widgets/table/e-table-column-specification.h index 4004e3eb8b..c19ea5b3d0 100644 --- a/widgets/table/e-table-column-specification.h +++ b/widgets/table/e-table-column-specification.h @@ -14,7 +14,7 @@ typedef struct { GtkObject base; int model_col; - char *title_; + char *title; char *pixbuf; double expansion; diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index bcefb1b53c..af31e1e788 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -27,20 +27,12 @@ config_destroy (GtkObject *object) { 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_destroy (GTK_OBJECT (config->state)); + gtk_object_destroy (GTK_OBJECT (config->spec)); + gtk_object_unref (GTK_OBJECT (config->state)); gtk_object_unref (GTK_OBJECT (config->spec)); - + GTK_OBJECT_CLASS (config_parent_class)->destroy (object); } @@ -55,79 +47,38 @@ config_class_init (GtkObjectClass *klass) static void config_clear_sort (GtkWidget *widget, ETableConfig *config) { - config->sort_dialog = NULL; gtk_object_unref (GTK_OBJECT(config)); } static void config_clear_group (GtkWidget *widget, ETableConfig *config) { - config->group_dialog = NULL; gtk_object_unref (GTK_OBJECT (config)); } static void config_sort_config_show (GtkWidget *widget, ETableConfig *config) { - if (config->sort_dialog) - gdk_window_raise (GTK_WIDGET (config->sort_dialog)->window); - else { - GtkWidget *etcf; - config->sort_dialog = gnome_dialog_new ( - _("Sort"), - GNOME_STOCK_BUTTON_OK, - NULL); - etcf = GTK_WIDGET (e_table_config_field_new - (config->spec, - config->state->sort_info, - FALSE)); - 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->dialog_toplevel)); - - 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 (config->sort_dialog), "clicked", - GTK_SIGNAL_FUNC(gnome_dialog_close), config); - - gtk_widget_show (GTK_WIDGET (etcf)); - gtk_widget_show (GTK_WIDGET (config->sort_dialog)); + GnomeDialog *dialog = GNOME_DIALOG (config->dialog_sort); + int button, count, i; + + /* + * Make the dialog reflect the current state + */ + count = e_table_sort_info_sorting_get_count (config->state->sort_info); + + for (i = 0; i < 4; i++){ + gboolean sensitive = (i <= count); + + gtk_widget_set_sensitive (config->frames [i], sensitive); } + + button = gnome_dialog_run (dialog); } static void config_group_config_show (GtkWidget *widget, ETableConfig *config) { - if (config->group_dialog) - gdk_window_raise(GTK_WIDGET(config->group_dialog)->window); - else { - GtkWidget *etcf; - config->group_dialog = gnome_dialog_new(_("Group"), - GNOME_STOCK_BUTTON_OK, - NULL); - etcf = GTK_WIDGET(e_table_config_field_new(config->spec, - config->state->sort_info, - TRUE)); - 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->dialog_toplevel)); - - 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(config->group_dialog)); - } } static void @@ -148,7 +99,7 @@ config_sort_info_update (ETableConfig *config) if (col.column != (*column)->model_col) continue; - g_string_append (res, (*column)->title_); + g_string_append (res, _((*column)->title)); g_string_append_c (res, ' '); g_string_append ( res, @@ -185,7 +136,7 @@ config_group_info_update (ETableConfig *config) if (col.column != (*column)->model_col) continue; - g_string_append (res, (*column)->title_); + g_string_append (res, _((*column)->title)); g_string_append_c (res, ' '); g_string_append ( res, @@ -217,7 +168,7 @@ config_fields_info_update (ETableConfig *config) if (config->state->columns [i] != (*column)->model_col) continue; - g_string_append (res, (*column)->title_); + g_string_append (res, _((*column)->title)); if (column [1]) g_string_append (res, ", "); items++; @@ -244,10 +195,68 @@ dialog_destroyed (GtkObject *dialog, ETableConfig *config) } static void +connect_button (ETableConfig *config, GladeXML *gui, const char *widget_name, void *cback) +{ + GtkWidget *button = glade_xml_get_widget (gui, widget_name); + + gtk_signal_connect( + GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (cback), config); +} + +/* + * Invoked by the Glade auto-connect code + */ +GtkWidget *e_table_proxy_gtk_combo_text_new (void); +GtkWidget * +e_table_proxy_gtk_combo_text_new (void) +{ + return gtk_combo_text_new (TRUE); +} + +static GtkWidget * +configure_dialog (GladeXML *gui, const char *widget_name, ETableConfig *config) +{ + GtkWidget *w; + + w = glade_xml_get_widget (gui, widget_name); + + return w; +} + +static void +configure_sort_dialog (ETableConfig *config, GladeXML *gui) +{ + ETableColumnSpecification **column; + int i; + + for (i = 0; i < 4; i++){ + char buffer [30]; + + snprintf (buffer, sizeof (buffer), "sort-combo-%d", i + 1); + config->sort_combos [i] = GTK_COMBO_TEXT ( + glade_xml_get_widget (gui, buffer)); + gtk_combo_text_add_item (config->sort_combos [i], "", ""); + + snprintf (buffer, sizeof (buffer), "frame-sort-%d", i + 1); + config->frames [i] = + glade_xml_get_widget (gui, buffer); + } + + for (column = config->spec->columns; *column; column++){ + char *label = (*column)->title; + + for (i = 0; i < 4; i++){ + gtk_combo_text_add_item ( + config->sort_combos [i], + _(label), label); + } + } +} + +static void setup_gui (ETableConfig *config) { - GtkWidget *sort_button; - GtkWidget *group_button; GladeXML *gui = glade_xml_new ( ETABLE_GLADEDIR "/e-table-config.glade", NULL); @@ -263,12 +272,9 @@ setup_gui (ETableConfig *config) 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->dialog_show_fields = configure_dialog (gui, "dialog-show-fields", config); + config->dialog_group_by = configure_dialog (gui, "dialog-group-by", config); + config->dialog_sort = configure_dialog (gui, "dialog-sort", config); config->sort_label = glade_xml_get_widget ( gui, "label-sort"); @@ -277,16 +283,11 @@ setup_gui (ETableConfig *config) 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); + connect_button (config, gui, "button-sort", config_sort_config_show); + connect_button (config, gui, "button-group", config_group_config_show); + configure_sort_dialog (config, gui); + gtk_signal_connect ( GTK_OBJECT (config->dialog_toplevel), "destroy", GTK_SIGNAL_FUNC (dialog_destroyed), config); @@ -298,10 +299,6 @@ static void config_init (ETableConfig *config) { glade_gnome_init (); - setup_gui (config); - - config->sorting_changed_id = 0; - config->grouping_changed_id = 0; } ETableConfig * @@ -310,27 +307,21 @@ e_table_config_construct (ETableConfig *config, ETableSpecification *spec, ETableState *state) { - config->spec = spec; - config->state = state; + g_return_val_if_fail (config != NULL, NULL); + g_return_val_if_fail (header != NULL, NULL); + g_return_val_if_fail (spec != NULL, NULL); + g_return_val_if_fail (state != NULL, NULL); + + config->source_spec = spec; + config->source_state = state; - if (config->spec) - gtk_object_ref (GTK_OBJECT(config->spec)); - if (config->state) - gtk_object_ref (GTK_OBJECT(config->state)); + gtk_object_ref (GTK_OBJECT (config->source_spec)); + gtk_object_ref (GTK_OBJECT (config->source_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->spec = e_table_specification_duplicate (spec); + config->state = e_table_state_duplicate (state); + + setup_gui (config); config_sort_info_update (config); config_group_info_update (config); diff --git a/widgets/table/e-table-config.glade b/widgets/table/e-table-config.glade index b210a4d2da..a6920ee81c 100644 --- a/widgets/table/e-table-config.glade +++ b/widgets/table/e-table-config.glade @@ -10,9 +10,17 @@ <language>C</language> <gnome_support>True</gnome_support> <gettext_support>True</gettext_support> + <use_widget_names>False</use_widget_names> <output_main_file>False</output_main_file> <output_support_files>False</output_support_files> <output_build_files>False</output_build_files> + <backup_source_files>True</backup_source_files> + <main_source_file>interface.c</main_source_file> + <main_header_file>interface.h</main_header_file> + <handler_source_file>callbacks.c</handler_source_file> + <handler_header_file>callbacks.h</handler_header_file> + <support_source_file>support.c</support_source_file> + <support_header_file>support.h</support_header_file> <output_translatable_strings>True</output_translatable_strings> <translatable_strings_file>e-table-config.glade.h</translatable_strings_file> </project> @@ -44,40 +52,6 @@ </child> <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area3</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</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>button20</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>button22</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> <class>GtkVBox</class> <name>vbox2</name> <homogeneous>False</homogeneous> @@ -214,7 +188,6 @@ <name>table-1</name> <can_focus>True</can_focus> <label>Table HERE</label> - <relief>GTK_RELIEF_NORMAL</relief> </widget> </widget> </widget> @@ -263,7 +236,6 @@ <name>table-2</name> <can_focus>True</can_focus> <label>Table HERE</label> - <relief>GTK_RELIEF_NORMAL</relief> </widget> </widget> </widget> @@ -284,7 +256,6 @@ <name>button-up</name> <can_focus>True</can_focus> <label>Move _Up</label> - <relief>GTK_RELIEF_NORMAL</relief> <child> <padding>0</padding> <expand>False</expand> @@ -297,7 +268,6 @@ <name>button-down</name> <can_focus>True</can_focus> <label>Move _Down</label> - <relief>GTK_RELIEF_NORMAL</relief> <child> <padding>0</padding> <expand>False</expand> @@ -332,7 +302,6 @@ <name>button-add</name> <can_focus>True</can_focus> <label>_Add -></label> - <relief>GTK_RELIEF_NORMAL</relief> <child> <padding>0</padding> <expand>False</expand> @@ -345,7 +314,6 @@ <name>button-remove</name> <can_focus>True</can_focus> <label><- _Remove</label> - <relief>GTK_RELIEF_NORMAL</relief> <child> <padding>0</padding> <expand>False</expand> @@ -359,39 +327,11 @@ </widget> </widget> </widget> - </widget> -</widget> - -<widget> - <class>GnomeDialog</class> - <name>dialog-group-by</name> - <visible>False</visible> - <title>Group</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-vbox4</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> <widget> <class>GtkHButtonBox</class> <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area4</name> + <name>dialog-action_area3</name> <layout_style>GTK_BUTTONBOX_END</layout_style> <spacing>8</spacing> <child_min_width>85</child_min_width> @@ -407,15 +347,7 @@ <widget> <class>GtkButton</class> - <name>button39</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Clear All</label> - </widget> - - <widget> - <class>GtkButton</class> - <name>button41</name> + <name>button20</name> <can_default>True</can_default> <can_focus>True</can_focus> <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> @@ -423,12 +355,40 @@ <widget> <class>GtkButton</class> - <name>button42</name> + <name>button22</name> <can_default>True</can_default> <can_focus>True</can_focus> <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> </widget> </widget> + </widget> +</widget> + +<widget> + <class>GnomeDialog</class> + <name>dialog-group-by</name> + <visible>False</visible> + <title>Group</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-vbox4</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> <widget> <class>GtkVBox</class> @@ -1153,39 +1113,11 @@ </widget> </widget> </widget> - </widget> -</widget> - -<widget> - <class>GnomeDialog</class> - <name>dialog-sort</name> - <visible>False</visible> - <title>Sort</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>vbox15</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> <widget> <class>GtkHButtonBox</class> <child_name>GnomeDialog:action_area</child_name> - <name>hbuttonbox1</name> + <name>dialog-action_area4</name> <layout_style>GTK_BUTTONBOX_END</layout_style> <spacing>8</spacing> <child_min_width>85</child_min_width> @@ -1201,7 +1133,7 @@ <widget> <class>GtkButton</class> - <name>button43</name> + <name>button39</name> <can_default>True</can_default> <can_focus>True</can_focus> <label>_Clear All</label> @@ -1209,7 +1141,7 @@ <widget> <class>GtkButton</class> - <name>button44</name> + <name>button41</name> <can_default>True</can_default> <can_focus>True</can_focus> <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> @@ -1217,12 +1149,40 @@ <widget> <class>GtkButton</class> - <name>button45</name> + <name>button42</name> <can_default>True</can_default> <can_focus>True</can_focus> <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> </widget> </widget> + </widget> +</widget> + +<widget> + <class>GnomeDialog</class> + <name>dialog-sort</name> + <visible>False</visible> + <title>Sort</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>True</hide_on_close> + + <widget> + <class>GtkVBox</class> + <child_name>GnomeDialog:vbox</child_name> + <name>vbox15</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> <widget> <class>GtkTable</class> @@ -1269,7 +1229,7 @@ <class>GtkAlignment</class> <name>alignment1</name> <xalign>0.5</xalign> - <yalign>7.45058e-09</yalign> + <yalign>0.5</yalign> <xscale>1</xscale> <yscale>0</yscale> <child> @@ -1279,25 +1239,12 @@ </child> <widget> - <class>GtkCombo</class> - <name>combo-sort-4</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-sort-4</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> + <class>Custom</class> + <name>sort-combo-4</name> + <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Tue, 16 Jan 2001 08:33:52 GMT</last_modification_time> </widget> </widget> @@ -1376,7 +1323,7 @@ <class>GtkAlignment</class> <name>alignment2</name> <xalign>0.5</xalign> - <yalign>7.45058e-09</yalign> + <yalign>0.5</yalign> <xscale>1</xscale> <yscale>0</yscale> <child> @@ -1386,25 +1333,12 @@ </child> <widget> - <class>GtkCombo</class> - <name>combo-sort-3</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-sort-3</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> + <class>Custom</class> + <name>sort-combo-3</name> + <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Tue, 16 Jan 2001 05:22:22 GMT</last_modification_time> </widget> </widget> @@ -1483,7 +1417,7 @@ <class>GtkAlignment</class> <name>alignment3</name> <xalign>0.5</xalign> - <yalign>0</yalign> + <yalign>0.5</yalign> <xscale>1</xscale> <yscale>0</yscale> <child> @@ -1493,25 +1427,12 @@ </child> <widget> - <class>GtkCombo</class> - <name>combo-sort-2</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-sort-2</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> + <class>Custom</class> + <name>sort-combo-2</name> + <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Tue, 16 Jan 2001 05:22:15 GMT</last_modification_time> </widget> </widget> @@ -1590,7 +1511,7 @@ <class>GtkAlignment</class> <name>alignment4</name> <xalign>0.5</xalign> - <yalign>0</yalign> + <yalign>0.5</yalign> <xscale>1</xscale> <yscale>0</yscale> <child> @@ -1600,25 +1521,12 @@ </child> <widget> - <class>GtkCombo</class> - <name>combo-sort-1</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-sort-1</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text>File By</text> - </widget> + <class>Custom</class> + <name>sort-combo-1</name> + <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Tue, 16 Jan 2001 05:22:00 GMT</last_modification_time> </widget> </widget> @@ -1666,17 +1574,54 @@ </widget> </widget> </widget> + + <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>hbuttonbox1</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</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>button43</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>_Clear All</label> + </widget> + + <widget> + <class>GtkButton</class> + <name>button44</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>button45</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> </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> @@ -1802,7 +1747,6 @@ <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> @@ -1830,7 +1774,6 @@ <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> @@ -1858,7 +1801,6 @@ <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> diff --git a/widgets/table/e-table-config.glade.h b/widgets/table/e-table-config.glade.h index bed862eaac..1bc023a51b 100644 --- a/widgets/table/e-table-config.glade.h +++ b/widgets/table/e-table-config.glade.h @@ -14,7 +14,6 @@ gchar *s = N_("Move _Down"); gchar *s = N_("_Add ->"); gchar *s = N_("<- _Remove"); gchar *s = N_("Group"); -gchar *s = N_("_Clear All"); gchar *s = N_("Group Items By"); gchar *s = N_("Show field in View"); gchar *s = N_("Ascending"); @@ -31,8 +30,8 @@ gchar *s = N_("Then By"); gchar *s = N_("Show field in View"); gchar *s = N_("Ascending"); gchar *s = N_("Descending"); -gchar *s = N_("Sort"); gchar *s = N_("_Clear All"); +gchar *s = N_("Sort"); gchar *s = N_("Then By"); gchar *s = N_("Ascending"); gchar *s = N_("Descending"); @@ -43,9 +42,9 @@ gchar *s = N_("Then By"); gchar *s = N_("Ascending"); gchar *s = N_("Descending"); gchar *s = N_("Sort Items By"); -gchar *s = N_("File By"); gchar *s = N_("Ascending"); gchar *s = N_("Descending"); +gchar *s = N_("_Clear All"); gchar *s = N_("Description"); gchar *s = N_("_Fields..."); gchar *s = N_("_Sort..."); diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h index 4b444636d7..fcf6eff9cc 100644 --- a/widgets/table/e-table-config.h +++ b/widgets/table/e-table-config.h @@ -5,6 +5,7 @@ #include <gnome.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-specification.h> +#include <gal/widgets/gtk-combo-text.h> #define E_TABLE_CONFIG_TYPE (e_table_config_get_type ()) #define E_TABLE_CONFIG(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_TYPE, ETableConfig)) @@ -26,18 +27,15 @@ typedef struct { /* * The state we manipulate */ - ETableSpecification *spec; - ETableState *state; + ETableSpecification *source_spec, *spec; + ETableState *source_state, *state; GtkWidget *sort_label; GtkWidget *group_label; GtkWidget *fields_label; - GtkWidget *sort_dialog; - GtkWidget *group_dialog; - - int sorting_changed_id; - int grouping_changed_id; + GtkComboText *sort_combos [4]; + GtkWidget *frames [4]; } ETableConfig; typedef struct { diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index fa80d6a40c..b9a3c4ee98 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -228,6 +228,10 @@ e_table_specification_save_to_file (ETableSpecification *specification, { xmlDoc *doc; + g_return_val_if_fail (specification != NULL, -1); + g_return_val_if_fail (filename != NULL, -1); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), -1); + doc = xmlNewDoc ("1.0"); xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); return xmlSaveFile (filename, doc); @@ -251,6 +255,9 @@ e_table_specification_save_to_string (ETableSpecification *specification) int length; xmlDoc *doc; + g_return_val_if_fail (specification != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); + doc = xmlNewDoc ("1.0"); xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); xmlDocDumpMemory (doc, &string, &length); @@ -275,9 +282,14 @@ xmlNode * e_table_specification_save_to_node (ETableSpecification *specification, xmlDoc *doc) { - xmlNode *node = xmlDocGetRootElement (doc); + xmlNode *node; char *s; - + + g_return_val_if_fail (doc != NULL, NULL); + g_return_val_if_fail (specification != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); + + node = xmlNewNode (NULL, "ETableSpecification"); e_xml_set_bool_prop_by_name (node, "no-headers", specification->no_headers); e_xml_set_bool_prop_by_name (node, "click-to-add", specification->click_to_add); e_xml_set_bool_prop_by_name (node, "draw-grid", specification->draw_grid); @@ -328,11 +340,17 @@ e_table_specification_save_to_node (ETableSpecification *specification, ETableSpecification * e_table_specification_duplicate (ETableSpecification *spec) { - ETableSpecification *new_spec = e_table_specification_new (); - char *spec_str = e_table_specification_save_to_string (spec); + ETableSpecification *new_spec; + char *spec_str; + g_return_val_if_fail (spec != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (spec), NULL); + + new_spec = e_table_specification_new (); + spec_str = e_table_specification_save_to_string (spec); printf ("This is the spec: \n%s\n", spec_str); e_table_specification_load_from_string (new_spec, spec_str); + g_free (spec_str); return new_spec; } diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index c9049b7a18..c978487368 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -2,8 +2,9 @@ /* * E-table-state.c: Savable state of a table. * - * Author: + * Authors: * Chris Lahey <clahey@ximian.com> + * Miguel de Icaza (miguel@ximian.com) * * (C) 2000 Ximian, Inc. */ @@ -87,37 +88,44 @@ e_table_state_load_from_string (ETableState *state, } } -typedef struct -{ +typedef struct { int column; double expansion; } int_and_double; void -e_table_state_load_from_node (ETableState *state, - const xmlNode *node) +e_table_state_load_from_node (ETableState *state, + const xmlNode *node) { xmlNode *children; GList *list = NULL, *iterator; gdouble state_version; int i; - state_version = e_xml_get_double_prop_by_name_with_default(node, "state-version", STATE_VERSION); + state_version = e_xml_get_double_prop_by_name_with_default ( + node, "state-version", STATE_VERSION); if (state->sort_info) - gtk_object_unref(GTK_OBJECT(state->sort_info)); + gtk_object_unref (GTK_OBJECT(state->sort_info)); + state->sort_info = NULL; - for (children = node->xmlChildrenNode; children; children = children->next) { - if (!strcmp(children->name, "column")) { + children = node->xmlChildrenNode; + for (; children; children = children->next) { + if (!strcmp (children->name, "column")) { int_and_double *column_info = g_new(int_and_double, 1); - column_info->column = e_xml_get_integer_prop_by_name(children, "source"); - column_info->expansion = e_xml_get_double_prop_by_name_with_default(children, "expansion", -2); + column_info->column = e_xml_get_integer_prop_by_name( + children, "source"); + column_info->expansion = + e_xml_get_double_prop_by_name_with_default( + children, "expansion", -2); - list = g_list_append(list, column_info); - } else if (state->sort_info == NULL && !strcmp(children->name, "grouping")) { + list = g_list_append (list, column_info); + } else if (state->sort_info == NULL && + !strcmp (children->name, "grouping")) { state->sort_info = e_table_sort_info_new(); - e_table_sort_info_load_from_node(state->sort_info, children, state_version); + e_table_sort_info_load_from_node( + state->sort_info, children, state_version); } } g_free(state->columns); @@ -125,11 +133,14 @@ e_table_state_load_from_node (ETableState *state, state->col_count = g_list_length(list); state->columns = g_new(int, state->col_count); state->expansions = g_new(double, state->col_count); - for (iterator = list, i = 0; iterator; iterator = g_list_next(iterator), i++) { + + for (iterator = list, i = 0; iterator; i++) { int_and_double *column_info = iterator->data; - state->columns[i] = column_info->column; - state->expansions[i] = column_info->expansion; - g_free(column_info); + + state->columns [i] = column_info->column; + state->expansions [i] = column_info->expansion; + g_free (column_info); + iterator = g_list_next (iterator); } g_list_free(list); } @@ -196,7 +207,7 @@ e_table_state_save_to_node (ETableState *state, /** * e_table_state_duplicate: - * @state: state to duplicate + * @state: The ETableState to duplicate * * This creates a copy of the %ETableState @state * @@ -205,11 +216,17 @@ e_table_state_save_to_node (ETableState *state, ETableState * e_table_state_duplicate (ETableState *state) { - ETableState *new_state = e_table_state_new (); - char *state_str = e_table_state_save_to_string (state); - - printf ("This is the state: \n%s\n", state_str); - e_table_state_load_from_string (new_state, state_str); + ETableState *new_state; + char *copy; + g_return_val_if_fail (state != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_STATE (state), NULL); + + new_state = e_table_state_new (); + copy = e_table_state_save_to_string (state); + e_table_state_load_from_string (new_state, copy); + g_free (copy); + return new_state; } + diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h index 32956bd5f8..906bbedb3f 100644 --- a/widgets/table/e-table-state.h +++ b/widgets/table/e-table-state.h @@ -40,6 +40,6 @@ void e_table_state_save_to_file (ETableState *state, char *e_table_state_save_to_string (ETableState *state); xmlNode *e_table_state_save_to_node (ETableState *state, xmlNode *parent); -ETableState *e_table_state_duplicate (ETableState *spec); +ETableState *e_table_state_duplicate (ETableState *state); #endif /* _E_TABLE_STATE_H_ */ diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 3a471ee7c8..5e597bdd0c 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -647,7 +647,9 @@ e_table_fill_table (ETable *e_table, ETableModel *model) } static ETableCol * -et_col_spec_to_col (ETable *e_table, ETableColumnSpecification *col_spec, ETableExtras *ete) +et_col_spec_to_col (ETable *e_table, + ETableColumnSpecification *col_spec, + ETableExtras *ete) { ETableCol *col = NULL; ECell *cell; @@ -660,24 +662,30 @@ et_col_spec_to_col (ETable *e_table, ETableColumnSpecification *col_spec, ETable if (col_spec->pixbuf && *col_spec->pixbuf) { GdkPixbuf *pixbuf; - pixbuf = e_table_extras_get_pixbuf(ete, col_spec->pixbuf); + pixbuf = e_table_extras_get_pixbuf( + ete, col_spec->pixbuf); if (pixbuf) { - col = e_table_col_new_with_pixbuf (col_spec->model_col, col_spec->title_, pixbuf, - col_spec->expansion, col_spec->minimum_width, - cell, compare, col_spec->resizable); + col = e_table_col_new_with_pixbuf ( + col_spec->model_col, _(col_spec->title), + pixbuf, col_spec->expansion, + col_spec->minimum_width, + cell, compare, col_spec->resizable); } } - if (col == NULL && col_spec->title_ && *col_spec->title_) { - col = e_table_col_new (col_spec->model_col, col_spec->title_, - col_spec->expansion, col_spec->minimum_width, - cell, compare, col_spec->resizable); + if (col == NULL && col_spec->title && *col_spec->title) { + col = e_table_col_new ( + col_spec->model_col, _(col_spec->title), + col_spec->expansion, col_spec->minimum_width, + cell, compare, col_spec->resizable); } } return col; } static ETableHeader * -et_spec_to_full_header (ETable *e_table, ETableSpecification *spec, ETableExtras *ete) +et_spec_to_full_header (ETable *e_table, + ETableSpecification *spec, + ETableExtras *ete) { ETableHeader *nh; int column; @@ -689,7 +697,8 @@ et_spec_to_full_header (ETable *e_table, ETableSpecification *spec, ETableExtras nh = e_table_header_new (); for (column = 0; spec->columns[column]; column++) { - ETableCol *col = et_col_spec_to_col(e_table, spec->columns[column], ete); + ETableCol *col = et_col_spec_to_col ( + e_table, spec->columns[column], ete); if (col) e_table_header_add_column (nh, col, -1); |