Merge lp:~awn-core/libdesktop-agnostic/various-fixes into lp:libdesktop-agnostic
- various-fixes
- Merge into trunk
Status: | Merged | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 399 | ||||||||||||||||||||||||||||||||
Proposed branch: | lp:~awn-core/libdesktop-agnostic/various-fixes | ||||||||||||||||||||||||||||||||
Merge into: | lp:libdesktop-agnostic | ||||||||||||||||||||||||||||||||
Diff against target: |
2099 lines (+1062/-186) 37 files modified
debian/control (+3/-3) docs/known-issues.rst (+1/-1) libdesktop-agnostic/config-bridge.vala (+4/-6) libdesktop-agnostic/config-client.vala (+2/-3) libdesktop-agnostic/config-impl-gconf.vala (+0/-1) libdesktop-agnostic/config-impl-keyfile.vala (+4/-1) libdesktop-agnostic/config-impl-memory.vala (+0/-1) libdesktop-agnostic/config-impl-null.vala (+0/-1) libdesktop-agnostic/config-schema.vala (+2/-1) libdesktop-agnostic/config-type-color.vala (+0/-1) libdesktop-agnostic/desktop-entry-impl-gio.vala (+394/-0) libdesktop-agnostic/desktop-entry-impl-glib.vala (+53/-1) libdesktop-agnostic/desktop-entry-impl-gnome.vala (+0/-1) libdesktop-agnostic/ui-color-button.vala (+1/-1) libdesktop-agnostic/ui-icon-chooser-dialog.vala (+147/-64) libdesktop-agnostic/ui-launcher-editor-dialog.vala (+123/-53) libdesktop-agnostic/vfs-bookmarks-gtk.vala (+1/-1) libdesktop-agnostic/vfs-file-impl-gio.vala (+65/-0) libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala (+18/-0) libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala (+18/-0) libdesktop-agnostic/vfs-file.vala (+42/-0) libdesktop-agnostic/vfs-impl-gio.vala (+0/-1) libdesktop-agnostic/vfs-impl-gnome-vfs.vala (+0/-1) libdesktop-agnostic/vfs-impl-thunar-vfs.vala (+0/-1) libdesktop-agnostic/vfs-trash-impl-gio.vala (+1/-1) libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala (+1/-1) libdesktop-agnostic/vfs-volume-impl-gio.vala (+4/-4) libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala (+1/-2) libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala (+1/-1) libdesktop-agnostic/wscript (+14/-5) python/desktopagnostic.override (+22/-14) python/fdo.override (+15/-3) python/ui.override (+5/-1) python/vfs.defs (+38/-0) python/vfs.override (+70/-6) tools/lda-desktop-entry-editor.vala (+2/-2) wscript (+10/-3) |
||||||||||||||||||||||||||||||||
To merge this branch: | bzr merge lp:~awn-core/libdesktop-agnostic/various-fixes | ||||||||||||||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mark Lee | style, build system | Needs Fixing | |
Julien Lavergne | Approve | ||
Review via email: mp+45033@code.launchpad.net |
Commit message
Description of the change
Could we please merge this into trunk. I understand it may not be perfect but we have a large number of users of awn trunk who need this... many who have been waiting very patiently. I'd be really happy if this could be merged and a snapshot release made. dave_largo is running out of a release window and may be stuck with releasing awn 0.4.0 to his users if something isn't done soon.
Michal Hruby (mhr3) wrote : | # |
I'd like Mark to look at the addition of "--disable-gi" configure option, I'm sure it could use some cleanup. Other than that I think this should be good to go (wonder why there's no diff here)...
Mark Lee (malept) wrote : | # |
> I'd like Mark to look at the addition of "--disable-gi" configure option,
> I'm sure it could use some cleanup.
Done, among other things:
=== libdesktop-
> + if bld.env[
Two lines, please (PEP8 applies). Same for all of the other instances.
=== python/
+ if (ret != NULL)
+ g_object_unref (ret);
Could someone please add curly braces to all of the statements which don't have them?
=== wscript:
+ opt.add_
+ dest='no_gi', default=False)
I generally don't like the idea of variable names with negatives in them. Could it change to be "dest='enable_gi', default=True)"?
> (wonder why there's no diff here)...
It looks like it's because the parent branch doesn't take into account my changing of the owner. I couldn't even `bzr branch` until I temporarily changed the owner of the main branch back to myself. Really stupid.
Michal Hruby (mhr3) wrote : | # |
> It looks like it's because the parent branch doesn't take into account my changing of the owner. I couldn't even `bzr branch` until I temporarily changed the owner of the main branch back to myself. Really stupid.
Got LP guys to fix it.
- 424. By Michal Hruby
-
Whoops, did I remove gilir's commit?
- 425. By Michal Hruby
-
PEP8 changes to wscript
Michal Hruby (mhr3) wrote : | # |
> > I'd like Mark to look at the addition of "--disable-gi" configure option,
> > I'm sure it could use some cleanup.
>
> Done, among other things:
>
> === libdesktop-
> > + if bld.env[
>
> Two lines, please (PEP8 applies). Same for all of the other instances.
Done.
>
> === python/
> + if (ret != NULL)
> + g_object_unref (ret);
>
> Could someone please add curly braces to all of the statements which don't
> have them?
This is the style rest of the python code generation uses.
>
> === wscript:
>
> + opt.add_
> + dest='no_gi', default=False)
>
> I generally don't like the idea of variable names with negatives in them.
> Could it change to be "dest='enable_gi', default=True)"?
>
I tried, but waf is too stupid to figure out that --disable-xyz is opposite of --enable-xyz. And no it doesn't support --enable-
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2010-04-18 20:00:06 +0000 | |||
3 | +++ debian/control 2011-02-13 20:22:06 +0000 | |||
4 | @@ -9,9 +9,9 @@ | |||
5 | 9 | intltool, | 9 | intltool, |
6 | 10 | valac (>= 0.7.10), | 10 | valac (>= 0.7.10), |
7 | 11 | gobject-introspection (>= 0.6.3), | 11 | gobject-introspection (>= 0.6.3), |
11 | 12 | gobject-introspection-glib-2.0, | 12 | gir-repository-dev (>= 0.6.3) | gobject-introspection-glib-2.0, |
12 | 13 | gobject-introspection-freedesktop, | 13 | gir-repository-dev (>= 0.6.3) | gobject-introspection-freedesktop, |
13 | 14 | gobject-introspection-repository, | 14 | gir-repository-dev (>= 0.6.3) | gobject-introspection-repository, |
14 | 15 | libgirepository1.0-dev (>= 0.6.3), | 15 | libgirepository1.0-dev (>= 0.6.3), |
15 | 16 | libglib2.0-dev (>= 2.16.0), | 16 | libglib2.0-dev (>= 2.16.0), |
16 | 17 | libgtk2.0-dev, | 17 | libgtk2.0-dev, |
17 | 18 | 18 | ||
18 | === modified file 'docs/known-issues.rst' | |||
19 | --- docs/known-issues.rst 2009-08-18 17:29:21 +0000 | |||
20 | +++ docs/known-issues.rst 2011-02-13 20:22:06 +0000 | |||
21 | @@ -19,7 +19,7 @@ | |||
22 | 19 | config-bridge.vala:164: warning: pointer targets in passing argument 2 of ‘g_object_class_list_properties’ differ in signedness | 19 | config-bridge.vala:164: warning: pointer targets in passing argument 2 of ‘g_object_class_list_properties’ differ in signedness |
23 | 20 | desktop-entry-impl-glib.c:306: warning: pointer targets in passing argument 4 of ‘g_key_file_get_string_list’ differ in signedness | 20 | desktop-entry-impl-glib.c:306: warning: pointer targets in passing argument 4 of ‘g_key_file_get_string_list’ differ in signedness |
24 | 21 | 21 | ||
26 | 22 | .. [1] See `GNOME Bug #582092`_. | 22 | .. [1] See `GNOME Bug #582092`_ (fixed in Vala 0.9.1). |
27 | 23 | .. [2] See `GNOME Bug #529866`_ (fixed in Vala 0.7.6). | 23 | .. [2] See `GNOME Bug #529866`_ (fixed in Vala 0.7.6). |
28 | 24 | .. [3] See `GNOME Bug #592108`_ (fixed in Vala 0.7.6). | 24 | .. [3] See `GNOME Bug #592108`_ (fixed in Vala 0.7.6). |
29 | 25 | 25 | ||
30 | 26 | 26 | ||
31 | === modified file 'libdesktop-agnostic/config-bridge.vala' | |||
32 | --- libdesktop-agnostic/config-bridge.vala 2010-03-31 20:31:44 +0000 | |||
33 | +++ libdesktop-agnostic/config-bridge.vala 2011-02-13 20:22:06 +0000 | |||
34 | @@ -202,14 +202,13 @@ | |||
35 | 202 | string key, ParamSpec spec, | 202 | string key, ParamSpec spec, |
36 | 203 | NotifyFuncHandler func) throws GLib.Error | 203 | NotifyFuncHandler func) throws GLib.Error |
37 | 204 | { | 204 | { |
40 | 205 | unowned BindingNotifier notifier; | 205 | unowned BindingNotifier? notifier; |
41 | 206 | notifier = (BindingNotifier*) config.get_data ("lda-binding-notifier"); | 206 | notifier = config.get_data ("lda-binding-notifier"); |
42 | 207 | if (notifier == null) | 207 | if (notifier == null) |
43 | 208 | { | 208 | { |
44 | 209 | BindingNotifier new_notifier = new BindingNotifier (config); | 209 | BindingNotifier new_notifier = new BindingNotifier (config); |
45 | 210 | notifier = new_notifier; | 210 | notifier = new_notifier; |
48 | 211 | config.set_data_full ("lda-binding-notifier", notifier.@ref (), | 211 | config.set_data ("lda-binding-notifier", notifier); |
47 | 212 | Object.unref); | ||
49 | 213 | } | 212 | } |
50 | 214 | 213 | ||
51 | 215 | if (spec.value_type == typeof (bool) || | 214 | if (spec.value_type == typeof (bool) || |
52 | @@ -353,8 +352,7 @@ | |||
53 | 353 | uint pos = -1; | 352 | uint pos = -1; |
54 | 354 | string binding_key; | 353 | string binding_key; |
55 | 355 | 354 | ||
58 | 356 | unowned BindingListWrapper? obj_bindings = | 355 | unowned BindingListWrapper? obj_bindings = obj.get_data ("lda-bindings"); |
57 | 357 | (BindingListWrapper*) obj.get_data ("lda-bindings"); | ||
59 | 358 | binding_key = "%s/%s/%s".printf (config.instance_id, group, key); | 356 | binding_key = "%s/%s/%s".printf (config.instance_id, group, key); |
60 | 359 | bindings_list = this.bindings.get_data (binding_key); | 357 | bindings_list = this.bindings.get_data (binding_key); |
61 | 360 | bindings_to_remove = new SList<uint> (); | 358 | bindings_to_remove = new SList<uint> (); |
62 | 361 | 359 | ||
63 | === modified file 'libdesktop-agnostic/config-client.vala' | |||
64 | --- libdesktop-agnostic/config-client.vala 2010-04-07 22:45:37 +0000 | |||
65 | +++ libdesktop-agnostic/config-client.vala 2011-02-13 20:22:06 +0000 | |||
66 | @@ -101,13 +101,12 @@ | |||
67 | 101 | // constructors | 101 | // constructors |
68 | 102 | public Client (string schema_filename) | 102 | public Client (string schema_filename) |
69 | 103 | { | 103 | { |
71 | 104 | this.schema_filename = schema_filename; | 104 | GLib.Object (schema_filename: schema_filename); |
72 | 105 | } | 105 | } |
73 | 106 | public Client.for_instance (string schema_filename, | 106 | public Client.for_instance (string schema_filename, |
74 | 107 | string instance_id) throws GLib.Error | 107 | string instance_id) throws GLib.Error |
75 | 108 | { | 108 | { |
78 | 109 | this.schema_filename = schema_filename; | 109 | GLib.Object (schema_filename: schema_filename, instance_id: instance_id); |
77 | 110 | this.instance_id = instance_id; | ||
79 | 111 | } | 110 | } |
80 | 112 | /** | 111 | /** |
81 | 113 | * Auto-determines whether an instance config object should be created. | 112 | * Auto-determines whether an instance config object should be created. |
82 | 114 | 113 | ||
83 | === modified file 'libdesktop-agnostic/config-impl-gconf.vala' | |||
84 | --- libdesktop-agnostic/config-impl-gconf.vala 2010-02-04 22:08:30 +0000 | |||
85 | +++ libdesktop-agnostic/config-impl-gconf.vala 2011-02-13 20:22:06 +0000 | |||
86 | @@ -654,7 +654,6 @@ | |||
87 | 654 | } | 654 | } |
88 | 655 | } | 655 | } |
89 | 656 | 656 | ||
90 | 657 | [ModuleInit] | ||
91 | 658 | public Type | 657 | public Type |
92 | 659 | register_plugin () | 658 | register_plugin () |
93 | 660 | { | 659 | { |
94 | 661 | 660 | ||
95 | === modified file 'libdesktop-agnostic/config-impl-keyfile.vala' | |||
96 | --- libdesktop-agnostic/config-impl-keyfile.vala 2009-10-21 18:48:42 +0000 | |||
97 | +++ libdesktop-agnostic/config-impl-keyfile.vala 2011-02-13 20:22:06 +0000 | |||
98 | @@ -697,6 +697,10 @@ | |||
99 | 697 | 697 | ||
100 | 698 | if (value.n_values == 0) | 698 | if (value.n_values == 0) |
101 | 699 | { | 699 | { |
102 | 700 | if (!this._data.has_group (group)) | ||
103 | 701 | { | ||
104 | 702 | return; | ||
105 | 703 | } | ||
106 | 700 | if (this._data.has_key (group, key)) | 704 | if (this._data.has_key (group, key)) |
107 | 701 | { | 705 | { |
108 | 702 | // set_*_list() doesn't like NULL lists, so just unset the key. | 706 | // set_*_list() doesn't like NULL lists, so just unset the key. |
109 | @@ -764,7 +768,6 @@ | |||
110 | 764 | } | 768 | } |
111 | 765 | } | 769 | } |
112 | 766 | } | 770 | } |
113 | 767 | [ModuleInit] | ||
114 | 768 | public Type | 771 | public Type |
115 | 769 | register_plugin () | 772 | register_plugin () |
116 | 770 | { | 773 | { |
117 | 771 | 774 | ||
118 | === modified file 'libdesktop-agnostic/config-impl-memory.vala' | |||
119 | --- libdesktop-agnostic/config-impl-memory.vala 2009-08-15 18:26:33 +0000 | |||
120 | +++ libdesktop-agnostic/config-impl-memory.vala 2011-02-13 20:22:06 +0000 | |||
121 | @@ -226,7 +226,6 @@ | |||
122 | 226 | } | 226 | } |
123 | 227 | } | 227 | } |
124 | 228 | } | 228 | } |
125 | 229 | [ModuleInit] | ||
126 | 230 | public Type | 229 | public Type |
127 | 231 | register_plugin () | 230 | register_plugin () |
128 | 232 | { | 231 | { |
129 | 233 | 232 | ||
130 | === modified file 'libdesktop-agnostic/config-impl-null.vala' | |||
131 | --- libdesktop-agnostic/config-impl-null.vala 2009-08-06 06:38:30 +0000 | |||
132 | +++ libdesktop-agnostic/config-impl-null.vala 2011-02-13 20:22:06 +0000 | |||
133 | @@ -121,7 +121,6 @@ | |||
134 | 121 | } | 121 | } |
135 | 122 | } | 122 | } |
136 | 123 | } | 123 | } |
137 | 124 | [ModuleInit] | ||
138 | 125 | public Type | 124 | public Type |
139 | 126 | register_plugin () | 125 | register_plugin () |
140 | 127 | { | 126 | { |
141 | 128 | 127 | ||
142 | === modified file 'libdesktop-agnostic/config-schema.vala' | |||
143 | --- libdesktop-agnostic/config-schema.vala 2009-09-26 20:13:40 +0000 | |||
144 | +++ libdesktop-agnostic/config-schema.vala 2011-02-13 20:22:06 +0000 | |||
145 | @@ -188,7 +188,8 @@ | |||
146 | 188 | */ | 188 | */ |
147 | 189 | public Schema (string filename) throws GLib.Error | 189 | public Schema (string filename) throws GLib.Error |
148 | 190 | { | 190 | { |
150 | 191 | this.filename = filename; | 191 | GLib.Object (filename: filename); |
151 | 192 | |||
152 | 192 | unowned HashTable<string,Value?> backend_metadata_keys; | 193 | unowned HashTable<string,Value?> backend_metadata_keys; |
153 | 193 | this.options = Datalist<SchemaOption> (); | 194 | this.options = Datalist<SchemaOption> (); |
154 | 194 | this.keys = new HashTable<string,List<string>> (str_hash, str_equal); | 195 | this.keys = new HashTable<string,List<string>> (str_hash, str_equal); |
155 | 195 | 196 | ||
156 | === modified file 'libdesktop-agnostic/config-type-color.vala' | |||
157 | --- libdesktop-agnostic/config-type-color.vala 2009-07-31 06:50:20 +0000 | |||
158 | +++ libdesktop-agnostic/config-type-color.vala 2011-02-13 20:22:06 +0000 | |||
159 | @@ -120,7 +120,6 @@ | |||
160 | 120 | dest_value = ct.deserialize ((string)src_value); | 120 | dest_value = ct.deserialize ((string)src_value); |
161 | 121 | } | 121 | } |
162 | 122 | } | 122 | } |
163 | 123 | [ModuleInit] | ||
164 | 124 | public Type | 123 | public Type |
165 | 125 | register_plugin () | 124 | register_plugin () |
166 | 126 | { | 125 | { |
167 | 127 | 126 | ||
168 | === added file 'libdesktop-agnostic/desktop-entry-impl-gio.vala' | |||
169 | --- libdesktop-agnostic/desktop-entry-impl-gio.vala 1970-01-01 00:00:00 +0000 | |||
170 | +++ libdesktop-agnostic/desktop-entry-impl-gio.vala 2011-02-13 20:22:06 +0000 | |||
171 | @@ -0,0 +1,394 @@ | |||
172 | 1 | /* | ||
173 | 2 | * Desktop Agnostic Library: Desktop Entry implementation using GLib. | ||
174 | 3 | * | ||
175 | 4 | * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com> | ||
176 | 5 | * | ||
177 | 6 | * This library is free software; you can redistribute it and/or | ||
178 | 7 | * modify it under the terms of the GNU Lesser General Public | ||
179 | 8 | * License as published by the Free Software Foundation; either | ||
180 | 9 | * version 2.1 of the License, or (at your option) any later version. | ||
181 | 10 | * | ||
182 | 11 | * This library is distributed in the hope that it will be useful, | ||
183 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
184 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
185 | 14 | * Lesser General Public License for more details. | ||
186 | 15 | * | ||
187 | 16 | * You should have received a copy of the GNU Lesser General Public | ||
188 | 17 | * License along with this library; if not, write to the Free Software | ||
189 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
190 | 19 | * | ||
191 | 20 | * Author : Michal Hruby <michal.mhr@gmail.com> | ||
192 | 21 | */ | ||
193 | 22 | |||
194 | 23 | using DesktopAgnostic; | ||
195 | 24 | |||
196 | 25 | namespace DesktopAgnostic.FDO | ||
197 | 26 | { | ||
198 | 27 | private const string GROUP = "Desktop Entry"; | ||
199 | 28 | public class DesktopEntryGio : DesktopEntry, Object | ||
200 | 29 | { | ||
201 | 30 | private KeyFile _keyfile = new KeyFile (); | ||
202 | 31 | private bool loaded = false; | ||
203 | 32 | private VFS.File _file = null; | ||
204 | 33 | |||
205 | 34 | public VFS.File? file | ||
206 | 35 | { | ||
207 | 36 | get | ||
208 | 37 | { | ||
209 | 38 | return this._file; | ||
210 | 39 | } | ||
211 | 40 | set construct | ||
212 | 41 | { | ||
213 | 42 | if (value != null) | ||
214 | 43 | { | ||
215 | 44 | if (this.loaded) | ||
216 | 45 | { | ||
217 | 46 | warning ("The desktop entry has already been initialized."); | ||
218 | 47 | } | ||
219 | 48 | else if (value.exists ()) | ||
220 | 49 | { | ||
221 | 50 | string? path; | ||
222 | 51 | |||
223 | 52 | this._file = value; | ||
224 | 53 | path = value.path; | ||
225 | 54 | if (path == null) | ||
226 | 55 | { | ||
227 | 56 | string data; | ||
228 | 57 | size_t data_len; | ||
229 | 58 | |||
230 | 59 | this._file.load_contents (out data, out data_len); | ||
231 | 60 | this._keyfile.load_from_data (data, data_len, | ||
232 | 61 | KeyFileFlags.KEEP_TRANSLATIONS); | ||
233 | 62 | } | ||
234 | 63 | else | ||
235 | 64 | { | ||
236 | 65 | this._keyfile.load_from_file (path, KeyFileFlags.KEEP_TRANSLATIONS); | ||
237 | 66 | } | ||
238 | 67 | this.loaded = true; | ||
239 | 68 | } | ||
240 | 69 | } | ||
241 | 70 | } | ||
242 | 71 | } | ||
243 | 72 | |||
244 | 73 | public KeyFile keyfile | ||
245 | 74 | { | ||
246 | 75 | get | ||
247 | 76 | { | ||
248 | 77 | return this._keyfile; | ||
249 | 78 | } | ||
250 | 79 | set construct | ||
251 | 80 | { | ||
252 | 81 | if (value != null) | ||
253 | 82 | { | ||
254 | 83 | if (this.loaded) | ||
255 | 84 | { | ||
256 | 85 | warning ("The desktop entry has already been initialized."); | ||
257 | 86 | } | ||
258 | 87 | else | ||
259 | 88 | { | ||
260 | 89 | string data; | ||
261 | 90 | size_t length; | ||
262 | 91 | |||
263 | 92 | data = value.to_data (out length); | ||
264 | 93 | this._keyfile.load_from_data (data, length, | ||
265 | 94 | KeyFileFlags.KEEP_TRANSLATIONS); | ||
266 | 95 | this.loaded = true; | ||
267 | 96 | } | ||
268 | 97 | } | ||
269 | 98 | } | ||
270 | 99 | } | ||
271 | 100 | |||
272 | 101 | public string data | ||
273 | 102 | { | ||
274 | 103 | set construct | ||
275 | 104 | { | ||
276 | 105 | if (value != null && value != "") | ||
277 | 106 | { | ||
278 | 107 | if (this.loaded) | ||
279 | 108 | { | ||
280 | 109 | warning ("The desktop entry has already been initialized."); | ||
281 | 110 | } | ||
282 | 111 | else | ||
283 | 112 | { | ||
284 | 113 | this._keyfile.load_from_data (value, value.size (), | ||
285 | 114 | KeyFileFlags.KEEP_TRANSLATIONS); | ||
286 | 115 | this.loaded = true; | ||
287 | 116 | } | ||
288 | 117 | } | ||
289 | 118 | } | ||
290 | 119 | } | ||
291 | 120 | |||
292 | 121 | public DesktopEntryType entry_type | ||
293 | 122 | { | ||
294 | 123 | get | ||
295 | 124 | { | ||
296 | 125 | string type = this.get_string ("Type"); | ||
297 | 126 | switch (type) | ||
298 | 127 | { | ||
299 | 128 | case "Application": | ||
300 | 129 | return DesktopEntryType.APPLICATION; | ||
301 | 130 | case "Link": | ||
302 | 131 | return DesktopEntryType.LINK; | ||
303 | 132 | case "Directory": | ||
304 | 133 | return DesktopEntryType.DIRECTORY; | ||
305 | 134 | default: | ||
306 | 135 | return DesktopEntryType.UNKNOWN; | ||
307 | 136 | } | ||
308 | 137 | } | ||
309 | 138 | set | ||
310 | 139 | { | ||
311 | 140 | this.set_string ("Type", desktop_entry_type_to_string (value)); | ||
312 | 141 | } | ||
313 | 142 | } | ||
314 | 143 | |||
315 | 144 | public string name | ||
316 | 145 | { | ||
317 | 146 | owned get | ||
318 | 147 | { | ||
319 | 148 | return this.get_string ("Name"); | ||
320 | 149 | } | ||
321 | 150 | set | ||
322 | 151 | { | ||
323 | 152 | this.set_string ("Name", value); | ||
324 | 153 | } | ||
325 | 154 | } | ||
326 | 155 | |||
327 | 156 | public string? icon | ||
328 | 157 | { | ||
329 | 158 | /** | ||
330 | 159 | * If a path is provided then return the given value. Otherwise, | ||
331 | 160 | * strip any extension (.xpm, .svg, .png). | ||
332 | 161 | */ | ||
333 | 162 | owned get | ||
334 | 163 | { | ||
335 | 164 | string? icon_name = this.get_string ("Icon"); | ||
336 | 165 | |||
337 | 166 | if (icon_name != null && Path.get_basename (icon_name) == icon_name) | ||
338 | 167 | { | ||
339 | 168 | icon_name = icon_name.split (".png", 2)[0]; | ||
340 | 169 | icon_name = icon_name.split (".svg", 2)[0]; | ||
341 | 170 | icon_name = icon_name.split (".xpm", 2)[0]; | ||
342 | 171 | } | ||
343 | 172 | |||
344 | 173 | return icon_name; | ||
345 | 174 | } | ||
346 | 175 | set | ||
347 | 176 | { | ||
348 | 177 | if (value == null) | ||
349 | 178 | { | ||
350 | 179 | warning ("Cannot set a NULL value for 'Icon'."); | ||
351 | 180 | } | ||
352 | 181 | else | ||
353 | 182 | { | ||
354 | 183 | this.set_string ("Icon", value); | ||
355 | 184 | } | ||
356 | 185 | } | ||
357 | 186 | } | ||
358 | 187 | |||
359 | 188 | public bool | ||
360 | 189 | key_exists (string key) | ||
361 | 190 | { | ||
362 | 191 | return this._keyfile.has_group (GROUP) && | ||
363 | 192 | this._keyfile.has_key (GROUP, key); | ||
364 | 193 | } | ||
365 | 194 | |||
366 | 195 | public bool | ||
367 | 196 | get_boolean (string key) | ||
368 | 197 | { | ||
369 | 198 | try | ||
370 | 199 | { | ||
371 | 200 | return this._keyfile.get_boolean (GROUP, key); | ||
372 | 201 | } | ||
373 | 202 | catch (KeyFileError err) | ||
374 | 203 | { | ||
375 | 204 | warning ("Error trying to retrieve '%s': %s", key, err.message); | ||
376 | 205 | return false; | ||
377 | 206 | } | ||
378 | 207 | } | ||
379 | 208 | |||
380 | 209 | public void | ||
381 | 210 | set_boolean (string key, bool value) | ||
382 | 211 | { | ||
383 | 212 | this._keyfile.set_boolean (GROUP, key, value); | ||
384 | 213 | } | ||
385 | 214 | |||
386 | 215 | public string? | ||
387 | 216 | get_string (string key) | ||
388 | 217 | { | ||
389 | 218 | try | ||
390 | 219 | { | ||
391 | 220 | return this._keyfile.get_string (GROUP, key); | ||
392 | 221 | } | ||
393 | 222 | catch (KeyFileError err) | ||
394 | 223 | { | ||
395 | 224 | warning ("Error trying to retrieve '%s': %s", key, err.message); | ||
396 | 225 | return null; | ||
397 | 226 | } | ||
398 | 227 | } | ||
399 | 228 | |||
400 | 229 | public void | ||
401 | 230 | set_string (string key, string value) | ||
402 | 231 | { | ||
403 | 232 | this._keyfile.set_string (GROUP, key, value); | ||
404 | 233 | } | ||
405 | 234 | |||
406 | 235 | public string? | ||
407 | 236 | get_localestring (string key, string? locale) | ||
408 | 237 | { | ||
409 | 238 | try | ||
410 | 239 | { | ||
411 | 240 | return this._keyfile.get_locale_string (GROUP, key, locale); | ||
412 | 241 | } | ||
413 | 242 | catch (KeyFileError err) | ||
414 | 243 | { | ||
415 | 244 | warning ("Error trying to retrieve '%s[%s]': %s", key, locale, | ||
416 | 245 | err.message); | ||
417 | 246 | return null; | ||
418 | 247 | } | ||
419 | 248 | } | ||
420 | 249 | |||
421 | 250 | public void | ||
422 | 251 | set_localestring (string key, string locale, string value) | ||
423 | 252 | { | ||
424 | 253 | this._keyfile.set_locale_string (GROUP, key, locale, value); | ||
425 | 254 | } | ||
426 | 255 | |||
427 | 256 | [CCode (array_length = false, array_null_terminated = true)] | ||
428 | 257 | public string[]? | ||
429 | 258 | get_string_list (string key) | ||
430 | 259 | { | ||
431 | 260 | try | ||
432 | 261 | { | ||
433 | 262 | return this._keyfile.get_string_list (GROUP, key); | ||
434 | 263 | } | ||
435 | 264 | catch (KeyFileError err) | ||
436 | 265 | { | ||
437 | 266 | warning ("Error trying to retrieve '%s': %s", key, err.message); | ||
438 | 267 | return null; | ||
439 | 268 | } | ||
440 | 269 | } | ||
441 | 270 | |||
442 | 271 | public void | ||
443 | 272 | set_string_list (string key, [CCode (array_length = false, array_null_terminated = true)] string[] value) | ||
444 | 273 | { | ||
445 | 274 | this._keyfile.set_string_list (GROUP, key, value); | ||
446 | 275 | } | ||
447 | 276 | |||
448 | 277 | /** | ||
449 | 278 | * Based on EggDesktopFile's egg_desktop_file_can_launch(). | ||
450 | 279 | */ | ||
451 | 280 | public bool | ||
452 | 281 | exists () | ||
453 | 282 | { | ||
454 | 283 | switch (this.entry_type) | ||
455 | 284 | { | ||
456 | 285 | case DesktopEntryType.APPLICATION: | ||
457 | 286 | if (this._keyfile.has_key (GROUP, "TryExec")) | ||
458 | 287 | { | ||
459 | 288 | if (Environment.find_program_in_path (this.get_string ("TryExec")) != null) | ||
460 | 289 | { | ||
461 | 290 | return true; | ||
462 | 291 | } | ||
463 | 292 | } | ||
464 | 293 | string? exec; | ||
465 | 294 | string[] argv = null;; | ||
466 | 295 | exec = this.get_string ("Exec"); | ||
467 | 296 | if (exec == null || !Shell.parse_argv (exec, out argv)) | ||
468 | 297 | { | ||
469 | 298 | return false; | ||
470 | 299 | } | ||
471 | 300 | return Environment.find_program_in_path (argv[0]) != null; | ||
472 | 301 | case DesktopEntryType.LINK: | ||
473 | 302 | if (this._keyfile.has_key (GROUP, "URL")) | ||
474 | 303 | { | ||
475 | 304 | string uri = this._keyfile.get_string (GROUP, "URL"); | ||
476 | 305 | VFS.File file = VFS.file_new_for_uri (uri); | ||
477 | 306 | return file.exists (); | ||
478 | 307 | } | ||
479 | 308 | else | ||
480 | 309 | { | ||
481 | 310 | return false; | ||
482 | 311 | } | ||
483 | 312 | default: | ||
484 | 313 | return false; | ||
485 | 314 | } | ||
486 | 315 | } | ||
487 | 316 | |||
488 | 317 | /** | ||
489 | 318 | * Launch desktop entry. | ||
490 | 319 | * @return always zero. | ||
491 | 320 | */ | ||
492 | 321 | public Pid | ||
493 | 322 | launch (DesktopEntryLaunchFlags flags, | ||
494 | 323 | SList<string>? documents) throws GLib.Error | ||
495 | 324 | { | ||
496 | 325 | List<unowned string> uris = new List<unowned string> (); | ||
497 | 326 | foreach (unowned string s in documents) | ||
498 | 327 | { | ||
499 | 328 | uris.append (s); | ||
500 | 329 | } | ||
501 | 330 | |||
502 | 331 | // interesting that GIO 2.26 supports only APPLICATION | ||
503 | 332 | switch (this.entry_type) | ||
504 | 333 | { | ||
505 | 334 | case DesktopEntryType.APPLICATION: | ||
506 | 335 | AppInfo info; | ||
507 | 336 | if (this._file != null) | ||
508 | 337 | { | ||
509 | 338 | info = new DesktopAppInfo.from_filename (this._file.path); | ||
510 | 339 | } | ||
511 | 340 | else | ||
512 | 341 | { | ||
513 | 342 | info = new DesktopAppInfo.from_keyfile (this._keyfile); | ||
514 | 343 | } | ||
515 | 344 | |||
516 | 345 | //var context = new AppLaunchContext (); | ||
517 | 346 | info.launch_uris (uris, null); | ||
518 | 347 | |||
519 | 348 | break; | ||
520 | 349 | case DesktopEntryType.LINK: | ||
521 | 350 | if (this._keyfile.has_key (GROUP, "URL")) | ||
522 | 351 | { | ||
523 | 352 | string uri = this._keyfile.get_string (GROUP, "URL"); | ||
524 | 353 | AppInfo.launch_default_for_uri (uri, null); | ||
525 | 354 | } | ||
526 | 355 | else | ||
527 | 356 | { | ||
528 | 357 | throw new DesktopEntryError.NOT_LAUNCHABLE ("Invalid desktop entry."); | ||
529 | 358 | } | ||
530 | 359 | break; | ||
531 | 360 | default: | ||
532 | 361 | throw new DesktopEntryError.NOT_LAUNCHABLE ("Unknown desktop entry type."); | ||
533 | 362 | } | ||
534 | 363 | |||
535 | 364 | return (Pid) 0; | ||
536 | 365 | } | ||
537 | 366 | |||
538 | 367 | public void | ||
539 | 368 | save (VFS.File? new_file) throws GLib.Error | ||
540 | 369 | { | ||
541 | 370 | VFS.File? file = null; | ||
542 | 371 | if (new_file != null) | ||
543 | 372 | { | ||
544 | 373 | file = new_file; | ||
545 | 374 | } | ||
546 | 375 | else if (this._file != null) | ||
547 | 376 | { | ||
548 | 377 | file = this._file; | ||
549 | 378 | } | ||
550 | 379 | else | ||
551 | 380 | { | ||
552 | 381 | throw new DesktopEntryError.INVALID_FILE ("No filename specified."); | ||
553 | 382 | } | ||
554 | 383 | file.replace_contents (this._keyfile.to_data ()); | ||
555 | 384 | } | ||
556 | 385 | } | ||
557 | 386 | } | ||
558 | 387 | |||
559 | 388 | public Type | ||
560 | 389 | register_plugin () | ||
561 | 390 | { | ||
562 | 391 | return typeof (DesktopAgnostic.FDO.DesktopEntryGio); | ||
563 | 392 | } | ||
564 | 393 | |||
565 | 394 | // vim: set ts=2 sts=2 sw=2 et ai cindent : | ||
566 | 0 | 395 | ||
567 | === modified file 'libdesktop-agnostic/desktop-entry-impl-glib.vala' | |||
568 | --- libdesktop-agnostic/desktop-entry-impl-glib.vala 2010-03-26 22:45:36 +0000 | |||
569 | +++ libdesktop-agnostic/desktop-entry-impl-glib.vala 2011-02-13 20:22:06 +0000 | |||
570 | @@ -531,6 +531,59 @@ | |||
571 | 531 | throw new DesktopEntryError.NOT_LAUNCHABLE ("Could not parse Exec key."); | 531 | throw new DesktopEntryError.NOT_LAUNCHABLE ("Could not parse Exec key."); |
572 | 532 | } | 532 | } |
573 | 533 | 533 | ||
574 | 534 | if (this._keyfile.has_key (GROUP, "Terminal") && | ||
575 | 535 | this.get_boolean ("Terminal")) | ||
576 | 536 | { | ||
577 | 537 | string[] term_argv = new string[argv.length + 2]; | ||
578 | 538 | |||
579 | 539 | // based on the code for GDesktopAppInfo | ||
580 | 540 | string? check = null; | ||
581 | 541 | check = Environment.find_program_in_path ("gnome-terminal"); | ||
582 | 542 | if (check != null) | ||
583 | 543 | { | ||
584 | 544 | term_argv[0] = check; | ||
585 | 545 | term_argv[1] = "-x"; | ||
586 | 546 | } | ||
587 | 547 | else | ||
588 | 548 | { | ||
589 | 549 | if (check == null) | ||
590 | 550 | { | ||
591 | 551 | check = Environment.find_program_in_path ("nxterm"); | ||
592 | 552 | } | ||
593 | 553 | if (check == null) | ||
594 | 554 | { | ||
595 | 555 | check = Environment.find_program_in_path ("color-xterm"); | ||
596 | 556 | } | ||
597 | 557 | if (check == null) | ||
598 | 558 | { | ||
599 | 559 | check = Environment.find_program_in_path ("rxvt"); | ||
600 | 560 | } | ||
601 | 561 | if (check == null) | ||
602 | 562 | { | ||
603 | 563 | check = Environment.find_program_in_path ("xterm"); | ||
604 | 564 | } | ||
605 | 565 | if (check == null) | ||
606 | 566 | { | ||
607 | 567 | check = Environment.find_program_in_path ("dtterm"); | ||
608 | 568 | } | ||
609 | 569 | if (check == null) | ||
610 | 570 | { | ||
611 | 571 | check = "xterm"; | ||
612 | 572 | warning ("couldn't find a terminal, falling back to xterm"); | ||
613 | 573 | } | ||
614 | 574 | |||
615 | 575 | term_argv[0] = check; | ||
616 | 576 | term_argv[1] = "-e"; | ||
617 | 577 | } | ||
618 | 578 | |||
619 | 579 | for (int i = 0; i < argv.length; i++) | ||
620 | 580 | { | ||
621 | 581 | term_argv[i+2] = argv[i]; | ||
622 | 582 | } | ||
623 | 583 | |||
624 | 584 | argv = (owned) term_argv; | ||
625 | 585 | } | ||
626 | 586 | |||
627 | 534 | Process.spawn_async_with_pipes (working_dir, argv, null, flags, null, out pid); | 587 | Process.spawn_async_with_pipes (working_dir, argv, null, flags, null, out pid); |
628 | 535 | return pid; | 588 | return pid; |
629 | 536 | } | 589 | } |
630 | @@ -614,7 +667,6 @@ | |||
631 | 614 | } | 667 | } |
632 | 615 | } | 668 | } |
633 | 616 | 669 | ||
634 | 617 | [ModuleInit] | ||
635 | 618 | public Type | 670 | public Type |
636 | 619 | register_plugin () | 671 | register_plugin () |
637 | 620 | { | 672 | { |
638 | 621 | 673 | ||
639 | === modified file 'libdesktop-agnostic/desktop-entry-impl-gnome.vala' | |||
640 | --- libdesktop-agnostic/desktop-entry-impl-gnome.vala 2010-03-26 22:45:36 +0000 | |||
641 | +++ libdesktop-agnostic/desktop-entry-impl-gnome.vala 2011-02-13 20:22:06 +0000 | |||
642 | @@ -305,7 +305,6 @@ | |||
643 | 305 | } | 305 | } |
644 | 306 | } | 306 | } |
645 | 307 | 307 | ||
646 | 308 | [ModuleInit] | ||
647 | 309 | public Type | 308 | public Type |
648 | 310 | register_plugin () | 309 | register_plugin () |
649 | 311 | { | 310 | { |
650 | 312 | 311 | ||
651 | === modified file 'libdesktop-agnostic/ui-color-button.vala' | |||
652 | --- libdesktop-agnostic/ui-color-button.vala 2009-10-29 05:26:26 +0000 | |||
653 | +++ libdesktop-agnostic/ui-color-button.vala 2011-02-13 20:22:06 +0000 | |||
654 | @@ -38,7 +38,7 @@ | |||
655 | 38 | this.on_color_set (); | 38 | this.on_color_set (); |
656 | 39 | } | 39 | } |
657 | 40 | 40 | ||
659 | 41 | private override void | 41 | protected override void |
660 | 42 | constructed () | 42 | constructed () |
661 | 43 | { | 43 | { |
662 | 44 | this.use_alpha = true; | 44 | this.use_alpha = true; |
663 | 45 | 45 | ||
664 | === modified file 'libdesktop-agnostic/ui-icon-chooser-dialog.vala' | |||
665 | --- libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-02-04 22:24:49 +0000 | |||
666 | +++ libdesktop-agnostic/ui-icon-chooser-dialog.vala 2011-02-13 20:22:06 +0000 | |||
667 | @@ -35,13 +35,40 @@ | |||
668 | 35 | FILE | 35 | FILE |
669 | 36 | } | 36 | } |
670 | 37 | 37 | ||
671 | 38 | private class LazyPixbufRenderer : CellRendererPixbuf | ||
672 | 39 | { | ||
673 | 40 | public bool item_ready { get; set; default = false; } | ||
674 | 41 | |||
675 | 42 | public signal void prepare_pixbuf (TreePath path); | ||
676 | 43 | |||
677 | 44 | public override void render (Gdk.Window window, | ||
678 | 45 | Gtk.Widget widget, | ||
679 | 46 | Gdk.Rectangle background_area, | ||
680 | 47 | Gdk.Rectangle cell_area, | ||
681 | 48 | Gdk.Rectangle expose_area, | ||
682 | 49 | Gtk.CellRendererState flags) | ||
683 | 50 | { | ||
684 | 51 | if (!item_ready) | ||
685 | 52 | { | ||
686 | 53 | int x, y; | ||
687 | 54 | var view = widget as Gtk.IconView; | ||
688 | 55 | x = cell_area.x + cell_area.width / 2; | ||
689 | 56 | y = cell_area.y + cell_area.height / 2; | ||
690 | 57 | var path = view.get_path_at_pos (x, y); | ||
691 | 58 | prepare_pixbuf (path); | ||
692 | 59 | } | ||
693 | 60 | base.render (window, widget, | ||
694 | 61 | background_area, cell_area, expose_area, flags); | ||
695 | 62 | } | ||
696 | 63 | } | ||
697 | 64 | |||
698 | 38 | public class IconChooserDialog : Dialog | 65 | public class IconChooserDialog : Dialog |
699 | 39 | { | 66 | { |
700 | 40 | private RadioButton _file; | 67 | private RadioButton _file; |
701 | 41 | private RadioButton _themed; | 68 | private RadioButton _themed; |
702 | 42 | private FileChooserButton _directory; | 69 | private FileChooserButton _directory; |
703 | 43 | private ComboBox _themed_context; | 70 | private ComboBox _themed_context; |
705 | 44 | private IconView _file_viewer; | 71 | private IconView? _file_viewer = null; |
706 | 45 | private IconView? _themed_viewer = null; | 72 | private IconView? _themed_viewer = null; |
707 | 46 | private unowned IconView _viewer; | 73 | private unowned IconView _viewer; |
708 | 47 | public string selected_icon { get; private set; default = null; } | 74 | public string selected_icon { get; private set; default = null; } |
709 | @@ -53,16 +80,26 @@ | |||
710 | 53 | PIXBUF, | 80 | PIXBUF, |
711 | 54 | NAME, | 81 | NAME, |
712 | 55 | DATA, | 82 | DATA, |
713 | 83 | PIXBUF_READY, | ||
714 | 56 | COUNT | 84 | COUNT |
715 | 57 | } | 85 | } |
716 | 58 | 86 | ||
717 | 59 | public signal void icon_selected (); | 87 | public signal void icon_selected (); |
718 | 60 | 88 | ||
719 | 89 | private static Gdk.Pixbuf NO_ICON; | ||
720 | 90 | |||
721 | 91 | static construct | ||
722 | 92 | { | ||
723 | 93 | var flags = IconLookupFlags.FORCE_SIZE | IconLookupFlags.GENERIC_FALLBACK; | ||
724 | 94 | NO_ICON = IconTheme.get_default ().load_icon ("gtk-file", 48, flags); | ||
725 | 95 | } | ||
726 | 96 | |||
727 | 61 | construct | 97 | construct |
728 | 62 | { | 98 | { |
729 | 63 | this.response.connect (this.on_response); | 99 | this.response.connect (this.on_response); |
730 | 64 | this.title = _ ("Select Icon"); | 100 | this.title = _ ("Select Icon"); |
731 | 65 | this.icon_name = STOCK_FIND; | 101 | this.icon_name = STOCK_FIND; |
732 | 102 | this.set_default_size (375, 375); | ||
733 | 66 | this.create_ui (); | 103 | this.create_ui (); |
734 | 67 | } | 104 | } |
735 | 68 | 105 | ||
736 | @@ -72,27 +109,17 @@ | |||
737 | 72 | HBox choices; | 109 | HBox choices; |
738 | 73 | 110 | ||
739 | 74 | choices = new HBox (false, 5); | 111 | choices = new HBox (false, 5); |
741 | 75 | this._file = new RadioButton.with_mnemonic (null, _ ("From File")); | 112 | this._themed = new RadioButton.with_mnemonic (null, _ ("From Theme")); |
742 | 113 | choices.add (this._themed); | ||
743 | 114 | this._file = new RadioButton.with_mnemonic_from_widget (this._themed, | ||
744 | 115 | _ ("From File")); | ||
745 | 116 | this._themed.active = true; | ||
746 | 117 | this._themed.toggled.connect (this.on_icon_type_toggled); | ||
747 | 76 | choices.add (this._file); | 118 | choices.add (this._file); |
748 | 77 | this._themed = new RadioButton.with_mnemonic_from_widget (this._file, | ||
749 | 78 | _ ("From Theme")); | ||
750 | 79 | this._themed.active = false; | ||
751 | 80 | this._themed.toggled.connect (this.on_icon_type_toggled); | ||
752 | 81 | choices.add (this._themed); | ||
753 | 82 | this.vbox.pack_start (choices, false, false, 5); | 119 | this.vbox.pack_start (choices, false, false, 5); |
754 | 83 | choices.show_all (); | 120 | choices.show_all (); |
755 | 84 | 121 | ||
767 | 85 | this._directory = new FileChooserButton (_ ("Select icon folder"), | 122 | this.on_icon_type_toggled (); |
757 | 86 | FileChooserAction.SELECT_FOLDER); | ||
758 | 87 | this._directory.current_folder_changed.connect (this.on_folder_changed); | ||
759 | 88 | this.vbox.pack_start (this._directory, false, false, 5); | ||
760 | 89 | this._directory.show (); | ||
761 | 90 | |||
762 | 91 | this.add_icon_viewer (ref this._file_viewer, false); | ||
763 | 92 | this._file_viewer.parent.show_all (); | ||
764 | 93 | this._viewer = this._file_viewer; | ||
765 | 94 | |||
766 | 95 | this.on_folder_changed (this._directory); | ||
768 | 96 | 123 | ||
769 | 97 | this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, | 124 | this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, |
770 | 98 | STOCK_OK, ResponseType.OK); | 125 | STOCK_OK, ResponseType.OK); |
771 | @@ -115,30 +142,64 @@ | |||
772 | 115 | create_icon_viewer (bool themed) | 142 | create_icon_viewer (bool themed) |
773 | 116 | { | 143 | { |
774 | 117 | IconView viewer; | 144 | IconView viewer; |
776 | 118 | CellRendererPixbuf cell_pixbuf; | 145 | LazyPixbufRenderer cell_pixbuf; |
777 | 119 | CellRendererText cell_text; | 146 | CellRendererText cell_text; |
778 | 120 | 147 | ||
779 | 121 | viewer = new IconView.with_model (this.create_model ()); | 148 | viewer = new IconView.with_model (this.create_model ()); |
786 | 122 | viewer.item_width = 72; | 149 | // without this the IconView is not shrinkable after expanding it |
787 | 123 | viewer.columns = 4; | 150 | viewer.set_size_request (108, -1); |
788 | 124 | viewer.column_spacing = 5; | 151 | viewer.set_item_width (108); |
789 | 125 | viewer.set_size_request (325, 300); | 152 | viewer.set_column_spacing (5); |
790 | 126 | viewer.tooltip_column = Column.DATA; | 153 | viewer.set_tooltip_column (Column.DATA); |
791 | 127 | cell_pixbuf = new CellRendererPixbuf (); | 154 | |
792 | 155 | cell_pixbuf = new LazyPixbufRenderer (); | ||
793 | 128 | cell_pixbuf.xalign = 0.5f; | 156 | cell_pixbuf.xalign = 0.5f; |
794 | 129 | cell_pixbuf.yalign = 0.5f; | 157 | cell_pixbuf.yalign = 0.5f; |
795 | 130 | cell_pixbuf.width = 48; | 158 | cell_pixbuf.width = 48; |
796 | 159 | |||
797 | 131 | viewer.pack_start (cell_pixbuf, false); | 160 | viewer.pack_start (cell_pixbuf, false); |
798 | 132 | viewer.add_attribute (cell_pixbuf, "pixbuf", Column.PIXBUF); | 161 | viewer.add_attribute (cell_pixbuf, "pixbuf", Column.PIXBUF); |
799 | 162 | viewer.add_attribute (cell_pixbuf, "item-ready", Column.PIXBUF_READY); | ||
800 | 163 | |||
801 | 164 | cell_pixbuf.prepare_pixbuf.connect ((p) => | ||
802 | 165 | { | ||
803 | 166 | TreeIter iter; | ||
804 | 167 | Value val; | ||
805 | 168 | var store = this._viewer.model as ListStore; | ||
806 | 169 | store.get_iter (out iter, p); | ||
807 | 170 | store.get_value (iter, Column.DATA, out val); | ||
808 | 171 | |||
809 | 172 | string icon_name = val.get_string (); | ||
810 | 173 | IconTheme icon_theme = IconTheme.get_default (); | ||
811 | 174 | var info = icon_theme.lookup_icon (icon_name, 48, 0); | ||
812 | 175 | string? name = info.get_display_name (); | ||
813 | 176 | if (name == null) | ||
814 | 177 | { | ||
815 | 178 | name = icon_name.replace ("-", " "); | ||
816 | 179 | } | ||
817 | 180 | try | ||
818 | 181 | { | ||
819 | 182 | var pixbuf = info.load_icon (); | ||
820 | 183 | store.set (iter, Column.NAME, name, Column.PIXBUF, pixbuf, | ||
821 | 184 | Column.PIXBUF_READY, true, -1); | ||
822 | 185 | } | ||
823 | 186 | catch (Error err) | ||
824 | 187 | { | ||
825 | 188 | warning ("Could not load %s: %s", icon_name, err.message); | ||
826 | 189 | store.set (iter, Column.NAME, name, Column.PIXBUF_READY, true, -1); | ||
827 | 190 | } | ||
828 | 191 | }); | ||
829 | 192 | |||
830 | 133 | cell_text = new CellRendererText (); | 193 | cell_text = new CellRendererText (); |
831 | 134 | cell_text.xalign = 0.5f; | 194 | cell_text.xalign = 0.5f; |
833 | 135 | cell_text.yalign = 0; | 195 | cell_text.yalign = 0.0f; |
834 | 136 | cell_text.wrap_mode = Pango.WrapMode.WORD; | 196 | cell_text.wrap_mode = Pango.WrapMode.WORD; |
838 | 137 | cell_text.wrap_width = 72; | 197 | int wrap_width = viewer.item_width - viewer.item_padding * 2; |
839 | 138 | cell_text.width = 72; | 198 | cell_text.wrap_width = wrap_width; |
840 | 139 | cell_text.ellipsize = Pango.EllipsizeMode.START; | 199 | cell_text.width = wrap_width; |
841 | 200 | cell_text.ellipsize = Pango.EllipsizeMode.MIDDLE; | ||
842 | 140 | viewer.pack_start (cell_text, true); | 201 | viewer.pack_start (cell_text, true); |
844 | 141 | viewer.add_attribute (cell_text, "text", 1); | 202 | viewer.add_attribute (cell_text, "text", Column.NAME); |
845 | 142 | viewer.selection_mode = SelectionMode.SINGLE; | 203 | viewer.selection_mode = SelectionMode.SINGLE; |
846 | 143 | 204 | ||
847 | 144 | return viewer; | 205 | return viewer; |
848 | @@ -148,20 +209,24 @@ | |||
849 | 148 | create_model () | 209 | create_model () |
850 | 149 | { | 210 | { |
851 | 150 | // icon, name, data | 211 | // icon, name, data |
854 | 151 | return new ListStore (Column.COUNT, typeof (Gdk.Pixbuf), typeof (string), | 212 | return new ListStore (Column.COUNT, |
855 | 152 | typeof (string)); | 213 | typeof (Gdk.Pixbuf), |
856 | 214 | typeof (string), | ||
857 | 215 | typeof (string), | ||
858 | 216 | typeof (bool)); | ||
859 | 153 | } | 217 | } |
860 | 154 | 218 | ||
861 | 155 | private void | 219 | private void |
863 | 156 | on_icon_type_toggled (ToggleButton themed) | 220 | on_icon_type_toggled () |
864 | 157 | { | 221 | { |
865 | 158 | if (this._themed.active) | 222 | if (this._themed.active) |
866 | 159 | { | 223 | { |
867 | 160 | if (this._themed_viewer == null) | 224 | if (this._themed_viewer == null) |
868 | 161 | { | 225 | { |
869 | 162 | unowned IconTheme icon_theme; | 226 | unowned IconTheme icon_theme; |
871 | 163 | unowned List<string> context_list; | 227 | List<string> context_list; |
872 | 164 | 228 | ||
873 | 229 | // "From Theme" widgets -> context combobox + icon view | ||
874 | 165 | this._themed_context = new ComboBox.text (); | 230 | this._themed_context = new ComboBox.text (); |
875 | 166 | this._themed_context.changed.connect (this.on_icon_context_changed); | 231 | this._themed_context.changed.connect (this.on_icon_context_changed); |
876 | 167 | this.vbox.pack_start (this._themed_context, false, false, 5); | 232 | this.vbox.pack_start (this._themed_context, false, false, 5); |
877 | @@ -171,21 +236,52 @@ | |||
878 | 171 | icon_theme = IconTheme.get_default (); | 236 | icon_theme = IconTheme.get_default (); |
879 | 172 | context_list = icon_theme.list_contexts (); | 237 | context_list = icon_theme.list_contexts (); |
880 | 173 | context_list.sort ((CompareFunc)strcmp); | 238 | context_list.sort ((CompareFunc)strcmp); |
881 | 239 | |||
882 | 240 | int active_index = 0; | ||
883 | 241 | int cur_index = 0; | ||
884 | 174 | foreach (unowned string context in context_list) | 242 | foreach (unowned string context in context_list) |
885 | 175 | { | 243 | { |
886 | 176 | this._themed_context.append_text (context); | 244 | this._themed_context.append_text (context); |
887 | 245 | // try to make "Applications" context active by default | ||
888 | 246 | if (context == "Applications") | ||
889 | 247 | { | ||
890 | 248 | active_index = cur_index; | ||
891 | 249 | } | ||
892 | 250 | cur_index++; | ||
893 | 177 | } | 251 | } |
897 | 178 | } | 252 | this._themed_context.set_active (active_index); |
898 | 179 | this._file_viewer.parent.hide (); | 253 | } |
899 | 180 | this._directory.hide (); | 254 | |
900 | 255 | if (this._file_viewer != null) | ||
901 | 256 | { | ||
902 | 257 | this._file_viewer.parent.hide (); | ||
903 | 258 | this._directory.hide (); | ||
904 | 259 | } | ||
905 | 181 | this._themed_viewer.parent.show (); | 260 | this._themed_viewer.parent.show (); |
906 | 182 | this._themed_context.show (); | 261 | this._themed_context.show (); |
907 | 183 | this._viewer = this._themed_viewer; | 262 | this._viewer = this._themed_viewer; |
908 | 184 | } | 263 | } |
909 | 185 | else | 264 | else |
910 | 186 | { | 265 | { |
913 | 187 | this._themed_viewer.parent.hide (); | 266 | if (this._file_viewer == null) |
914 | 188 | this._themed_context.hide (); | 267 | { |
915 | 268 | // "From File" widgets -> directory chooser + icon view | ||
916 | 269 | this._directory = new FileChooserButton (_ ("Select icon folder"), | ||
917 | 270 | FileChooserAction.SELECT_FOLDER); | ||
918 | 271 | this._directory.current_folder_changed.connect (this.on_folder_changed); | ||
919 | 272 | this.vbox.pack_start (this._directory, false, false, 5); | ||
920 | 273 | this._directory.show (); | ||
921 | 274 | |||
922 | 275 | this.add_icon_viewer (ref this._file_viewer, false); | ||
923 | 276 | |||
924 | 277 | this.on_folder_changed (this._directory); | ||
925 | 278 | } | ||
926 | 279 | |||
927 | 280 | if (this._themed_viewer != null) | ||
928 | 281 | { | ||
929 | 282 | this._themed_viewer.parent.hide (); | ||
930 | 283 | this._themed_context.hide (); | ||
931 | 284 | } | ||
932 | 189 | this._file_viewer.parent.show (); | 285 | this._file_viewer.parent.show (); |
933 | 190 | this._directory.show (); | 286 | this._directory.show (); |
934 | 191 | this._viewer = this._file_viewer; | 287 | this._viewer = this._file_viewer; |
935 | @@ -225,7 +321,9 @@ | |||
936 | 225 | pixbuf = new Gdk.Pixbuf.from_file_at_scale (path, 48, -1, true); | 321 | pixbuf = new Gdk.Pixbuf.from_file_at_scale (path, 48, -1, true); |
937 | 226 | 322 | ||
938 | 227 | model.append (out iter); | 323 | model.append (out iter); |
940 | 228 | model.set (iter, Column.PIXBUF, pixbuf, | 324 | model.set (iter, |
941 | 325 | Column.PIXBUF, pixbuf, | ||
942 | 326 | Column.PIXBUF_READY, true, | ||
943 | 229 | Column.NAME, Path.get_basename (path), | 327 | Column.NAME, Path.get_basename (path), |
944 | 230 | Column.DATA, path); | 328 | Column.DATA, path); |
945 | 231 | } | 329 | } |
946 | @@ -246,7 +344,7 @@ | |||
947 | 246 | { | 344 | { |
948 | 247 | unowned ListStore model; | 345 | unowned ListStore model; |
949 | 248 | unowned IconTheme icon_theme; | 346 | unowned IconTheme icon_theme; |
951 | 249 | unowned List<string> icon_list; | 347 | List<string> icon_list; |
952 | 250 | 348 | ||
953 | 251 | model = this._themed_viewer.model as ListStore; | 349 | model = this._themed_viewer.model as ListStore; |
954 | 252 | model.clear (); | 350 | model.clear (); |
955 | @@ -256,29 +354,14 @@ | |||
956 | 256 | icon_list.sort ((CompareFunc)strcmp); | 354 | icon_list.sort ((CompareFunc)strcmp); |
957 | 257 | foreach (unowned string icon_name in icon_list) | 355 | foreach (unowned string icon_name in icon_list) |
958 | 258 | { | 356 | { |
965 | 259 | try | 357 | TreeIter iter; |
960 | 260 | { | ||
961 | 261 | IconInfo info; | ||
962 | 262 | Gdk.Pixbuf pixbuf; | ||
963 | 263 | string? name; | ||
964 | 264 | TreeIter iter; | ||
966 | 265 | 358 | ||
983 | 266 | info = icon_theme.lookup_icon (icon_name, 48, 0); | 359 | model.append (out iter); |
984 | 267 | pixbuf = info.load_icon (); | 360 | model.set (iter, |
985 | 268 | name = info.get_display_name (); | 361 | Column.PIXBUF, NO_ICON, |
986 | 269 | if (name == null) | 362 | Column.PIXBUF_READY, false, |
987 | 270 | { | 363 | Column.NAME, icon_name, |
988 | 271 | name = icon_name.replace ("-", " "); | 364 | Column.DATA, icon_name); |
973 | 272 | } | ||
974 | 273 | model.append (out iter); | ||
975 | 274 | model.set (iter, Column.PIXBUF, pixbuf, | ||
976 | 275 | Column.NAME, name, | ||
977 | 276 | Column.DATA, icon_name); | ||
978 | 277 | } | ||
979 | 278 | catch (Error err) | ||
980 | 279 | { | ||
981 | 280 | warning ("Could not load %s: %s", icon_name, err.message); | ||
982 | 281 | } | ||
989 | 282 | } | 365 | } |
990 | 283 | } | 366 | } |
991 | 284 | 367 | ||
992 | @@ -297,7 +380,7 @@ | |||
993 | 297 | 380 | ||
994 | 298 | msg = _ ("Please select an icon."); | 381 | msg = _ ("Please select an icon."); |
995 | 299 | dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR, | 382 | dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR, |
997 | 300 | ButtonsType.OK, msg); | 383 | ButtonsType.OK, "%s", msg); |
998 | 301 | dialog.title = _ ("Error"); | 384 | dialog.title = _ ("Error"); |
999 | 302 | dialog.run (); | 385 | dialog.run (); |
1000 | 303 | dialog.destroy (); | 386 | dialog.destroy (); |
1001 | 304 | 387 | ||
1002 | === modified file 'libdesktop-agnostic/ui-launcher-editor-dialog.vala' | |||
1003 | --- libdesktop-agnostic/ui-launcher-editor-dialog.vala 2009-10-27 07:36:10 +0000 | |||
1004 | +++ libdesktop-agnostic/ui-launcher-editor-dialog.vala 2011-02-13 20:22:06 +0000 | |||
1005 | @@ -53,51 +53,45 @@ | |||
1006 | 53 | this.attach (widget, left_attach, right_attach, top_attach, bottom_attach, | 53 | this.attach (widget, left_attach, right_attach, top_attach, bottom_attach, |
1007 | 54 | AttachOptions.FILL, 0, 0, 0); | 54 | AttachOptions.FILL, 0, 0, 0); |
1008 | 55 | } | 55 | } |
1009 | 56 | |||
1010 | 57 | public void | ||
1011 | 58 | attach_expand (Widget widget, uint left_attach, uint right_attach, | ||
1012 | 59 | uint top_attach, uint bottom_attach) | ||
1013 | 60 | { | ||
1014 | 61 | this.attach (widget, left_attach, right_attach, top_attach, bottom_attach, | ||
1015 | 62 | AttachOptions.FILL | AttachOptions.EXPAND, 0, 0, 0); | ||
1016 | 63 | } | ||
1017 | 56 | } | 64 | } |
1018 | 57 | 65 | ||
1019 | 58 | public class LauncherEditorDialog : Dialog | 66 | public class LauncherEditorDialog : Dialog |
1020 | 59 | { | 67 | { |
1021 | 68 | private ComboBox _type_combo; | ||
1022 | 60 | private IconButton _icon; | 69 | private IconButton _icon; |
1023 | 61 | private Entry _name; | 70 | private Entry _name; |
1024 | 62 | private Entry _desc; | 71 | private Entry _desc; |
1025 | 63 | private Entry _exec; | 72 | private Entry _exec; |
1026 | 73 | private Expander _advanced; | ||
1027 | 64 | private CheckButton _terminal; | 74 | private CheckButton _terminal; |
1028 | 65 | private CheckButton _startup_notification; | 75 | private CheckButton _startup_notification; |
1029 | 76 | private unowned Label _command_label; | ||
1030 | 66 | public unowned VFS.File file { get; construct; } | 77 | public unowned VFS.File file { get; construct; } |
1031 | 67 | public VFS.File? output { get; construct; } | 78 | public VFS.File? output { get; construct; } |
1033 | 68 | private bool _standalone; | 79 | public bool entry_type_sensitive { get; construct set; default = false; } |
1034 | 69 | private DesktopEntry _entry; | 80 | private DesktopEntry _entry; |
1035 | 70 | 81 | ||
1037 | 71 | public LauncherEditorDialog (VFS.File file, VFS.File? output, bool standalone) | 82 | public LauncherEditorDialog (VFS.File file, VFS.File? output = null, |
1038 | 83 | bool entry_type_sensitive = true) | ||
1039 | 72 | { | 84 | { |
1054 | 73 | WindowType type; | 85 | GLib.Object (file: file, output: output, |
1055 | 74 | 86 | border_width: 4, | |
1056 | 75 | if (standalone) | 87 | entry_type_sensitive: entry_type_sensitive); |
1043 | 76 | { | ||
1044 | 77 | type = WindowType.TOPLEVEL; | ||
1045 | 78 | } | ||
1046 | 79 | else | ||
1047 | 80 | { | ||
1048 | 81 | type = WindowType.POPUP; | ||
1049 | 82 | } | ||
1050 | 83 | this.type = type; | ||
1051 | 84 | this._standalone = standalone; | ||
1052 | 85 | this.file = file; | ||
1053 | 86 | this.output = output; | ||
1057 | 87 | } | 88 | } |
1058 | 88 | 89 | ||
1060 | 89 | private override void | 90 | protected override void |
1061 | 90 | constructed () | 91 | constructed () |
1062 | 91 | { | 92 | { |
1063 | 92 | this.title = _ ("Desktop Entry Editor"); | 93 | this.title = _ ("Desktop Entry Editor"); |
1064 | 93 | this.icon_name = "gtk-preferences"; | 94 | this.icon_name = "gtk-preferences"; |
1065 | 94 | if (this._standalone) | ||
1066 | 95 | { | ||
1067 | 96 | this.delete_event.connect((widget, event) => { | ||
1068 | 97 | main_quit (); | ||
1069 | 98 | return true; | ||
1070 | 99 | }); | ||
1071 | 100 | } | ||
1072 | 101 | if (this._output == null) | 95 | if (this._output == null) |
1073 | 102 | { | 96 | { |
1074 | 103 | this._output = file; | 97 | this._output = file; |
1075 | @@ -113,10 +107,10 @@ | |||
1076 | 113 | string icon; | 107 | string icon; |
1077 | 114 | Button exec_button; | 108 | Button exec_button; |
1078 | 115 | Image exec_image; | 109 | Image exec_image; |
1080 | 116 | Label name_label, desc_label, exec_label; | 110 | Label type_label, name_label, desc_label, exec_label; |
1081 | 117 | HBox exec_hbox; | 111 | HBox exec_hbox; |
1082 | 118 | Expander advanced; | ||
1083 | 119 | VBox advanced_vbox; | 112 | VBox advanced_vbox; |
1084 | 113 | bool is_application = true; | ||
1085 | 120 | 114 | ||
1086 | 121 | // Action bar | 115 | // Action bar |
1087 | 122 | this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, | 116 | this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, |
1088 | @@ -125,12 +119,12 @@ | |||
1089 | 125 | this.response.connect (this.on_response); | 119 | this.response.connect (this.on_response); |
1090 | 126 | 120 | ||
1091 | 127 | // Form container | 121 | // Form container |
1093 | 128 | table = new FixedTable (4, 3); | 122 | table = new FixedTable (3, 5); |
1094 | 129 | // FIXME Table.row_spacing needs [NoAccessorMethod] in the VAPI, in | 123 | // FIXME Table.row_spacing needs [NoAccessorMethod] in the VAPI, in |
1095 | 130 | // Vala 0.7.6 | 124 | // Vala 0.7.6 |
1096 | 131 | //table.row_spacing = 5; | 125 | //table.row_spacing = 5; |
1097 | 132 | table.set_row_spacings (5); | 126 | table.set_row_spacings (5); |
1099 | 133 | table.column_spacing = 5; | 127 | table.column_spacing = 6; |
1100 | 134 | 128 | ||
1101 | 135 | // Icon | 129 | // Icon |
1102 | 136 | if (this._entry.key_exists ("Icon")) | 130 | if (this._entry.key_exists ("Icon")) |
1103 | @@ -143,11 +137,48 @@ | |||
1104 | 143 | } | 137 | } |
1105 | 144 | this._icon = new IconButton (icon); | 138 | this._icon = new IconButton (icon); |
1106 | 145 | this._icon.icon_selected.connect (this.on_icon_changed); | 139 | this._icon.icon_selected.connect (this.on_icon_changed); |
1108 | 146 | table.attach_defaults (this._icon, 0, 1, 0, 3); | 140 | table.attach_defaults (this._icon, 0, 1, 0, 4); |
1109 | 141 | |||
1110 | 142 | // Entry Type | ||
1111 | 143 | if (this._entry.key_exists ("Type")) | ||
1112 | 144 | { | ||
1113 | 145 | is_application = this._entry.entry_type == DesktopEntryType.APPLICATION; | ||
1114 | 146 | } | ||
1115 | 147 | else | ||
1116 | 148 | { | ||
1117 | 149 | // if type is unset, use application | ||
1118 | 150 | this._entry.entry_type = DesktopEntryType.APPLICATION; | ||
1119 | 151 | } | ||
1120 | 152 | type_label = new Label.with_mnemonic (_ ("T_ype:")); | ||
1121 | 153 | type_label.xalign = 1.0f; | ||
1122 | 154 | table.attach_defaults (type_label, 1, 2, 0, 1); | ||
1123 | 155 | this._type_combo = new ComboBox.text (); | ||
1124 | 156 | this._type_combo.append_text (_ ("Application")); | ||
1125 | 157 | this._type_combo.append_text (_ ("Location")); | ||
1126 | 158 | type_label.set_mnemonic_widget (this._type_combo); | ||
1127 | 159 | |||
1128 | 160 | int active_index = -1; | ||
1129 | 161 | switch (this._entry.entry_type) | ||
1130 | 162 | { | ||
1131 | 163 | case DesktopEntryType.APPLICATION: | ||
1132 | 164 | active_index = 0; | ||
1133 | 165 | break; | ||
1134 | 166 | case DesktopEntryType.LINK: | ||
1135 | 167 | active_index = 1; | ||
1136 | 168 | break; | ||
1137 | 169 | } | ||
1138 | 170 | this._type_combo.set_active (active_index); | ||
1139 | 171 | this._type_combo.set_sensitive (entry_type_sensitive); | ||
1140 | 172 | this.notify["entry-type-sensitive"].connect ( | ||
1141 | 173 | () => { this._type_combo.set_sensitive (this.entry_type_sensitive); } | ||
1142 | 174 | ); | ||
1143 | 175 | this._type_combo.changed.connect (this.on_type_changed); | ||
1144 | 176 | table.attach_expand (this._type_combo, 2, 3, 0, 1); | ||
1145 | 147 | 177 | ||
1146 | 148 | // Name | 178 | // Name |
1147 | 149 | name_label = new Label.with_mnemonic (_ ("_Name:")); | 179 | name_label = new Label.with_mnemonic (_ ("_Name:")); |
1149 | 150 | table.attach_defaults (name_label, 1, 2, 0, 1); | 180 | name_label.xalign = 1.0f; |
1150 | 181 | table.attach_defaults (name_label, 1, 2, 1, 2); | ||
1151 | 151 | this._name = new Entry (); | 182 | this._name = new Entry (); |
1152 | 152 | name_label.set_mnemonic_widget (this._name); | 183 | name_label.set_mnemonic_widget (this._name); |
1153 | 153 | if (this._entry.key_exists ("Name")) | 184 | if (this._entry.key_exists ("Name")) |
1154 | @@ -155,11 +186,12 @@ | |||
1155 | 155 | this._name.set_text (this._entry.name); | 186 | this._name.set_text (this._entry.name); |
1156 | 156 | } | 187 | } |
1157 | 157 | this._name.changed.connect (this.on_name_changed); | 188 | this._name.changed.connect (this.on_name_changed); |
1159 | 158 | table.attach_defaults (this._name, 2, 3, 0, 1); | 189 | table.attach_expand (this._name, 2, 3, 1, 2); |
1160 | 159 | 190 | ||
1161 | 160 | // Description | 191 | // Description |
1162 | 161 | desc_label = new Label.with_mnemonic (_ ("_Description:")); | 192 | desc_label = new Label.with_mnemonic (_ ("_Description:")); |
1164 | 162 | table.attach_defaults (desc_label, 1, 2, 1, 2); | 193 | desc_label.xalign = 1.0f; |
1165 | 194 | table.attach_defaults (desc_label, 1, 2, 2, 3); | ||
1166 | 163 | this._desc = new Entry (); | 195 | this._desc = new Entry (); |
1167 | 164 | desc_label.set_mnemonic_widget (this._desc); | 196 | desc_label.set_mnemonic_widget (this._desc); |
1168 | 165 | if (this._entry.key_exists ("Comment")) | 197 | if (this._entry.key_exists ("Comment")) |
1169 | @@ -167,31 +199,36 @@ | |||
1170 | 167 | this._desc.set_text (this._entry.get_string ("Comment")); | 199 | this._desc.set_text (this._entry.get_string ("Comment")); |
1171 | 168 | } | 200 | } |
1172 | 169 | this._desc.changed.connect (this.on_desc_changed); | 201 | this._desc.changed.connect (this.on_desc_changed); |
1174 | 170 | table.attach_defaults (this._desc, 2, 3, 1, 2); | 202 | table.attach_expand (this._desc, 2, 3, 2, 3); |
1175 | 171 | 203 | ||
1176 | 172 | // Exec | 204 | // Exec |
1177 | 173 | exec_label = new Label.with_mnemonic (_ ("_Command:")); | 205 | exec_label = new Label.with_mnemonic (_ ("_Command:")); |
1179 | 174 | table.attach_defaults (exec_label, 1, 2, 2, 3); | 206 | _command_label = exec_label; |
1180 | 207 | exec_label.xalign = 1.0f; | ||
1181 | 208 | table.attach_defaults (exec_label, 1, 2, 3, 4); | ||
1182 | 175 | exec_hbox = new HBox (false, 5); | 209 | exec_hbox = new HBox (false, 5); |
1183 | 176 | this._exec = new Entry (); | 210 | this._exec = new Entry (); |
1184 | 177 | exec_label.set_mnemonic_widget (this._exec); | 211 | exec_label.set_mnemonic_widget (this._exec); |
1186 | 178 | if (this._entry.key_exists ("Exec")) | 212 | |
1187 | 213 | string key_name = is_application ? "Exec" : "URL"; | ||
1188 | 214 | if (this._entry.key_exists (key_name)) | ||
1189 | 179 | { | 215 | { |
1191 | 180 | this._exec.set_text (this._entry.get_string ("Exec")); | 216 | this._exec.set_text (this._entry.get_string (key_name)); |
1192 | 181 | } | 217 | } |
1193 | 218 | |||
1194 | 182 | this._exec.changed.connect (this.on_exec_changed); | 219 | this._exec.changed.connect (this.on_exec_changed); |
1196 | 183 | exec_hbox.add (this._exec); | 220 | exec_hbox.pack_start (this._exec, true); |
1197 | 184 | exec_button = new Button.with_mnemonic (_ ("_Browse...")); | 221 | exec_button = new Button.with_mnemonic (_ ("_Browse...")); |
1198 | 185 | exec_image = new Image.from_stock (STOCK_OPEN, IconSize.BUTTON); | 222 | exec_image = new Image.from_stock (STOCK_OPEN, IconSize.BUTTON); |
1199 | 186 | exec_button.set_image (exec_image); | 223 | exec_button.set_image (exec_image); |
1200 | 187 | exec_button.clicked.connect (this.on_exec_browse); | 224 | exec_button.clicked.connect (this.on_exec_browse); |
1203 | 188 | exec_hbox.add (exec_button); | 225 | exec_hbox.pack_start (exec_button, false); |
1204 | 189 | table.attach_defaults (exec_hbox, 2, 3, 2, 3); | 226 | table.attach_expand (exec_hbox, 2, 3, 3, 4); |
1205 | 190 | 227 | ||
1206 | 191 | // Advanced options | 228 | // Advanced options |
1207 | 192 | // TODO look into ResizeMode so that the window shrinks when the expander | 229 | // TODO look into ResizeMode so that the window shrinks when the expander |
1208 | 193 | // is un-expanded. | 230 | // is un-expanded. |
1210 | 194 | advanced = new Expander.with_mnemonic (_ ("_Advanced")); | 231 | this._advanced = new Expander.with_mnemonic (_ ("_Advanced")); |
1211 | 195 | advanced_vbox = new VBox (false, 5); | 232 | advanced_vbox = new VBox (false, 5); |
1212 | 196 | this._terminal = new CheckButton.with_mnemonic (_ ("Run in _terminal")); | 233 | this._terminal = new CheckButton.with_mnemonic (_ ("Run in _terminal")); |
1213 | 197 | if (this._entry.key_exists ("Terminal")) | 234 | if (this._entry.key_exists ("Terminal")) |
1214 | @@ -207,8 +244,20 @@ | |||
1215 | 207 | } | 244 | } |
1216 | 208 | this._startup_notification.toggled.connect (this.on_startup_notification_toggled); | 245 | this._startup_notification.toggled.connect (this.on_startup_notification_toggled); |
1217 | 209 | advanced_vbox.add (this._startup_notification); | 246 | advanced_vbox.add (this._startup_notification); |
1220 | 210 | advanced.add (advanced_vbox); | 247 | this._advanced.add (advanced_vbox); |
1221 | 211 | table.attach_fill (advanced, 0, 3, 3, 4); | 248 | table.attach_expand (this._advanced, 0, 3, 4, 5); |
1222 | 249 | |||
1223 | 250 | // make sure widgets are properly set up | ||
1224 | 251 | on_type_changed (this._type_combo); | ||
1225 | 252 | |||
1226 | 253 | List<unowned Widget> focus_chain_list = new List<unowned Widget> (); | ||
1227 | 254 | focus_chain_list.append (this._type_combo); | ||
1228 | 255 | focus_chain_list.append (this._name); | ||
1229 | 256 | focus_chain_list.append (this._desc); | ||
1230 | 257 | focus_chain_list.append (exec_hbox); | ||
1231 | 258 | focus_chain_list.append (this._icon); | ||
1232 | 259 | focus_chain_list.append (this._advanced); | ||
1233 | 260 | table.set_focus_chain (focus_chain_list); | ||
1234 | 212 | 261 | ||
1235 | 213 | this.vbox.add (table); | 262 | this.vbox.add (table); |
1236 | 214 | } | 263 | } |
1237 | @@ -220,6 +269,29 @@ | |||
1238 | 220 | } | 269 | } |
1239 | 221 | 270 | ||
1240 | 222 | private void | 271 | private void |
1241 | 272 | on_type_changed (ComboBox combo) | ||
1242 | 273 | { | ||
1243 | 274 | switch (combo.get_active ()) | ||
1244 | 275 | { | ||
1245 | 276 | case 0: this._entry.entry_type = DesktopEntryType.APPLICATION; break; | ||
1246 | 277 | case 1: this._entry.entry_type = DesktopEntryType.LINK; break; | ||
1247 | 278 | } | ||
1248 | 279 | |||
1249 | 280 | if (this._entry.entry_type == DesktopEntryType.LINK) | ||
1250 | 281 | { | ||
1251 | 282 | this._command_label.set_markup_with_mnemonic (_ ("_Location:")); | ||
1252 | 283 | this._advanced.hide (); | ||
1253 | 284 | this._advanced.set_no_show_all (true); | ||
1254 | 285 | } | ||
1255 | 286 | else | ||
1256 | 287 | { | ||
1257 | 288 | this._command_label.set_markup_with_mnemonic (_ ("_Command:")); | ||
1258 | 289 | this._advanced.set_no_show_all (false); | ||
1259 | 290 | this._advanced.show (); | ||
1260 | 291 | } | ||
1261 | 292 | } | ||
1262 | 293 | |||
1263 | 294 | private void | ||
1264 | 223 | on_name_changed (Editable editable) | 295 | on_name_changed (Editable editable) |
1265 | 224 | { | 296 | { |
1266 | 225 | Entry entry = editable as Entry; | 297 | Entry entry = editable as Entry; |
1267 | @@ -237,7 +309,9 @@ | |||
1268 | 237 | on_exec_changed (Editable editable) | 309 | on_exec_changed (Editable editable) |
1269 | 238 | { | 310 | { |
1270 | 239 | Entry entry = editable as Entry; | 311 | Entry entry = editable as Entry; |
1272 | 240 | this._entry.set_string ("Exec", entry.text); | 312 | string key_name = |
1273 | 313 | this._entry.entry_type == DesktopEntryType.LINK ? "URL" : "Exec"; | ||
1274 | 314 | this._entry.set_string (key_name, entry.text); | ||
1275 | 241 | } | 315 | } |
1276 | 242 | 316 | ||
1277 | 243 | private void | 317 | private void |
1278 | @@ -246,14 +320,17 @@ | |||
1279 | 246 | FileChooserDialog dialog; | 320 | FileChooserDialog dialog; |
1280 | 247 | int response; | 321 | int response; |
1281 | 248 | 322 | ||
1283 | 249 | dialog = new FileChooserDialog (_ ("Locate Command"), this, | 323 | bool is_link = this._entry.entry_type == DesktopEntryType.LINK; |
1284 | 324 | string title = is_link ? _ ("Locate a file") : _ ("Locate Command"); | ||
1285 | 325 | |||
1286 | 326 | dialog = new FileChooserDialog (title, this, | ||
1287 | 250 | FileChooserAction.OPEN, | 327 | FileChooserAction.OPEN, |
1288 | 251 | STOCK_CANCEL, ResponseType.CANCEL, | 328 | STOCK_CANCEL, ResponseType.CANCEL, |
1289 | 252 | STOCK_OK, ResponseType.OK); | 329 | STOCK_OK, ResponseType.OK); |
1290 | 253 | response = dialog.run (); | 330 | response = dialog.run (); |
1291 | 254 | if (response == ResponseType.OK) | 331 | if (response == ResponseType.OK) |
1292 | 255 | { | 332 | { |
1294 | 256 | this._exec.text = dialog.get_filename (); | 333 | this._exec.text = is_link ? dialog.get_uri () : dialog.get_filename (); |
1295 | 257 | } | 334 | } |
1296 | 258 | dialog.destroy (); | 335 | dialog.destroy (); |
1297 | 259 | } | 336 | } |
1298 | @@ -345,14 +422,7 @@ | |||
1299 | 345 | } | 422 | } |
1300 | 346 | } | 423 | } |
1301 | 347 | } | 424 | } |
1310 | 348 | if (this._standalone) | 425 | this.hide (); |
1303 | 349 | { | ||
1304 | 350 | main_quit (); | ||
1305 | 351 | } | ||
1306 | 352 | else | ||
1307 | 353 | { | ||
1308 | 354 | this.hide (); | ||
1309 | 355 | } | ||
1311 | 356 | } | 426 | } |
1312 | 357 | } | 427 | } |
1313 | 358 | } | 428 | } |
1314 | 359 | 429 | ||
1315 | === modified file 'libdesktop-agnostic/vfs-bookmarks-gtk.vala' | |||
1316 | --- libdesktop-agnostic/vfs-bookmarks-gtk.vala 2009-07-18 08:06:58 +0000 | |||
1317 | +++ libdesktop-agnostic/vfs-bookmarks-gtk.vala 2011-02-13 20:22:06 +0000 | |||
1318 | @@ -77,7 +77,7 @@ | |||
1319 | 77 | */ | 77 | */ |
1320 | 78 | public GtkBookmarks (File? file = null, bool monitor = true) | 78 | public GtkBookmarks (File? file = null, bool monitor = true) |
1321 | 79 | { | 79 | { |
1323 | 80 | this.file = file; | 80 | GLib.Object (file: file); |
1324 | 81 | if (this._file.exists ()) | 81 | if (this._file.exists ()) |
1325 | 82 | { | 82 | { |
1326 | 83 | this.parse (); | 83 | this.parse (); |
1327 | 84 | 84 | ||
1328 | === modified file 'libdesktop-agnostic/vfs-file-impl-gio.vala' | |||
1329 | --- libdesktop-agnostic/vfs-file-impl-gio.vala 2010-03-26 22:45:36 +0000 | |||
1330 | +++ libdesktop-agnostic/vfs-file-impl-gio.vala 2011-02-13 20:22:06 +0000 | |||
1331 | @@ -239,6 +239,71 @@ | |||
1332 | 239 | } | 239 | } |
1333 | 240 | return this._file.delete (null); | 240 | return this._file.delete (null); |
1334 | 241 | } | 241 | } |
1335 | 242 | |||
1336 | 243 | public override bool is_native () | ||
1337 | 244 | { | ||
1338 | 245 | return this._file.is_native (); | ||
1339 | 246 | } | ||
1340 | 247 | |||
1341 | 248 | public override string get_mime_type () throws Error | ||
1342 | 249 | { | ||
1343 | 250 | var fi = this._file.query_info (FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, | ||
1344 | 251 | 0, null); | ||
1345 | 252 | return fi.get_content_type (); | ||
1346 | 253 | } | ||
1347 | 254 | |||
1348 | 255 | public override string[] get_icon_names () throws Error | ||
1349 | 256 | { | ||
1350 | 257 | var fi = this._file.query_info (FILE_ATTRIBUTE_STANDARD_ICON, | ||
1351 | 258 | 0, null); | ||
1352 | 259 | GLib.Icon icon = fi.get_icon (); | ||
1353 | 260 | if (icon != null) | ||
1354 | 261 | { | ||
1355 | 262 | if (icon is ThemedIcon) | ||
1356 | 263 | { | ||
1357 | 264 | // wow! Vala sucks! | ||
1358 | 265 | Value v = Value (typeof (string[])); | ||
1359 | 266 | icon.get_property ("names", ref v); | ||
1360 | 267 | string[] names = (string[]) v; | ||
1361 | 268 | |||
1362 | 269 | // this should be fixed in vala 0.12 | ||
1363 | 270 | //names = (icon as ThemedIcon).get_names (); | ||
1364 | 271 | |||
1365 | 272 | return names; | ||
1366 | 273 | } | ||
1367 | 274 | |||
1368 | 275 | if (icon is FileIcon) | ||
1369 | 276 | { | ||
1370 | 277 | string path = (icon as FileIcon).get_file ().get_path (); | ||
1371 | 278 | string[] result = { path }; | ||
1372 | 279 | |||
1373 | 280 | return result; | ||
1374 | 281 | } | ||
1375 | 282 | } | ||
1376 | 283 | |||
1377 | 284 | // hmm... what now? | ||
1378 | 285 | string[] unknown = {}; | ||
1379 | 286 | return unknown; | ||
1380 | 287 | } | ||
1381 | 288 | |||
1382 | 289 | public override string? | ||
1383 | 290 | get_thumbnail_path () | ||
1384 | 291 | { | ||
1385 | 292 | try | ||
1386 | 293 | { | ||
1387 | 294 | var fi = this._file.query_info (FILE_ATTRIBUTE_THUMBNAIL_PATH, | ||
1388 | 295 | 0, null); | ||
1389 | 296 | if (fi.has_attribute (FILE_ATTRIBUTE_THUMBNAIL_PATH)) | ||
1390 | 297 | { | ||
1391 | 298 | return fi.get_attribute_byte_string (FILE_ATTRIBUTE_THUMBNAIL_PATH); | ||
1392 | 299 | } | ||
1393 | 300 | } | ||
1394 | 301 | catch (GLib.Error err) | ||
1395 | 302 | { | ||
1396 | 303 | warning ("%s", err.message); | ||
1397 | 304 | } | ||
1398 | 305 | return null; | ||
1399 | 306 | } | ||
1400 | 242 | } | 307 | } |
1401 | 243 | } | 308 | } |
1402 | 244 | 309 | ||
1403 | 245 | 310 | ||
1404 | === modified file 'libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala' | |||
1405 | --- libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala 2010-03-26 22:45:36 +0000 | |||
1406 | +++ libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala 2011-02-13 20:22:06 +0000 | |||
1407 | @@ -322,6 +322,24 @@ | |||
1408 | 322 | } | 322 | } |
1409 | 323 | return (GnomeVFS.unlink_from_uri (this._uri) == GnomeVFS.Result.OK); | 323 | return (GnomeVFS.unlink_from_uri (this._uri) == GnomeVFS.Result.OK); |
1410 | 324 | } | 324 | } |
1411 | 325 | |||
1412 | 326 | public override bool | ||
1413 | 327 | is_native () | ||
1414 | 328 | { | ||
1415 | 329 | return this._uri_str.has_prefix ("file:"); | ||
1416 | 330 | } | ||
1417 | 331 | |||
1418 | 332 | public override string | ||
1419 | 333 | get_mime_type () throws Error | ||
1420 | 334 | { | ||
1421 | 335 | return GnomeVFS.get_mime_type_from_uri (this._uri); | ||
1422 | 336 | } | ||
1423 | 337 | |||
1424 | 338 | public override string[] | ||
1425 | 339 | get_icon_names () throws Error | ||
1426 | 340 | { | ||
1427 | 341 | return get_icon_names_for_mime_type (this.get_mime_type ()); | ||
1428 | 342 | } | ||
1429 | 325 | } | 343 | } |
1430 | 326 | } | 344 | } |
1431 | 327 | 345 | ||
1432 | 328 | 346 | ||
1433 | === modified file 'libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala' | |||
1434 | --- libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala 2009-10-27 07:29:55 +0000 | |||
1435 | +++ libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000 | |||
1436 | @@ -247,6 +247,24 @@ | |||
1437 | 247 | } | 247 | } |
1438 | 248 | return (FileUtils.unlink (this.impl_path) == 0); | 248 | return (FileUtils.unlink (this.impl_path) == 0); |
1439 | 249 | } | 249 | } |
1440 | 250 | |||
1441 | 251 | public override bool | ||
1442 | 252 | is_native () | ||
1443 | 253 | { | ||
1444 | 254 | return this._uri.has_prefix ("file:"); | ||
1445 | 255 | } | ||
1446 | 256 | |||
1447 | 257 | public override string | ||
1448 | 258 | get_mime_type () throws Error | ||
1449 | 259 | { | ||
1450 | 260 | return this._info.mime_info.get_name (); | ||
1451 | 261 | } | ||
1452 | 262 | |||
1453 | 263 | public override string[] | ||
1454 | 264 | get_icon_names () throws Error | ||
1455 | 265 | { | ||
1456 | 266 | return get_icon_names_for_mime_type (this.get_mime_type ()); | ||
1457 | 267 | } | ||
1458 | 250 | } | 268 | } |
1459 | 251 | } | 269 | } |
1460 | 252 | 270 | ||
1461 | 253 | 271 | ||
1462 | === modified file 'libdesktop-agnostic/vfs-file.vala' | |||
1463 | --- libdesktop-agnostic/vfs-file.vala 2009-10-27 07:29:55 +0000 | |||
1464 | +++ libdesktop-agnostic/vfs-file.vala 2011-02-13 20:22:06 +0000 | |||
1465 | @@ -190,6 +190,34 @@ | |||
1466 | 190 | * @return %TRUE on success, %FALSE on failure. | 190 | * @return %TRUE on success, %FALSE on failure. |
1467 | 191 | */ | 191 | */ |
1468 | 192 | public abstract bool remove () throws Error; | 192 | public abstract bool remove () throws Error; |
1469 | 193 | |||
1470 | 194 | /** | ||
1471 | 195 | * Checks to see if a file is native to the platform. | ||
1472 | 196 | * @return %TRUE if file is native, %FALSE otherwise. | ||
1473 | 197 | */ | ||
1474 | 198 | public abstract bool is_native (); | ||
1475 | 199 | |||
1476 | 200 | /** | ||
1477 | 201 | * Gets the file's mime type. (might block) | ||
1478 | 202 | * @return String containing file's mime type. | ||
1479 | 203 | */ | ||
1480 | 204 | public abstract string get_mime_type () throws Error; | ||
1481 | 205 | |||
1482 | 206 | /** | ||
1483 | 207 | * Gets list of possible icon names representing this file. (might block) | ||
1484 | 208 | * @return List of possible icon names. | ||
1485 | 209 | */ | ||
1486 | 210 | public abstract string[] get_icon_names () throws Error; | ||
1487 | 211 | |||
1488 | 212 | /** | ||
1489 | 213 | * Get path to thumbnail representing this file. (might block) | ||
1490 | 214 | * @return Path to file with thumbnail or %null if thumbnail cannot be | ||
1491 | 215 | * found or backend doesn't support it. | ||
1492 | 216 | */ | ||
1493 | 217 | public virtual string? get_thumbnail_path () | ||
1494 | 218 | { | ||
1495 | 219 | return null; | ||
1496 | 220 | } | ||
1497 | 193 | } | 221 | } |
1498 | 194 | 222 | ||
1499 | 195 | public File? | 223 | public File? |
1500 | @@ -219,6 +247,20 @@ | |||
1501 | 219 | return (File)Object.new (vfs.file_type, "uri", uri); | 247 | return (File)Object.new (vfs.file_type, "uri", uri); |
1502 | 220 | } | 248 | } |
1503 | 221 | } | 249 | } |
1504 | 250 | |||
1505 | 251 | public static string[] | ||
1506 | 252 | get_icon_names_for_mime_type (string mime_type) | ||
1507 | 253 | { | ||
1508 | 254 | string[] names = null; | ||
1509 | 255 | |||
1510 | 256 | return_val_if_fail (mime_type != "", null); | ||
1511 | 257 | |||
1512 | 258 | names += mime_type.replace ("/", "-"); | ||
1513 | 259 | names += "gnome-mime-%s".printf (names[0]); | ||
1514 | 260 | names += "%s-x-generic".printf (Regex.split_simple ("/.*", mime_type)[0]); | ||
1515 | 261 | |||
1516 | 262 | return names; | ||
1517 | 263 | } | ||
1518 | 222 | } | 264 | } |
1519 | 223 | 265 | ||
1520 | 224 | // vim: set et ts=2 sts=2 sw=2 ai : | 266 | // vim: set et ts=2 sts=2 sw=2 ai : |
1521 | 225 | 267 | ||
1522 | === modified file 'libdesktop-agnostic/vfs-impl-gio.vala' | |||
1523 | --- libdesktop-agnostic/vfs-impl-gio.vala 2009-07-18 02:12:37 +0000 | |||
1524 | +++ libdesktop-agnostic/vfs-impl-gio.vala 2011-02-13 20:22:06 +0000 | |||
1525 | @@ -89,7 +89,6 @@ | |||
1526 | 89 | } | 89 | } |
1527 | 90 | } | 90 | } |
1528 | 91 | } | 91 | } |
1529 | 92 | [ModuleInit] | ||
1530 | 93 | public Type | 92 | public Type |
1531 | 94 | register_plugin () | 93 | register_plugin () |
1532 | 95 | { | 94 | { |
1533 | 96 | 95 | ||
1534 | === modified file 'libdesktop-agnostic/vfs-impl-gnome-vfs.vala' | |||
1535 | --- libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2009-07-18 02:12:37 +0000 | |||
1536 | +++ libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2011-02-13 20:22:06 +0000 | |||
1537 | @@ -92,7 +92,6 @@ | |||
1538 | 92 | } | 92 | } |
1539 | 93 | } | 93 | } |
1540 | 94 | } | 94 | } |
1541 | 95 | [ModuleInit] | ||
1542 | 96 | public Type | 95 | public Type |
1543 | 97 | register_plugin () | 96 | register_plugin () |
1544 | 98 | { | 97 | { |
1545 | 99 | 98 | ||
1546 | === modified file 'libdesktop-agnostic/vfs-impl-thunar-vfs.vala' | |||
1547 | --- libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2009-07-18 02:12:37 +0000 | |||
1548 | +++ libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000 | |||
1549 | @@ -92,7 +92,6 @@ | |||
1550 | 92 | } | 92 | } |
1551 | 93 | } | 93 | } |
1552 | 94 | } | 94 | } |
1553 | 95 | [ModuleInit] | ||
1554 | 96 | public Type | 95 | public Type |
1555 | 97 | register_plugin () | 96 | register_plugin () |
1556 | 98 | { | 97 | { |
1557 | 99 | 98 | ||
1558 | === modified file 'libdesktop-agnostic/vfs-trash-impl-gio.vala' | |||
1559 | --- libdesktop-agnostic/vfs-trash-impl-gio.vala 2009-11-02 06:42:05 +0000 | |||
1560 | +++ libdesktop-agnostic/vfs-trash-impl-gio.vala 2011-02-13 20:22:06 +0000 | |||
1561 | @@ -77,7 +77,7 @@ | |||
1562 | 77 | 77 | ||
1563 | 78 | try | 78 | try |
1564 | 79 | { | 79 | { |
1566 | 80 | file_info = dir.query_info_finish (res); | 80 | file_info = dir.query_info_async.end (res); |
1567 | 81 | this._file_count = file_info.get_attribute_uint32 (FILE_ATTRIBUTE_TRASH_ITEM_COUNT); | 81 | this._file_count = file_info.get_attribute_uint32 (FILE_ATTRIBUTE_TRASH_ITEM_COUNT); |
1568 | 82 | this.file_count_changed (); | 82 | this.file_count_changed (); |
1569 | 83 | } | 83 | } |
1570 | 84 | 84 | ||
1571 | === modified file 'libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala' | |||
1572 | --- libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2009-09-21 17:53:13 +0000 | |||
1573 | +++ libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000 | |||
1574 | @@ -53,7 +53,7 @@ | |||
1575 | 53 | { | 53 | { |
1576 | 54 | Monitor monitor; | 54 | Monitor monitor; |
1577 | 55 | this.trash = ThunarVfs.Path.get_for_trash (); | 55 | this.trash = ThunarVfs.Path.get_for_trash (); |
1579 | 56 | this.dbus = Bus.get (BusType.SESSION); | 56 | this.dbus = DBus.Bus.get (DBus.BusType.SESSION); |
1580 | 57 | this.xfce_trash = | 57 | this.xfce_trash = |
1581 | 58 | (Xfce.Trash)this.dbus.get_object ("org.xfce.Thunar", | 58 | (Xfce.Trash)this.dbus.get_object ("org.xfce.Thunar", |
1582 | 59 | "/org/xfce/FileManager"); | 59 | "/org/xfce/FileManager"); |
1583 | 60 | 60 | ||
1584 | === modified file 'libdesktop-agnostic/vfs-volume-impl-gio.vala' | |||
1585 | --- libdesktop-agnostic/vfs-volume-impl-gio.vala 2009-09-24 16:36:40 +0000 | |||
1586 | +++ libdesktop-agnostic/vfs-volume-impl-gio.vala 2011-02-13 20:22:06 +0000 | |||
1587 | @@ -121,7 +121,7 @@ | |||
1588 | 121 | bool result = false; | 121 | bool result = false; |
1589 | 122 | try | 122 | try |
1590 | 123 | { | 123 | { |
1592 | 124 | result = this.vol.mount_finish (this.async_result); | 124 | result = this.vol.mount.end (this.async_result); |
1593 | 125 | } | 125 | } |
1594 | 126 | catch (GLib.Error err) | 126 | catch (GLib.Error err) |
1595 | 127 | { | 127 | { |
1596 | @@ -156,7 +156,7 @@ | |||
1597 | 156 | bool result = false; | 156 | bool result = false; |
1598 | 157 | try | 157 | try |
1599 | 158 | { | 158 | { |
1601 | 159 | result = this.vol.get_mount ().unmount_finish (this.async_result); | 159 | result = this.vol.get_mount ().unmount.end (this.async_result); |
1602 | 160 | } | 160 | } |
1603 | 161 | catch (GLib.Error err) | 161 | catch (GLib.Error err) |
1604 | 162 | { | 162 | { |
1605 | @@ -192,7 +192,7 @@ | |||
1606 | 192 | bool result = false; | 192 | bool result = false; |
1607 | 193 | try | 193 | try |
1608 | 194 | { | 194 | { |
1610 | 195 | result = this.vol.eject_finish (this.async_result); | 195 | result = this.vol.eject.end (this.async_result); |
1611 | 196 | } | 196 | } |
1612 | 197 | catch (GLib.Error err) | 197 | catch (GLib.Error err) |
1613 | 198 | { | 198 | { |
1614 | @@ -211,7 +211,7 @@ | |||
1615 | 211 | this.monitor = GLib.VolumeMonitor.get (); | 211 | this.monitor = GLib.VolumeMonitor.get (); |
1616 | 212 | this._volumes = new HashTable<GLib.Volume,VFS.Volume> (direct_hash, | 212 | this._volumes = new HashTable<GLib.Volume,VFS.Volume> (direct_hash, |
1617 | 213 | direct_equal); | 213 | direct_equal); |
1619 | 214 | unowned List<GLib.Volume> vols = this.monitor.get_volumes (); | 214 | List<GLib.Volume> vols = this.monitor.get_volumes (); |
1620 | 215 | foreach (unowned GLib.Volume gvol in vols) | 215 | foreach (unowned GLib.Volume gvol in vols) |
1621 | 216 | { | 216 | { |
1622 | 217 | VFS.Volume vol = this.create_volume (gvol); | 217 | VFS.Volume vol = this.create_volume (gvol); |
1623 | 218 | 218 | ||
1624 | === modified file 'libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala' | |||
1625 | --- libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2009-09-24 16:36:40 +0000 | |||
1626 | +++ libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2011-02-13 20:22:06 +0000 | |||
1627 | @@ -190,8 +190,7 @@ | |||
1628 | 190 | this.monitor = GnomeVFS.get_volume_monitor (); | 190 | this.monitor = GnomeVFS.get_volume_monitor (); |
1629 | 191 | this._volumes = new HashTable<GnomeVFS.Drive,VFS.Volume> (direct_hash, | 191 | this._volumes = new HashTable<GnomeVFS.Drive,VFS.Volume> (direct_hash, |
1630 | 192 | direct_equal); | 192 | direct_equal); |
1633 | 193 | unowned List<GnomeVFS.Drive> drives = | 193 | List<GnomeVFS.Drive> drives = this.monitor.get_connected_drives (); |
1632 | 194 | this.monitor.get_connected_drives (); | ||
1634 | 195 | foreach (unowned GnomeVFS.Drive drive in drives) | 194 | foreach (unowned GnomeVFS.Drive drive in drives) |
1635 | 196 | { | 195 | { |
1636 | 197 | VFS.Volume vol = this.create_volume (drive); | 196 | VFS.Volume vol = this.create_volume (drive); |
1637 | 198 | 197 | ||
1638 | === modified file 'libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala' | |||
1639 | --- libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2009-09-24 16:36:40 +0000 | |||
1640 | +++ libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000 | |||
1641 | @@ -63,7 +63,7 @@ | |||
1642 | 63 | } | 63 | } |
1643 | 64 | public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl) | 64 | public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl) |
1644 | 65 | { | 65 | { |
1646 | 66 | this.implementation = impl; | 66 | GLib.Object (implementation: impl); |
1647 | 67 | } | 67 | } |
1648 | 68 | public bool | 68 | public bool |
1649 | 69 | is_mounted () | 69 | is_mounted () |
1650 | 70 | 70 | ||
1651 | === modified file 'libdesktop-agnostic/wscript' | |||
1652 | --- libdesktop-agnostic/wscript 2010-04-10 23:17:55 +0000 | |||
1653 | +++ libdesktop-agnostic/wscript 2011-02-13 20:22:06 +0000 | |||
1654 | @@ -34,6 +34,10 @@ | |||
1655 | 34 | } | 34 | } |
1656 | 35 | }, | 35 | }, |
1657 | 36 | 'fdo': { | 36 | 'fdo': { |
1658 | 37 | 'gio': { | ||
1659 | 38 | 'uselib': 'GIO_UNIX', | ||
1660 | 39 | 'packages': 'gio-unix-2.0', | ||
1661 | 40 | }, | ||
1662 | 37 | 'gnome': { | 41 | 'gnome': { |
1663 | 38 | 'uselib': 'GNOME_DESKTOP', | 42 | 'uselib': 'GNOME_DESKTOP', |
1664 | 39 | 'packages': 'gnome-desktop-2.0', | 43 | 'packages': 'gnome-desktop-2.0', |
1665 | @@ -113,7 +117,8 @@ | |||
1666 | 113 | ]) | 117 | ]) |
1667 | 114 | lib.packages = 'gdk-2.0 gmodule-2.0' | 118 | lib.packages = 'gdk-2.0 gmodule-2.0' |
1668 | 115 | lib.target = 'desktop-agnostic' | 119 | lib.target = 'desktop-agnostic' |
1670 | 116 | lib.gir = 'DesktopAgnostic-1.0' | 120 | if bld.env['INTROSPECTION']: |
1671 | 121 | lib.gir = 'DesktopAgnostic-1.0' | ||
1672 | 117 | lib.uselib = 'M GDK GMODULE' | 122 | lib.uselib = 'M GDK GMODULE' |
1673 | 118 | lib.packages_private = 'build' | 123 | lib.packages_private = 'build' |
1674 | 119 | lib.includes = '..' | 124 | lib.includes = '..' |
1675 | @@ -133,7 +138,8 @@ | |||
1676 | 133 | vfs.packages = 'desktop-agnostic posix' | 138 | vfs.packages = 'desktop-agnostic posix' |
1677 | 134 | vfs.target = 'desktop-agnostic-vfs' | 139 | vfs.target = 'desktop-agnostic-vfs' |
1678 | 135 | vfs.header = 'vfs' | 140 | vfs.header = 'vfs' |
1680 | 136 | vfs.gir = 'DesktopAgnosticVFS-1.0' | 141 | if bld.env['INTROSPECTION']: |
1681 | 142 | vfs.gir = 'DesktopAgnosticVFS-1.0' | ||
1682 | 137 | vfs.uselib_local = 'desktop-agnostic' | 143 | vfs.uselib_local = 'desktop-agnostic' |
1683 | 138 | vfs.packages_private = 'posix-glob' | 144 | vfs.packages_private = 'posix-glob' |
1684 | 139 | vfs.includes = '..' | 145 | vfs.includes = '..' |
1685 | @@ -152,7 +158,8 @@ | |||
1686 | 152 | cfg.packages = 'desktop-agnostic-vfs' | 158 | cfg.packages = 'desktop-agnostic-vfs' |
1687 | 153 | cfg.target = 'desktop-agnostic-cfg' | 159 | cfg.target = 'desktop-agnostic-cfg' |
1688 | 154 | cfg.header = 'config' | 160 | cfg.header = 'config' |
1690 | 155 | cfg.gir = 'DesktopAgnosticConfig-1.0' | 161 | if bld.env['INTROSPECTION']: |
1691 | 162 | cfg.gir = 'DesktopAgnosticConfig-1.0' | ||
1692 | 156 | cfg.uselib_local = 'desktop-agnostic-vfs' | 163 | cfg.uselib_local = 'desktop-agnostic-vfs' |
1693 | 157 | cfg.packages_private = 'hashtable-gtype-key' | 164 | cfg.packages_private = 'hashtable-gtype-key' |
1694 | 158 | cfg.includes = '..' | 165 | cfg.includes = '..' |
1695 | @@ -166,7 +173,8 @@ | |||
1696 | 166 | fdo.packages = 'desktop-agnostic-vfs' | 173 | fdo.packages = 'desktop-agnostic-vfs' |
1697 | 167 | fdo.target = 'desktop-agnostic-fdo' | 174 | fdo.target = 'desktop-agnostic-fdo' |
1698 | 168 | fdo.header = 'fdo' | 175 | fdo.header = 'fdo' |
1700 | 169 | fdo.gir = 'DesktopAgnosticFDO-1.0' | 176 | if bld.env['INTROSPECTION']: |
1701 | 177 | fdo.gir = 'DesktopAgnosticFDO-1.0' | ||
1702 | 170 | fdo.uselib_local = 'desktop-agnostic-vfs' | 178 | fdo.uselib_local = 'desktop-agnostic-vfs' |
1703 | 171 | fdo.vapi_dirs = '.' | 179 | fdo.vapi_dirs = '.' |
1704 | 172 | fdo.includes = '..' | 180 | fdo.includes = '..' |
1705 | @@ -183,7 +191,8 @@ | |||
1706 | 183 | ui.packages_private = 'build' | 191 | ui.packages_private = 'build' |
1707 | 184 | ui.target = 'desktop-agnostic-ui' | 192 | ui.target = 'desktop-agnostic-ui' |
1708 | 185 | ui.header = 'ui' | 193 | ui.header = 'ui' |
1710 | 186 | ui.gir = 'DesktopAgnosticUI-1.0' | 194 | if bld.env['INTROSPECTION']: |
1711 | 195 | ui.gir = 'DesktopAgnosticUI-1.0' | ||
1712 | 187 | ui.uselib = 'GTK' | 196 | ui.uselib = 'GTK' |
1713 | 188 | ui.uselib_local = 'desktop-agnostic-fdo' | 197 | ui.uselib_local = 'desktop-agnostic-fdo' |
1714 | 189 | ui.vapi_dirs = '. ../vapi' | 198 | ui.vapi_dirs = '. ../vapi' |
1715 | 190 | 199 | ||
1716 | === modified file 'python/desktopagnostic.override' | |||
1717 | --- python/desktopagnostic.override 2009-08-25 22:11:31 +0000 | |||
1718 | +++ python/desktopagnostic.override 2011-02-13 20:22:06 +0000 | |||
1719 | @@ -98,19 +98,23 @@ | |||
1720 | 98 | _wrap_desktop_agnostic_color_from_values (PyObject *self, PyObject *args, | 98 | _wrap_desktop_agnostic_color_from_values (PyObject *self, PyObject *args, |
1721 | 99 | PyObject *kwargs) | 99 | PyObject *kwargs) |
1722 | 100 | { | 100 | { |
1736 | 101 | static char *kwlist[] = { "red", "green", "blue", "alpha", NULL }; | 101 | static char *kwlist[] = { "red", "green", "blue", "alpha", NULL }; |
1737 | 102 | int red, green, blue, alpha; | 102 | int red, green, blue, alpha; |
1738 | 103 | DesktopAgnosticColor *ret; | 103 | DesktopAgnosticColor *ret; |
1739 | 104 | 104 | PyObject *py_ret; | |
1740 | 105 | if (!PyArg_ParseTupleAndKeywords (args, kwargs, | 105 | |
1741 | 106 | "iiii:color_new_from_values", kwlist, | 106 | if (!PyArg_ParseTupleAndKeywords (args, kwargs, |
1742 | 107 | &red, &green, &blue, &alpha)) | 107 | "iiii:color_new_from_values", kwlist, |
1743 | 108 | return NULL; | 108 | &red, &green, &blue, &alpha)) |
1744 | 109 | 109 | return NULL; | |
1745 | 110 | ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha); | 110 | |
1746 | 111 | 111 | ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha); | |
1747 | 112 | /* pygobject_new handles NULL checking */ | 112 | |
1748 | 113 | return pygobject_new ((GObject *)ret); | 113 | /* pygobject_new handles NULL checking */ |
1749 | 114 | py_ret = pygobject_new ((GObject *)ret); | ||
1750 | 115 | if (ret != NULL) | ||
1751 | 116 | g_object_unref (ret); | ||
1752 | 117 | return py_ret; | ||
1753 | 114 | } | 118 | } |
1754 | 115 | %% | 119 | %% |
1755 | 116 | define DesktopAgnosticColor.from_string kwargs staticmethod | 120 | define DesktopAgnosticColor.from_string kwargs staticmethod |
1756 | @@ -122,6 +126,7 @@ | |||
1757 | 122 | char *spec; | 126 | char *spec; |
1758 | 123 | GError *error = NULL; | 127 | GError *error = NULL; |
1759 | 124 | DesktopAgnosticColor *ret; | 128 | DesktopAgnosticColor *ret; |
1760 | 129 | PyObject *py_ret; | ||
1761 | 125 | 130 | ||
1762 | 126 | if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string", | 131 | if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string", |
1763 | 127 | kwlist, &spec)) | 132 | kwlist, &spec)) |
1764 | @@ -137,7 +142,10 @@ | |||
1765 | 137 | } | 142 | } |
1766 | 138 | 143 | ||
1767 | 139 | /* pygobject_new handles NULL checking */ | 144 | /* pygobject_new handles NULL checking */ |
1769 | 140 | return pygobject_new ((GObject *)ret); | 145 | py_ret = pygobject_new ((GObject *)ret); |
1770 | 146 | if (ret != NULL) | ||
1771 | 147 | g_object_unref (ret); | ||
1772 | 148 | return py_ret; | ||
1773 | 141 | } | 149 | } |
1774 | 142 | %% | 150 | %% |
1775 | 143 | override-slot DesktopAgnosticColor.tp_str | 151 | override-slot DesktopAgnosticColor.tp_str |
1776 | 144 | 152 | ||
1777 | === modified file 'python/fdo.override' | |||
1778 | --- python/fdo.override 2009-10-06 18:53:45 +0000 | |||
1779 | +++ python/fdo.override 2011-02-13 20:22:06 +0000 | |||
1780 | @@ -197,6 +197,7 @@ | |||
1781 | 197 | { | 197 | { |
1782 | 198 | DesktopAgnosticFDODesktopEntry *ret; | 198 | DesktopAgnosticFDODesktopEntry *ret; |
1783 | 199 | GError *error = NULL; | 199 | GError *error = NULL; |
1784 | 200 | PyObject *py_ret; | ||
1785 | 200 | 201 | ||
1786 | 201 | ret = desktop_agnostic_fdo_desktop_entry_new (&error); | 202 | ret = desktop_agnostic_fdo_desktop_entry_new (&error); |
1787 | 202 | 203 | ||
1788 | @@ -206,7 +207,10 @@ | |||
1789 | 206 | } | 207 | } |
1790 | 207 | 208 | ||
1791 | 208 | /* pygobject_new handles NULL checking */ | 209 | /* pygobject_new handles NULL checking */ |
1793 | 209 | return pygobject_new ((GObject *)ret); | 210 | py_ret = pygobject_new ((GObject *)ret); |
1794 | 211 | if (ret != NULL) | ||
1795 | 212 | g_object_unref (ret); | ||
1796 | 213 | return py_ret; | ||
1797 | 210 | } | 214 | } |
1798 | 211 | %% | 215 | %% |
1799 | 212 | define DesktopAgnosticFDODesktopEntry.for_data kwargs staticmethod | 216 | define DesktopAgnosticFDODesktopEntry.for_data kwargs staticmethod |
1800 | @@ -218,6 +222,7 @@ | |||
1801 | 218 | static char *kwlist[] = { "data", NULL }; | 222 | static char *kwlist[] = { "data", NULL }; |
1802 | 219 | char *data; | 223 | char *data; |
1803 | 220 | DesktopAgnosticFDODesktopEntry *ret; | 224 | DesktopAgnosticFDODesktopEntry *ret; |
1804 | 225 | PyObject *py_ret; | ||
1805 | 221 | GError *error = NULL; | 226 | GError *error = NULL; |
1806 | 222 | 227 | ||
1807 | 223 | if (!PyArg_ParseTupleAndKeywords (args, kwargs, | 228 | if (!PyArg_ParseTupleAndKeywords (args, kwargs, |
1808 | @@ -235,7 +240,10 @@ | |||
1809 | 235 | } | 240 | } |
1810 | 236 | 241 | ||
1811 | 237 | /* pygobject_new handles NULL checking */ | 242 | /* pygobject_new handles NULL checking */ |
1813 | 238 | return pygobject_new ((GObject *)ret); | 243 | py_ret = pygobject_new ((GObject *)ret); |
1814 | 244 | if (ret != NULL) | ||
1815 | 245 | g_object_unref (ret); | ||
1816 | 246 | return py_ret; | ||
1817 | 239 | } | 247 | } |
1818 | 240 | %% | 248 | %% |
1819 | 241 | define DesktopAgnosticFDODesktopEntry.for_file onearg staticmethod | 249 | define DesktopAgnosticFDODesktopEntry.for_file onearg staticmethod |
1820 | @@ -244,6 +252,7 @@ | |||
1821 | 244 | PyGObject *file) | 252 | PyGObject *file) |
1822 | 245 | { | 253 | { |
1823 | 246 | DesktopAgnosticFDODesktopEntry *ret; | 254 | DesktopAgnosticFDODesktopEntry *ret; |
1824 | 255 | PyObject *py_ret; | ||
1825 | 247 | GError *error = NULL; | 256 | GError *error = NULL; |
1826 | 248 | 257 | ||
1827 | 249 | ret = desktop_agnostic_fdo_desktop_entry_new_for_file (DESKTOP_AGNOSTIC_VFS_FILE(file->obj), | 258 | ret = desktop_agnostic_fdo_desktop_entry_new_for_file (DESKTOP_AGNOSTIC_VFS_FILE(file->obj), |
1828 | @@ -255,7 +264,10 @@ | |||
1829 | 255 | } | 264 | } |
1830 | 256 | 265 | ||
1831 | 257 | /* pygobject_new handles NULL checking */ | 266 | /* pygobject_new handles NULL checking */ |
1833 | 258 | return pygobject_new ((GObject *)ret); | 267 | py_ret = pygobject_new ((GObject *)ret); |
1834 | 268 | if (ret != NULL) | ||
1835 | 269 | g_object_unref (ret); | ||
1836 | 270 | return py_ret; | ||
1837 | 259 | } | 271 | } |
1838 | 260 | %% | 272 | %% |
1839 | 261 | define DesktopAgnosticFDODesktopEntry.type_to_string onearg staticmethod | 273 | define DesktopAgnosticFDODesktopEntry.type_to_string onearg staticmethod |
1840 | 262 | 274 | ||
1841 | === modified file 'python/ui.override' | |||
1842 | --- python/ui.override 2009-10-21 22:09:04 +0000 | |||
1843 | +++ python/ui.override 2011-02-13 20:22:06 +0000 | |||
1844 | @@ -46,9 +46,13 @@ | |||
1845 | 46 | PyGObject *color) | 46 | PyGObject *color) |
1846 | 47 | { | 47 | { |
1847 | 48 | DesktopAgnosticUIColorButton *ret; | 48 | DesktopAgnosticUIColorButton *ret; |
1848 | 49 | PyObject *py_ret; | ||
1849 | 49 | 50 | ||
1850 | 50 | ret = desktop_agnostic_ui_color_button_new_with_color (DESKTOP_AGNOSTIC_COLOR(color->obj)); | 51 | ret = desktop_agnostic_ui_color_button_new_with_color (DESKTOP_AGNOSTIC_COLOR(color->obj)); |
1851 | 51 | 52 | ||
1852 | 52 | /* pygobject_new handles NULL checking */ | 53 | /* pygobject_new handles NULL checking */ |
1854 | 53 | return pygobject_new((GObject *)ret); | 54 | py_ret = pygobject_new ((GObject *)ret); |
1855 | 55 | if (ret != NULL) | ||
1856 | 56 | g_object_unref (ret); | ||
1857 | 57 | return py_ret; | ||
1858 | 54 | } | 58 | } |
1859 | 55 | 59 | ||
1860 | === modified file 'python/vfs.defs' | |||
1861 | --- python/vfs.defs 2009-09-08 03:28:50 +0000 | |||
1862 | +++ python/vfs.defs 2011-02-13 20:22:06 +0000 | |||
1863 | @@ -199,6 +199,36 @@ | |||
1864 | 199 | ) | 199 | ) |
1865 | 200 | ) | 200 | ) |
1866 | 201 | 201 | ||
1867 | 202 | (define-method is_native | ||
1868 | 203 | (of-object "DesktopAgnosticVFSFile") | ||
1869 | 204 | (c-name "desktop_agnostic_vfs_file_is_native") | ||
1870 | 205 | (return-type "gboolean") | ||
1871 | 206 | ) | ||
1872 | 207 | |||
1873 | 208 | (define-method get_mime_type | ||
1874 | 209 | (of-object "DesktopAgnosticVFSFile") | ||
1875 | 210 | (c-name "desktop_agnostic_vfs_file_get_mime_type") | ||
1876 | 211 | (return-type "char*") | ||
1877 | 212 | (parameters | ||
1878 | 213 | '("GError**" "error") | ||
1879 | 214 | ) | ||
1880 | 215 | ) | ||
1881 | 216 | |||
1882 | 217 | (define-method get_icon_names | ||
1883 | 218 | (of-object "DesktopAgnosticVFSFile") | ||
1884 | 219 | (c-name "desktop_agnostic_vfs_file_get_icon_names") | ||
1885 | 220 | (return-type "GStrv") | ||
1886 | 221 | (parameters | ||
1887 | 222 | '("GError**" "error") | ||
1888 | 223 | ) | ||
1889 | 224 | ) | ||
1890 | 225 | |||
1891 | 226 | (define-method get_thumbnail_path | ||
1892 | 227 | (of-object "DesktopAgnosticVFSFile") | ||
1893 | 228 | (c-name "desktop_agnostic_vfs_file_get_thumbnail_path") | ||
1894 | 229 | (return-type "char*") | ||
1895 | 230 | ) | ||
1896 | 231 | |||
1897 | 202 | (define-function file_new_for_path | 232 | (define-function file_new_for_path |
1898 | 203 | (c-name "desktop_agnostic_vfs_file_new_for_path") | 233 | (c-name "desktop_agnostic_vfs_file_new_for_path") |
1899 | 204 | (return-type "DesktopAgnosticVFSFile*") | 234 | (return-type "DesktopAgnosticVFSFile*") |
1900 | @@ -217,6 +247,14 @@ | |||
1901 | 217 | ) | 247 | ) |
1902 | 218 | ) | 248 | ) |
1903 | 219 | 249 | ||
1904 | 250 | (define-function get_icon_names_for_mime_type | ||
1905 | 251 | (c-name "desktop_agnostic_vfs_get_icon_names_for_mime_type") | ||
1906 | 252 | (return-type "char*") | ||
1907 | 253 | (parameters | ||
1908 | 254 | '("const-char*" "mime_type") | ||
1909 | 255 | ) | ||
1910 | 256 | ) | ||
1911 | 257 | |||
1912 | 220 | (define-method changed | 258 | (define-method changed |
1913 | 221 | (of-object "DesktopAgnosticVFSFileMonitor") | 259 | (of-object "DesktopAgnosticVFSFileMonitor") |
1914 | 222 | (c-name "desktop_agnostic_vfs_file_monitor_emit") | 260 | (c-name "desktop_agnostic_vfs_file_monitor_emit") |
1915 | 223 | 261 | ||
1916 | === modified file 'python/vfs.override' | |||
1917 | --- python/vfs.override 2009-09-08 03:28:50 +0000 | |||
1918 | +++ python/vfs.override 2011-02-13 20:22:06 +0000 | |||
1919 | @@ -117,6 +117,7 @@ | |||
1920 | 117 | { | 117 | { |
1921 | 118 | char *path; | 118 | char *path; |
1922 | 119 | DesktopAgnosticVFSFile *ret; | 119 | DesktopAgnosticVFSFile *ret; |
1923 | 120 | PyObject *py_ret; | ||
1924 | 120 | GError *error = NULL; | 121 | GError *error = NULL; |
1925 | 121 | 122 | ||
1926 | 122 | if (!PyString_Check (arg)) | 123 | if (!PyString_Check (arg)) |
1927 | @@ -136,16 +137,20 @@ | |||
1928 | 136 | } | 137 | } |
1929 | 137 | 138 | ||
1930 | 138 | /* pygobject_new handles NULL checking */ | 139 | /* pygobject_new handles NULL checking */ |
1932 | 139 | return pygobject_new ((GObject *)ret); | 140 | py_ret = pygobject_new ((GObject *)ret); |
1933 | 141 | if (ret != NULL) | ||
1934 | 142 | g_object_unref (ret); | ||
1935 | 143 | return py_ret; | ||
1936 | 140 | } | 144 | } |
1937 | 141 | %% | 145 | %% |
1938 | 142 | define DesktopAgnosticVFSFile.for_uri onearg staticmethod | 146 | define DesktopAgnosticVFSFile.for_uri onearg staticmethod |
1939 | 143 | static PyObject * | 147 | static PyObject * |
1940 | 144 | _wrap_desktop_agnostic_v_f_s_file_for_uri (PyObject *self, PyObject *arg) | 148 | _wrap_desktop_agnostic_v_f_s_file_for_uri (PyObject *self, PyObject *arg) |
1941 | 145 | { | 149 | { |
1945 | 146 | char *uri; | 150 | char *uri; |
1946 | 147 | DesktopAgnosticVFSFile *ret; | 151 | DesktopAgnosticVFSFile *ret; |
1947 | 148 | GError *error = NULL; | 152 | PyObject *py_ret; |
1948 | 153 | GError *error = NULL; | ||
1949 | 149 | 154 | ||
1950 | 150 | if (!PyString_Check (arg)) | 155 | if (!PyString_Check (arg)) |
1951 | 151 | { | 156 | { |
1952 | @@ -164,8 +169,39 @@ | |||
1953 | 164 | } | 169 | } |
1954 | 165 | 170 | ||
1955 | 166 | /* pygobject_new handles NULL checking */ | 171 | /* pygobject_new handles NULL checking */ |
1958 | 167 | return pygobject_new ((GObject *)ret); | 172 | py_ret = pygobject_new ((GObject *)ret); |
1959 | 168 | } | 173 | if (ret != NULL) |
1960 | 174 | g_object_unref (ret); | ||
1961 | 175 | return py_ret; | ||
1962 | 176 | } | ||
1963 | 177 | %% | ||
1964 | 178 | override desktop_agnostic_vfs_get_icon_names_for_mime_type kwargs | ||
1965 | 179 | static PyObject * | ||
1966 | 180 | _wrap_desktop_agnostic_vfs_get_icon_names_for_mime_type(PyObject *self, PyObject *args, PyObject *kwargs) | ||
1967 | 181 | { | ||
1968 | 182 | static char *kwlist[] = { "mime_type", NULL }; | ||
1969 | 183 | char *mime_type; | ||
1970 | 184 | gchar **ret; | ||
1971 | 185 | int ret_length = 0; | ||
1972 | 186 | int i; | ||
1973 | 187 | PyObject *py_ret; | ||
1974 | 188 | |||
1975 | 189 | if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:get_icon_names_for_mime_type", kwlist, &mime_type)) | ||
1976 | 190 | return NULL; | ||
1977 | 191 | |||
1978 | 192 | ret = desktop_agnostic_vfs_get_icon_names_for_mime_type(mime_type, &ret_length); | ||
1979 | 193 | |||
1980 | 194 | py_ret = PyList_New (ret_length); | ||
1981 | 195 | if (ret) { | ||
1982 | 196 | for (i=0; i<ret_length; i++) { | ||
1983 | 197 | PyList_SetItem (py_ret, i, PyString_FromString (ret[i])); | ||
1984 | 198 | g_free (ret[i]); | ||
1985 | 199 | } | ||
1986 | 200 | g_free(ret); | ||
1987 | 201 | } | ||
1988 | 202 | return py_ret; | ||
1989 | 203 | } | ||
1990 | 204 | |||
1991 | 169 | %% | 205 | %% |
1992 | 170 | override desktop_agnostic_vfs_file_enumerate_children noargs | 206 | override desktop_agnostic_vfs_file_enumerate_children noargs |
1993 | 171 | static PyObject * | 207 | static PyObject * |
1994 | @@ -209,6 +245,34 @@ | |||
1995 | 209 | return PyString_FromStringAndSize (data, length); | 245 | return PyString_FromStringAndSize (data, length); |
1996 | 210 | } | 246 | } |
1997 | 211 | %% | 247 | %% |
1998 | 248 | override desktop_agnostic_vfs_file_get_icon_names noargs | ||
1999 | 249 | static PyObject * | ||
2000 | 250 | _wrap_desktop_agnostic_vfs_file_get_icon_names (PyGObject *self) | ||
2001 | 251 | { | ||
2002 | 252 | int i, res_length; | ||
2003 | 253 | char **result; | ||
2004 | 254 | PyObject *py_result; | ||
2005 | 255 | GError *error = NULL; | ||
2006 | 256 | |||
2007 | 257 | result = desktop_agnostic_vfs_file_get_icon_names (DESKTOP_AGNOSTIC_VFS_FILE (self->obj), | ||
2008 | 258 | &res_length, &error); | ||
2009 | 259 | |||
2010 | 260 | if (pyg_error_check (&error)) | ||
2011 | 261 | { | ||
2012 | 262 | return NULL; | ||
2013 | 263 | } | ||
2014 | 264 | |||
2015 | 265 | py_result = PyList_New (res_length); | ||
2016 | 266 | for (i=0; i<res_length; i++) | ||
2017 | 267 | { | ||
2018 | 268 | PyList_SetItem (py_result, i, PyString_FromString (result[i])); | ||
2019 | 269 | g_free (result[i]); | ||
2020 | 270 | } | ||
2021 | 271 | if (result != NULL) g_free (result); | ||
2022 | 272 | |||
2023 | 273 | return py_result; | ||
2024 | 274 | } | ||
2025 | 275 | %% | ||
2026 | 212 | define DesktopAgnosticVFSTrash.get_default noargs staticmethod | 276 | define DesktopAgnosticVFSTrash.get_default noargs staticmethod |
2027 | 213 | static PyObject * | 277 | static PyObject * |
2028 | 214 | _wrap_desktop_agnostic_v_f_s_trash_get_default (PyObject *self) | 278 | _wrap_desktop_agnostic_v_f_s_trash_get_default (PyObject *self) |
2029 | 215 | 279 | ||
2030 | === modified file 'tools/lda-desktop-entry-editor.vala' | |||
2031 | --- tools/lda-desktop-entry-editor.vala 2009-10-21 22:09:04 +0000 | |||
2032 | +++ tools/lda-desktop-entry-editor.vala 2011-02-13 20:22:06 +0000 | |||
2033 | @@ -51,9 +51,9 @@ | |||
2034 | 51 | { | 51 | { |
2035 | 52 | output = VFS.file_new_for_path (args[2]); | 52 | output = VFS.file_new_for_path (args[2]); |
2036 | 53 | } | 53 | } |
2038 | 54 | editor = new LauncherEditorDialog (file, output, true); | 54 | editor = new LauncherEditorDialog (file, output); |
2039 | 55 | editor.show_all (); | 55 | editor.show_all (); |
2041 | 56 | Gtk.main (); | 56 | editor.run (); |
2042 | 57 | 57 | ||
2043 | 58 | VFS.shutdown (); | 58 | VFS.shutdown (); |
2044 | 59 | } | 59 | } |
2045 | 60 | 60 | ||
2046 | === modified file 'wscript' | |||
2047 | --- wscript 2010-04-18 20:00:06 +0000 | |||
2048 | +++ wscript 2011-02-13 20:22:06 +0000 | |||
2049 | @@ -15,7 +15,7 @@ | |||
2050 | 15 | API_VERSION = '1.0' | 15 | API_VERSION = '1.0' |
2051 | 16 | 16 | ||
2052 | 17 | # the following two variables are used by the target "waf dist" | 17 | # the following two variables are used by the target "waf dist" |
2054 | 18 | VERSION = '0.3.90' | 18 | VERSION = '0.3.91' |
2055 | 19 | VNUM = '0.4.0' | 19 | VNUM = '0.4.0' |
2056 | 20 | 20 | ||
2057 | 21 | CFG_BACKENDS = ','.join(['gconf', 'keyfile']) | 21 | CFG_BACKENDS = ','.join(['gconf', 'keyfile']) |
2058 | @@ -70,6 +70,8 @@ | |||
2059 | 70 | dest='profiling', default=False, | 70 | dest='profiling', default=False, |
2060 | 71 | help='Enables the library to be built so that it is ' | 71 | help='Enables the library to be built so that it is ' |
2061 | 72 | 'instrumented to measure performance.') | 72 | 'instrumented to measure performance.') |
2062 | 73 | opt.add_option('--disable-gi', action='store_true', | ||
2063 | 74 | dest='no_gi', default=False) | ||
2064 | 73 | 75 | ||
2065 | 74 | 76 | ||
2066 | 75 | def configure(conf): | 77 | def configure(conf): |
2067 | @@ -88,12 +90,13 @@ | |||
2068 | 88 | conf.env['DEBUG'] = Options.options.debug | 90 | conf.env['DEBUG'] = Options.options.debug |
2069 | 89 | conf.env['EXTRA_WARNINGS'] = Options.options.extra_warnings | 91 | conf.env['EXTRA_WARNINGS'] = Options.options.extra_warnings |
2070 | 90 | conf.env['PROFILING'] = Options.options.profiling | 92 | conf.env['PROFILING'] = Options.options.profiling |
2071 | 93 | conf.env['INTROSPECTION'] = not Options.options.no_gi | ||
2072 | 91 | conf.env['VNUM'] = str(VNUM) | 94 | conf.env['VNUM'] = str(VNUM) |
2073 | 92 | 95 | ||
2074 | 93 | conf.check_tool('gnu_dirs') | 96 | conf.check_tool('gnu_dirs') |
2075 | 94 | conf.check_tool('compiler_cc intltool misc python vala') | 97 | conf.check_tool('compiler_cc intltool misc python vala') |
2076 | 95 | 98 | ||
2078 | 96 | MIN_VALA_VERSION = (0, 7, 10) | 99 | MIN_VALA_VERSION = (0, 8, 1) |
2079 | 97 | 100 | ||
2080 | 98 | conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE', | 101 | conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE', |
2081 | 99 | atleast_version='2.6.0', mandatory=True, | 102 | atleast_version='2.6.0', mandatory=True, |
2082 | @@ -131,12 +134,16 @@ | |||
2083 | 131 | conf.check_cfg(package='gnome-vfs-2.0', uselib_store='GNOME_VFS', | 134 | conf.check_cfg(package='gnome-vfs-2.0', uselib_store='GNOME_VFS', |
2084 | 132 | atleast_version='2.6.0', mandatory=True, | 135 | atleast_version='2.6.0', mandatory=True, |
2085 | 133 | args='--cflags --libs') | 136 | args='--cflags --libs') |
2086 | 137 | if 'gio' in conf.env['BACKENDS_DE']: | ||
2087 | 138 | conf.check_cfg(package='gio-unix-2.0', uselib_store='GIO_UNIX', | ||
2088 | 139 | atleast_version='2.18.0', mandatory=True, | ||
2089 | 140 | args='--cflags --libs') | ||
2090 | 134 | if 'gnome' in conf.env['BACKENDS_DE']: | 141 | if 'gnome' in conf.env['BACKENDS_DE']: |
2091 | 135 | conf.check_cfg(package='gnome-desktop-2.0', | 142 | conf.check_cfg(package='gnome-desktop-2.0', |
2092 | 136 | uselib_store='GNOME_DESKTOP', mandatory=True, | 143 | uselib_store='GNOME_DESKTOP', mandatory=True, |
2093 | 137 | args='--cflags --libs') | 144 | args='--cflags --libs') |
2094 | 138 | # make sure we have the proper Vala version | 145 | # make sure we have the proper Vala version |
2096 | 139 | if conf.env['VALAC_VERSION'] != MIN_VALA_VERSION and \ | 146 | if conf.env['VALAC_VERSION'] < MIN_VALA_VERSION and \ |
2097 | 140 | not os.path.isdir(os.path.join(conf.curdir, GEN_SRC_DIR)): | 147 | not os.path.isdir(os.path.join(conf.curdir, GEN_SRC_DIR)): |
2098 | 141 | conf.fatal('''\ | 148 | conf.fatal('''\ |
2099 | 142 | Your Vala compiler version %s is too old. The project requires | 149 | Your Vala compiler version %s is too old. The project requires |
I'm using this branch in Ubuntu for quite some time, without any problems. I'm for it, but I can't review the code itself for the merge.