Merge lp:~3v1n0/unity/filemanager-operations-timestamp into lp:unity

Proposed by Marco Trevisan (Treviño) on 2015-12-11
Status: Merged
Approved by: Andrea Azzarone on 2016-02-23
Approved revision: 4112
Merged at revision: 4076
Proposed branch: lp:~3v1n0/unity/filemanager-operations-timestamp
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/launcher-filemanager-integration
Diff against target: 94 lines (+4/-39)
2 files modified
unity-shared/GnomeFileManager.cpp (+4/-38)
unity-shared/GnomeFileManager.h (+0/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/filemanager-operations-timestamp
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) 2015-12-11 Approve on 2016-02-23
PS Jenkins bot (community) continuous-integration Approve on 2015-12-11
Review via email: mp+280341@code.launchpad.net

Commit message

GnomeFileManager: use *WithTimestamp file operations instead of using Activate workaround

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-shared/GnomeFileManager.cpp'
2--- unity-shared/GnomeFileManager.cpp 2015-12-11 17:59:00 +0000
3+++ unity-shared/GnomeFileManager.cpp 2015-12-11 17:59:00 +0000
4@@ -169,39 +169,6 @@
5 Open(TRASH_URI, timestamp);
6 }
7
8-void GnomeFileManager::Activate(uint64_t timestamp)
9-{
10- glib::Cancellable cancellable;
11- glib::Object<GFile> file(g_file_new_for_uri(TRASH_URI.c_str()));
12- glib::Object<GAppInfo> app_info(g_file_query_default_handler(file, cancellable, nullptr));
13-
14- if (app_info)
15- {
16- GdkDisplay* display = gdk_display_get_default();
17- glib::Object<GdkAppLaunchContext> context(gdk_display_get_app_launch_context(display));
18-
19- if (timestamp > 0)
20- gdk_app_launch_context_set_timestamp(context, timestamp);
21-
22- auto const& gcontext = glib::object_cast<GAppLaunchContext>(context);
23- auto proxy = std::make_shared<glib::DBusProxy>(NAUTILUS_NAME, NAUTILUS_PATH,
24- "org.freedesktop.Application");
25-
26- glib::String context_string(g_app_launch_context_get_startup_notify_id(gcontext, app_info, nullptr));
27-
28- if (context_string && g_utf8_validate(context_string, -1, nullptr))
29- {
30- GVariantBuilder builder;
31- g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}"));
32- g_variant_builder_add(&builder, "{sv}", "desktop-startup-id", g_variant_new("s", context_string.Value()));
33- GVariant *param = g_variant_new("(@a{sv})", g_variant_builder_end(&builder));
34-
35- // Passing the proxy to the lambda we ensure that it will be destroyed when needed
36- proxy->CallBegin("Activate", param, [proxy] (GVariant*, glib::Error const&) {});
37- }
38- }
39-}
40-
41 bool GnomeFileManager::TrashFile(std::string const& uri)
42 {
43 glib::Cancellable cancellable;
44@@ -217,11 +184,10 @@
45
46 void GnomeFileManager::EmptyTrash(uint64_t timestamp)
47 {
48- Activate(timestamp);
49 auto const& proxy = impl_->NautilusOperationsProxy();
50
51 // Passing the proxy to the lambda we ensure that it will be destroyed when needed
52- proxy->CallBegin("EmptyTrash", nullptr, [proxy] (GVariant*, glib::Error const&) {});
53+ proxy->CallBegin("EmptyTrashWithTimestamp", g_variant_new("(u)", timestamp), [proxy] (GVariant*, glib::Error const&) {});
54 }
55
56 void GnomeFileManager::CopyFiles(std::set<std::string> const& uris, std::string const& dest, uint64_t timestamp)
57@@ -231,7 +197,7 @@
58
59 bool found_valid = false;
60 GVariantBuilder b;
61- g_variant_builder_init(&b, G_VARIANT_TYPE("(ass)"));
62+ g_variant_builder_init(&b, G_VARIANT_TYPE("(assu)"));
63 g_variant_builder_open(&b, G_VARIANT_TYPE("as"));
64
65 for (auto const& uri : uris)
66@@ -245,14 +211,14 @@
67
68 g_variant_builder_close(&b);
69 g_variant_builder_add(&b, "s", dest.c_str());
70+ g_variant_builder_add(&b, "u", timestamp);
71 glib::Variant parameters(g_variant_builder_end(&b));
72
73 if (found_valid)
74 {
75 // Passing the proxy to the lambda we ensure that it will be destroyed when needed
76 auto const& proxy = impl_->NautilusOperationsProxy();
77- proxy->CallBegin("CopyURIs", parameters, [proxy] (GVariant*, glib::Error const&) {});
78- Activate(timestamp);
79+ proxy->CallBegin("CopyURIsWithTimestamp", parameters, [proxy] (GVariant*, glib::Error const&) {});
80 }
81 }
82
83
84=== modified file 'unity-shared/GnomeFileManager.h'
85--- unity-shared/GnomeFileManager.h 2015-12-11 17:59:00 +0000
86+++ unity-shared/GnomeFileManager.h 2015-12-11 17:59:00 +0000
87@@ -44,7 +44,6 @@
88
89 private:
90 GnomeFileManager();
91- void Activate(uint64_t timestamp);
92
93 struct Impl;
94 std::unique_ptr<Impl> impl_;