[gnome-control-center] region: remove helper function not needed since GTK+ 3.0
- From: Sergey V. Udaltsov <svu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: remove helper function not needed since GTK+ 3.0
- Date: Sun, 12 Jun 2011 13:08:39 +0000 (UTC)
commit 60a25073668b8d8e571dd68ca2d34c9c1a7483ee
Author: Rui Matos <tiagomatos gmail com>
Date: Sun Jun 12 01:12:20 2011 +0100
region: remove helper function not needed since GTK+ 3.0
GTK+ 3.0 introduced gtk_tree_model_iter_previous() so we no longer need to
keep this helper function.
Also, simplify the use of GtkTreeIters by allocating them on the stack.
https://bugzilla.gnome.org/show_bug.cgi?id=652374
panels/region/gnome-region-panel-xkblt.c | 38 ++++++-----------------------
1 files changed, 8 insertions(+), 30 deletions(-)
---
diff --git a/panels/region/gnome-region-panel-xkblt.c b/panels/region/gnome-region-panel-xkblt.c
index 7737dda..21574b3 100644
--- a/panels/region/gnome-region-panel-xkblt.c
+++ b/panels/region/gnome-region-panel-xkblt.c
@@ -374,39 +374,20 @@ remove_selected_layout (GtkWidget * button, GtkBuilder * dialog)
update_layouts_list (model, dialog);
}
-static gboolean
-_tree_model_iter_previous (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- GtkTreePath *path;
- gboolean ret;
-
- path = gtk_tree_model_get_path (tree_model, iter);
- ret = gtk_tree_path_prev (path);
- if (ret != FALSE)
- gtk_tree_model_get_iter (tree_model, iter, path);
-
- gtk_tree_path_free (path);
- return ret;
-}
-
static void
move_up_selected_layout (GtkWidget * button, GtkBuilder * dialog)
{
GtkTreeModel *model;
- GtkTreeIter iter, *prev;
+ GtkTreeIter iter, prev;
if (get_selected_iter (dialog, &model, &iter) == FALSE)
return;
- prev = gtk_tree_iter_copy (&iter);
- if (!_tree_model_iter_previous (model, prev)) {
- gtk_tree_iter_free (prev);
+ prev = iter;
+ if (!gtk_tree_model_iter_previous (model, &prev))
return;
- }
- gtk_list_store_swap (GTK_LIST_STORE (model), &iter, prev);
- gtk_tree_iter_free (prev);
+ gtk_list_store_swap (GTK_LIST_STORE (model), &iter, &prev);
update_layouts_list (model, dialog);
}
@@ -415,19 +396,16 @@ static void
move_down_selected_layout (GtkWidget * button, GtkBuilder * dialog)
{
GtkTreeModel *model;
- GtkTreeIter iter, *next;
+ GtkTreeIter iter, next;
if (get_selected_iter (dialog, &model, &iter) == FALSE)
return;
- next = gtk_tree_iter_copy (&iter);
- if (!gtk_tree_model_iter_next (model, next)) {
- gtk_tree_iter_free (next);
+ next = iter;
+ if (!gtk_tree_model_iter_next (model, &next))
return;
- }
- gtk_list_store_swap (GTK_LIST_STORE (model), &iter, next);
- gtk_tree_iter_free (next);
+ gtk_list_store_swap (GTK_LIST_STORE (model), &iter, &next);
update_layouts_list (model, dialog);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]