mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
Update binreloc to use Cocoa-based GtkOSXApplication instead of ige-mac-bundle.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19198 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
603b7d908e
commit
46a0872993
@ -19,7 +19,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#ifdef MAC_INTEGRATION
|
||||
#include <igemacintegration/ige-mac-bundle.h>
|
||||
#include <igemacintegration/gtkosxapplication.h>
|
||||
#endif
|
||||
#endif /* ENABLE_BINRELOC */
|
||||
#include <stdio.h>
|
||||
@ -30,9 +30,6 @@
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#if defined ENABLE_BINRELOC && defined MAC_INTEGRATION
|
||||
static IgeMacBundle *bundle = NULL;
|
||||
#endif
|
||||
|
||||
/** @internal
|
||||
* Find the canonical filename of the executable. Returns the filename
|
||||
@ -66,27 +63,10 @@ _br_find_exe (Gnc_GbrInitError *error)
|
||||
g_free (prefix);
|
||||
return result;
|
||||
#elif defined MAC_INTEGRATION
|
||||
gchar *prefix = NULL, *result = NULL;
|
||||
GtkOSXApplication *theApp;
|
||||
g_type_init();
|
||||
bundle = ige_mac_bundle_new();
|
||||
if (!bundle)
|
||||
{
|
||||
*error = GNC_GBR_INIT_ERROR_MAC_NOT_BUNDLE;
|
||||
return NULL;
|
||||
}
|
||||
if (!ige_mac_bundle_get_is_app_bundle (bundle))
|
||||
{
|
||||
g_object_unref(bundle);
|
||||
bundle = NULL;
|
||||
*error = GNC_GBR_INIT_ERROR_MAC_NOT_APP_BUNDLE;
|
||||
return NULL;
|
||||
}
|
||||
ige_mac_bundle_setup_environment(bundle);
|
||||
prefix = g_strdup(ige_mac_bundle_get_path(bundle));
|
||||
result = g_build_filename(prefix, "Contents/MacOS",
|
||||
"gnucash-bin", NULL);
|
||||
g_free(prefix);
|
||||
return result;
|
||||
theApp = g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
return gtk_osxapplication_get_executable_path(theApp);
|
||||
#else
|
||||
char *path, *path2, *line, *result;
|
||||
size_t buf_size;
|
||||
@ -300,12 +280,6 @@ set_gerror (GError **error, Gnc_GbrInitError errcode)
|
||||
case GNC_GBR_INIT_ERROR_INVALID_MAPS:
|
||||
error_message = "The file format of /proc/self/maps is invalid.";
|
||||
break;
|
||||
case GNC_GBR_INIT_ERROR_MAC_NOT_BUNDLE:
|
||||
error_message = "Binreloc did not find a bundle";
|
||||
break;
|
||||
case GNC_GBR_INIT_ERROR_MAC_NOT_APP_BUNDLE:
|
||||
error_message = "Binreloc found that the bundle is not an app bundle";
|
||||
break;
|
||||
case GNC_GBR_INIT_ERROR_DISABLED:
|
||||
error_message = "Binary relocation support is disabled.";
|
||||
break;
|
||||
@ -389,23 +363,20 @@ gnc_gbr_find_exe_dir (const gchar *default_dir)
|
||||
gchar *
|
||||
gnc_gbr_find_prefix (const gchar *default_prefix)
|
||||
{
|
||||
gchar *dir1, *dir2;
|
||||
|
||||
#if defined ENABLE_BINRELOC && defined MAC_INTEGRATION
|
||||
gchar *prefix = NULL, *result = NULL;
|
||||
if (bundle == NULL)
|
||||
{
|
||||
/* BinReloc not initialized. */
|
||||
if (default_prefix != NULL)
|
||||
return g_strdup (default_prefix);
|
||||
else
|
||||
return NULL;
|
||||
GtkOSXApplication* theApp = g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
gchar *id = gtk_osxapplication_get_bundle_id (theApp);
|
||||
gchar *path = gtk_osxapplication_get_resource_path (theApp);
|
||||
if (id == NULL) {
|
||||
gchar *dirname = g_path_get_dirname (path);
|
||||
g_free (path);
|
||||
g_free (id);
|
||||
return dirname;
|
||||
}
|
||||
prefix = g_strdup(ige_mac_bundle_get_path(bundle));
|
||||
result = g_build_filename(prefix, "Contents/Resources", NULL);
|
||||
g_free(prefix);
|
||||
return result;
|
||||
g_free (id);
|
||||
return path;
|
||||
#else
|
||||
gchar *dir1, *dir2;
|
||||
|
||||
if (exe == NULL)
|
||||
{
|
||||
@ -440,21 +411,6 @@ gchar *
|
||||
gnc_gbr_find_bin_dir (const gchar *default_bin_dir)
|
||||
{
|
||||
gchar *prefix, *dir;
|
||||
#if defined ENABLE_BINRELOC && defined MAC_INTEGRATION
|
||||
if (bundle == NULL)
|
||||
{
|
||||
/* BinReloc not initialized. */
|
||||
if (default_bin_dir != NULL)
|
||||
return g_strdup (default_bin_dir);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
prefix = g_strdup(ige_mac_bundle_get_path(bundle));
|
||||
dir = g_build_filename(prefix, "Contents/MacOS", NULL);
|
||||
g_free(prefix);
|
||||
return dir;
|
||||
#else
|
||||
|
||||
prefix = gnc_gbr_find_prefix (NULL);
|
||||
if (prefix == NULL)
|
||||
{
|
||||
@ -468,7 +424,6 @@ gnc_gbr_find_bin_dir (const gchar *default_bin_dir)
|
||||
dir = g_build_filename (prefix, "bin", NULL);
|
||||
g_free (prefix);
|
||||
return dir;
|
||||
#endif //ENABLE_BINRELOC && MAC_INTEGRATION
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user