Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ else

if get_option('development')
config_h.set10('DEVELOPMENT_BUILD', get_option('development'))
config_h.set_quoted('DEVELOPMENT_EXAMPLE_YAML', get_option('prefix') / get_option('datadir') / 'bazaar' / 'example.yaml')
install_data(
'docs/example.yaml',
install_dir: get_option('datadir') / 'bazaar',
)
endif

configure_file(output: 'config.h', configuration: config_h)
Expand Down
17 changes: 17 additions & 0 deletions src/bz-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -3211,6 +3211,23 @@ init_service_struct (BzApplication *self,
gtk_string_list_append (curated_configs, gtk_string_object_get_string (string));
}
}

#ifdef DEVELOPMENT_BUILD
if (g_list_model_get_n_items (G_LIST_MODEL (curated_configs)) == 0)
{
g_autofree char *dest_path = NULL;
g_autoptr (GFile) src = NULL;
g_autoptr (GFile) dest = NULL;

dest_path = g_build_filename (g_get_user_data_dir (), "example.yaml", NULL);
src = g_file_new_for_path (DEVELOPMENT_EXAMPLE_YAML);
dest = g_file_new_for_path (dest_path);
g_file_copy (src, dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL);

gtk_string_list_append (curated_configs, dest_path);
}
#endif

self->curated_configs = g_object_ref (curated_configs);
self->curated_configs_to_files = gtk_map_list_model_new (
NULL, (GtkMapListModelMapFunc) map_strings_to_files, NULL, NULL);
Expand Down
20 changes: 17 additions & 3 deletions src/bz-inspector.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <json-glib/json-glib.h>

#include "config.h"

#include "bz-entry-inspector.h"
#include "bz-env.h"
#include "bz-inspector.h"
Expand Down Expand Up @@ -236,13 +238,25 @@ open_file_externally_cb (GtkListItem *list_item,
{
GtkStringObject *string = NULL;
const char *path = NULL;
g_autofree char *uri = NULL;

string = gtk_list_item_get_item (list_item);
path = gtk_string_object_get_string (string);

uri = g_strdup_printf ("file://%s", path);
g_app_info_launch_default_for_uri (uri, NULL, NULL);
#if defined(DEVELOPMENT_BUILD) && defined(SANDBOXED_LIBFLATPAK)
{
const char *argv[] = { "flatpak-spawn", "--host", "xdg-open", NULL, NULL };
argv[3] = path;

g_spawn_async (NULL, (char **) argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
}
#else
{
g_autofree char *uri = NULL;

uri = g_strdup_printf ("file://%s", path);
g_app_info_launch_default_for_uri (uri, NULL, NULL);
}
#endif
}

static void
Expand Down
Loading