aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-header-item.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>2001-01-19 12:48:04 +0800
committerMiguel de Icaza <miguel@src.gnome.org>2001-01-19 12:48:04 +0800
commita35fff26e83d1f36bd0027a3b9c701a2094b4a32 (patch)
treea6a446ed2dd6d16aadc4dd19c6702789e0a6ba01 /widgets/table/e-table-header-item.c
parent26f5efce64c121c990c3247e03b09df982c59385 (diff)
downloadgsoc2013-evolution-a35fff26e83d1f36bd0027a3b9c701a2094b4a32.tar
gsoc2013-evolution-a35fff26e83d1f36bd0027a3b9c701a2094b4a32.tar.gz
gsoc2013-evolution-a35fff26e83d1f36bd0027a3b9c701a2094b4a32.tar.bz2
gsoc2013-evolution-a35fff26e83d1f36bd0027a3b9c701a2094b4a32.tar.lz
gsoc2013-evolution-a35fff26e83d1f36bd0027a3b9c701a2094b4a32.tar.xz
gsoc2013-evolution-a35fff26e83d1f36bd0027a3b9c701a2094b4a32.tar.zst
gsoc2013-evolution-a35fff26e83d1f36bd0027a3b9c701a2094b4a32.zip
Keep track of the valid column names (not used right now).
2001-01-18 Miguel de Icaza <miguel@gnu.org> * e-table-config.c (configure_sort_dialog): Keep track of the valid column names (not used right now). (config_destroy): release column names (entry_changed): Handle invalid input to mean "Next entry is grayed out". * e-table-header-item.c (ethi_popup_customize_view): Hook up to the "apply" signal on the dialog box to apply the changes. (apply_changes): New function to apply the changes from the ETableConfig object. * e-table-sort-info.c (e_table_sort_info_load_from_node): Notify of sort info changes. * e-table-header-item.c: Swapped the way arrows were done, so that they actually match the sorting that its expected. * e-table.c: Added inline documentation for a few methods. * e-table-config.h: Dropped ::spec, and temp_spec, we always use ::source_spec, as we never modify this variable. svn path=/trunk/; revision=7633
Diffstat (limited to 'widgets/table/e-table-header-item.c')
-rw-r--r--widgets/table/e-table-header-item.c138
1 files changed, 91 insertions, 47 deletions
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index dae8d595b5..e1fb7f4b02 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -788,8 +788,8 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
g_hash_table_insert (arrows,
(gpointer) column.column,
(gpointer) (column.ascending ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ E_TABLE_COL_ARROW_UP :
+ E_TABLE_COL_ARROW_DOWN));
}
length = e_table_sort_info_sorting_get_count(ethi->sort_info);
for (i = 0; i < length; i++) {
@@ -797,8 +797,8 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
g_hash_table_insert (arrows,
(gpointer) column.column,
(gpointer) (column.ascending ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ E_TABLE_COL_ARROW_UP :
+ E_TABLE_COL_ARROW_DOWN));
}
}
@@ -973,27 +973,36 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
int length = e_table_sort_info_grouping_get_count(ethi->sort_info);
int i;
for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
+ ETableSortColumn column =
+ e_table_sort_info_grouping_get_nth(
+ ethi->sort_info, i);
group_indent ++;
- g_hash_table_insert (arrows,
- (gpointer) column.column,
- (gpointer) (column.ascending ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ g_hash_table_insert (
+ arrows,
+ (gpointer) column.column,
+ (gpointer) (column.ascending ?
+ E_TABLE_COL_ARROW_UP :
+ E_TABLE_COL_ARROW_DOWN));
}
length = e_table_sort_info_sorting_get_count(ethi->sort_info);
for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
- g_hash_table_insert (arrows,
- (gpointer) column.column,
- (gpointer) (column.ascending ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ ETableSortColumn column =
+ e_table_sort_info_sorting_get_nth (
+ ethi->sort_info, i);
+
+ g_hash_table_insert (
+ arrows,
+ (gpointer) column.column,
+ (gpointer) (column.ascending ?
+ E_TABLE_COL_ARROW_UP :
+ E_TABLE_COL_ARROW_DOWN));
}
}
- ethi_drag_types[0].target = g_strdup_printf("%s-%s", ethi_drag_types[0].target, ethi->dnd_code);
- list = gtk_target_list_new (ethi_drag_types, ELEMENTS (ethi_drag_types));
+ ethi_drag_types[0].target = g_strdup_printf(
+ "%s-%s", ethi_drag_types[0].target, ethi->dnd_code);
+ list = gtk_target_list_new (
+ ethi_drag_types, ELEMENTS (ethi_drag_types));
context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
g_free(ethi_drag_types[0].target);
@@ -1001,21 +1010,23 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
col_width = ecol->width;
pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1);
- e_table_header_draw_button (pixmap, ecol,
- widget->style, ethi->font,
- GTK_WIDGET_STATE (widget),
- widget, ethi->gc,
- 0, 0,
- col_width, ethi->height,
- col_width, ethi->height,
- (ETableColArrow) g_hash_table_lookup (
- arrows, (gpointer) ecol->col_idx));
- gtk_drag_set_icon_pixmap (context,
- gdk_window_get_colormap (widget->window),
- pixmap,
- NULL,
- col_width / 2,
- ethi->height / 2);
+ e_table_header_draw_button (
+ pixmap, ecol,
+ widget->style, ethi->font,
+ GTK_WIDGET_STATE (widget),
+ widget, ethi->gc,
+ 0, 0,
+ col_width, ethi->height,
+ col_width, ethi->height,
+ (ETableColArrow) g_hash_table_lookup (
+ arrows, (gpointer) ecol->col_idx));
+ gtk_drag_set_icon_pixmap (
+ context,
+ gdk_window_get_colormap (widget->window),
+ pixmap,
+ NULL,
+ col_width / 2,
+ ethi->height / 2);
gdk_pixmap_unref (pixmap);
ethi->maybe_drag = FALSE;
@@ -1042,21 +1053,28 @@ ethi_popup_sort_ascending(GtkWidget *widget, EthiHeaderInfo *info)
length = e_table_sort_info_grouping_get_count(ethi->sort_info);
for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
+ ETableSortColumn column = e_table_sort_info_grouping_get_nth (
+ ethi->sort_info, i);
+
if (model_col == column.column){
column.ascending = 1;
- e_table_sort_info_grouping_set_nth(ethi->sort_info, i, column);
+ e_table_sort_info_grouping_set_nth (
+ ethi->sort_info, i, column);
found = 1;
break;
}
}
if (!found) {
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
+ length = e_table_sort_info_sorting_get_count (
+ ethi->sort_info);
for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
+ ETableSortColumn column =
+ e_table_sort_info_sorting_get_nth(
+ ethi->sort_info, i);
if (model_col == column.column){
column.ascending = 1;
- e_table_sort_info_sorting_set_nth(ethi->sort_info, i, column);
+ e_table_sort_info_sorting_set_nth (
+ ethi->sort_info, i, column);
found = 1;
break;
}
@@ -1086,21 +1104,27 @@ ethi_popup_sort_descending(GtkWidget *widget, EthiHeaderInfo *info)
length = e_table_sort_info_grouping_get_count(ethi->sort_info);
for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
+ ETableSortColumn column = e_table_sort_info_grouping_get_nth(
+ ethi->sort_info, i);
if (model_col == column.column){
column.ascending = 0;
- e_table_sort_info_grouping_set_nth(ethi->sort_info, i, column);
+ e_table_sort_info_grouping_set_nth(
+ ethi->sort_info, i, column);
found = 1;
break;
}
}
if (!found) {
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
+ length = e_table_sort_info_sorting_get_count (ethi->sort_info);
for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
+ ETableSortColumn column =
+ e_table_sort_info_sorting_get_nth(
+ ethi->sort_info, i);
+
if (model_col == column.column){
column.ascending = 0;
- e_table_sort_info_sorting_set_nth(ethi->sort_info, i, column);
+ e_table_sort_info_sorting_set_nth (
+ ethi->sort_info, i, column);
found = 1;
break;
}
@@ -1108,10 +1132,11 @@ ethi_popup_sort_descending(GtkWidget *widget, EthiHeaderInfo *info)
}
if (!found) {
ETableSortColumn column = { model_col, 0 };
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
+ length = e_table_sort_info_sorting_get_count (ethi->sort_info);
if (length == 0)
length++;
- e_table_sort_info_sorting_set_nth(ethi->sort_info, length - 1, column);
+ e_table_sort_info_sorting_set_nth (
+ ethi->sort_info, length - 1, column);
}
}
@@ -1196,6 +1221,19 @@ config_destroyed (GtkObject *object, ETableHeaderItem *ethi)
}
static void
+apply_changes (GnomePropertyBox *pbox, gint page_num, ETableHeaderItem *ethi)
+{
+ ETableConfig *config = E_TABLE_CONFIG (ethi->config);
+ char *state = e_table_state_save_to_string (config->state);
+
+ if (page_num != -1)
+ return;
+
+ e_table_set_state (ethi->table, state);
+ g_free (state);
+}
+
+static void
ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info)
{
ETableHeaderItem *ethi = info->ethi;
@@ -1209,8 +1247,14 @@ ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info)
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);
+ gtk_signal_connect (
+ 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_SIGNAL_FUNC (apply_changes), ethi);
}
}