[PATCH 3/3] Try load UI xml files from the current working directory

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

 



Currently, gitg looks for the UI xml files only at the paths where
they should have been installed.  This makes hard to just give gitg a
try without actually installing it, as it simply errors out.

This patch makes running gitg from the root directory of the working
tree possible by checking whether those UI files can be found under
the 'gitg' directory relative to the current working directory if they
can't be found on their proper place.

Signed-off-by: SZEDER Gábor <szeder@xxxxxxxxxx>
---

  This should be further enhanced (e.g. by looking for those files
  relative to the path of the gitg binary), because you can only browse
  gitg's history that way;  running gitg in an other git repository
  without installing it still doesn't work.

 gitg/gitg-utils.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gitg/gitg-utils.c b/gitg/gitg-utils.c
index cfce323..95bccd2 100644
--- a/gitg/gitg-utils.c
+++ b/gitg/gitg-utils.c
@@ -429,7 +429,12 @@ gitg_builder_add_from_file(GtkBuilder *builder, const gchar *filename)
 	if (!gtk_builder_add_from_file(builder, full_filename, &error))
 	{
 		g_critical("Could not open UI file: %s (%s)", full_filename, error->message);
-		g_error_free(error);
-		exit(1);
+
+		g_snprintf(full_filename, PATH_MAX, "%s%c%s", "gitg", G_DIR_SEPARATOR, filename);
+		if (!gtk_builder_add_from_file(builder, full_filename, &error))
+		{
+			g_error_free(error);
+			exit(1);
+		}
 	}
 }
-- 
1.6.1.2.362.g0f78

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux