~elementary-pantheon/switchboard-plug-applications/freya

« back to all changes in this revision

Viewing changes to src/Defaults/Utils.vala

Code style clean up

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
***/
20
20
namespace Defaults {
21
21
 
22
 
        void map_types_to_app (string[] types, GLib.AppInfo app) {
23
 
                try {
24
 
                        for (int i=0; i < types.length; i++) {
25
 
                                app.set_as_default_for_type(types[i]);
26
 
                        }
27
 
                } catch (GLib.Error e) {
 
22
    void map_types_to_app (string[] types, GLib.AppInfo app) {
 
23
        try {
 
24
            for (int i=0; i < types.length; i++) {
 
25
                app.set_as_default_for_type(types[i]);
 
26
            }
 
27
        } catch (GLib.Error e) {
28
28
            stdout.printf("Error: %s\n", e.message);
29
 
                }
 
29
        }
30
30
 
31
 
        }
 
31
    }
32
32
/*
33
33
 * Get the essential types for the apps
34
34
 *
35
35
 */
36
 
        string[] get_types_for_app (string app) {
37
 
                switch (app) {
 
36
    string[] get_types_for_app (string app) {
 
37
        switch (app) {
38
38
            case "web_browser":
39
39
                return { "x-scheme-handler/http",
40
 
                                        "x-scheme-handler/https",
41
 
                                        "text/html",
42
 
                                        "application/x-extension-htm",
43
 
                                        "application/x-extension-html",
44
 
                                        "application/x-extension-shtml",
45
 
                                        "application/xhtml+xml",
46
 
                                        "application/x-extension-xht"
47
 
                        };
 
40
                        "x-scheme-handler/https",
 
41
                        "text/html",
 
42
                        "application/x-extension-htm",
 
43
                        "application/x-extension-html",
 
44
                        "application/x-extension-shtml",
 
45
                        "application/xhtml+xml",
 
46
                        "application/x-extension-xht"
 
47
                };
48
48
 
49
49
            case "email_client":
50
50
                return  { "x-scheme-handler/mailto"
51
 
                        };
 
51
                };
52
52
 
53
53
            case "calendar":
54
54
                return { "text/calendar"
55
 
                        };
 
55
                };
56
56
 
57
57
            case "video_player":
58
58
                return {    "application/x-quicktimeplayer",
59
 
                                        "application/vnd.rn-realmedia",
60
 
                                        "application/asx",
61
 
                                        "application/x-mplayer2",
62
 
                                        "application/x-ms-wmv",
63
 
                                        "video/quicktime",
64
 
                                        "video/x-quicktime",
65
 
                                        "video/vnd.rn-realvideo",
66
 
                                        "video/x-ms-asf-plugin",
67
 
                                        "video/x-msvideo",
68
 
                                        "video/msvideo",
69
 
                                        "video/x-ms-asf",
70
 
                                        "video/x-ms-wm",
71
 
                                        "video/x-ms-wmv",
72
 
                                        "video/x-ms-wmp",
73
 
                                        "video/x-ms-wvx",
74
 
                                        "video/mpeg",
75
 
                                        "video/x-mpeg",
76
 
                                        "video/x-mpeg2",
77
 
                                        "video/mp4",
78
 
                                        "video/3gpp",
79
 
                                        "video/fli",
80
 
                                        "video/x-fli",
81
 
                                        "video/x-flv",
82
 
                                        "video/vnd.vivo",
83
 
                                        "video/x-matroska",
84
 
                                        "video/matroska",
85
 
                                        "video/x-mng",
86
 
                                        "video/webm",
87
 
                                        "video/x-webm",
88
 
                                        "video/mp2t",
89
 
                                        "video/vnd.mpegurl",
90
 
                                        "video/x-ogm+ogg"
91
 
                        };
 
59
                        "application/vnd.rn-realmedia",
 
60
                        "application/asx",
 
61
                        "application/x-mplayer2",
 
62
                        "application/x-ms-wmv",
 
63
                        "video/quicktime",
 
64
                        "video/x-quicktime",
 
65
                        "video/vnd.rn-realvideo",
 
66
                        "video/x-ms-asf-plugin",
 
67
                        "video/x-msvideo",
 
68
                        "video/msvideo",
 
69
                        "video/x-ms-asf",
 
70
                        "video/x-ms-wm",
 
71
                        "video/x-ms-wmv",
 
72
                        "video/x-ms-wmp",
 
73
                        "video/x-ms-wvx",
 
74
                        "video/mpeg",
 
75
                        "video/x-mpeg",
 
76
                        "video/x-mpeg2",
 
77
                        "video/mp4",
 
78
                        "video/3gpp",
 
79
                        "video/fli",
 
80
                        "video/x-fli",
 
81
                        "video/x-flv",
 
82
                        "video/vnd.vivo",
 
83
                        "video/x-matroska",
 
84
                        "video/matroska",
 
85
                        "video/x-mng",
 
86
                        "video/webm",
 
87
                        "video/x-webm",
 
88
                        "video/mp2t",
 
89
                        "video/vnd.mpegurl",
 
90
                        "video/x-ogm+ogg"
 
91
                };
92
92
 
93
93
            case "music_player":
94
94
                return  {   "audio/ogg",
95
 
                                        "audio/mpeg",
96
 
                                        "audio/mp4",
97
 
                                        "audio/flac",
98
 
                                        "application/x-musepack",
99
 
                                        "application/musepack",
100
 
                                        "application/x-ape",
101
 
                                        "application/x-id3",
102
 
                                        "application/ogg",
103
 
                                        "application/x-ogg",
104
 
                                        "application/x-vorbis+ogg",
105
 
                                        "application/x-flac",
106
 
                                        "application/vnd.rn-realaudio",
107
 
                                        "application/x-nsv-vp3-mp3",
108
 
                                        "audio/x-musepack",
109
 
                                        "audio/musepack",
110
 
                                        "audio/ape",
111
 
                                        "audio/x-ape",
112
 
                                        "audio/x-mp3",
113
 
                                        "audio/mpeg",
114
 
                                        "audio/x-mpeg",
115
 
                                        "audio/x-mpeg-3",
116
 
                                        "audio/mpeg3",
117
 
                                        "audio/mp3",
118
 
                                        "audio/mp4",
119
 
                                        "audio/x-m4a",
120
 
                                        "audio/mpc",
121
 
                                        "audio/x-mpc",
122
 
                                        "audio/mp",
123
 
                                        "audio/x-mp",
124
 
                                        "audio/x-vorbis+ogg",
125
 
                                        "audio/vorbis",
126
 
                                        "audio/x-vorbis",
127
 
                                        "audio/ogg",
128
 
                                        "audio/x-ogg",
129
 
                                        "audio/x-flac",
130
 
                                        "audio/flac",
131
 
                                        "audio/x-s3m",
132
 
                                        "audio/x-mod",
133
 
                                        "audio/x-xm",
134
 
                                        "audio/x-it",
135
 
                                        "audio/x-pn-realaudio",
136
 
                                        "audio/x-realaudio",
137
 
                                                "audio/x-pn-realaudio-plugin",
138
 
                                                "audio/x-ms-wmv",
139
 
                                                "audio/x-ms-wax",
140
 
                                                "audio/x-ms-wma",
141
 
                                                "audio/wav",
142
 
                                                "audio/x-wav",
143
 
                                                "audio/mpeg2",
144
 
                                                "audio/x-mpeg2",
145
 
                                                "audio/x-mpeg3",
146
 
                                                "audio/x-mpegurl",
147
 
                                                "audio/basic",
148
 
                                                "audio/x-basic",
149
 
                                                "audio/midi",
150
 
                                                "audio/x-scpls",
151
 
                                                "audio/webm",
152
 
                                                "audio/x-webm"
153
 
                                };
 
95
                        "audio/mpeg",
 
96
                        "audio/mp4",
 
97
                        "audio/flac",
 
98
                        "application/x-musepack",
 
99
                        "application/musepack",
 
100
                        "application/x-ape",
 
101
                        "application/x-id3",
 
102
                        "application/ogg",
 
103
                        "application/x-ogg",
 
104
                        "application/x-vorbis+ogg",
 
105
                        "application/x-flac",
 
106
                        "application/vnd.rn-realaudio",
 
107
                        "application/x-nsv-vp3-mp3",
 
108
                        "audio/x-musepack",
 
109
                        "audio/musepack",
 
110
                        "audio/ape",
 
111
                        "audio/x-ape",
 
112
                        "audio/x-mp3",
 
113
                        "audio/mpeg",
 
114
                        "audio/x-mpeg",
 
115
                        "audio/x-mpeg-3",
 
116
                        "audio/mpeg3",
 
117
                        "audio/mp3",
 
118
                        "audio/mp4",
 
119
                        "audio/x-m4a",
 
120
                        "audio/mpc",
 
121
                        "audio/x-mpc",
 
122
                        "audio/mp",
 
123
                        "audio/x-mp",
 
124
                        "audio/x-vorbis+ogg",
 
125
                        "audio/vorbis",
 
126
                        "audio/x-vorbis",
 
127
                        "audio/ogg",
 
128
                        "audio/x-ogg",
 
129
                        "audio/x-flac",
 
130
                        "audio/flac",
 
131
                        "audio/x-s3m",
 
132
                        "audio/x-mod",
 
133
                        "audio/x-xm",
 
134
                        "audio/x-it",
 
135
                        "audio/x-pn-realaudio",
 
136
                        "audio/x-realaudio",
 
137
                        "audio/x-pn-realaudio-plugin",
 
138
                        "audio/x-ms-wmv",
 
139
                        "audio/x-ms-wax",
 
140
                        "audio/x-ms-wma",
 
141
                        "audio/wav",
 
142
                        "audio/x-wav",
 
143
                        "audio/mpeg2",
 
144
                        "audio/x-mpeg2",
 
145
                        "audio/x-mpeg3",
 
146
                        "audio/x-mpegurl",
 
147
                        "audio/basic",
 
148
                        "audio/x-basic",
 
149
                        "audio/midi",
 
150
                        "audio/x-scpls",
 
151
                        "audio/webm",
 
152
                        "audio/x-webm"
 
153
                };
154
154
 
155
155
            case "image_viewer":
156
156
                return {    "image/jpeg",
157
 
                                                "image/jpg",
158
 
                                                "image/pjpeg",
159
 
                                                "image/png",
160
 
                                                "image/tiff",
161
 
                                                "image/x-3fr",
162
 
                                                "image/x-adobe-dng",
163
 
                                                "image/x-arw",
164
 
                                                "image/x-bay",
165
 
                                                "image/x-bmp",
166
 
                                                "image/x-canon-cr2",
167
 
                                                "image/x-canon-crw",
168
 
                                                "image/x-cap",
169
 
                                                "image/x-cr2",
170
 
                                                "image/x-crw",
171
 
                                                "image/x-dcr",
172
 
                                                "image/x-dcraw",
173
 
                                                "image/x-dcs",
174
 
                                                "image/x-dng",
175
 
                                                "image/x-drf",
176
 
                                                "image/x-eip",
177
 
                                                "image/x-erf",
178
 
                                                "image/x-fff",
179
 
                                                "image/x-fuji-raf",
180
 
                                                "image/x-iiq",
181
 
                                                "image/x-k25",
182
 
                                                "image/x-kdc",
183
 
                                                "image/x-mef",
184
 
                                                "image/x-minolta-mrw",
185
 
                                                "image/x-mos",
186
 
                                                "image/x-mrw",
187
 
                                                "image/x-nef",
188
 
                                                "image/x-nikon-nef",
189
 
                                                "image/x-nrw",
190
 
                                                "image/x-olympus-orf",
191
 
                                                "image/x-orf",
192
 
                                                "image/x-panasonic-raw",
193
 
                                                "image/x-pef",
194
 
                                                "image/x-pentax-pef",
195
 
                                                "image/x-png",
196
 
                                                "image/x-ptx",
197
 
                                                "image/x-pxn",
198
 
                                                "image/x-r3d",
199
 
                                                "image/x-raf",
200
 
                                                "image/x-raw",
201
 
                                                "image/x-raw",
202
 
                                                "image/x-rw2",
203
 
                                                "image/x-rwl",
204
 
                                                "image/x-rwz",
205
 
                                                "image/x-sigma-x3f",
206
 
                                                "image/x-sony-arw",
207
 
                                                "image/x-sony-sr2",
208
 
                                                "image/x-sony-srf",
209
 
                                                "image/x-sr2",
210
 
                                                "image/x-srf",
211
 
                                                "image/x-x3f"
212
 
                                };
 
157
                        "image/jpg",
 
158
                        "image/pjpeg",
 
159
                        "image/png",
 
160
                        "image/tiff",
 
161
                        "image/x-3fr",
 
162
                        "image/x-adobe-dng",
 
163
                        "image/x-arw",
 
164
                        "image/x-bay",
 
165
                        "image/x-bmp",
 
166
                        "image/x-canon-cr2",
 
167
                        "image/x-canon-crw",
 
168
                        "image/x-cap",
 
169
                        "image/x-cr2",
 
170
                        "image/x-crw",
 
171
                        "image/x-dcr",
 
172
                        "image/x-dcraw",
 
173
                        "image/x-dcs",
 
174
                        "image/x-dng",
 
175
                        "image/x-drf",
 
176
                        "image/x-eip",
 
177
                        "image/x-erf",
 
178
                        "image/x-fff",
 
179
                        "image/x-fuji-raf",
 
180
                        "image/x-iiq",
 
181
                        "image/x-k25",
 
182
                        "image/x-kdc",
 
183
                        "image/x-mef",
 
184
                        "image/x-minolta-mrw",
 
185
                        "image/x-mos",
 
186
                        "image/x-mrw",
 
187
                        "image/x-nef",
 
188
                        "image/x-nikon-nef",
 
189
                        "image/x-nrw",
 
190
                        "image/x-olympus-orf",
 
191
                        "image/x-orf",
 
192
                        "image/x-panasonic-raw",
 
193
                        "image/x-pef",
 
194
                        "image/x-pentax-pef",
 
195
                        "image/x-png",
 
196
                        "image/x-ptx",
 
197
                        "image/x-pxn",
 
198
                        "image/x-r3d",
 
199
                        "image/x-raf",
 
200
                        "image/x-raw",
 
201
                        "image/x-raw",
 
202
                        "image/x-rw2",
 
203
                        "image/x-rwl",
 
204
                        "image/x-rwz",
 
205
                        "image/x-sigma-x3f",
 
206
                        "image/x-sony-arw",
 
207
                        "image/x-sony-sr2",
 
208
                        "image/x-sony-srf",
 
209
                        "image/x-sr2",
 
210
                        "image/x-srf",
 
211
                        "image/x-x3f"
 
212
                };
213
213
 
214
214
            case "text_editor":
215
215
                return { "application/xml",
216
 
                                                "text/plain",
217
 
                                                "text/xml"
218
 
                                };
 
216
                        "text/plain",
 
217
                        "text/xml"
 
218
                };
219
219
 
220
220
            case "file_browser":
221
 
                                return { "inode/directory",
222
 
                                                "x-directory/normal",
223
 
                                                "x-directory/gnome-default-handler"
224
 
                                };
 
221
                return { "inode/directory",
 
222
                        "x-directory/normal",
 
223
                        "x-directory/gnome-default-handler"
 
224
                };
225
225
 
226
226
            default:
227
227
                return {};
228
 
                }
229
 
        }
 
228
        }
 
229
    }
230
230
}
 
 
b'\\ No newline at end of file'