[geany/geany-plugins] f6cb49: git-changebar: Fix locating the ui file on OS X when using bundle
Jiří Techet
git-noreply at xxxxx
Wed Apr 26 20:46:20 UTC 2017
Branch: refs/heads/osx_relpath
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Wed, 26 Apr 2017 20:46:20 UTC
Commit: f6cb49987fde36ecdede37a87052bd9888398d17
https://github.com/geany/geany-plugins/commit/f6cb49987fde36ecdede37a87052bd9888398d17
Log Message:
-----------
git-changebar: Fix locating the ui file on OS X when using bundle
Modified Paths:
--------------
git-changebar/src/gcb-plugin.c
Modified: git-changebar/src/gcb-plugin.c
27 lines changed, 19 insertions(+), 8 deletions(-)
===================================================================
@@ -1386,19 +1386,31 @@ on_plugin_configure_response (GtkDialog *dialog,
}
}
+static gchar *
+get_data_dir_path (const gchar *filename)
+{
+ gchar *prefix = NULL;
+ gchar *path;
+
+#ifdef G_OS_WIN32
+ prefix = g_win32_get_package_installation_directory_of_module (NULL);
+#elif defined(__APPLE__)
+ if (g_getenv ("GEANY_PLUGINS_SHARE_PATH"))
+ return g_build_filename (g_getenv ("GEANY_PLUGINS_SHARE_PATH"),
+ PLUGIN, filename, NULL);
+#endif
+ path = g_build_filename (prefix ? prefix : "", PLUGINDATADIR, filename, NULL);
+ g_free (prefix);
+ return path;
+}
+
GtkWidget *
plugin_configure (GtkDialog *dialog)
{
GError *error = NULL;
GtkWidget *base = NULL;
GtkBuilder *builder = gtk_builder_new ();
-#ifdef G_OS_WIN32
- gchar *prefix = g_win32_get_package_installation_directory_of_module (NULL);
-#else
- gchar *prefix = NULL;
-#endif
- gchar *path = g_build_filename (prefix ? prefix : "", PLUGINDATADIR,
- "prefs.ui", NULL);
+ gchar *path = get_data_dir_path ("prefs.ui");
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
if (! gtk_builder_add_from_file (builder, path, &error)) {
@@ -1444,7 +1456,6 @@ plugin_configure (GtkDialog *dialog)
}
g_free (path);
- g_free (prefix);
g_object_unref (builder);
return base;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list