git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Feb 3, 2009, 13:08 UTC
Message-ID
<1233666531-21589-3-git-send-email-szeder@ira.uka.de>
In-Reply-To
<1233666531-21589-2-git-send-email-szeder@ira.uka.de>

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@ira.uka.de>
---
  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
Previous: SZEDER GáborNext: Jesse van den Kieboom
Message 5 of 26 in “git gtk+/GNOME gui application: gitg”
  1. Jesse van den KieboomJan 31, 2009
  2. SZEDER GáborFeb 3, 2009
  3. 1/3 Fix "multi-character character constant" compile warningSZEDER Gábor, Feb 3, 2009
  4. 2/3 Refactor loading xml UI filesSZEDER Gábor, Feb 3, 2009
  5. 3/3 Try load UI xml files from the current working directorySZEDER Gábor, Feb 3, 2009
  6. Jesse van den KieboomFeb 14, 2009
  7. Jesse van den KieboomFeb 4, 2009
  8. Michael J GruberFeb 3, 2009
  9. Stefan KarpinskiFeb 3, 2009
  10. Jesse van den KieboomFeb 4, 2009
  11. Miles BaderFeb 4, 2009
  12. Jakub NarebskiFeb 3, 2009
  13. Felipe ContrerasFeb 4, 2009
  14. Jesse van den KieboomFeb 4, 2009
  15. Michael J GruberFeb 4, 2009
  16. Felipe ContrerasFeb 4, 2009
  17. Jesse van den KieboomFeb 4, 2009
  18. Felipe ContrerasFeb 4, 2009
  19. Michael J GruberFeb 4, 2009
  20. Jesse van den KieboomFeb 4, 2009
  21. Michael J GruberFeb 4, 2009
  22. Jesse van den KieboomFeb 4, 2009
  23. Miles BaderFeb 5, 2009
  24. Jesse van den KieboomFeb 5, 2009
  25. Miles BaderFeb 6, 2009
  26. Jakub NarebskiFeb 4, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.