[Merge] ~rs2009/unity:master into unity:master
Marco Trevisan (Treviño)
mp+429299 at code.launchpad.net
Mon Sep 12 14:05:54 UTC 2022
Few more comments
Diff comments:
> diff --git a/unity-shared/GnomeFileManager.cpp b/unity-shared/GnomeFileManager.cpp
> index bd2a051..1fd6451 100644
> --- a/unity-shared/GnomeFileManager.cpp
> +++ b/unity-shared/GnomeFileManager.cpp
> @@ -214,19 +220,44 @@ bool GnomeFileManager::TrashFile(std::string const& uri)
> return false;
> }
>
> -void GnomeFileManager::EmptyTrash(uint64_t timestamp, Window parent_xid)
> +void GioEmptyTrash (GtkWidget *dialog, int response)
This has wrong signature, because you're using a swapped request, so, please just don't use a `swapped` one.
> {
> - auto const& proxy = impl_->NautilusOperationsProxy();
> - const bool ask_confirmation = true;
> + if (response == GTK_RESPONSE_OK) {
> + GError *error = NULL;
>
> - GVariantBuilder b;
> - g_variant_builder_init(&b, G_VARIANT_TYPE("(ba{sv})"));
> - g_variant_builder_add(&b, "b", ask_confirmation);
> - g_variant_builder_add_value(&b, impl_->GetPlatformData(timestamp, parent_xid));
> - glib::Variant parameters(g_variant_builder_end(&b));
> + g_subprocess_new (G_SUBPROCESS_FLAGS_STDOUT_SILENCE, &error, "/usr/bin/gio", "trash", "--empty", NULL);
> + }
> +
> + gtk_widget_destroy (dialog);
> +}
>
> - // Passing the proxy to the lambda we ensure that it will be destroyed when needed
> - proxy->CallBegin("EmptyTrash", parameters, [proxy] (GVariant*, glib::Error const&) {});
> +void GnomeFileManager::EmptyTrash(uint64_t timestamp, Window parent_xid)
> +{
> + GtkWidget *dialog, *label, *content_area;
> + GtkDialogFlags flags;
> +
> + flags = GTK_DIALOG_DESTROY_WITH_PARENT;
> + dialog = gtk_dialog_new_with_buttons ("Question",
> + NULL,
> + flags,
> + _("Yes"), GTK_RESPONSE_OK,
> + _("No"), GTK_RESPONSE_CANCEL,
> + NULL);
> + gtk_widget_set_size_request(dialog, 250, 65);
> + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
> + label = gtk_label_new (_("Do you want to empty the trash?"));
> +
> + // Ensure that the dialog box is destroyed when the user responds
This is not happening, so please, add a
+ g_signal_connect_swapped (dialog,
+ "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
*AFTER* the normal callback.
> +
> + g_signal_connect_swapped (dialog,
> + "response",
> + G_CALLBACK (GioEmptyTrash),
I think it's nicer if you use C++ lambdas, we have GLib wrappers for handling signal connections in a nicer way in libunity core, so use that or manually go with:
g_signal_connect (dialog, "response", [] (GtkWidget *dialog, int response, void *data) { ... }, NULL);
> + dialog);
> +
> + // Add the label, and show everything we’ve added
> +
> + gtk_container_add (GTK_CONTAINER (content_area), label);
> + gtk_widget_show_all (dialog);
> }
>
> void GnomeFileManager::CopyFiles(std::set<std::string> const& uris, std::string const& dest, uint64_t timestamp, Window parent_xid)
--
https://code.launchpad.net/~rs2009/unity/+git/unity/+merge/429299
Your team Unity Team is subscribed to branch unity:master.
More information about the Ubuntu-reviews
mailing list