~donadigo/appcenter/apt-link-support

« back to all changes in this revision

Viewing changes to src/Application.vala

  • Committer: Adam Bieńkowski
  • Date: 2016-12-27 23:45:51 UTC
  • Revision ID: donadigos159@gmail.com-20161227234551-2t473lvk9yfcum2n
Instead of apt, support appstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
            }
66
66
        });
67
67
 
68
 
        if (AppInfo.get_default_for_uri_scheme ("apt") == null) {
 
68
        if (AppInfo.get_default_for_uri_scheme ("appstream") == null) {
69
69
            var appinfo = new DesktopAppInfo (app_launcher);
70
70
            try {
71
 
                appinfo.set_as_default_for_type ("x-scheme-handler/apt");
 
71
                appinfo.set_as_default_for_type ("x-scheme-handler/appstream");
72
72
            } catch (Error e) {
73
73
                critical ("Unable to set default for the settings scheme: %s", e.message);
74
74
            }
84
84
            return;
85
85
        }
86
86
 
87
 
        if (file.has_uri_scheme ("apt")) {
88
 
            link = file.get_uri ().replace ("apt://", "");
 
87
        if (file.has_uri_scheme ("appstream")) {
 
88
            link = file.get_uri ().replace ("appstream://", "");
89
89
            if (link.has_suffix ("/")) {
90
90
                link = link.substring (0, link.last_index_of_char ('/'));
91
91
            }
116
116
            });
117
117
 
118
118
            if (link != null) {
119
 
                var package = client.get_package_for_name (link);
 
119
                var package = client.get_package_for_id (link);
120
120
                if (package != null) {
121
121
                    main_window.show_package (package);
122
122
                } else {