static void config_button_add (GtkWidget *widget, ETableConfig *config) { GList *columns = NULL; GList *column; int count; int i; e_table_selected_row_foreach (config->available, add_column, &columns); columns = g_list_reverse (columns); count = g_list_length (columns); config->temp_state->columns = g_renew (int, config->temp_state->columns, config->temp_state->col_count + count); config->temp_state->expansions = g_renew (double, config->temp_state->expansions, config->temp_state->col_count + count); i = config->temp_state->col_count; for (column = columns; column; column = column->next) { config->temp_state->columns[i] = get_source_model_col_index (config, GPOINTER_TO_INT (column->data)); config->temp_state->expansions[i] = config->source_spec->columns[config->temp_state->columns[i]]->expansion; i++; } config->temp_state->col_count += count; g_list_free (columns); setup_fields (config); }
static void config_button_up (GtkWidget *widget, ETableConfig *config) { GList *columns = NULL; GList *column; int *new_shown; double *new_expansions; int next_col; double next_expansion; int i; e_table_selected_row_foreach (config->shown, add_column, &columns); /* if no columns left, just return */ if (columns == NULL) return; columns = g_list_reverse (columns); new_shown = g_new (int, config->temp_state->col_count); new_expansions = g_new (double, config->temp_state->col_count); column = columns; next_col = config->temp_state->columns[0]; next_expansion = config->temp_state->expansions[0]; for (i = 1; i < config->temp_state->col_count; i++) { if (column && (GPOINTER_TO_INT (column->data) == i)) { new_expansions[i - 1] = config->temp_state->expansions[i]; new_shown[i - 1] = config->temp_state->columns[i]; column = column->next; } else { new_shown[i - 1] = next_col; next_col = config->temp_state->columns[i]; new_expansions[i - 1] = next_expansion; next_expansion = config->temp_state->expansions[i]; } } new_shown[i - 1] = next_col; new_expansions[i - 1] = next_expansion; g_free (config->temp_state->columns); g_free (config->temp_state->expansions); config->temp_state->columns = new_shown; config->temp_state->expansions = new_expansions; g_list_free (columns); setup_fields (config); }
const gchar * gnocam_camera_selector_get_name (GnoCamCameraSelector *selector) { ETable *table; table = GNOCAM_CAPPLET_TABLE_SCROLLED (selector->priv->table)->table; if (e_table_selected_count (table) != 1) g_warning ("Not exactly one entry selected!"); e_table_selected_row_foreach (table, foreach_name, selector); return (selector->priv->name); }
static void memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content, gint row, gint col, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time) { EMemoTable *memo_table; GdkAtom target; struct { ECalModel *model; GSList *list; } foreach_data; /* Sanity check the selection target. */ target = gtk_selection_data_get_target (selection_data); if (!e_targets_include_calendar (&target, 1)) return; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); foreach_data.model = e_memo_table_get_model (memo_table); foreach_data.list = NULL; e_table_selected_row_foreach ( E_TABLE (memo_table), memo_shell_content_table_foreach_cb, &foreach_data); if (foreach_data.list != NULL) { cal_comp_selection_set_string_list ( selection_data, foreach_data.list); g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL); g_slist_free (foreach_data.list); } }
static void config_button_remove (GtkWidget *widget, ETableConfig *config) { GList *columns = NULL; GList *column; e_table_selected_row_foreach (config->shown, add_column, &columns); for (column = columns; column; column = column->next) { int row = GPOINTER_TO_INT (column->data); memmove (config->temp_state->columns + row, config->temp_state->columns + row + 1, sizeof (int) * (config->temp_state->col_count - row - 1)); memmove (config->temp_state->expansions + row, config->temp_state->expansions + row + 1, sizeof (double) * (config->temp_state->col_count - row - 1)); config->temp_state->col_count --; } config->temp_state->columns = g_renew (int, config->temp_state->columns, config->temp_state->col_count); config->temp_state->expansions = g_renew (double, config->temp_state->expansions, config->temp_state->col_count); g_list_free (columns); setup_fields (config); }