[gitg/wip/guyou/path-filtering: 4/119] Take in account all filtering parameters



commit d287926de09d46609f0e063625c20efcd623c681
Author: Guilhem Bonnefille <guilhem bonnefille gmail com>
Date:   Mon Mar 30 21:21:51 2009 +0200

    Take in account all filtering parameters

 gitg/gitg-window.c | 59 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 24 deletions(-)
---
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index 22446cfa..4c8ed58d 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -284,41 +284,52 @@ branches_separator_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 }
 
 static void
-on_path_activate(GtkEntry *entry, GitgWindow *window)
+filter_repository(GitgWindow *window)
 {
        gchar **args;
        const gchar *path;
+       int argc = 0;
 
-       path = gtk_entry_get_text(window->priv->entry_path);
+       args = g_new(gchar*, 4);
+
+       if (gtk_combo_box_get_active(window->priv->combo_branches) >= 2)
+       {
+               gchar *name;
+               GtkTreeIter iter;
+               GtkTreeIter next;
+       
+               gtk_combo_box_get_active_iter(window->priv->combo_branches, &iter);
+               next = iter;
+       
+               if (!gtk_tree_model_iter_next(gtk_combo_box_get_model(window->priv->combo_branches), &next))
+                       name = g_strdup("--all");
+               else
+                       gtk_tree_model_get(gtk_combo_box_get_model(window->priv->combo_branches), &iter, 0, 
&name, -1);
+               
+               args[argc++] = name;
+       }
 
-       args = g_new(gchar*, 3);
-       args[0] = g_strdup("--all");
-       args[1] = g_strdup("--");
-       args[2] = g_strdup(path);
-       gitg_repository_load(window->priv->repository, 3, args, NULL);
+       path = gtk_entry_get_text(window->priv->entry_path);
+       if (path)
+       {
+               args[argc++] = g_strdup("--");
+               args[argc++] = g_strdup(path);
+       }
+       
+       gitg_repository_load(window->priv->repository, argc, (gchar const **)args, NULL);
        /*g_strfreev(args);*/
 }
 
 static void
-on_branches_combo_changed(GtkComboBox *combo, GitgWindow *window)
+on_path_activate(GtkEntry *entry, GitgWindow *window)
 {
-       if (gtk_combo_box_get_active(combo) < 2)
-               return;
-       
-       gchar *name;
-       GtkTreeIter iter;
-       GtkTreeIter next;
-       
-       gtk_combo_box_get_active_iter(combo, &iter);
-       next = iter;
-       
-       if (!gtk_tree_model_iter_next(gtk_combo_box_get_model(combo), &next))
-               name = g_strdup("--all");
-       else
-               gtk_tree_model_get(gtk_combo_box_get_model(combo), &iter, 0, &name, -1);
+       filter_repository(window);
+}
 
-       gitg_repository_load(window->priv->repository, 1, (gchar const **)&name, NULL);
-       g_free(name);
+static void
+on_branches_combo_changed(GtkComboBox *combo, GitgWindow *window)
+{
+       filter_repository(window);
 }
 
 static void


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