[gitg] Added value regex parameter to gitg_config_get_value_regex
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Added value regex parameter to gitg_config_get_value_regex
- Date: Sat, 29 May 2010 19:32:40 +0000 (UTC)
commit 3c8c6c59d32b8003a595ec0bbeee6c00dfc0ccba
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sat May 29 21:21:54 2010 +0200
Added value regex parameter to gitg_config_get_value_regex
gitg/gitg-config.c | 18 +++++++++++++-----
gitg/gitg-config.h | 2 +-
gitg/gitg-repository-dialog.c | 4 +++-
gitg/gitg-repository.c | 2 +-
4 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/gitg/gitg-config.c b/gitg/gitg-config.c
index c68cddd..8a8b30a 100644
--- a/gitg/gitg-config.c
+++ b/gitg/gitg-config.c
@@ -194,7 +194,9 @@ get_value_global (GitgConfig *config, gchar const *key)
}
static gchar *
-get_value_global_regex (GitgConfig *config, gchar const *regex)
+get_value_global_regex (GitgConfig *config,
+ gchar const *regex,
+ gchar const *value_regex)
{
gchar const *argv[] = {
"git",
@@ -202,6 +204,7 @@ get_value_global_regex (GitgConfig *config, gchar const *regex)
"--global",
"--get-regexp",
regex,
+ value_regex,
NULL
};
@@ -240,7 +243,9 @@ get_value_local (GitgConfig *config, gchar const *key)
}
static gchar *
-get_value_local_regex (GitgConfig *config, gchar const *regex)
+get_value_local_regex (GitgConfig *config,
+ gchar const *regex,
+ gchar const *value_regex)
{
gboolean ret;
GFile *git_dir;
@@ -260,6 +265,7 @@ get_value_local_regex (GitgConfig *config, gchar const *regex)
cfg,
"--get-regexp",
regex,
+ value_regex,
NULL);
g_free (cfg);
@@ -381,18 +387,20 @@ gitg_config_get_value (GitgConfig *config, gchar const *key)
}
gchar *
-gitg_config_get_value_regex (GitgConfig *config, gchar const *regex)
+gitg_config_get_value_regex (GitgConfig *config,
+ gchar const *regex,
+ gchar const *value_regex)
{
g_return_val_if_fail (GITG_IS_CONFIG (config), NULL);
g_return_val_if_fail (regex != NULL, NULL);
if (config->priv->repository != NULL)
{
- return get_value_local_regex (config, regex);
+ return get_value_local_regex (config, regex, value_regex);
}
else
{
- return get_value_global_regex (config, regex);
+ return get_value_global_regex (config, regex, value_regex);
}
}
diff --git a/gitg/gitg-config.h b/gitg/gitg-config.h
index f6de130..3fd612a 100644
--- a/gitg/gitg-config.h
+++ b/gitg/gitg-config.h
@@ -54,7 +54,7 @@ GType gitg_config_get_type (void) G_GNUC_CONST;
GitgConfig *gitg_config_new (GitgRepository *repository);
gchar *gitg_config_get_value (GitgConfig *config, gchar const *key);
-gchar *gitg_config_get_value_regex (GitgConfig *config, gchar const *regex);
+gchar *gitg_config_get_value_regex (GitgConfig *config, gchar const *regex, gchar const *value_regex);
gboolean gitg_config_rename (GitgConfig *config, gchar const *old, gchar const *nw);
gboolean gitg_config_set_value (GitgConfig *config, gchar const *key, gchar const *value);
diff --git a/gitg/gitg-repository-dialog.c b/gitg/gitg-repository-dialog.c
index 504f222..fe24b04 100644
--- a/gitg/gitg-repository-dialog.c
+++ b/gitg/gitg-repository-dialog.c
@@ -361,7 +361,9 @@ on_selection_changed (GtkTreeSelection *selection, GitgRepositoryDialog *dialog)
static void
init_remotes(GitgRepositoryDialog *dialog)
{
- gchar *ret = gitg_config_get_value_regex (dialog->priv->config, "remote\\..*\\.url");
+ gchar *ret = gitg_config_get_value_regex (dialog->priv->config,
+ "remote\\..*\\.url",
+ NULL);
if (!ret)
{
diff --git a/gitg/gitg-repository.c b/gitg/gitg-repository.c
index 165b608..402e281 100644
--- a/gitg/gitg-repository.c
+++ b/gitg/gitg-repository.c
@@ -1707,7 +1707,7 @@ gitg_repository_get_remotes (GitgRepository *repository)
g_return_val_if_fail (GITG_IS_REPOSITORY (repository), NULL);
GitgConfig *config = gitg_config_new (repository);
- gchar *ret = gitg_config_get_value_regex (config, "remote\\..*\\.url");
+ gchar *ret = gitg_config_get_value_regex (config, "remote\\..*\\.url", NULL);
GPtrArray *remotes = g_ptr_array_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]