[giggle] src: Use g_list_free_full() convenience function



commit 652fc96cb4a03b8bb812d152ea513753f9603788
Author: Javier JardÃn <jjardon gnome org>
Date:   Mon Jan 2 03:52:27 2012 +0100

    src: Use g_list_free_full() convenience function

 libgiggle/giggle-revision.c |    2 +-
 src/giggle-diff-window.c    |    9 +++------
 src/giggle-file-list.c      |    6 ++----
 src/giggle-helpers.c        |    3 +--
 src/giggle-rev-list-view.c  |   17 +++++++----------
 src/giggle-window.c         |    3 +--
 6 files changed, 15 insertions(+), 25 deletions(-)
---
diff --git a/libgiggle/giggle-revision.c b/libgiggle/giggle-revision.c
index 26366b4..cb3390a 100644
--- a/libgiggle/giggle-revision.c
+++ b/libgiggle/giggle-revision.c
@@ -132,7 +132,7 @@ revision_get_property (GObject    *object,
 static void
 revision_dispose (GObject *object)
 {
-	GiggleRevision *revision = GIGGLE_REVISON (object);
+	GiggleRevision *revision = GIGGLE_REVISION (object);
 	GiggleRevisionPriv *priv = revision->priv;
 
 	g_clear_object (&priv->author);
diff --git a/src/giggle-diff-window.c b/src/giggle-diff-window.c
index 51c8118..c461df1 100644
--- a/src/giggle-diff-window.c
+++ b/src/giggle-diff-window.c
@@ -147,8 +147,7 @@ diff_window_finalize (GObject *object)
 
 	g_object_unref (priv->git);
 
-	g_list_foreach (priv->files, (GFunc) g_free, NULL);
-	g_list_free (priv->files);
+	g_list_free_full (priv->files, g_free);
 
 	G_OBJECT_CLASS (giggle_diff_window_parent_class)->finalize (object);
 }
@@ -269,10 +268,8 @@ giggle_diff_window_set_files (GiggleDiffWindow *window,
 
 	priv = GET_PRIV (window);
 
-	if (priv->files) {
-		g_list_foreach (priv->files, (GFunc) g_free, NULL);
-		g_list_free (priv->files);
-	}
+	if (priv->files)
+		g_list_free_full (priv->files, g_free);
 
 	priv->files = files;
 }
diff --git a/src/giggle-file-list.c b/src/giggle-file-list.c
index 8b5bde2..0555190 100644
--- a/src/giggle-file-list.c
+++ b/src/giggle-file-list.c
@@ -298,8 +298,7 @@ file_list_button_press (GtkWidget      *widget,
 		gtk_menu_popup (GTK_MENU (priv->popup), NULL, NULL,
 				NULL, NULL, event->button, event->time);
 
-		g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
-		g_list_free (rows);
+		g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free);
 	} else {
 		GTK_WIDGET_CLASS (giggle_file_list_parent_class)->button_press_event (widget, event);
 
@@ -1565,8 +1564,7 @@ giggle_file_list_get_selection (GiggleFileList *list)
 		files = g_list_prepend (files, path);
 	}
 
-	g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
-	g_list_free (rows);
+	g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free);
 
 	return g_list_reverse (files);
 }
diff --git a/src/giggle-helpers.c b/src/giggle-helpers.c
index a40b62f..7e8204c 100644
--- a/src/giggle-helpers.c
+++ b/src/giggle-helpers.c
@@ -67,8 +67,7 @@ giggle_list_view_delete_selection (GtkWidget   *treeview,
 							     (GtkTreeSelectionForeachFunc)
 								remote_editor_tree_selection_get_branches,
 							     &branches);
-			g_list_foreach (branches, (GFunc)remote_editor_remove_branch, NULL);
-			g_list_free (branches);
+			g_list_free_full (branches, remote_editor_remove_branch);
 			return TRUE;
 		}
 	}
diff --git a/src/giggle-rev-list-view.c b/src/giggle-rev-list-view.c
index 9800f3d..03cc7bd 100644
--- a/src/giggle-rev-list-view.c
+++ b/src/giggle-rev-list-view.c
@@ -924,8 +924,7 @@ rev_list_view_search (GiggleSearchable      *searchable,
 	}
 
 	gtk_tree_path_free (path);
-	g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
-	g_list_free (list);
+	g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
 
 	return (found && !priv->cancelled);
 }
@@ -1080,8 +1079,8 @@ rev_list_view_create_branch (GtkAction          *action,
 		g_object_unref (branch);
 	}
 
-	g_list_foreach (paths, (GFunc) gtk_tree_path_free, NULL);
-	g_list_free (paths);
+	g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
+
 	g_object_unref (revision);
 	gtk_widget_destroy (input_dialog);
 }
@@ -1132,8 +1131,8 @@ rev_list_view_create_tag (GtkAction          *action,
 		g_object_unref (tag);
 	}
 
-	g_list_foreach (paths, (GFunc) gtk_tree_path_free, NULL);
-	g_list_free (paths);
+	g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
+
 	g_object_unref (revision);
 	gtk_widget_destroy (input_dialog);
 }
@@ -1287,8 +1286,7 @@ rev_list_view_create_patch (GtkAction          *action,
 
 	gtk_tree_model_get_iter (model, &iter, (GtkTreePath *) paths->data);
 	gtk_tree_model_get (model, &iter, COL_OBJECT, &revision, -1);
-	g_list_foreach (paths, (GFunc) gtk_tree_path_free, NULL);
-	g_list_free (paths);
+	g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
 
 	/* If we don't have a revision, it means we selected the item
 	 * for uncommitted changes, and we can only do a diff here.
@@ -1614,8 +1612,7 @@ rev_list_view_selection_changed_cb (GtkTreeSelection  *selection,
 	if (last_revision)
 		g_object_unref (last_revision);
 
-	g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
-	g_list_free (rows);
+	g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free);
 }
 
 static void
diff --git a/src/giggle-window.c b/src/giggle-window.c
index 7421827..ced4ead 100644
--- a/src/giggle-window.c
+++ b/src/giggle-window.c
@@ -1399,8 +1399,7 @@ window_recent_repositories_update (GiggleWindow *window)
 		}
 	}
 
-	g_list_foreach (recent_items, (GFunc) gtk_recent_info_unref, NULL);
-	g_list_free (recent_items);
+	g_list_free_full (recent_items, (GDestroyNotify) gtk_recent_info_unref);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]