diff options
author | Dmitry Mastrukov <dmitry@taurussoft.org> | 2003-03-05 06:09:44 +0800 |
---|---|---|
committer | Mike Kestner <mkestner@src.gnome.org> | 2003-03-05 06:09:44 +0800 |
commit | 63aef14c027c66d5804af335cd112439395496c7 (patch) | |
tree | f092c746035e83a621c47b958e5206e67c8388da /widgets | |
parent | fbf56b4c56143ef9487e5e454d906e83fe2ef4a2 (diff) | |
download | gsoc2013-evolution-63aef14c027c66d5804af335cd112439395496c7.tar.gz gsoc2013-evolution-63aef14c027c66d5804af335cd112439395496c7.tar.zst gsoc2013-evolution-63aef14c027c66d5804af335cd112439395496c7.zip |
i18n fix
2003-03-04 Dmitry Mastrukov <dmitry@taurussoft.org>
* gal/widgets/e-unicode.c : i18n fix
2003-03-04 Dmitry Mastrukov <dmitry@taurussoft.org>
* e-cell-date.c (ecd_get_text): i18n fix
* e-table.c (et_real_construct): i18n fix
* e-table-config.c (create_global_store): i18n fix
* e-table-utils.c (et_col_spec_to_col): i18n fix
2003-03-04 Mike Kestner <mkestner@ximian.com>
* e-tree-selection-model.c : some cursor fixes
svn path=/trunk/; revision=20156
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/e-unicode.c | 2 | ||||
-rw-r--r-- | widgets/table/e-cell-date.c | 2 | ||||
-rw-r--r-- | widgets/table/e-table-config.c | 2 | ||||
-rw-r--r-- | widgets/table/e-table-utils.c | 2 | ||||
-rw-r--r-- | widgets/table/e-table.c | 2 | ||||
-rw-r--r-- | widgets/table/e-tree-selection-model.c | 129 |
6 files changed, 130 insertions, 9 deletions
diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c index 0cea6371b4..fb81db1798 100644 --- a/widgets/misc/e-unicode.c +++ b/widgets/misc/e-unicode.c @@ -2263,7 +2263,7 @@ e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, const xmlC combined_name = g_strdup_printf("_%s", prop_name); prop = xmlGetProp ((xmlNode *) parent, combined_name); if (prop != NULL) { - ret_val = e_utf8_from_locale_string (gettext (prop)); + ret_val = g_strdup (gettext (prop)); xmlFree (prop); } g_free(combined_name); diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c index 2b9c97c955..022a3fa517 100644 --- a/widgets/table/e-cell-date.c +++ b/widgets/table/e-cell-date.c @@ -48,7 +48,7 @@ ecd_get_text(ECellText *cell, ETableModel *model, int col, int row) gboolean done = FALSE; if (date == 0) { - return e_utf8_from_locale_string (_("?")); + return g_strdup (_("?")); } localtime_r (&date, &then); diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 63aac26837..af6e2bee8c 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -517,7 +517,7 @@ create_global_store (ETableConfig *config) global_store = e_table_memory_store_new (store_columns); for (i = 0; config->source_spec->columns[i]; i++) { - char *text = e_utf8_from_locale_string (dgettext (config->domain, + char *text = g_strdup (dgettext (config->domain, config->source_spec->columns[i]->title)); e_table_memory_store_insert_adopt (E_TABLE_MEMORY_STORE (global_store), i, NULL, text); diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index 579ba25dc9..76427ae464 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -88,7 +88,7 @@ et_col_spec_to_col (ETableColumnSpecification *col_spec, if (cell && compare) { char *title = dgettext (domain, col_spec->title); - title = e_utf8_from_locale_string (title); + title = g_strdup (title); if (col_spec->pixbuf && *col_spec->pixbuf) { GdkPixbuf *pixbuf; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index cb9b33ef07..ee25c00093 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1446,7 +1446,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->use_click_to_add = specification->click_to_add; e_table->use_click_to_add_end = specification->click_to_add_end; - e_table->click_to_add_message = e_utf8_from_locale_string (dgettext (e_table->domain, specification->click_to_add_message)); + e_table->click_to_add_message = g_strdup (dgettext (e_table->domain, specification->click_to_add_message)); e_table->alternating_row_colors = specification->alternating_row_colors; e_table->horizontal_draw_grid = specification->horizontal_draw_grid; e_table->vertical_draw_grid = specification->vertical_draw_grid; diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index db486795fa..c02accb4fb 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -49,7 +49,14 @@ struct ETreeSelectionModelPriv { ETreePath cursor_path; ETreePath end_path; gint cursor_col; - + gchar *cursor_save_id; + + gint tree_model_pre_change_id; + gint tree_model_no_change_id; + gint tree_model_node_changed_id; + gint tree_model_node_data_changed_id; + gint tree_model_node_col_changed_id; + gint tree_model_node_inserted_id; gint tree_model_node_removed_id; gint tree_model_node_deleted_id; }; @@ -87,6 +94,7 @@ select_single_path (ETreeSelectionModel *etsm, ETreePath path) { clear_selection (etsm); change_one_path(etsm, path, TRUE); + etsm->priv->cursor_path = path; } static void @@ -108,15 +116,91 @@ select_range (ETreeSelectionModel *etsm, gint start, gint end) } static void +free_id (ETreeSelectionModel *etsm) +{ + g_free (etsm->priv->cursor_save_id); + etsm->priv->cursor_save_id = NULL; +} + +static void +restore_cursor (ETreeSelectionModel *etsm, ETreeModel *etm) +{ + clear_selection (etsm); + etsm->priv->cursor_path = NULL; + + if (etsm->priv->cursor_save_id) { + etsm->priv->cursor_path = e_tree_model_get_node_by_id (etm, etsm->priv->cursor_save_id); + if (etsm->priv->cursor_path != NULL && etsm->priv->cursor_col == -1) + etsm->priv->cursor_col = 0; + + select_single_path(etsm, etsm->priv->cursor_path); + } + + e_selection_model_selection_changed(E_SELECTION_MODEL(etsm)); + + if (etsm->priv->cursor_path) { + gint cursor_row = get_cursor_row (etsm); + e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), cursor_row, etsm->priv->cursor_col); + } else { + e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1); + e_selection_model_cursor_activated(E_SELECTION_MODEL(etsm), -1, -1); + + } + + free_id (etsm); +} + +static void +etsm_pre_change (ETreeModel *etm, ETreeSelectionModel *etsm) +{ + g_free (etsm->priv->cursor_save_id); + etsm->priv->cursor_save_id = NULL; + + if (e_tree_model_has_get_node_by_id (etm) && e_tree_model_has_save_id (etm) && etsm->priv->cursor_path) { + etsm->priv->cursor_save_id = e_tree_model_get_save_id (etm, etsm->priv->cursor_path); + } +} + +static void +etsm_no_change (ETreeModel *etm, ETreeSelectionModel *etsm) +{ + free_id (etsm); +} + +static void +etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm) +{ + restore_cursor (etsm, etm); +} + +static void +etsm_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm) +{ + free_id (etsm); +} + +static void +etsm_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSelectionModel *etsm) +{ + free_id (etsm); +} + +static void +etsm_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSelectionModel *etsm) +{ + restore_cursor (etsm, etm); +} + +static void etsm_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm) { - change_one_path(etsm, child, FALSE); + restore_cursor (etsm, etm); } static void etsm_node_deleted (ETreeModel *etm, ETreePath child, ETreeSelectionModel *etsm) { - change_one_path(etsm, child, FALSE); + restore_cursor (etsm, etm); } @@ -131,6 +215,18 @@ add_model(ETreeSelectionModel *etsm, ETreeModel *model) return; g_object_ref(priv->model); + priv->tree_model_pre_change_id = g_signal_connect_after (G_OBJECT (priv->model), "pre_change", + G_CALLBACK (etsm_pre_change), etsm); + priv->tree_model_no_change_id = g_signal_connect_after (G_OBJECT (priv->model), "no_change", + G_CALLBACK (etsm_no_change), etsm); + priv->tree_model_node_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_changed", + G_CALLBACK (etsm_node_changed), etsm); + priv->tree_model_node_data_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_data_changed", + G_CALLBACK (etsm_node_data_changed), etsm); + priv->tree_model_node_col_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_col_changed", + G_CALLBACK (etsm_node_col_changed), etsm); + priv->tree_model_node_inserted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_inserted", + G_CALLBACK (etsm_node_inserted), etsm); priv->tree_model_node_removed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_removed", G_CALLBACK (etsm_node_removed), etsm); priv->tree_model_node_deleted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_deleted", @@ -146,6 +242,18 @@ drop_model(ETreeSelectionModel *etsm) return; g_signal_handler_disconnect (G_OBJECT (priv->model), + priv->tree_model_pre_change_id); + g_signal_handler_disconnect (G_OBJECT (priv->model), + priv->tree_model_no_change_id); + g_signal_handler_disconnect (G_OBJECT (priv->model), + priv->tree_model_node_changed_id); + g_signal_handler_disconnect (G_OBJECT (priv->model), + priv->tree_model_node_data_changed_id); + g_signal_handler_disconnect (G_OBJECT (priv->model), + priv->tree_model_node_col_changed_id); + g_signal_handler_disconnect (G_OBJECT (priv->model), + priv->tree_model_node_inserted_id); + g_signal_handler_disconnect (G_OBJECT (priv->model), priv->tree_model_node_removed_id); g_signal_handler_disconnect (G_OBJECT (priv->model), priv->tree_model_node_deleted_id); @@ -153,6 +261,12 @@ drop_model(ETreeSelectionModel *etsm) g_object_unref (priv->model); priv->model = NULL; + priv->tree_model_pre_change_id = 0; + priv->tree_model_no_change_id = 0; + priv->tree_model_node_changed_id = 0; + priv->tree_model_node_data_changed_id = 0; + priv->tree_model_node_col_changed_id = 0; + priv->tree_model_node_inserted_id = 0; priv->tree_model_node_removed_id = 0; priv->tree_model_node_deleted_id = 0; } @@ -596,7 +710,14 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm) priv->cursor_path = NULL; priv->cursor_col = -1; - + priv->cursor_save_id = NULL; + + priv->tree_model_pre_change_id = 0; + priv->tree_model_no_change_id = 0; + priv->tree_model_node_changed_id = 0; + priv->tree_model_node_data_changed_id = 0; + priv->tree_model_node_col_changed_id = 0; + priv->tree_model_node_inserted_id = 0; priv->tree_model_node_removed_id = 0; priv->tree_model_node_deleted_id = 0; } |