diff options
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-table-config.c | 58 | ||||
-rw-r--r-- | widgets/table/e-table-config.glade | 250 | ||||
-rw-r--r-- | widgets/table/e-table-config.glade.h | 4 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 14 | ||||
-rw-r--r-- | widgets/table/e-table-state.c | 3 |
5 files changed, 166 insertions, 163 deletions
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index f25e77245d..c249c498e8 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -49,11 +49,12 @@ config_destroy (GtkObject *object) } static void -e_table_config_changed (ETableConfig *config, ETableState *state) +e_table_config_changed (ETableConfig *config, ETableState *state) { g_return_if_fail (config != NULL); g_return_if_fail (E_IS_TABLE_CONFIG (config)); + gtk_signal_emit(GTK_OBJECT(config), e_table_config_signals [CHANGED], state); @@ -75,8 +76,8 @@ config_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, object_class->type, GTK_SIGNAL_OFFSET (ETableConfigClass, changed), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, E_TABLE_STATE_TYPE); + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); gtk_object_class_add_signals (object_class, e_table_config_signals, LAST_SIGNAL); } @@ -127,6 +128,7 @@ update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) for (i = 0; i < 4; i++){ gboolean sensitive = (i <= count); + char *text = ""; gtk_widget_set_sensitive (widgets [i].frames, sensitive); @@ -136,6 +138,9 @@ update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) gtk_signal_handler_block ( GTK_OBJECT (widgets [i].radio_ascending), widgets [i].toggled_id); + gtk_signal_handler_block ( + GTK_OBJECT (widgets [i].combo->entry), + widgets [i].changed_id); if (i < count){ GtkToggleButton *a, *d; @@ -161,18 +166,7 @@ update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) continue; } - /* - * Change the text - */ - gtk_signal_handler_block ( - GTK_OBJECT (widgets [i].combo->entry), - widgets [i].changed_id); - gtk_combo_text_set_text ( - widgets [i].combo, gettext ( - column->title)); - gtk_signal_handler_unblock ( - GTK_OBJECT (widgets [i].combo->entry), - widgets [i].changed_id); + text = gettext (column->title); /* * Update radio buttons @@ -189,21 +183,26 @@ update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) t = GTK_TOGGLE_BUTTON ( widgets [i].radio_ascending); + if (is_sort) + g_assert (widgets [i].radio_ascending != config->group [i].radio_ascending); + else + g_assert (widgets [i].radio_ascending != config->sort [i].radio_ascending); gtk_toggle_button_set_active (t, 1); } + + /* Set the text */ + gtk_combo_text_set_text (widgets [i].combo, text); + gtk_signal_handler_unblock ( GTK_OBJECT (widgets [i].radio_ascending), widgets [i].toggled_id); + gtk_signal_handler_unblock ( + GTK_OBJECT (widgets [i].combo->entry), + widgets [i].changed_id); } } static void -update_group_config_dialog (ETableConfig *config) -{ - g_warning ("IMPLEMENT ME\n"); -} - -static void config_sort_info_update (ETableConfig *config) { ETableSortInfo *info = config->state->sort_info; @@ -250,7 +249,6 @@ config_group_info_update (ETableConfig *config) int count, i; count = e_table_sort_info_grouping_get_count (info); - printf ("Count of the grouping action: %d\n", count); res = g_string_new (""); for (i = 0; i < count; i++) { @@ -310,7 +308,7 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) int button, running = 1; config->temp_state = e_table_state_duplicate (config->state); - + update_sort_and_group_config_dialog (config, is_sort); gtk_widget_grab_focus (GTK_WIDGET ( @@ -342,6 +340,7 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) case 1: gtk_object_unref (GTK_OBJECT (config->state)); config->state = config->temp_state; + config->temp_state = 0; running = 0; gnome_property_box_changed ( GNOME_PROPERTY_BOX (config->dialog_toplevel)); @@ -434,13 +433,13 @@ sort_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *sort) char *s = gtk_entry_get_text (entry); - if (g_hash_table_lookup (sort->combo->elements, s)){ + if (s && s [0] && g_hash_table_lookup (sort->combo->elements, s)){ ETableSortColumn c; int col; col = find_model_column_by_name (config->source_spec, s); if (col == -1){ - g_warning ("This should not happen"); + g_warning ("sort: This should not happen (%s)", s); return; } @@ -535,16 +534,15 @@ group_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *group) ETableSortInfo *sort_info = config->temp_state->sort_info; ETableConfigSortWidgets *base = &config->group[0]; int idx = group - base; - char *s = gtk_entry_get_text (entry); - if (g_hash_table_lookup (group->combo->elements, s)){ + if (s && s [0] && g_hash_table_lookup (group->combo->elements, s)){ ETableSortColumn c; int col; col = find_model_column_by_name (config->source_spec, s); if (col == -1){ - g_warning ("This should not happen"); + g_warning ("grouping: this should not happen, %s", s); return; } @@ -553,10 +551,10 @@ group_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *group) c.column = col; e_table_sort_info_grouping_set_nth (sort_info, idx, c); - update_group_config_dialog (config); + update_sort_and_group_config_dialog (config, FALSE); } else { e_table_sort_info_grouping_truncate (sort_info, idx); - update_group_config_dialog (config); + update_sort_and_group_config_dialog (config, FALSE); } } diff --git a/widgets/table/e-table-config.glade b/widgets/table/e-table-config.glade index e0035daf67..b199b521a7 100644 --- a/widgets/table/e-table-config.glade +++ b/widgets/table/e-table-config.glade @@ -10,17 +10,9 @@ <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> @@ -52,6 +44,40 @@ </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> @@ -188,6 +214,7 @@ <name>table-1</name> <can_focus>True</can_focus> <label>Table HERE</label> + <relief>GTK_RELIEF_NORMAL</relief> </widget> </widget> </widget> @@ -236,6 +263,7 @@ <name>table-2</name> <can_focus>True</can_focus> <label>Table HERE</label> + <relief>GTK_RELIEF_NORMAL</relief> </widget> </widget> </widget> @@ -256,6 +284,7 @@ <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> @@ -268,6 +297,7 @@ <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> @@ -302,6 +332,7 @@ <name>button-add</name> <can_focus>True</can_focus> <label>_Add -></label> + <relief>GTK_RELIEF_NORMAL</relief> <child> <padding>0</padding> <expand>False</expand> @@ -314,6 +345,7 @@ <name>button-remove</name> <can_focus>True</can_focus> <label><- _Remove</label> + <relief>GTK_RELIEF_NORMAL</relief> <child> <padding>0</padding> <expand>False</expand> @@ -327,11 +359,39 @@ </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>True</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_area3</name> + <name>dialog-action_area4</name> <layout_style>GTK_BUTTONBOX_END</layout_style> <spacing>8</spacing> <child_min_width>85</child_min_width> @@ -347,7 +407,15 @@ <widget> <class>GtkButton</class> - <name>button20</name> + <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> <can_default>True</can_default> <can_focus>True</can_focus> <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> @@ -355,40 +423,12 @@ <widget> <class>GtkButton</class> - <name>button22</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-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> @@ -488,7 +528,7 @@ <label>Ascending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-1</group> + <group>g-group-1</group> <child> <padding>0</padding> <expand>False</expand> @@ -503,7 +543,7 @@ <label>Descending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-1</group> + <group>g-group-1</group> <child> <padding>0</padding> <expand>False</expand> @@ -670,7 +710,7 @@ <label>Ascending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-2</group> + <group>g-group-2</group> <child> <padding>0</padding> <expand>False</expand> @@ -685,7 +725,7 @@ <label>Descending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-2</group> + <group>g-group-2</group> <child> <padding>0</padding> <expand>False</expand> @@ -852,7 +892,7 @@ <label>Ascending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-3</group> + <group>g-group-3</group> <child> <padding>0</padding> <expand>False</expand> @@ -867,7 +907,7 @@ <label>Descending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-3</group> + <group>g-group-3</group> <child> <padding>0</padding> <expand>False</expand> @@ -1034,7 +1074,7 @@ <label>Ascending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-4</group> + <group>g-group-4</group> <child> <padding>0</padding> <expand>False</expand> @@ -1049,7 +1089,7 @@ <label>Descending</label> <active>False</active> <draw_indicator>True</draw_indicator> - <group>group-4</group> + <group>g-group-4</group> <child> <padding>0</padding> <expand>False</expand> @@ -1061,11 +1101,39 @@ </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>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>GtkHButtonBox</class> <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area4</name> + <name>hbuttonbox1</name> <layout_style>GTK_BUTTONBOX_END</layout_style> <spacing>8</spacing> <child_min_width>85</child_min_width> @@ -1081,7 +1149,7 @@ <widget> <class>GtkButton</class> - <name>button39</name> + <name>button43</name> <can_default>True</can_default> <can_focus>True</can_focus> <label>Clear All</label> @@ -1089,48 +1157,21 @@ <widget> <class>GtkButton</class> - <name>button41</name> + <name>button44</name> <can_default>True</can_default> + <has_default>True</has_default> <can_focus>True</can_focus> <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> </widget> <widget> <class>GtkButton</class> - <name>button42</name> + <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>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> @@ -1524,55 +1565,17 @@ </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> - <has_default>True</has_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> @@ -1698,6 +1701,7 @@ <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> @@ -1725,6 +1729,7 @@ <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> @@ -1752,6 +1757,7 @@ <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 4218ce256a..76f2aaea31 100644 --- a/widgets/table/e-table-config.glade.h +++ b/widgets/table/e-table-config.glade.h @@ -14,6 +14,7 @@ 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"); @@ -30,8 +31,8 @@ gchar *s = N_("Then By"); gchar *s = N_("Show field in View"); gchar *s = N_("Ascending"); gchar *s = N_("Descending"); -gchar *s = N_("Clear All"); gchar *s = N_("Sort"); +gchar *s = N_("Clear All"); gchar *s = N_("Then By"); gchar *s = N_("Ascending"); gchar *s = N_("Descending"); @@ -44,7 +45,6 @@ gchar *s = N_("Descending"); gchar *s = N_("Sort Items 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-header-item.c b/widgets/table/e-table-header-item.c index 70bdb3d698..c3db9e7dfc 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1221,14 +1221,13 @@ config_destroyed (GtkObject *object, ETableHeaderItem *ethi) } static void -apply_changes (GnomePropertyBox *pbox, gint page_num, ETableHeaderItem *ethi) +apply_changes (ETableConfig *config, ETableHeaderItem *ethi) { - ETableConfig *config = E_TABLE_CONFIG (ethi->config); char *state = e_table_state_save_to_string (config->state); - if (page_num != -1) - return; - + printf ("This is the Table: %p %p\n", ethi->table, ethi); + printf ("This is the state: %s\n", state); + e_table_set_state (ethi->table, state); g_free (state); } @@ -1239,6 +1238,7 @@ ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info) ETableHeaderItem *ethi = info->ethi; ETableState *state; + printf ("___This is the Table: %p %p\n", ethi->table, ethi); if (ethi->config) e_table_config_raise (E_TABLE_CONFIG (ethi->config)); else { @@ -1251,9 +1251,7 @@ ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info) GTK_OBJECT (ethi->config), "destroy", GTK_SIGNAL_FUNC (config_destroyed), ethi); gtk_signal_connect ( - GTK_OBJECT ( - E_TABLE_CONFIG (ethi->config)->dialog_toplevel), - "apply", + GTK_OBJECT (ethi->config), "changed", GTK_SIGNAL_FUNC (apply_changes), ethi); } } diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index c978487368..2d7fb3b3ac 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -28,9 +28,10 @@ etst_destroy (GtkObject *object) { ETableState *etst = E_TABLE_STATE (object); + gtk_object_destroy (GTK_OBJECT (etst->sort_info)); if (etst->columns) g_free (etst->columns); - + GTK_OBJECT_CLASS (etst_parent_class)->destroy (object); } |