Merge lp:~adam-davies/noise/fix-999735 into lp:~elementary-apps/noise/trunk

Proposed by Adam Davies
Status: Merged
Approved by: Victor Martinez
Approved revision: 1114
Merged at revision: 1140
Proposed branch: lp:~adam-davies/noise/fix-999735
Merge into: lp:~elementary-apps/noise/trunk
Diff against target: 55 lines (+29/-13)
1 file modified
src/Dialogs/InstallGstreamerPluginsDialog.vala (+29/-13)
To merge this branch: bzr merge lp:~adam-davies/noise/fix-999735
Reviewer Review Type Date Requested Status
Victor Martinez (community) Approve
Review via email: mp+131807@code.launchpad.net

Description of the change

Added new method that checks every three seconds to whether or not plugins have been installed.

To post a comment you must log in.
lp:~adam-davies/noise/fix-999735 updated
1114. By adam-davies <email address hidden>

Fixed code style

Revision history for this message
Victor Martinez (victored) wrote :

Looks good! Thanks for your work Adam.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Dialogs/InstallGstreamerPluginsDialog.vala'
2--- src/Dialogs/InstallGstreamerPluginsDialog.vala 2012-07-26 17:29:26 +0000
3+++ src/Dialogs/InstallGstreamerPluginsDialog.vala 2012-10-29 00:52:26 +0000
4@@ -93,23 +93,39 @@
5 doNothing.clicked.connect ( () => {
6 this.destroy ();
7 });
8-
9 add(padding);
10 show_all();
11 }
12
13- public void installPluginClicked() {
14- var installer = Gst.missing_plugin_message_get_installer_detail(message);
15- var context = new Gst.InstallPluginsContext();
16-
17- Gst.install_plugins_async({installer}, context, (Gst.InstallPluginsResultFunc)install_plugins_finished);
18-
19- this.hide();
20- }
21+ public void installPluginClicked() {
22+ var installer = Gst.missing_plugin_message_get_installer_detail(message);
23+ var context = new Gst.InstallPluginsContext();
24+
25+ Gst.install_plugins_async({installer}, context, (Gst.InstallPluginsResultFunc)install_plugins_finished);
26+ // This callback was called before APT was done, so let's periodically check
27+ // whether the plugins have actually been installed. We won't update the
28+ // registry here.
29+ Timeout.add_seconds (3, Checker);
30+ this.hide ();
31+ }
32
33- public void install_plugins_finished(Gst.InstallPluginsReturn result) {
34- GLib.message ("Install of plugins finished.. updating registry");
35- Gst.update_registry();
36- }
37+ public void install_plugins_finished(Gst.InstallPluginsReturn result) {
38+ GLib.message ("Install of plugins finished.. updating registry");
39+ }
40+ private bool installation_done = false;
41+ private bool Checker () {
42+ if (installation_done)
43+ return false; // this ends the checking method
44+ var search = new Granite.Services.SimpleCommand ("/home", "/usr/bin/dpkg -l");
45+ search.run (); // this is asynchronous. It will tell us when its done
46+ search.done.connect ((exit) => {
47+ if(search.output_str.contains ("fluendo")) { // if plugins installed
48+ Gst.update_registry ();
49+ installation_done = true;
50+ }
51+ });
52+ // this will mean that it will be checked again
53+ return true;
54+ }
55 }
56

Subscribers

People subscribed via source and target branches