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
29 changes: 15 additions & 14 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ src/bz-app-size-dialog.blp
src/bz-app-size-dialog.c
src/bz-app-tile.blp
src/bz-app-tile.c
src/bz-apps-page.blp
src/bz-apps-page.c
src/bz-application-map-factory.c
src/bz-application.c
src/bz-apps-page.blp
src/bz-apps-page.c
src/bz-appstream-parser.c
src/bz-async-texture.c
src/bz-backend.c
src/bz-bundle-install-dialog.c
src/bz-content-provider.c
src/bz-context-tile-callbacks.c
src/bz-context-tile.blp
src/bz-context-tile.c
src/bz-context-tile-callbacks.c
src/bz-curated-view.blp
src/bz-curated-view.c
src/bz-data-graph.c
Expand All @@ -38,23 +39,23 @@ src/bz-donations-dialog.c
src/bz-download-worker.c
src/bz-dynamic-list-view.c
src/bz-entry-cache-manager.c
src/bz-entry-group.c
src/bz-entry-group-util.c
src/bz-entry-group.c
src/bz-entry-inspector.blp
src/bz-entry-inspector.c
src/bz-entry-selection-row.blp
src/bz-entry-selection-row.c
src/bz-entry.c
src/bz-env.c
src/bz-error.c
src/bz-error-dialog.blp
src/bz-error-dialog.c
src/bz-favorite-button.c
src/bz-error.c
src/bz-favorite-button.blp
src/bz-favorites-tile.c
src/bz-favorites-tile.blp
src/bz-favorites-page.c
src/bz-favorite-button.c
src/bz-favorites-page.blp
src/bz-favorites-page.c
src/bz-favorites-tile.blp
src/bz-favorites-tile.c
src/bz-featured-carousel.blp
src/bz-featured-tile.blp
src/bz-flathub-category-section.c
Expand Down Expand Up @@ -101,15 +102,15 @@ src/bz-rich-app-tile.c
src/bz-safety-calculator.c
src/bz-safety-dialog.blp
src/bz-safety-dialog.c
src/bz-screenshot.c
src/bz-screenshot-page.blp
src/bz-screenshot.c
src/bz-screenshots-carousel.blp
src/bz-search-engine.c
src/bz-search-pill-list.c
src/bz-search-filter-popover.blp
src/bz-search-filter-popover.c
src/bz-search-page.blp
src/bz-search-page.c
src/bz-search-pill-list.c
src/bz-section-view.blp
src/bz-section-view.c
src/bz-serializable.c
Expand All @@ -126,14 +127,14 @@ src/bz-transaction-tile.c
src/bz-transaction.c
src/bz-updates-card.blp
src/bz-updates-card.c
src/bz-user-data-page.c
src/bz-user-data-page.blp
src/bz-user-data-tile.c
src/bz-user-data-page.c
src/bz-user-data-tile.blp
src/bz-user-data-tile.c
src/bz-window.blp
src/bz-window.c
src/bz-world-map.c
src/bz-yaml-parser.c
src/dl-worker.c
src/shortcuts-dialog.blp
src/main.c
src/shortcuts-dialog.blp
13 changes: 7 additions & 6 deletions src/bazaar.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@

<file preprocess="xml-stripblanks">bz-addon-tile.ui</file>
<file preprocess="xml-stripblanks">bz-addons-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-donations-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-age-rating-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-all-apps-page.ui</file>
<file preprocess="xml-stripblanks">bz-app-size-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-app-tile.ui</file>
<file preprocess="xml-stripblanks">bz-all-apps-page.ui</file>
<file preprocess="xml-stripblanks">bz-apps-page.ui</file>
<file preprocess="xml-stripblanks">bz-appstream-description-render.ui</file>
<file preprocess="xml-stripblanks">bz-curated-view.ui</file>
<file preprocess="xml-stripblanks">bz-bundle-install-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-category-tile.ui</file>
<file preprocess="xml-stripblanks">bz-context-tile.ui</file>
<file preprocess="xml-stripblanks">bz-curated-app-tile.ui</file>
<file preprocess="xml-stripblanks">bz-curated-view.ui</file>
<file preprocess="xml-stripblanks">bz-decorated-screenshot.ui</file>
<file preprocess="xml-stripblanks">bz-developer-badge.ui</file>
<file preprocess="xml-stripblanks">bz-donations-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-entry-inspector.ui</file>
<file preprocess="xml-stripblanks">bz-entry-selection-row.ui</file>
<file preprocess="xml-stripblanks">bz-error-dialog.ui</file>
Expand All @@ -45,8 +46,8 @@
<file preprocess="xml-stripblanks">bz-hardware-support-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-inspector.ui</file>
<file preprocess="xml-stripblanks">bz-install-controls.ui</file>
<file preprocess="xml-stripblanks">bz-library-page.ui</file>
<file preprocess="xml-stripblanks">bz-installed-tile.ui</file>
<file preprocess="xml-stripblanks">bz-library-page.ui</file>
<file preprocess="xml-stripblanks">bz-license-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-login-page.ui</file>
<file preprocess="xml-stripblanks">bz-preferences-dialog.ui</file>
Expand All @@ -58,12 +59,12 @@
<file preprocess="xml-stripblanks">bz-safety-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-screenshot-page.ui</file>
<file preprocess="xml-stripblanks">bz-screenshots-carousel.ui</file>
<file preprocess="xml-stripblanks">bz-search-page.ui</file>
<file preprocess="xml-stripblanks">bz-search-filter-popover.ui</file>
<file preprocess="xml-stripblanks">bz-search-page.ui</file>
<file preprocess="xml-stripblanks">bz-section-view.ui</file>
<file preprocess="xml-stripblanks">bz-stats-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-transaction-tile.ui</file>
<file preprocess="xml-stripblanks">bz-transaction-list-dialog.ui</file>
<file preprocess="xml-stripblanks">bz-transaction-tile.ui</file>
<file preprocess="xml-stripblanks">bz-updates-card.ui</file>
<file preprocess="xml-stripblanks">bz-user-data-page.ui</file>
<file preprocess="xml-stripblanks">bz-user-data-tile.ui</file>
Expand Down
142 changes: 117 additions & 25 deletions src/bz-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "bz-appstream-parser.h"
#include "bz-auth-state.h"
#include "bz-backend-notification.h"
#include "bz-bundle-install-dialog.h"
#include "bz-content-provider.h"
#include "bz-donations-dialog.h"
#include "bz-download-worker.h"
Expand Down Expand Up @@ -1246,7 +1247,17 @@ enumerate_disk_entries_fiber (GWeakRef *wr)
future = g_ptr_array_index (futures, i);
value = dex_future_get_value (future, &local_error);
if (value != NULL)
g_ptr_array_add (entries, g_value_dup_object (value));
{
g_autoptr (BzEntry) entry = NULL;

entry = g_value_dup_object (value);
if (BZ_IS_FLATPAK_ENTRY (entry) &&
bz_flatpak_entry_get_bundle_path (BZ_FLATPAK_ENTRY (entry)) != NULL)
/* refrain from restoring bundle entries */
continue;

g_ptr_array_add (entries, g_steal_pointer (&entry));
}
else
{
g_warning ("Unable to retrieve cached entry: %s", local_error->message);
Expand Down Expand Up @@ -1363,6 +1374,17 @@ respond_to_flatpak_fiber (RespondToFlatpakData *data)
kind = bz_backend_notification_get_kind (notif);
switch (kind)
{
case BZ_BACKEND_NOTIFICATION_KIND_PRESENT_ID:
{
const char *id = NULL;

id = bz_backend_notification_get_generic_id (notif);
if (id == NULL)
break;

open_generic_id (self, id);
}
break;
case BZ_BACKEND_NOTIFICATION_KIND_ERROR:
{
const char *error = NULL;
Expand Down Expand Up @@ -1542,11 +1564,13 @@ respond_to_flatpak_fiber (RespondToFlatpakData *data)
}
break;
case BZ_BACKEND_NOTIFICATION_KIND_ERROR:
case BZ_BACKEND_NOTIFICATION_KIND_TELL_INCOMING:
case BZ_BACKEND_NOTIFICATION_KIND_REPLACE_ENTRY:
case BZ_BACKEND_NOTIFICATION_KIND_REMOTE_SYNC_START:
case BZ_BACKEND_NOTIFICATION_KIND_REMOTE_SYNC_FINISH:
case BZ_BACKEND_NOTIFICATION_KIND_EXTERNAL_CHANGE:
case BZ_BACKEND_NOTIFICATION_KIND_INVALIDATE_REMOTES:
case BZ_BACKEND_NOTIFICATION_KIND_PRESENT_ID:
case BZ_BACKEND_NOTIFICATION_KIND_REMOTE_SYNC_FINISH:
case BZ_BACKEND_NOTIFICATION_KIND_REMOTE_SYNC_START:
case BZ_BACKEND_NOTIFICATION_KIND_REPLACE_ENTRY:
case BZ_BACKEND_NOTIFICATION_KIND_TELL_INCOMING:
default:
g_assert_not_reached ();
};
Expand All @@ -1564,8 +1588,10 @@ respond_to_flatpak_fiber (RespondToFlatpakData *data)
}
}
break;
case BZ_BACKEND_NOTIFICATION_KIND_INVALIDATE_REMOTES:
case BZ_BACKEND_NOTIFICATION_KIND_EXTERNAL_CHANGE:
{
g_autoptr (GListModel) repos = NULL;
g_autoptr (GHashTable) installed_set = NULL;
g_autoptr (GPtrArray) diff_reads = NULL;
GHashTableIter old_iter = { 0 };
Expand All @@ -1574,6 +1600,18 @@ respond_to_flatpak_fiber (RespondToFlatpakData *data)

bz_state_info_set_background_task_label (self->state, _ ("Refreshing…"));

repos = dex_await_object (
bz_backend_list_repositories (BZ_BACKEND (self->flatpak), NULL),
&local_error);

if (repos != NULL)
bz_state_info_set_repositories (self->state, repos);
else
{
g_warning ("Failed to enumerate repositories: %s", local_error->message);
g_clear_error (&local_error);
}

installed_set = dex_await_boxed (
bz_backend_retrieve_install_ids (
BZ_BACKEND (self->flatpak), NULL),
Expand Down Expand Up @@ -1763,7 +1801,6 @@ open_flatpakref_fiber (OpenFlatpakrefData *data)
GFile *file = data->file;
g_autoptr (GError) local_error = NULL;
g_autoptr (DexFuture) future = NULL;
GtkWindow *window = NULL;
const GValue *value = NULL;

bz_weak_get_or_return_reject (self, data->self);
Expand All @@ -1772,25 +1809,47 @@ open_flatpakref_fiber (OpenFlatpakrefData *data)
future = bz_backend_load_local_package (BZ_BACKEND (self->flatpak), file, NULL);
dex_await (dex_ref (future), NULL);

window = gtk_application_get_active_window (GTK_APPLICATION (self));
if (window == NULL)
window = new_window (self);

value = dex_future_get_value (future, &local_error);
if (value != NULL)
if (value == NULL)
{
if (G_VALUE_HOLDS_OBJECT (value))
{
BzEntry *entry = NULL;
GtkWindow *window = NULL;

entry = g_value_get_object (value);
bz_window_show_entry (BZ_WINDOW (window), entry);
}
else
open_generic_id (self, g_value_get_string (value));
window = gtk_application_get_active_window (GTK_APPLICATION (self));
if (window == NULL)
window = new_window (self);

bz_show_error_for_widget (
GTK_WIDGET (window),
_ ("Failed to open file"),
local_error->message);

return dex_future_new_for_error (g_steal_pointer (&local_error));
}

if (G_VALUE_HOLDS_OBJECT (value))
{
GtkWindow *window = NULL;
BzEntry *entry = NULL;
BzBundleInstallDialog *install_ui = NULL;
AdwDialog *dialog = NULL;

window = gtk_application_get_active_window (GTK_APPLICATION (self));
if (window == NULL)
window = new_window (self);

entry = g_value_get_object (value);
install_ui = g_object_new (
BZ_TYPE_BUNDLE_INSTALL_DIALOG,
"state", self->state,
"entry", entry,
NULL);

dialog = adw_dialog_new ();
adw_dialog_set_follows_content_size (dialog, TRUE);
adw_dialog_set_child (dialog, GTK_WIDGET (install_ui));

adw_dialog_present (dialog, GTK_WIDGET (window));
}
else
bz_show_error_for_widget (GTK_WIDGET (window), _ ("Failed to open .flatpakref"), local_error->message);

return dex_future_new_true ();
}
Expand Down Expand Up @@ -2003,9 +2062,7 @@ ensure_group_and_add (BzApplication *self,

group = g_hash_table_lookup (self->ids_to_groups, id);
if (group != NULL)
{
bz_entry_group_add (group, entry, eol_runtime, ignore_eol);
}
bz_entry_group_add (group, entry, eol_runtime, ignore_eol);
else
{
g_autoptr (BzEntryGroup) new_group = NULL;
Expand Down Expand Up @@ -3201,11 +3258,46 @@ static void
open_flatpakref_take (BzApplication *self,
GFile *file)
{
g_autoptr (GError) local_error = NULL;
gboolean result = FALSE;
g_autofree char *path = NULL;
g_autoptr (OpenFlatpakrefData) data = NULL;

path = g_file_get_path (file);
g_info ("Loading flatpakref at %s...", path);
if (path != NULL)
/* We must do this synchronously so we don't lose access to a portal file */
{
g_autofree char *basename = NULL;
g_autofree char *module_dir = NULL;
g_autofree char *staging = NULL;
g_autofree char *dest = NULL;
g_autoptr (GFile) copied = NULL;

basename = g_file_get_basename (file);
module_dir = bz_dup_module_dir ();
staging = g_build_filename (module_dir, "bundle-staging", NULL);
g_mkdir_with_parents (staging, 0755);
dest = g_build_filename (staging, basename, NULL);
copied = g_file_new_for_path (dest);

result = g_file_copy (
file, copied,
G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS,
NULL, NULL, NULL,
&local_error);
if (result)
{
g_clear_object (&file);
file = g_steal_pointer (&copied);
}
else
{
g_warning ("Failed to copy bundle to %s : %s",
dest, local_error->message);
g_clear_error (&local_error);
g_clear_object (&copied);
}
}

data = open_flatpakref_data_new ();
data->self = bz_track_weak (self);
Expand Down
3 changes: 2 additions & 1 deletion src/bz-backend-notification.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parent-prefix=g
parent-name=object
author=AUTOGEN

enum=bz backend_notification_kind error tell_incoming replace_entry remote_sync_start remote_sync_finish install_done update_done remove_done external_change
enum=bz backend_notification_kind error tell_incoming replace_entry invalidate_remotes remote_sync_start remote_sync_finish install_done update_done remove_done external_change present_id

include="bz-entry.h"

Expand All @@ -14,4 +14,5 @@ property=n_incoming int G_TYPE_INT int
property=entry BzEntry BZ_TYPE_ENTRY object
property=version char G_TYPE_STRING string
property=remote_name char G_TYPE_STRING string
property=generic_id char G_TYPE_STRING string
property=unique_id char G_TYPE_STRING string
Loading
Loading