[geany/geany-plugins] 802e8d: scope: Fix locating the glade file on OS X and Windows

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:      802e8d3266ec2773705d3e4522e1a57b9972dfe7
             https://github.com/geany/geany-plugins/commit/802e8d3266ec2773705d3e4522e1a57b9972dfe7

Log Message:
-----------
scope: Fix locating the glade file on OS X and Windows


Modified Paths:
--------------
    scope/src/scope.c

Modified: scope/src/scope.c
19 lines changed, 18 insertions(+), 1 deletions(-)
===================================================================
@@ -524,10 +524,27 @@ void configure_panel(void)
 	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(debug_panel), pref_panel_tab_pos);
 }
 
+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;
+}
+
 void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
 {
 	GeanyKeyGroup *scope_key_group;
-	char *gladefile = g_build_filename(PLUGINDATADIR, "scope.glade", NULL);
+	char *gladefile = get_data_dir_path("scope.glade");
 	GError *gerror = NULL;
 	GtkWidget *menubar1 = ui_lookup_widget(geany->main_widgets->window, "menubar1");
 	guint item;



--------------
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