aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Tellier <jonathan.tellier@gmail.com>2009-08-28 23:23:44 +0800
committerjtellier <jonathan.tellier@collabora.co.uk>2009-08-29 02:27:43 +0800
commit0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac (patch)
treeb36f9ce833bd5ddb63033487b8653a05f7bb82af /src
parent9b845e9ce1fe88006335f73a02ff68853757bd30 (diff)
downloadgsoc2013-empathy-0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac.tar
gsoc2013-empathy-0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac.tar.gz
gsoc2013-empathy-0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac.tar.bz2
gsoc2013-empathy-0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac.tar.lz
gsoc2013-empathy-0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac.tar.xz
gsoc2013-empathy-0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac.tar.zst
gsoc2013-empathy-0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac.zip
Using GtkTreeRowReference instead of a string path.
- When the user selects another account and has pending changes to the currently selected account, we need to keed track of the destination row. Instead of saving that information as the string representation of a GtkTreePath, we now use a GtkTreeRowReference.
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts-dialog.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 6cfc830d1..5e5c94756 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -118,7 +118,7 @@ typedef struct {
* is retrieved asynchronously, we keep some information as member of the
* EmpathyAccountsDialog object. */
gboolean force_change_row;
- gchar *destination_path;
+ GtkTreeRowReference *destination_row;
} EmpathyAccountsDialogPriv;
@@ -897,30 +897,31 @@ accounts_dialog_selection_change_response_cb (GtkDialog *message_dialog,
gtk_widget_destroy (GTK_WIDGET (message_dialog));
- if (response_id == GTK_RESPONSE_YES)
+ if (response_id == GTK_RESPONSE_YES && priv->destination_row != NULL)
{
/* The user wants to lose unsaved changes to the currently selected
* account and select another account. We discard the changes and
* select the other account. */
- GtkTreeIter iter;
+ GtkTreePath *path;
GtkTreeSelection *selection;
- GtkTreeModel *model;
priv->force_change_row = TRUE;
empathy_account_widget_discard_pending_changes (
priv->setting_widget_object);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
+ path = gtk_tree_row_reference_get_path (priv->destination_row);
selection = gtk_tree_view_get_selection (
GTK_TREE_VIEW (priv->treeview));
- if (gtk_tree_model_get_iter_from_string (model,
- &iter, priv->destination_path))
+ if (path != NULL)
{
/* This will trigger a call to
* accounts_dialog_account_selection_change() */
- gtk_tree_selection_select_iter (selection, &iter);
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
}
+
+ gtk_tree_row_reference_free (priv->destination_row);
}
else
{
@@ -954,7 +955,7 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection,
* the user if he really wants to lose his changes and select another
* account */
gchar *question_dialog_primary_text;
- priv->destination_path = gtk_tree_path_to_string (path);
+ priv->destination_row = gtk_tree_row_reference_new (model, path);
question_dialog_primary_text = g_strdup_printf (
PENDING_CHANGES_QUESTION_PRIMARY_TEXT,