[anjuta/git-shell] git: Allow status pane users to select which types of status codes they want
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/git-shell] git: Allow status pane users to select which types of status codes they want
- Date: Sun, 11 Jul 2010 02:22:24 +0000 (UTC)
commit 9074f350c78d1f62c3a3c63b58a61ac701c38055
Author: James Liggett <jrliggett cox net>
Date: Sat Jul 10 17:24:21 2010 -0700
git: Allow status pane users to select which types of status codes they want
The new selection methods now take a bitfield to represent which status codes
the user needs from each section.
plugins/git/git-commit-pane.c | 3 +-
plugins/git/git-status-pane.c | 59 ++++++++++++++++++++++++++--------------
plugins/git/git-status-pane.h | 9 ++++--
3 files changed, 46 insertions(+), 25 deletions(-)
---
diff --git a/plugins/git/git-commit-pane.c b/plugins/git/git-commit-pane.c
index aec8544..0441080 100644
--- a/plugins/git/git-commit-pane.c
+++ b/plugins/git/git-commit-pane.c
@@ -155,7 +155,8 @@ on_ok_button_clicked (GtkButton *button, GitCommitPane *self)
}
}
- selected_paths = git_status_pane_get_all_selected_items (GIT_STATUS_PANE (plugin->status_pane));
+ selected_paths = git_status_pane_get_all_selected_items (GIT_STATUS_PANE (plugin->status_pane),
+ ANJUTA_VCS_STATUS_ALL);
commit_command = git_commit_command_new (plugin->project_root_directory,
gtk_toggle_button_get_active (amend_check),
diff --git a/plugins/git/git-status-pane.c b/plugins/git/git-status-pane.c
index f08f245..8e79249 100644
--- a/plugins/git/git-status-pane.c
+++ b/plugins/git/git-status-pane.c
@@ -36,6 +36,13 @@ enum
STATUS_TYPE_NOT_UPDATED
};
+/* Data for generating lists of selected items */
+typedef struct
+{
+ AnjutaVcsStatus status_codes;
+ GList *list;
+} StatusSelectionData;
+
struct _GitStatusPanePriv
{
GtkBuilder *builder;
@@ -225,6 +232,7 @@ on_selected_renderer_toggled (GtkCellRendererToggle *renderer, gchar *tree_path,
GtkTreeModel *status_model;
GtkTreeIter iter;
gboolean selected;
+ AnjutaVcsStatus status;
gchar *path;
gint type;
@@ -234,7 +242,8 @@ on_selected_renderer_toggled (GtkCellRendererToggle *renderer, gchar *tree_path,
gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (status_model), &iter,
tree_path);
gtk_tree_model_get (status_model, &iter,
- COL_SELECTED, &selected,
+ COL_SELECTED, &selected,
+ COL_STATUS, &status,
COL_PATH, &path,
COL_TYPE, &type,
-1);
@@ -249,11 +258,11 @@ on_selected_renderer_toggled (GtkCellRendererToggle *renderer, gchar *tree_path,
{
case STATUS_TYPE_COMMIT:
g_hash_table_insert (self->priv->selected_commit_items,
- g_strdup (path), NULL);
+ g_strdup (path), GINT_TO_POINTER (status));
break;
case STATUS_TYPE_NOT_UPDATED:
g_hash_table_insert (self->priv->selected_not_updated_items,
- g_strdup (path), NULL);
+ g_strdup (path), GINT_TO_POINTER (status));
break;
default:
break;
@@ -511,53 +520,61 @@ git_status_pane_new (Git *plugin)
}
static void
-selected_items_table_foreach (gchar *path, gchar *value, GList **list)
+selected_items_table_foreach (gchar *path, gpointer status,
+ StatusSelectionData *data)
{
- *list = g_list_append (*list, g_strdup (path));
+ if (GPOINTER_TO_INT (status) & data->status_codes)
+ data->list = g_list_append (data->list, g_strdup (path));
}
GList *
-git_status_pane_get_selected_commit_items (GitStatusPane *self)
+git_status_pane_get_selected_commit_items (GitStatusPane *self,
+ AnjutaVcsStatus status_codes)
{
- GList *list;
+ StatusSelectionData data;
- list = NULL;
+ data.status_codes = status_codes;
+ data.list = NULL;
g_hash_table_foreach (self->priv->selected_commit_items,
(GHFunc) selected_items_table_foreach,
- &list);
+ &data);
- return list;
+ return data.list;
}
GList *
-git_status_pane_get_selected_not_updated_items (GitStatusPane *self)
+git_status_pane_get_selected_not_updated_items (GitStatusPane *self,
+ AnjutaVcsStatus status_codes)
{
- GList *list;
+ StatusSelectionData data;
- list = NULL;
+ data.status_codes = status_codes;
+ data.list = NULL;
g_hash_table_foreach (self->priv->selected_not_updated_items,
(GHFunc) selected_items_table_foreach,
- &list);
+ &data);
- return list;
+ return data.list;
}
GList *
-git_status_pane_get_all_selected_items (GitStatusPane *self)
+git_status_pane_get_all_selected_items (GitStatusPane *self,
+ AnjutaVcsStatus status_codes)
{
- GList *list;
+ StatusSelectionData data;
- list = NULL;
+ data.status_codes = status_codes;
+ data.list = NULL;
g_hash_table_foreach (self->priv->selected_commit_items,
(GHFunc) selected_items_table_foreach,
- &list);
+ &data);
g_hash_table_foreach (self->priv->selected_not_updated_items,
(GHFunc) selected_items_table_foreach,
- &list);
+ &data);
- return list;
+ return data.list;
}
diff --git a/plugins/git/git-status-pane.h b/plugins/git/git-status-pane.h
index a66feaf..c761cc0 100644
--- a/plugins/git/git-status-pane.h
+++ b/plugins/git/git-status-pane.h
@@ -51,9 +51,12 @@ struct _GitStatusPane
GType git_status_pane_get_type (void) G_GNUC_CONST;
AnjutaDockPane *git_status_pane_new (Git *plugin);
-GList *git_status_pane_get_selected_commit_items (GitStatusPane *self);
-GList *git_status_pane_get_selected_not_updated_items (GitStatusPane *self);
-GList *git_status_pane_get_all_selected_items (GitStatusPane *self);
+GList *git_status_pane_get_selected_commit_items (GitStatusPane *self,
+ AnjutaVcsStatus status_codes);
+GList *git_status_pane_get_selected_not_updated_items (GitStatusPane *self,
+ AnjutaVcsStatus status_codes);
+GList *git_status_pane_get_all_selected_items (GitStatusPane *self,
+ AnjutaVcsStatus status_codes);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]