[gitg] Added support for handling gitg://<path>[:sha1] uri
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gitg] Added support for handling gitg://<path>[:sha1] uri
- Date: Sat, 9 Jan 2010 19:29:11 +0000 (UTC)
commit 1b6fb14008bc8017f7439bf379e72555965324db
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sat Jan 9 20:17:05 2010 +0100
Added support for handling gitg://<path>[:sha1] uri
data/gitg.schemas.in | 35 ++++++++++++++++++++++++++++++++++-
gitg/gitg-window.c | 21 +++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/data/gitg.schemas.in b/data/gitg.schemas.in
index 1bce33e..51ab258 100644
--- a/data/gitg.schemas.in
+++ b/data/gitg.schemas.in
@@ -11,7 +11,7 @@
<long>Whether searching filters the revisions in the history view
instead of jumping to the first match.</long>
</locale>
- </schema>
+ </schema>
<schema>
<key>/schemas/apps/gitg/preferences/view/history/collapse-inactive-lanes</key>
<applyto>/apps/gitg/preferences/view/history/collapse-inactive-lanes</applyto>
@@ -52,5 +52,38 @@
</long>
</locale>
</schema>
+ <schema>
+ <key>/schemas/desktop/gnome/url-handlers/gitg/command</key>
+ <applyto>/desktop/gnome/url-handlers/gitg/command</applyto>
+ <owner>gitg</owner>
+ <type>string</type>
+ <default>gitg "%s"</default>
+ <locale name="C">
+ <short>The command to handle GITG scheme URLs</short>
+ <long>The command to handle FEED scheme URLs.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/gnome/url-handlers/gitg/needs_terminal</key>
+ <applyto>/desktop/gnome/url-handlers/gitg/needs_terminal</applyto>
+ <owner>gitg</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether command to handle GITG scheme URLs needs a terminal</short>
+ <long>Whether command to handle GITG scheme URLs needs a terminal.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/gnome/url-handlers/gitg/enabled</key>
+ <applyto>/desktop/gnome/url-handlers/gitg/enabled</applyto>
+ <owner>gitg</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Whether command to handle GITG scheme URLs is enabled</short>
+ <long>Whether command to handle GITG scheme URLs is enabled.</long>
+ </locale>
+ </schema>
</schemalist>
</gconfschemafile>
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index 789201d..dde9b44 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -810,11 +810,32 @@ static gboolean
create_repository(GitgWindow *window, gchar const *path, gboolean usewd)
{
gboolean ret = TRUE;
+ gchar *select_sha1 = NULL;
if (path)
{
GFile *file = g_file_new_for_commandline_arg(path);
+ if (g_file_has_uri_scheme (file, "gitg"))
+ {
+ /* Extract path and sha information */
+ gchar *uri = g_file_get_uri (file);
+ gchar *fd = strrchr (uri, ':');
+ gint pos = fd ? fd - uri : 0;
+
+ if (pos > 5 && strlen (uri) - pos - 1 <= 40)
+ {
+ /* It has a sha */
+ *fd = '\0';
+ select_sha1 = g_strdup (fd + 1);
+ }
+
+ g_object_unref (file);
+
+ file = g_file_new_for_path (uri + 7);
+ g_free (uri);
+ }
+
if (g_file_is_native(file) && g_file_query_exists(file, NULL))
{
gchar *p = g_file_get_path(file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]