[gtranslator] Only put the selection in middle when it is not selected by the user.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Only put the selection in middle when it is not selected by the user.
- Date: Mon, 19 Apr 2010 09:45:51 +0000 (UTC)
commit e90569de76aa4845d2f839727016d85019331a5f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Apr 19 11:42:26 2010 +0200
Only put the selection in middle when it is not selected by the user.
src/gtr-message-table.c | 70 ++++++++++++++++++++++++-----------------------
1 files changed, 36 insertions(+), 34 deletions(-)
---
diff --git a/src/gtr-message-table.c b/src/gtr-message-table.c
index 686f03b..157a967 100644
--- a/src/gtr-message-table.c
+++ b/src/gtr-message-table.c
@@ -42,19 +42,40 @@
GtrMessageTablePrivate))
G_DEFINE_TYPE (GtrMessageTable, gtr_message_table, GTK_TYPE_VBOX)
- struct _GtrMessageTablePrivate
- {
- GtkWidget *treeview;
- GtrMessageTableModel *store;
- GtkTreeModel *sort_model;
-
- GtrTab *tab;
- };
-
- static void
- gtr_message_table_selection_changed (GtkTreeSelection *
- selection,
- GtrMessageTable * table)
+
+struct _GtrMessageTablePrivate
+{
+ GtkWidget *treeview;
+ GtrMessageTableModel *store;
+ GtkTreeModel *sort_model;
+
+ GtrTab *tab;
+};
+
+static void
+showed_message_cb (GtrTab * tab, GtrMsg * msg, GtrMessageTable * table)
+{
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeIter iter;
+
+ selection =
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (table->priv->treeview));
+
+ path = gtk_tree_row_reference_get_path (gtr_msg_get_row_reference (msg));
+
+ gtk_tree_model_get_iter (table->priv->sort_model, &iter, path);
+
+ gtk_tree_selection_select_iter (selection, &iter);
+
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (table->priv->treeview),
+ path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free (path);
+}
+
+static void
+gtr_message_table_selection_changed (GtkTreeSelection *selection,
+ GtrMessageTable *table)
{
GtkTreeIter iter;
GtkTreeModel *model;
@@ -76,34 +97,15 @@ G_DEFINE_TYPE (GtrMessageTable, gtr_message_table, GTK_TYPE_VBOX)
&& g_utf8_collate (gtr_msg_get_msgid (msg->data),
gtr_msg_get_msgid (current_msg->data)))
{
+ g_signal_handlers_block_by_func (table->priv->tab, showed_message_cb, table);
gtr_tab_message_go_to (table->priv->tab, msg,
FALSE, GTR_TAB_MOVE_NONE);
+ g_signal_handlers_unblock_by_func (table->priv->tab, showed_message_cb, table);
}
}
}
static void
-showed_message_cb (GtrTab * tab, GtrMsg * msg, GtrMessageTable * table)
-{
- GtkTreePath *path;
- GtkTreeSelection *selection;
- GtkTreeIter iter;
-
- selection =
- gtk_tree_view_get_selection (GTK_TREE_VIEW (table->priv->treeview));
-
- path = gtk_tree_row_reference_get_path (gtr_msg_get_row_reference (msg));
-
- gtk_tree_model_get_iter (table->priv->sort_model, &iter, path);
-
- gtk_tree_selection_select_iter (selection, &iter);
-
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (table->priv->treeview),
- path, NULL, TRUE, 0.5, 0.0);
- gtk_tree_path_free (path);
-}
-
-static void
message_changed_cb (GtrTab * tab, GtrMsg * msg, GtrMessageTable * table)
{
GtkTreePath *sort_path, *path;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]