Merge lp:~awn-core/libdesktop-agnostic/various-fixes into lp:libdesktop-agnostic

Proposed by moonbeam
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
Reviewer Review Type Date Requested Status
Mark Lee style, build system Needs Fixing
Julien Lavergne Approve
Review via email: mp+45033@code.launchpad.net

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.

To post a comment you must log in.
Julien Lavergne (gilir) wrote :

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.

review: Approve
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-agnostic/wscript:
> + if bld.env['INTROSPECTION']: lib.gir = 'DesktopAgnostic-1.0'

Two lines, please (PEP8 applies). Same for all of the other instances.

=== python/desktopagnostic.override:
+ 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_option('--disable-gi', action='store_true',
+ 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.

review: Needs Fixing (style, build system)
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 on 2011-01-22

Whoops, did I remove gilir's commit?

425. By Michal Hruby on 2011-02-13

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-agnostic/wscript:
> > + if bld.env['INTROSPECTION']: lib.gir = 'DesktopAgnostic-1.0'
>
> Two lines, please (PEP8 applies). Same for all of the other instances.

Done.

>
> === python/desktopagnostic.override:
> + 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_option('--disable-gi', action='store_true',
> + 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-xyz=no/false.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2010-04-18 20:00:06 +0000
+++ debian/control 2011-02-13 20:22:06 +0000
@@ -9,9 +9,9 @@
9 intltool,9 intltool,
10 valac (>= 0.7.10),10 valac (>= 0.7.10),
11 gobject-introspection (>= 0.6.3),11 gobject-introspection (>= 0.6.3),
12 gobject-introspection-glib-2.0,12 gir-repository-dev (>= 0.6.3) | gobject-introspection-glib-2.0,
13 gobject-introspection-freedesktop,13 gir-repository-dev (>= 0.6.3) | gobject-introspection-freedesktop,
14 gobject-introspection-repository,14 gir-repository-dev (>= 0.6.3) | gobject-introspection-repository,
15 libgirepository1.0-dev (>= 0.6.3),15 libgirepository1.0-dev (>= 0.6.3),
16 libglib2.0-dev (>= 2.16.0),16 libglib2.0-dev (>= 2.16.0),
17 libgtk2.0-dev,17 libgtk2.0-dev,
1818
=== modified file 'docs/known-issues.rst'
--- docs/known-issues.rst 2009-08-18 17:29:21 +0000
+++ docs/known-issues.rst 2011-02-13 20:22:06 +0000
@@ -19,7 +19,7 @@
19 config-bridge.vala:164: warning: pointer targets in passing argument 2 of ‘g_object_class_list_properties’ differ in signedness19 config-bridge.vala:164: warning: pointer targets in passing argument 2 of ‘g_object_class_list_properties’ 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 signedness20 desktop-entry-impl-glib.c:306: warning: pointer targets in passing argument 4 of ‘g_key_file_get_string_list’ differ in signedness
2121
22.. [1] See `GNOME Bug #582092`_.22.. [1] See `GNOME Bug #582092`_ (fixed in Vala 0.9.1).
23.. [2] See `GNOME Bug #529866`_ (fixed in Vala 0.7.6).23.. [2] See `GNOME Bug #529866`_ (fixed in Vala 0.7.6).
24.. [3] See `GNOME Bug #592108`_ (fixed in Vala 0.7.6).24.. [3] See `GNOME Bug #592108`_ (fixed in Vala 0.7.6).
2525
2626
=== modified file 'libdesktop-agnostic/config-bridge.vala'
--- libdesktop-agnostic/config-bridge.vala 2010-03-31 20:31:44 +0000
+++ libdesktop-agnostic/config-bridge.vala 2011-02-13 20:22:06 +0000
@@ -202,14 +202,13 @@
202 string key, ParamSpec spec,202 string key, ParamSpec spec,
203 NotifyFuncHandler func) throws GLib.Error203 NotifyFuncHandler func) throws GLib.Error
204 {204 {
205 unowned BindingNotifier notifier;205 unowned BindingNotifier? notifier;
206 notifier = (BindingNotifier*) config.get_data ("lda-binding-notifier");206 notifier = config.get_data ("lda-binding-notifier");
207 if (notifier == null)207 if (notifier == null)
208 {208 {
209 BindingNotifier new_notifier = new BindingNotifier (config);209 BindingNotifier new_notifier = new BindingNotifier (config);
210 notifier = new_notifier;210 notifier = new_notifier;
211 config.set_data_full ("lda-binding-notifier", notifier.@ref (),211 config.set_data ("lda-binding-notifier", notifier);
212 Object.unref);
213 }212 }
214213
215 if (spec.value_type == typeof (bool) ||214 if (spec.value_type == typeof (bool) ||
@@ -353,8 +352,7 @@
353 uint pos = -1;352 uint pos = -1;
354 string binding_key;353 string binding_key;
355354
356 unowned BindingListWrapper? obj_bindings = 355 unowned BindingListWrapper? obj_bindings = obj.get_data ("lda-bindings");
357 (BindingListWrapper*) obj.get_data ("lda-bindings");
358 binding_key = "%s/%s/%s".printf (config.instance_id, group, key);356 binding_key = "%s/%s/%s".printf (config.instance_id, group, key);
359 bindings_list = this.bindings.get_data (binding_key);357 bindings_list = this.bindings.get_data (binding_key);
360 bindings_to_remove = new SList<uint> ();358 bindings_to_remove = new SList<uint> ();
361359
=== modified file 'libdesktop-agnostic/config-client.vala'
--- libdesktop-agnostic/config-client.vala 2010-04-07 22:45:37 +0000
+++ libdesktop-agnostic/config-client.vala 2011-02-13 20:22:06 +0000
@@ -101,13 +101,12 @@
101 // constructors101 // constructors
102 public Client (string schema_filename)102 public Client (string schema_filename)
103 {103 {
104 this.schema_filename = schema_filename;104 GLib.Object (schema_filename: schema_filename);
105 }105 }
106 public Client.for_instance (string schema_filename,106 public Client.for_instance (string schema_filename,
107 string instance_id) throws GLib.Error107 string instance_id) throws GLib.Error
108 {108 {
109 this.schema_filename = schema_filename;109 GLib.Object (schema_filename: schema_filename, instance_id: instance_id);
110 this.instance_id = instance_id;
111 }110 }
112 /**111 /**
113 * Auto-determines whether an instance config object should be created.112 * Auto-determines whether an instance config object should be created.
114113
=== modified file 'libdesktop-agnostic/config-impl-gconf.vala'
--- libdesktop-agnostic/config-impl-gconf.vala 2010-02-04 22:08:30 +0000
+++ libdesktop-agnostic/config-impl-gconf.vala 2011-02-13 20:22:06 +0000
@@ -654,7 +654,6 @@
654 }654 }
655}655}
656656
657[ModuleInit]
658public Type657public Type
659register_plugin ()658register_plugin ()
660{659{
661660
=== modified file 'libdesktop-agnostic/config-impl-keyfile.vala'
--- libdesktop-agnostic/config-impl-keyfile.vala 2009-10-21 18:48:42 +0000
+++ libdesktop-agnostic/config-impl-keyfile.vala 2011-02-13 20:22:06 +0000
@@ -697,6 +697,10 @@
697697
698 if (value.n_values == 0)698 if (value.n_values == 0)
699 {699 {
700 if (!this._data.has_group (group))
701 {
702 return;
703 }
700 if (this._data.has_key (group, key))704 if (this._data.has_key (group, key))
701 {705 {
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.
@@ -764,7 +768,6 @@
764 }768 }
765 }769 }
766}770}
767[ModuleInit]
768public Type771public Type
769register_plugin ()772register_plugin ()
770{773{
771774
=== modified file 'libdesktop-agnostic/config-impl-memory.vala'
--- libdesktop-agnostic/config-impl-memory.vala 2009-08-15 18:26:33 +0000
+++ libdesktop-agnostic/config-impl-memory.vala 2011-02-13 20:22:06 +0000
@@ -226,7 +226,6 @@
226 }226 }
227 }227 }
228}228}
229[ModuleInit]
230public Type229public Type
231register_plugin ()230register_plugin ()
232{231{
233232
=== modified file 'libdesktop-agnostic/config-impl-null.vala'
--- libdesktop-agnostic/config-impl-null.vala 2009-08-06 06:38:30 +0000
+++ libdesktop-agnostic/config-impl-null.vala 2011-02-13 20:22:06 +0000
@@ -121,7 +121,6 @@
121 }121 }
122 }122 }
123}123}
124[ModuleInit]
125public Type124public Type
126register_plugin ()125register_plugin ()
127{126{
128127
=== modified file 'libdesktop-agnostic/config-schema.vala'
--- libdesktop-agnostic/config-schema.vala 2009-09-26 20:13:40 +0000
+++ libdesktop-agnostic/config-schema.vala 2011-02-13 20:22:06 +0000
@@ -188,7 +188,8 @@
188 */188 */
189 public Schema (string filename) throws GLib.Error189 public Schema (string filename) throws GLib.Error
190 {190 {
191 this.filename = filename;191 GLib.Object (filename: filename);
192
192 unowned HashTable<string,Value?> backend_metadata_keys;193 unowned HashTable<string,Value?> backend_metadata_keys;
193 this.options = Datalist<SchemaOption> ();194 this.options = Datalist<SchemaOption> ();
194 this.keys = new HashTable<string,List<string>> (str_hash, str_equal);195 this.keys = new HashTable<string,List<string>> (str_hash, str_equal);
195196
=== modified file 'libdesktop-agnostic/config-type-color.vala'
--- libdesktop-agnostic/config-type-color.vala 2009-07-31 06:50:20 +0000
+++ libdesktop-agnostic/config-type-color.vala 2011-02-13 20:22:06 +0000
@@ -120,7 +120,6 @@
120 dest_value = ct.deserialize ((string)src_value);120 dest_value = ct.deserialize ((string)src_value);
121 }121 }
122}122}
123[ModuleInit]
124public Type123public Type
125register_plugin ()124register_plugin ()
126{125{
127126
=== added file 'libdesktop-agnostic/desktop-entry-impl-gio.vala'
--- libdesktop-agnostic/desktop-entry-impl-gio.vala 1970-01-01 00:00:00 +0000
+++ libdesktop-agnostic/desktop-entry-impl-gio.vala 2011-02-13 20:22:06 +0000
@@ -0,0 +1,394 @@
1/*
2 * Desktop Agnostic Library: Desktop Entry implementation using GLib.
3 *
4 * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author : Michal Hruby <michal.mhr@gmail.com>
21 */
22
23using DesktopAgnostic;
24
25namespace DesktopAgnostic.FDO
26{
27 private const string GROUP = "Desktop Entry";
28 public class DesktopEntryGio : DesktopEntry, Object
29 {
30 private KeyFile _keyfile = new KeyFile ();
31 private bool loaded = false;
32 private VFS.File _file = null;
33
34 public VFS.File? file
35 {
36 get
37 {
38 return this._file;
39 }
40 set construct
41 {
42 if (value != null)
43 {
44 if (this.loaded)
45 {
46 warning ("The desktop entry has already been initialized.");
47 }
48 else if (value.exists ())
49 {
50 string? path;
51
52 this._file = value;
53 path = value.path;
54 if (path == null)
55 {
56 string data;
57 size_t data_len;
58
59 this._file.load_contents (out data, out data_len);
60 this._keyfile.load_from_data (data, data_len,
61 KeyFileFlags.KEEP_TRANSLATIONS);
62 }
63 else
64 {
65 this._keyfile.load_from_file (path, KeyFileFlags.KEEP_TRANSLATIONS);
66 }
67 this.loaded = true;
68 }
69 }
70 }
71 }
72
73 public KeyFile keyfile
74 {
75 get
76 {
77 return this._keyfile;
78 }
79 set construct
80 {
81 if (value != null)
82 {
83 if (this.loaded)
84 {
85 warning ("The desktop entry has already been initialized.");
86 }
87 else
88 {
89 string data;
90 size_t length;
91
92 data = value.to_data (out length);
93 this._keyfile.load_from_data (data, length,
94 KeyFileFlags.KEEP_TRANSLATIONS);
95 this.loaded = true;
96 }
97 }
98 }
99 }
100
101 public string data
102 {
103 set construct
104 {
105 if (value != null && value != "")
106 {
107 if (this.loaded)
108 {
109 warning ("The desktop entry has already been initialized.");
110 }
111 else
112 {
113 this._keyfile.load_from_data (value, value.size (),
114 KeyFileFlags.KEEP_TRANSLATIONS);
115 this.loaded = true;
116 }
117 }
118 }
119 }
120
121 public DesktopEntryType entry_type
122 {
123 get
124 {
125 string type = this.get_string ("Type");
126 switch (type)
127 {
128 case "Application":
129 return DesktopEntryType.APPLICATION;
130 case "Link":
131 return DesktopEntryType.LINK;
132 case "Directory":
133 return DesktopEntryType.DIRECTORY;
134 default:
135 return DesktopEntryType.UNKNOWN;
136 }
137 }
138 set
139 {
140 this.set_string ("Type", desktop_entry_type_to_string (value));
141 }
142 }
143
144 public string name
145 {
146 owned get
147 {
148 return this.get_string ("Name");
149 }
150 set
151 {
152 this.set_string ("Name", value);
153 }
154 }
155
156 public string? icon
157 {
158 /**
159 * If a path is provided then return the given value. Otherwise,
160 * strip any extension (.xpm, .svg, .png).
161 */
162 owned get
163 {
164 string? icon_name = this.get_string ("Icon");
165
166 if (icon_name != null && Path.get_basename (icon_name) == icon_name)
167 {
168 icon_name = icon_name.split (".png", 2)[0];
169 icon_name = icon_name.split (".svg", 2)[0];
170 icon_name = icon_name.split (".xpm", 2)[0];
171 }
172
173 return icon_name;
174 }
175 set
176 {
177 if (value == null)
178 {
179 warning ("Cannot set a NULL value for 'Icon'.");
180 }
181 else
182 {
183 this.set_string ("Icon", value);
184 }
185 }
186 }
187
188 public bool
189 key_exists (string key)
190 {
191 return this._keyfile.has_group (GROUP) &&
192 this._keyfile.has_key (GROUP, key);
193 }
194
195 public bool
196 get_boolean (string key)
197 {
198 try
199 {
200 return this._keyfile.get_boolean (GROUP, key);
201 }
202 catch (KeyFileError err)
203 {
204 warning ("Error trying to retrieve '%s': %s", key, err.message);
205 return false;
206 }
207 }
208
209 public void
210 set_boolean (string key, bool value)
211 {
212 this._keyfile.set_boolean (GROUP, key, value);
213 }
214
215 public string?
216 get_string (string key)
217 {
218 try
219 {
220 return this._keyfile.get_string (GROUP, key);
221 }
222 catch (KeyFileError err)
223 {
224 warning ("Error trying to retrieve '%s': %s", key, err.message);
225 return null;
226 }
227 }
228
229 public void
230 set_string (string key, string value)
231 {
232 this._keyfile.set_string (GROUP, key, value);
233 }
234
235 public string?
236 get_localestring (string key, string? locale)
237 {
238 try
239 {
240 return this._keyfile.get_locale_string (GROUP, key, locale);
241 }
242 catch (KeyFileError err)
243 {
244 warning ("Error trying to retrieve '%s[%s]': %s", key, locale,
245 err.message);
246 return null;
247 }
248 }
249
250 public void
251 set_localestring (string key, string locale, string value)
252 {
253 this._keyfile.set_locale_string (GROUP, key, locale, value);
254 }
255
256 [CCode (array_length = false, array_null_terminated = true)]
257 public string[]?
258 get_string_list (string key)
259 {
260 try
261 {
262 return this._keyfile.get_string_list (GROUP, key);
263 }
264 catch (KeyFileError err)
265 {
266 warning ("Error trying to retrieve '%s': %s", key, err.message);
267 return null;
268 }
269 }
270
271 public void
272 set_string_list (string key, [CCode (array_length = false, array_null_terminated = true)] string[] value)
273 {
274 this._keyfile.set_string_list (GROUP, key, value);
275 }
276
277 /**
278 * Based on EggDesktopFile's egg_desktop_file_can_launch().
279 */
280 public bool
281 exists ()
282 {
283 switch (this.entry_type)
284 {
285 case DesktopEntryType.APPLICATION:
286 if (this._keyfile.has_key (GROUP, "TryExec"))
287 {
288 if (Environment.find_program_in_path (this.get_string ("TryExec")) != null)
289 {
290 return true;
291 }
292 }
293 string? exec;
294 string[] argv = null;;
295 exec = this.get_string ("Exec");
296 if (exec == null || !Shell.parse_argv (exec, out argv))
297 {
298 return false;
299 }
300 return Environment.find_program_in_path (argv[0]) != null;
301 case DesktopEntryType.LINK:
302 if (this._keyfile.has_key (GROUP, "URL"))
303 {
304 string uri = this._keyfile.get_string (GROUP, "URL");
305 VFS.File file = VFS.file_new_for_uri (uri);
306 return file.exists ();
307 }
308 else
309 {
310 return false;
311 }
312 default:
313 return false;
314 }
315 }
316
317 /**
318 * Launch desktop entry.
319 * @return always zero.
320 */
321 public Pid
322 launch (DesktopEntryLaunchFlags flags,
323 SList<string>? documents) throws GLib.Error
324 {
325 List<unowned string> uris = new List<unowned string> ();
326 foreach (unowned string s in documents)
327 {
328 uris.append (s);
329 }
330
331 // interesting that GIO 2.26 supports only APPLICATION
332 switch (this.entry_type)
333 {
334 case DesktopEntryType.APPLICATION:
335 AppInfo info;
336 if (this._file != null)
337 {
338 info = new DesktopAppInfo.from_filename (this._file.path);
339 }
340 else
341 {
342 info = new DesktopAppInfo.from_keyfile (this._keyfile);
343 }
344
345 //var context = new AppLaunchContext ();
346 info.launch_uris (uris, null);
347
348 break;
349 case DesktopEntryType.LINK:
350 if (this._keyfile.has_key (GROUP, "URL"))
351 {
352 string uri = this._keyfile.get_string (GROUP, "URL");
353 AppInfo.launch_default_for_uri (uri, null);
354 }
355 else
356 {
357 throw new DesktopEntryError.NOT_LAUNCHABLE ("Invalid desktop entry.");
358 }
359 break;
360 default:
361 throw new DesktopEntryError.NOT_LAUNCHABLE ("Unknown desktop entry type.");
362 }
363
364 return (Pid) 0;
365 }
366
367 public void
368 save (VFS.File? new_file) throws GLib.Error
369 {
370 VFS.File? file = null;
371 if (new_file != null)
372 {
373 file = new_file;
374 }
375 else if (this._file != null)
376 {
377 file = this._file;
378 }
379 else
380 {
381 throw new DesktopEntryError.INVALID_FILE ("No filename specified.");
382 }
383 file.replace_contents (this._keyfile.to_data ());
384 }
385 }
386}
387
388public Type
389register_plugin ()
390{
391 return typeof (DesktopAgnostic.FDO.DesktopEntryGio);
392}
393
394// vim: set ts=2 sts=2 sw=2 et ai cindent :
0395
=== modified file 'libdesktop-agnostic/desktop-entry-impl-glib.vala'
--- libdesktop-agnostic/desktop-entry-impl-glib.vala 2010-03-26 22:45:36 +0000
+++ libdesktop-agnostic/desktop-entry-impl-glib.vala 2011-02-13 20:22:06 +0000
@@ -531,6 +531,59 @@
531 throw new DesktopEntryError.NOT_LAUNCHABLE ("Could not parse Exec key.");531 throw new DesktopEntryError.NOT_LAUNCHABLE ("Could not parse Exec key.");
532 }532 }
533533
534 if (this._keyfile.has_key (GROUP, "Terminal") &&
535 this.get_boolean ("Terminal"))
536 {
537 string[] term_argv = new string[argv.length + 2];
538
539 // based on the code for GDesktopAppInfo
540 string? check = null;
541 check = Environment.find_program_in_path ("gnome-terminal");
542 if (check != null)
543 {
544 term_argv[0] = check;
545 term_argv[1] = "-x";
546 }
547 else
548 {
549 if (check == null)
550 {
551 check = Environment.find_program_in_path ("nxterm");
552 }
553 if (check == null)
554 {
555 check = Environment.find_program_in_path ("color-xterm");
556 }
557 if (check == null)
558 {
559 check = Environment.find_program_in_path ("rxvt");
560 }
561 if (check == null)
562 {
563 check = Environment.find_program_in_path ("xterm");
564 }
565 if (check == null)
566 {
567 check = Environment.find_program_in_path ("dtterm");
568 }
569 if (check == null)
570 {
571 check = "xterm";
572 warning ("couldn't find a terminal, falling back to xterm");
573 }
574
575 term_argv[0] = check;
576 term_argv[1] = "-e";
577 }
578
579 for (int i = 0; i < argv.length; i++)
580 {
581 term_argv[i+2] = argv[i];
582 }
583
584 argv = (owned) term_argv;
585 }
586
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);
535 return pid;588 return pid;
536 }589 }
@@ -614,7 +667,6 @@
614 }667 }
615}668}
616669
617[ModuleInit]
618public Type670public Type
619register_plugin ()671register_plugin ()
620{672{
621673
=== modified file 'libdesktop-agnostic/desktop-entry-impl-gnome.vala'
--- libdesktop-agnostic/desktop-entry-impl-gnome.vala 2010-03-26 22:45:36 +0000
+++ libdesktop-agnostic/desktop-entry-impl-gnome.vala 2011-02-13 20:22:06 +0000
@@ -305,7 +305,6 @@
305 }305 }
306}306}
307307
308[ModuleInit]
309public Type308public Type
310register_plugin ()309register_plugin ()
311{310{
312311
=== modified file 'libdesktop-agnostic/ui-color-button.vala'
--- libdesktop-agnostic/ui-color-button.vala 2009-10-29 05:26:26 +0000
+++ libdesktop-agnostic/ui-color-button.vala 2011-02-13 20:22:06 +0000
@@ -38,7 +38,7 @@
38 this.on_color_set ();38 this.on_color_set ();
39 }39 }
4040
41 private override void41 protected override void
42 constructed ()42 constructed ()
43 {43 {
44 this.use_alpha = true;44 this.use_alpha = true;
4545
=== modified file 'libdesktop-agnostic/ui-icon-chooser-dialog.vala'
--- libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-02-04 22:24:49 +0000
+++ libdesktop-agnostic/ui-icon-chooser-dialog.vala 2011-02-13 20:22:06 +0000
@@ -35,13 +35,40 @@
35 FILE35 FILE
36 }36 }
3737
38 private class LazyPixbufRenderer : CellRendererPixbuf
39 {
40 public bool item_ready { get; set; default = false; }
41
42 public signal void prepare_pixbuf (TreePath path);
43
44 public override void render (Gdk.Window window,
45 Gtk.Widget widget,
46 Gdk.Rectangle background_area,
47 Gdk.Rectangle cell_area,
48 Gdk.Rectangle expose_area,
49 Gtk.CellRendererState flags)
50 {
51 if (!item_ready)
52 {
53 int x, y;
54 var view = widget as Gtk.IconView;
55 x = cell_area.x + cell_area.width / 2;
56 y = cell_area.y + cell_area.height / 2;
57 var path = view.get_path_at_pos (x, y);
58 prepare_pixbuf (path);
59 }
60 base.render (window, widget,
61 background_area, cell_area, expose_area, flags);
62 }
63 }
64
38 public class IconChooserDialog : Dialog65 public class IconChooserDialog : Dialog
39 {66 {
40 private RadioButton _file;67 private RadioButton _file;
41 private RadioButton _themed;68 private RadioButton _themed;
42 private FileChooserButton _directory;69 private FileChooserButton _directory;
43 private ComboBox _themed_context;70 private ComboBox _themed_context;
44 private IconView _file_viewer;71 private IconView? _file_viewer = null;
45 private IconView? _themed_viewer = null;72 private IconView? _themed_viewer = null;
46 private unowned IconView _viewer;73 private unowned IconView _viewer;
47 public string selected_icon { get; private set; default = null; }74 public string selected_icon { get; private set; default = null; }
@@ -53,16 +80,26 @@
53 PIXBUF,80 PIXBUF,
54 NAME,81 NAME,
55 DATA,82 DATA,
83 PIXBUF_READY,
56 COUNT84 COUNT
57 }85 }
5886
59 public signal void icon_selected ();87 public signal void icon_selected ();
6088
89 private static Gdk.Pixbuf NO_ICON;
90
91 static construct
92 {
93 var flags = IconLookupFlags.FORCE_SIZE | IconLookupFlags.GENERIC_FALLBACK;
94 NO_ICON = IconTheme.get_default ().load_icon ("gtk-file", 48, flags);
95 }
96
61 construct97 construct
62 {98 {
63 this.response.connect (this.on_response);99 this.response.connect (this.on_response);
64 this.title = _ ("Select Icon");100 this.title = _ ("Select Icon");
65 this.icon_name = STOCK_FIND;101 this.icon_name = STOCK_FIND;
102 this.set_default_size (375, 375);
66 this.create_ui ();103 this.create_ui ();
67 }104 }
68105
@@ -72,27 +109,17 @@
72 HBox choices;109 HBox choices;
73110
74 choices = new HBox (false, 5);111 choices = new HBox (false, 5);
75 this._file = new RadioButton.with_mnemonic (null, _ ("From File"));112 this._themed = new RadioButton.with_mnemonic (null, _ ("From Theme"));
113 choices.add (this._themed);
114 this._file = new RadioButton.with_mnemonic_from_widget (this._themed,
115 _ ("From File"));
116 this._themed.active = true;
117 this._themed.toggled.connect (this.on_icon_type_toggled);
76 choices.add (this._file);118 choices.add (this._file);
77 this._themed = new RadioButton.with_mnemonic_from_widget (this._file,
78 _ ("From Theme"));
79 this._themed.active = false;
80 this._themed.toggled.connect (this.on_icon_type_toggled);
81 choices.add (this._themed);
82 this.vbox.pack_start (choices, false, false, 5);119 this.vbox.pack_start (choices, false, false, 5);
83 choices.show_all ();120 choices.show_all ();
84121
85 this._directory = new FileChooserButton (_ ("Select icon folder"),122 this.on_icon_type_toggled ();
86 FileChooserAction.SELECT_FOLDER);
87 this._directory.current_folder_changed.connect (this.on_folder_changed);
88 this.vbox.pack_start (this._directory, false, false, 5);
89 this._directory.show ();
90
91 this.add_icon_viewer (ref this._file_viewer, false);
92 this._file_viewer.parent.show_all ();
93 this._viewer = this._file_viewer;
94
95 this.on_folder_changed (this._directory);
96123
97 this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL,124 this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL,
98 STOCK_OK, ResponseType.OK);125 STOCK_OK, ResponseType.OK);
@@ -115,30 +142,64 @@
115 create_icon_viewer (bool themed)142 create_icon_viewer (bool themed)
116 {143 {
117 IconView viewer;144 IconView viewer;
118 CellRendererPixbuf cell_pixbuf;145 LazyPixbufRenderer cell_pixbuf;
119 CellRendererText cell_text;146 CellRendererText cell_text;
120147
121 viewer = new IconView.with_model (this.create_model ());148 viewer = new IconView.with_model (this.create_model ());
122 viewer.item_width = 72;149 // without this the IconView is not shrinkable after expanding it
123 viewer.columns = 4;150 viewer.set_size_request (108, -1);
124 viewer.column_spacing = 5;151 viewer.set_item_width (108);
125 viewer.set_size_request (325, 300);152 viewer.set_column_spacing (5);
126 viewer.tooltip_column = Column.DATA;153 viewer.set_tooltip_column (Column.DATA);
127 cell_pixbuf = new CellRendererPixbuf ();154
155 cell_pixbuf = new LazyPixbufRenderer ();
128 cell_pixbuf.xalign = 0.5f;156 cell_pixbuf.xalign = 0.5f;
129 cell_pixbuf.yalign = 0.5f;157 cell_pixbuf.yalign = 0.5f;
130 cell_pixbuf.width = 48;158 cell_pixbuf.width = 48;
159
131 viewer.pack_start (cell_pixbuf, false);160 viewer.pack_start (cell_pixbuf, false);
132 viewer.add_attribute (cell_pixbuf, "pixbuf", Column.PIXBUF);161 viewer.add_attribute (cell_pixbuf, "pixbuf", Column.PIXBUF);
162 viewer.add_attribute (cell_pixbuf, "item-ready", Column.PIXBUF_READY);
163
164 cell_pixbuf.prepare_pixbuf.connect ((p) =>
165 {
166 TreeIter iter;
167 Value val;
168 var store = this._viewer.model as ListStore;
169 store.get_iter (out iter, p);
170 store.get_value (iter, Column.DATA, out val);
171
172 string icon_name = val.get_string ();
173 IconTheme icon_theme = IconTheme.get_default ();
174 var info = icon_theme.lookup_icon (icon_name, 48, 0);
175 string? name = info.get_display_name ();
176 if (name == null)
177 {
178 name = icon_name.replace ("-", " ");
179 }
180 try
181 {
182 var pixbuf = info.load_icon ();
183 store.set (iter, Column.NAME, name, Column.PIXBUF, pixbuf,
184 Column.PIXBUF_READY, true, -1);
185 }
186 catch (Error err)
187 {
188 warning ("Could not load %s: %s", icon_name, err.message);
189 store.set (iter, Column.NAME, name, Column.PIXBUF_READY, true, -1);
190 }
191 });
192
133 cell_text = new CellRendererText ();193 cell_text = new CellRendererText ();
134 cell_text.xalign = 0.5f;194 cell_text.xalign = 0.5f;
135 cell_text.yalign = 0;195 cell_text.yalign = 0.0f;
136 cell_text.wrap_mode = Pango.WrapMode.WORD;196 cell_text.wrap_mode = Pango.WrapMode.WORD;
137 cell_text.wrap_width = 72;197 int wrap_width = viewer.item_width - viewer.item_padding * 2;
138 cell_text.width = 72;198 cell_text.wrap_width = wrap_width;
139 cell_text.ellipsize = Pango.EllipsizeMode.START;199 cell_text.width = wrap_width;
200 cell_text.ellipsize = Pango.EllipsizeMode.MIDDLE;
140 viewer.pack_start (cell_text, true);201 viewer.pack_start (cell_text, true);
141 viewer.add_attribute (cell_text, "text", 1);202 viewer.add_attribute (cell_text, "text", Column.NAME);
142 viewer.selection_mode = SelectionMode.SINGLE;203 viewer.selection_mode = SelectionMode.SINGLE;
143204
144 return viewer;205 return viewer;
@@ -148,20 +209,24 @@
148 create_model ()209 create_model ()
149 {210 {
150 // icon, name, data211 // icon, name, data
151 return new ListStore (Column.COUNT, typeof (Gdk.Pixbuf), typeof (string),212 return new ListStore (Column.COUNT,
152 typeof (string));213 typeof (Gdk.Pixbuf),
214 typeof (string),
215 typeof (string),
216 typeof (bool));
153 }217 }
154218
155 private void219 private void
156 on_icon_type_toggled (ToggleButton themed)220 on_icon_type_toggled ()
157 {221 {
158 if (this._themed.active)222 if (this._themed.active)
159 {223 {
160 if (this._themed_viewer == null)224 if (this._themed_viewer == null)
161 {225 {
162 unowned IconTheme icon_theme;226 unowned IconTheme icon_theme;
163 unowned List<string> context_list;227 List<string> context_list;
164228
229 // "From Theme" widgets -> context combobox + icon view
165 this._themed_context = new ComboBox.text ();230 this._themed_context = new ComboBox.text ();
166 this._themed_context.changed.connect (this.on_icon_context_changed);231 this._themed_context.changed.connect (this.on_icon_context_changed);
167 this.vbox.pack_start (this._themed_context, false, false, 5);232 this.vbox.pack_start (this._themed_context, false, false, 5);
@@ -171,21 +236,52 @@
171 icon_theme = IconTheme.get_default ();236 icon_theme = IconTheme.get_default ();
172 context_list = icon_theme.list_contexts ();237 context_list = icon_theme.list_contexts ();
173 context_list.sort ((CompareFunc)strcmp);238 context_list.sort ((CompareFunc)strcmp);
239
240 int active_index = 0;
241 int cur_index = 0;
174 foreach (unowned string context in context_list)242 foreach (unowned string context in context_list)
175 {243 {
176 this._themed_context.append_text (context);244 this._themed_context.append_text (context);
245 // try to make "Applications" context active by default
246 if (context == "Applications")
247 {
248 active_index = cur_index;
249 }
250 cur_index++;
177 }251 }
178 }252 this._themed_context.set_active (active_index);
179 this._file_viewer.parent.hide ();253 }
180 this._directory.hide ();254
255 if (this._file_viewer != null)
256 {
257 this._file_viewer.parent.hide ();
258 this._directory.hide ();
259 }
181 this._themed_viewer.parent.show ();260 this._themed_viewer.parent.show ();
182 this._themed_context.show ();261 this._themed_context.show ();
183 this._viewer = this._themed_viewer;262 this._viewer = this._themed_viewer;
184 }263 }
185 else264 else
186 {265 {
187 this._themed_viewer.parent.hide ();266 if (this._file_viewer == null)
188 this._themed_context.hide ();267 {
268 // "From File" widgets -> directory chooser + icon view
269 this._directory = new FileChooserButton (_ ("Select icon folder"),
270 FileChooserAction.SELECT_FOLDER);
271 this._directory.current_folder_changed.connect (this.on_folder_changed);
272 this.vbox.pack_start (this._directory, false, false, 5);
273 this._directory.show ();
274
275 this.add_icon_viewer (ref this._file_viewer, false);
276
277 this.on_folder_changed (this._directory);
278 }
279
280 if (this._themed_viewer != null)
281 {
282 this._themed_viewer.parent.hide ();
283 this._themed_context.hide ();
284 }
189 this._file_viewer.parent.show ();285 this._file_viewer.parent.show ();
190 this._directory.show ();286 this._directory.show ();
191 this._viewer = this._file_viewer;287 this._viewer = this._file_viewer;
@@ -225,7 +321,9 @@
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);
226322
227 model.append (out iter);323 model.append (out iter);
228 model.set (iter, Column.PIXBUF, pixbuf,324 model.set (iter,
325 Column.PIXBUF, pixbuf,
326 Column.PIXBUF_READY, true,
229 Column.NAME, Path.get_basename (path),327 Column.NAME, Path.get_basename (path),
230 Column.DATA, path);328 Column.DATA, path);
231 }329 }
@@ -246,7 +344,7 @@
246 {344 {
247 unowned ListStore model;345 unowned ListStore model;
248 unowned IconTheme icon_theme;346 unowned IconTheme icon_theme;
249 unowned List<string> icon_list;347 List<string> icon_list;
250348
251 model = this._themed_viewer.model as ListStore;349 model = this._themed_viewer.model as ListStore;
252 model.clear ();350 model.clear ();
@@ -256,29 +354,14 @@
256 icon_list.sort ((CompareFunc)strcmp);354 icon_list.sort ((CompareFunc)strcmp);
257 foreach (unowned string icon_name in icon_list)355 foreach (unowned string icon_name in icon_list)
258 {356 {
259 try357 TreeIter iter;
260 {
261 IconInfo info;
262 Gdk.Pixbuf pixbuf;
263 string? name;
264 TreeIter iter;
265358
266 info = icon_theme.lookup_icon (icon_name, 48, 0);359 model.append (out iter);
267 pixbuf = info.load_icon ();360 model.set (iter,
268 name = info.get_display_name ();361 Column.PIXBUF, NO_ICON,
269 if (name == null)362 Column.PIXBUF_READY, false,
270 {363 Column.NAME, icon_name,
271 name = icon_name.replace ("-", " ");364 Column.DATA, icon_name);
272 }
273 model.append (out iter);
274 model.set (iter, Column.PIXBUF, pixbuf,
275 Column.NAME, name,
276 Column.DATA, icon_name);
277 }
278 catch (Error err)
279 {
280 warning ("Could not load %s: %s", icon_name, err.message);
281 }
282 }365 }
283 }366 }
284367
@@ -297,7 +380,7 @@
297380
298 msg = _ ("Please select an icon.");381 msg = _ ("Please select an icon.");
299 dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR,382 dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR,
300 ButtonsType.OK, msg);383 ButtonsType.OK, "%s", msg);
301 dialog.title = _ ("Error");384 dialog.title = _ ("Error");
302 dialog.run ();385 dialog.run ();
303 dialog.destroy ();386 dialog.destroy ();
304387
=== modified file 'libdesktop-agnostic/ui-launcher-editor-dialog.vala'
--- libdesktop-agnostic/ui-launcher-editor-dialog.vala 2009-10-27 07:36:10 +0000
+++ libdesktop-agnostic/ui-launcher-editor-dialog.vala 2011-02-13 20:22:06 +0000
@@ -53,51 +53,45 @@
53 this.attach (widget, left_attach, right_attach, top_attach, bottom_attach,53 this.attach (widget, left_attach, right_attach, top_attach, bottom_attach,
54 AttachOptions.FILL, 0, 0, 0);54 AttachOptions.FILL, 0, 0, 0);
55 }55 }
56
57 public void
58 attach_expand (Widget widget, uint left_attach, uint right_attach,
59 uint top_attach, uint bottom_attach)
60 {
61 this.attach (widget, left_attach, right_attach, top_attach, bottom_attach,
62 AttachOptions.FILL | AttachOptions.EXPAND, 0, 0, 0);
63 }
56 }64 }
5765
58 public class LauncherEditorDialog : Dialog66 public class LauncherEditorDialog : Dialog
59 {67 {
68 private ComboBox _type_combo;
60 private IconButton _icon;69 private IconButton _icon;
61 private Entry _name;70 private Entry _name;
62 private Entry _desc;71 private Entry _desc;
63 private Entry _exec;72 private Entry _exec;
73 private Expander _advanced;
64 private CheckButton _terminal;74 private CheckButton _terminal;
65 private CheckButton _startup_notification;75 private CheckButton _startup_notification;
76 private unowned Label _command_label;
66 public unowned VFS.File file { get; construct; }77 public unowned VFS.File file { get; construct; }
67 public VFS.File? output { get; construct; }78 public VFS.File? output { get; construct; }
68 private bool _standalone;79 public bool entry_type_sensitive { get; construct set; default = false; }
69 private DesktopEntry _entry;80 private DesktopEntry _entry;
7081
71 public LauncherEditorDialog (VFS.File file, VFS.File? output, bool standalone)82 public LauncherEditorDialog (VFS.File file, VFS.File? output = null,
83 bool entry_type_sensitive = true)
72 {84 {
73 WindowType type;85 GLib.Object (file: file, output: output,
7486 border_width: 4,
75 if (standalone)87 entry_type_sensitive: entry_type_sensitive);
76 {
77 type = WindowType.TOPLEVEL;
78 }
79 else
80 {
81 type = WindowType.POPUP;
82 }
83 this.type = type;
84 this._standalone = standalone;
85 this.file = file;
86 this.output = output;
87 }88 }
8889
89 private override void90 protected override void
90 constructed ()91 constructed ()
91 {92 {
92 this.title = _ ("Desktop Entry Editor");93 this.title = _ ("Desktop Entry Editor");
93 this.icon_name = "gtk-preferences";94 this.icon_name = "gtk-preferences";
94 if (this._standalone)
95 {
96 this.delete_event.connect((widget, event) => {
97 main_quit ();
98 return true;
99 });
100 }
101 if (this._output == null)95 if (this._output == null)
102 {96 {
103 this._output = file;97 this._output = file;
@@ -113,10 +107,10 @@
113 string icon;107 string icon;
114 Button exec_button;108 Button exec_button;
115 Image exec_image;109 Image exec_image;
116 Label name_label, desc_label, exec_label;110 Label type_label, name_label, desc_label, exec_label;
117 HBox exec_hbox;111 HBox exec_hbox;
118 Expander advanced;
119 VBox advanced_vbox;112 VBox advanced_vbox;
113 bool is_application = true;
120114
121 // Action bar115 // Action bar
122 this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL,116 this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL,
@@ -125,12 +119,12 @@
125 this.response.connect (this.on_response);119 this.response.connect (this.on_response);
126120
127 // Form container121 // Form container
128 table = new FixedTable (4, 3);122 table = new FixedTable (3, 5);
129 // FIXME Table.row_spacing needs [NoAccessorMethod] in the VAPI, in123 // FIXME Table.row_spacing needs [NoAccessorMethod] in the VAPI, in
130 // Vala 0.7.6124 // Vala 0.7.6
131 //table.row_spacing = 5;125 //table.row_spacing = 5;
132 table.set_row_spacings (5);126 table.set_row_spacings (5);
133 table.column_spacing = 5;127 table.column_spacing = 6;
134128
135 // Icon129 // Icon
136 if (this._entry.key_exists ("Icon"))130 if (this._entry.key_exists ("Icon"))
@@ -143,11 +137,48 @@
143 }137 }
144 this._icon = new IconButton (icon);138 this._icon = new IconButton (icon);
145 this._icon.icon_selected.connect (this.on_icon_changed);139 this._icon.icon_selected.connect (this.on_icon_changed);
146 table.attach_defaults (this._icon, 0, 1, 0, 3);140 table.attach_defaults (this._icon, 0, 1, 0, 4);
141
142 // Entry Type
143 if (this._entry.key_exists ("Type"))
144 {
145 is_application = this._entry.entry_type == DesktopEntryType.APPLICATION;
146 }
147 else
148 {
149 // if type is unset, use application
150 this._entry.entry_type = DesktopEntryType.APPLICATION;
151 }
152 type_label = new Label.with_mnemonic (_ ("T_ype:"));
153 type_label.xalign = 1.0f;
154 table.attach_defaults (type_label, 1, 2, 0, 1);
155 this._type_combo = new ComboBox.text ();
156 this._type_combo.append_text (_ ("Application"));
157 this._type_combo.append_text (_ ("Location"));
158 type_label.set_mnemonic_widget (this._type_combo);
159
160 int active_index = -1;
161 switch (this._entry.entry_type)
162 {
163 case DesktopEntryType.APPLICATION:
164 active_index = 0;
165 break;
166 case DesktopEntryType.LINK:
167 active_index = 1;
168 break;
169 }
170 this._type_combo.set_active (active_index);
171 this._type_combo.set_sensitive (entry_type_sensitive);
172 this.notify["entry-type-sensitive"].connect (
173 () => { this._type_combo.set_sensitive (this.entry_type_sensitive); }
174 );
175 this._type_combo.changed.connect (this.on_type_changed);
176 table.attach_expand (this._type_combo, 2, 3, 0, 1);
147177
148 // Name178 // Name
149 name_label = new Label.with_mnemonic (_ ("_Name:"));179 name_label = new Label.with_mnemonic (_ ("_Name:"));
150 table.attach_defaults (name_label, 1, 2, 0, 1);180 name_label.xalign = 1.0f;
181 table.attach_defaults (name_label, 1, 2, 1, 2);
151 this._name = new Entry ();182 this._name = new Entry ();
152 name_label.set_mnemonic_widget (this._name);183 name_label.set_mnemonic_widget (this._name);
153 if (this._entry.key_exists ("Name"))184 if (this._entry.key_exists ("Name"))
@@ -155,11 +186,12 @@
155 this._name.set_text (this._entry.name);186 this._name.set_text (this._entry.name);
156 }187 }
157 this._name.changed.connect (this.on_name_changed);188 this._name.changed.connect (this.on_name_changed);
158 table.attach_defaults (this._name, 2, 3, 0, 1);189 table.attach_expand (this._name, 2, 3, 1, 2);
159190
160 // Description191 // Description
161 desc_label = new Label.with_mnemonic (_ ("_Description:"));192 desc_label = new Label.with_mnemonic (_ ("_Description:"));
162 table.attach_defaults (desc_label, 1, 2, 1, 2);193 desc_label.xalign = 1.0f;
194 table.attach_defaults (desc_label, 1, 2, 2, 3);
163 this._desc = new Entry ();195 this._desc = new Entry ();
164 desc_label.set_mnemonic_widget (this._desc);196 desc_label.set_mnemonic_widget (this._desc);
165 if (this._entry.key_exists ("Comment"))197 if (this._entry.key_exists ("Comment"))
@@ -167,31 +199,36 @@
167 this._desc.set_text (this._entry.get_string ("Comment"));199 this._desc.set_text (this._entry.get_string ("Comment"));
168 }200 }
169 this._desc.changed.connect (this.on_desc_changed);201 this._desc.changed.connect (this.on_desc_changed);
170 table.attach_defaults (this._desc, 2, 3, 1, 2);202 table.attach_expand (this._desc, 2, 3, 2, 3);
171203
172 // Exec204 // Exec
173 exec_label = new Label.with_mnemonic (_ ("_Command:"));205 exec_label = new Label.with_mnemonic (_ ("_Command:"));
174 table.attach_defaults (exec_label, 1, 2, 2, 3);206 _command_label = exec_label;
207 exec_label.xalign = 1.0f;
208 table.attach_defaults (exec_label, 1, 2, 3, 4);
175 exec_hbox = new HBox (false, 5);209 exec_hbox = new HBox (false, 5);
176 this._exec = new Entry ();210 this._exec = new Entry ();
177 exec_label.set_mnemonic_widget (this._exec);211 exec_label.set_mnemonic_widget (this._exec);
178 if (this._entry.key_exists ("Exec"))212
213 string key_name = is_application ? "Exec" : "URL";
214 if (this._entry.key_exists (key_name))
179 {215 {
180 this._exec.set_text (this._entry.get_string ("Exec"));216 this._exec.set_text (this._entry.get_string (key_name));
181 }217 }
218
182 this._exec.changed.connect (this.on_exec_changed);219 this._exec.changed.connect (this.on_exec_changed);
183 exec_hbox.add (this._exec);220 exec_hbox.pack_start (this._exec, true);
184 exec_button = new Button.with_mnemonic (_ ("_Browse..."));221 exec_button = new Button.with_mnemonic (_ ("_Browse..."));
185 exec_image = new Image.from_stock (STOCK_OPEN, IconSize.BUTTON);222 exec_image = new Image.from_stock (STOCK_OPEN, IconSize.BUTTON);
186 exec_button.set_image (exec_image);223 exec_button.set_image (exec_image);
187 exec_button.clicked.connect (this.on_exec_browse);224 exec_button.clicked.connect (this.on_exec_browse);
188 exec_hbox.add (exec_button);225 exec_hbox.pack_start (exec_button, false);
189 table.attach_defaults (exec_hbox, 2, 3, 2, 3);226 table.attach_expand (exec_hbox, 2, 3, 3, 4);
190227
191 // Advanced options228 // Advanced options
192 // TODO look into ResizeMode so that the window shrinks when the expander229 // TODO look into ResizeMode so that the window shrinks when the expander
193 // is un-expanded.230 // is un-expanded.
194 advanced = new Expander.with_mnemonic (_ ("_Advanced"));231 this._advanced = new Expander.with_mnemonic (_ ("_Advanced"));
195 advanced_vbox = new VBox (false, 5);232 advanced_vbox = new VBox (false, 5);
196 this._terminal = new CheckButton.with_mnemonic (_ ("Run in _terminal"));233 this._terminal = new CheckButton.with_mnemonic (_ ("Run in _terminal"));
197 if (this._entry.key_exists ("Terminal"))234 if (this._entry.key_exists ("Terminal"))
@@ -207,8 +244,20 @@
207 }244 }
208 this._startup_notification.toggled.connect (this.on_startup_notification_toggled);245 this._startup_notification.toggled.connect (this.on_startup_notification_toggled);
209 advanced_vbox.add (this._startup_notification);246 advanced_vbox.add (this._startup_notification);
210 advanced.add (advanced_vbox);247 this._advanced.add (advanced_vbox);
211 table.attach_fill (advanced, 0, 3, 3, 4);248 table.attach_expand (this._advanced, 0, 3, 4, 5);
249
250 // make sure widgets are properly set up
251 on_type_changed (this._type_combo);
252
253 List<unowned Widget> focus_chain_list = new List<unowned Widget> ();
254 focus_chain_list.append (this._type_combo);
255 focus_chain_list.append (this._name);
256 focus_chain_list.append (this._desc);
257 focus_chain_list.append (exec_hbox);
258 focus_chain_list.append (this._icon);
259 focus_chain_list.append (this._advanced);
260 table.set_focus_chain (focus_chain_list);
212261
213 this.vbox.add (table);262 this.vbox.add (table);
214 }263 }
@@ -220,6 +269,29 @@
220 }269 }
221270
222 private void271 private void
272 on_type_changed (ComboBox combo)
273 {
274 switch (combo.get_active ())
275 {
276 case 0: this._entry.entry_type = DesktopEntryType.APPLICATION; break;
277 case 1: this._entry.entry_type = DesktopEntryType.LINK; break;
278 }
279
280 if (this._entry.entry_type == DesktopEntryType.LINK)
281 {
282 this._command_label.set_markup_with_mnemonic (_ ("_Location:"));
283 this._advanced.hide ();
284 this._advanced.set_no_show_all (true);
285 }
286 else
287 {
288 this._command_label.set_markup_with_mnemonic (_ ("_Command:"));
289 this._advanced.set_no_show_all (false);
290 this._advanced.show ();
291 }
292 }
293
294 private void
223 on_name_changed (Editable editable)295 on_name_changed (Editable editable)
224 {296 {
225 Entry entry = editable as Entry;297 Entry entry = editable as Entry;
@@ -237,7 +309,9 @@
237 on_exec_changed (Editable editable)309 on_exec_changed (Editable editable)
238 {310 {
239 Entry entry = editable as Entry;311 Entry entry = editable as Entry;
240 this._entry.set_string ("Exec", entry.text);312 string key_name =
313 this._entry.entry_type == DesktopEntryType.LINK ? "URL" : "Exec";
314 this._entry.set_string (key_name, entry.text);
241 }315 }
242316
243 private void317 private void
@@ -246,14 +320,17 @@
246 FileChooserDialog dialog;320 FileChooserDialog dialog;
247 int response;321 int response;
248322
249 dialog = new FileChooserDialog (_ ("Locate Command"), this,323 bool is_link = this._entry.entry_type == DesktopEntryType.LINK;
324 string title = is_link ? _ ("Locate a file") : _ ("Locate Command");
325
326 dialog = new FileChooserDialog (title, this,
250 FileChooserAction.OPEN,327 FileChooserAction.OPEN,
251 STOCK_CANCEL, ResponseType.CANCEL,328 STOCK_CANCEL, ResponseType.CANCEL,
252 STOCK_OK, ResponseType.OK);329 STOCK_OK, ResponseType.OK);
253 response = dialog.run ();330 response = dialog.run ();
254 if (response == ResponseType.OK)331 if (response == ResponseType.OK)
255 {332 {
256 this._exec.text = dialog.get_filename ();333 this._exec.text = is_link ? dialog.get_uri () : dialog.get_filename ();
257 }334 }
258 dialog.destroy ();335 dialog.destroy ();
259 }336 }
@@ -345,14 +422,7 @@
345 }422 }
346 }423 }
347 }424 }
348 if (this._standalone)425 this.hide ();
349 {
350 main_quit ();
351 }
352 else
353 {
354 this.hide ();
355 }
356 }426 }
357 }427 }
358}428}
359429
=== modified file 'libdesktop-agnostic/vfs-bookmarks-gtk.vala'
--- libdesktop-agnostic/vfs-bookmarks-gtk.vala 2009-07-18 08:06:58 +0000
+++ libdesktop-agnostic/vfs-bookmarks-gtk.vala 2011-02-13 20:22:06 +0000
@@ -77,7 +77,7 @@
77 */77 */
78 public GtkBookmarks (File? file = null, bool monitor = true)78 public GtkBookmarks (File? file = null, bool monitor = true)
79 {79 {
80 this.file = file;80 GLib.Object (file: file);
81 if (this._file.exists ())81 if (this._file.exists ())
82 {82 {
83 this.parse ();83 this.parse ();
8484
=== modified file 'libdesktop-agnostic/vfs-file-impl-gio.vala'
--- libdesktop-agnostic/vfs-file-impl-gio.vala 2010-03-26 22:45:36 +0000
+++ libdesktop-agnostic/vfs-file-impl-gio.vala 2011-02-13 20:22:06 +0000
@@ -239,6 +239,71 @@
239 }239 }
240 return this._file.delete (null);240 return this._file.delete (null);
241 }241 }
242
243 public override bool is_native ()
244 {
245 return this._file.is_native ();
246 }
247
248 public override string get_mime_type () throws Error
249 {
250 var fi = this._file.query_info (FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
251 0, null);
252 return fi.get_content_type ();
253 }
254
255 public override string[] get_icon_names () throws Error
256 {
257 var fi = this._file.query_info (FILE_ATTRIBUTE_STANDARD_ICON,
258 0, null);
259 GLib.Icon icon = fi.get_icon ();
260 if (icon != null)
261 {
262 if (icon is ThemedIcon)
263 {
264 // wow! Vala sucks!
265 Value v = Value (typeof (string[]));
266 icon.get_property ("names", ref v);
267 string[] names = (string[]) v;
268
269 // this should be fixed in vala 0.12
270 //names = (icon as ThemedIcon).get_names ();
271
272 return names;
273 }
274
275 if (icon is FileIcon)
276 {
277 string path = (icon as FileIcon).get_file ().get_path ();
278 string[] result = { path };
279
280 return result;
281 }
282 }
283
284 // hmm... what now?
285 string[] unknown = {};
286 return unknown;
287 }
288
289 public override string?
290 get_thumbnail_path ()
291 {
292 try
293 {
294 var fi = this._file.query_info (FILE_ATTRIBUTE_THUMBNAIL_PATH,
295 0, null);
296 if (fi.has_attribute (FILE_ATTRIBUTE_THUMBNAIL_PATH))
297 {
298 return fi.get_attribute_byte_string (FILE_ATTRIBUTE_THUMBNAIL_PATH);
299 }
300 }
301 catch (GLib.Error err)
302 {
303 warning ("%s", err.message);
304 }
305 return null;
306 }
242 }307 }
243}308}
244309
245310
=== modified file 'libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala'
--- libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala 2010-03-26 22:45:36 +0000
+++ libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala 2011-02-13 20:22:06 +0000
@@ -322,6 +322,24 @@
322 }322 }
323 return (GnomeVFS.unlink_from_uri (this._uri) == GnomeVFS.Result.OK);323 return (GnomeVFS.unlink_from_uri (this._uri) == GnomeVFS.Result.OK);
324 }324 }
325
326 public override bool
327 is_native ()
328 {
329 return this._uri_str.has_prefix ("file:");
330 }
331
332 public override string
333 get_mime_type () throws Error
334 {
335 return GnomeVFS.get_mime_type_from_uri (this._uri);
336 }
337
338 public override string[]
339 get_icon_names () throws Error
340 {
341 return get_icon_names_for_mime_type (this.get_mime_type ());
342 }
325 }343 }
326}344}
327345
328346
=== modified file 'libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala'
--- libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala 2009-10-27 07:29:55 +0000
+++ libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000
@@ -247,6 +247,24 @@
247 }247 }
248 return (FileUtils.unlink (this.impl_path) == 0);248 return (FileUtils.unlink (this.impl_path) == 0);
249 }249 }
250
251 public override bool
252 is_native ()
253 {
254 return this._uri.has_prefix ("file:");
255 }
256
257 public override string
258 get_mime_type () throws Error
259 {
260 return this._info.mime_info.get_name ();
261 }
262
263 public override string[]
264 get_icon_names () throws Error
265 {
266 return get_icon_names_for_mime_type (this.get_mime_type ());
267 }
250 }268 }
251}269}
252270
253271
=== modified file 'libdesktop-agnostic/vfs-file.vala'
--- libdesktop-agnostic/vfs-file.vala 2009-10-27 07:29:55 +0000
+++ libdesktop-agnostic/vfs-file.vala 2011-02-13 20:22:06 +0000
@@ -190,6 +190,34 @@
190 * @return %TRUE on success, %FALSE on failure.190 * @return %TRUE on success, %FALSE on failure.
191 */191 */
192 public abstract bool remove () throws Error;192 public abstract bool remove () throws Error;
193
194 /**
195 * Checks to see if a file is native to the platform.
196 * @return %TRUE if file is native, %FALSE otherwise.
197 */
198 public abstract bool is_native ();
199
200 /**
201 * Gets the file's mime type. (might block)
202 * @return String containing file's mime type.
203 */
204 public abstract string get_mime_type () throws Error;
205
206 /**
207 * Gets list of possible icon names representing this file. (might block)
208 * @return List of possible icon names.
209 */
210 public abstract string[] get_icon_names () throws Error;
211
212 /**
213 * Get path to thumbnail representing this file. (might block)
214 * @return Path to file with thumbnail or %null if thumbnail cannot be
215 * found or backend doesn't support it.
216 */
217 public virtual string? get_thumbnail_path ()
218 {
219 return null;
220 }
193 }221 }
194222
195 public File?223 public File?
@@ -219,6 +247,20 @@
219 return (File)Object.new (vfs.file_type, "uri", uri);247 return (File)Object.new (vfs.file_type, "uri", uri);
220 }248 }
221 }249 }
250
251 public static string[]
252 get_icon_names_for_mime_type (string mime_type)
253 {
254 string[] names = null;
255
256 return_val_if_fail (mime_type != "", null);
257
258 names += mime_type.replace ("/", "-");
259 names += "gnome-mime-%s".printf (names[0]);
260 names += "%s-x-generic".printf (Regex.split_simple ("/.*", mime_type)[0]);
261
262 return names;
263 }
222}264}
223265
224// vim: set et ts=2 sts=2 sw=2 ai :266// vim: set et ts=2 sts=2 sw=2 ai :
225267
=== modified file 'libdesktop-agnostic/vfs-impl-gio.vala'
--- libdesktop-agnostic/vfs-impl-gio.vala 2009-07-18 02:12:37 +0000
+++ libdesktop-agnostic/vfs-impl-gio.vala 2011-02-13 20:22:06 +0000
@@ -89,7 +89,6 @@
89 }89 }
90 }90 }
91}91}
92[ModuleInit]
93public Type92public Type
94register_plugin ()93register_plugin ()
95{94{
9695
=== modified file 'libdesktop-agnostic/vfs-impl-gnome-vfs.vala'
--- libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2009-07-18 02:12:37 +0000
+++ libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2011-02-13 20:22:06 +0000
@@ -92,7 +92,6 @@
92 }92 }
93 }93 }
94}94}
95[ModuleInit]
96public Type95public Type
97register_plugin ()96register_plugin ()
98{97{
9998
=== modified file 'libdesktop-agnostic/vfs-impl-thunar-vfs.vala'
--- libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2009-07-18 02:12:37 +0000
+++ libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000
@@ -92,7 +92,6 @@
92 }92 }
93 }93 }
94}94}
95[ModuleInit]
96public Type95public Type
97register_plugin ()96register_plugin ()
98{97{
9998
=== modified file 'libdesktop-agnostic/vfs-trash-impl-gio.vala'
--- libdesktop-agnostic/vfs-trash-impl-gio.vala 2009-11-02 06:42:05 +0000
+++ libdesktop-agnostic/vfs-trash-impl-gio.vala 2011-02-13 20:22:06 +0000
@@ -77,7 +77,7 @@
7777
78 try78 try
79 {79 {
80 file_info = dir.query_info_finish (res);80 file_info = dir.query_info_async.end (res);
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);
82 this.file_count_changed ();82 this.file_count_changed ();
83 }83 }
8484
=== modified file 'libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala'
--- libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2009-09-21 17:53:13 +0000
+++ libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000
@@ -53,7 +53,7 @@
53 {53 {
54 Monitor monitor;54 Monitor monitor;
55 this.trash = ThunarVfs.Path.get_for_trash ();55 this.trash = ThunarVfs.Path.get_for_trash ();
56 this.dbus = Bus.get (BusType.SESSION);56 this.dbus = DBus.Bus.get (DBus.BusType.SESSION);
57 this.xfce_trash =57 this.xfce_trash =
58 (Xfce.Trash)this.dbus.get_object ("org.xfce.Thunar",58 (Xfce.Trash)this.dbus.get_object ("org.xfce.Thunar",
59 "/org/xfce/FileManager");59 "/org/xfce/FileManager");
6060
=== modified file 'libdesktop-agnostic/vfs-volume-impl-gio.vala'
--- libdesktop-agnostic/vfs-volume-impl-gio.vala 2009-09-24 16:36:40 +0000
+++ libdesktop-agnostic/vfs-volume-impl-gio.vala 2011-02-13 20:22:06 +0000
@@ -121,7 +121,7 @@
121 bool result = false;121 bool result = false;
122 try122 try
123 {123 {
124 result = this.vol.mount_finish (this.async_result);124 result = this.vol.mount.end (this.async_result);
125 }125 }
126 catch (GLib.Error err)126 catch (GLib.Error err)
127 {127 {
@@ -156,7 +156,7 @@
156 bool result = false;156 bool result = false;
157 try157 try
158 {158 {
159 result = this.vol.get_mount ().unmount_finish (this.async_result);159 result = this.vol.get_mount ().unmount.end (this.async_result);
160 }160 }
161 catch (GLib.Error err)161 catch (GLib.Error err)
162 {162 {
@@ -192,7 +192,7 @@
192 bool result = false;192 bool result = false;
193 try193 try
194 {194 {
195 result = this.vol.eject_finish (this.async_result);195 result = this.vol.eject.end (this.async_result);
196 }196 }
197 catch (GLib.Error err)197 catch (GLib.Error err)
198 {198 {
@@ -211,7 +211,7 @@
211 this.monitor = GLib.VolumeMonitor.get ();211 this.monitor = GLib.VolumeMonitor.get ();
212 this._volumes = new HashTable<GLib.Volume,VFS.Volume> (direct_hash,212 this._volumes = new HashTable<GLib.Volume,VFS.Volume> (direct_hash,
213 direct_equal);213 direct_equal);
214 unowned List<GLib.Volume> vols = this.monitor.get_volumes ();214 List<GLib.Volume> vols = this.monitor.get_volumes ();
215 foreach (unowned GLib.Volume gvol in vols)215 foreach (unowned GLib.Volume gvol in vols)
216 {216 {
217 VFS.Volume vol = this.create_volume (gvol);217 VFS.Volume vol = this.create_volume (gvol);
218218
=== modified file 'libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala'
--- libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2009-09-24 16:36:40 +0000
+++ libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2011-02-13 20:22:06 +0000
@@ -190,8 +190,7 @@
190 this.monitor = GnomeVFS.get_volume_monitor ();190 this.monitor = GnomeVFS.get_volume_monitor ();
191 this._volumes = new HashTable<GnomeVFS.Drive,VFS.Volume> (direct_hash,191 this._volumes = new HashTable<GnomeVFS.Drive,VFS.Volume> (direct_hash,
192 direct_equal);192 direct_equal);
193 unowned List<GnomeVFS.Drive> drives =193 List<GnomeVFS.Drive> drives = this.monitor.get_connected_drives ();
194 this.monitor.get_connected_drives ();
195 foreach (unowned GnomeVFS.Drive drive in drives)194 foreach (unowned GnomeVFS.Drive drive in drives)
196 {195 {
197 VFS.Volume vol = this.create_volume (drive);196 VFS.Volume vol = this.create_volume (drive);
198197
=== modified file 'libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala'
--- libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2009-09-24 16:36:40 +0000
+++ libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2011-02-13 20:22:06 +0000
@@ -63,7 +63,7 @@
63 }63 }
64 public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl)64 public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl)
65 {65 {
66 this.implementation = impl;66 GLib.Object (implementation: impl);
67 }67 }
68 public bool68 public bool
69 is_mounted ()69 is_mounted ()
7070
=== modified file 'libdesktop-agnostic/wscript'
--- libdesktop-agnostic/wscript 2010-04-10 23:17:55 +0000
+++ libdesktop-agnostic/wscript 2011-02-13 20:22:06 +0000
@@ -34,6 +34,10 @@
34 }34 }
35 },35 },
36 'fdo': {36 'fdo': {
37 'gio': {
38 'uselib': 'GIO_UNIX',
39 'packages': 'gio-unix-2.0',
40 },
37 'gnome': {41 'gnome': {
38 'uselib': 'GNOME_DESKTOP',42 'uselib': 'GNOME_DESKTOP',
39 'packages': 'gnome-desktop-2.0',43 'packages': 'gnome-desktop-2.0',
@@ -113,7 +117,8 @@
113 ])117 ])
114 lib.packages = 'gdk-2.0 gmodule-2.0'118 lib.packages = 'gdk-2.0 gmodule-2.0'
115 lib.target = 'desktop-agnostic'119 lib.target = 'desktop-agnostic'
116 lib.gir = 'DesktopAgnostic-1.0'120 if bld.env['INTROSPECTION']:
121 lib.gir = 'DesktopAgnostic-1.0'
117 lib.uselib = 'M GDK GMODULE'122 lib.uselib = 'M GDK GMODULE'
118 lib.packages_private = 'build'123 lib.packages_private = 'build'
119 lib.includes = '..'124 lib.includes = '..'
@@ -133,7 +138,8 @@
133 vfs.packages = 'desktop-agnostic posix'138 vfs.packages = 'desktop-agnostic posix'
134 vfs.target = 'desktop-agnostic-vfs'139 vfs.target = 'desktop-agnostic-vfs'
135 vfs.header = 'vfs'140 vfs.header = 'vfs'
136 vfs.gir = 'DesktopAgnosticVFS-1.0'141 if bld.env['INTROSPECTION']:
142 vfs.gir = 'DesktopAgnosticVFS-1.0'
137 vfs.uselib_local = 'desktop-agnostic'143 vfs.uselib_local = 'desktop-agnostic'
138 vfs.packages_private = 'posix-glob'144 vfs.packages_private = 'posix-glob'
139 vfs.includes = '..'145 vfs.includes = '..'
@@ -152,7 +158,8 @@
152 cfg.packages = 'desktop-agnostic-vfs'158 cfg.packages = 'desktop-agnostic-vfs'
153 cfg.target = 'desktop-agnostic-cfg'159 cfg.target = 'desktop-agnostic-cfg'
154 cfg.header = 'config'160 cfg.header = 'config'
155 cfg.gir = 'DesktopAgnosticConfig-1.0'161 if bld.env['INTROSPECTION']:
162 cfg.gir = 'DesktopAgnosticConfig-1.0'
156 cfg.uselib_local = 'desktop-agnostic-vfs'163 cfg.uselib_local = 'desktop-agnostic-vfs'
157 cfg.packages_private = 'hashtable-gtype-key'164 cfg.packages_private = 'hashtable-gtype-key'
158 cfg.includes = '..'165 cfg.includes = '..'
@@ -166,7 +173,8 @@
166 fdo.packages = 'desktop-agnostic-vfs'173 fdo.packages = 'desktop-agnostic-vfs'
167 fdo.target = 'desktop-agnostic-fdo'174 fdo.target = 'desktop-agnostic-fdo'
168 fdo.header = 'fdo'175 fdo.header = 'fdo'
169 fdo.gir = 'DesktopAgnosticFDO-1.0'176 if bld.env['INTROSPECTION']:
177 fdo.gir = 'DesktopAgnosticFDO-1.0'
170 fdo.uselib_local = 'desktop-agnostic-vfs'178 fdo.uselib_local = 'desktop-agnostic-vfs'
171 fdo.vapi_dirs = '.'179 fdo.vapi_dirs = '.'
172 fdo.includes = '..'180 fdo.includes = '..'
@@ -183,7 +191,8 @@
183 ui.packages_private = 'build'191 ui.packages_private = 'build'
184 ui.target = 'desktop-agnostic-ui'192 ui.target = 'desktop-agnostic-ui'
185 ui.header = 'ui'193 ui.header = 'ui'
186 ui.gir = 'DesktopAgnosticUI-1.0'194 if bld.env['INTROSPECTION']:
195 ui.gir = 'DesktopAgnosticUI-1.0'
187 ui.uselib = 'GTK'196 ui.uselib = 'GTK'
188 ui.uselib_local = 'desktop-agnostic-fdo'197 ui.uselib_local = 'desktop-agnostic-fdo'
189 ui.vapi_dirs = '. ../vapi'198 ui.vapi_dirs = '. ../vapi'
190199
=== modified file 'python/desktopagnostic.override'
--- python/desktopagnostic.override 2009-08-25 22:11:31 +0000
+++ python/desktopagnostic.override 2011-02-13 20:22:06 +0000
@@ -98,19 +98,23 @@
98_wrap_desktop_agnostic_color_from_values (PyObject *self, PyObject *args,98_wrap_desktop_agnostic_color_from_values (PyObject *self, PyObject *args,
99 PyObject *kwargs)99 PyObject *kwargs)
100{100{
101 static char *kwlist[] = { "red", "green", "blue", "alpha", NULL };101 static char *kwlist[] = { "red", "green", "blue", "alpha", NULL };
102 int red, green, blue, alpha;102 int red, green, blue, alpha;
103 DesktopAgnosticColor *ret;103 DesktopAgnosticColor *ret;
104104 PyObject *py_ret;
105 if (!PyArg_ParseTupleAndKeywords (args, kwargs,105
106 "iiii:color_new_from_values", kwlist,106 if (!PyArg_ParseTupleAndKeywords (args, kwargs,
107 &red, &green, &blue, &alpha))107 "iiii:color_new_from_values", kwlist,
108 return NULL;108 &red, &green, &blue, &alpha))
109109 return NULL;
110 ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha);110
111111 ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha);
112 /* pygobject_new handles NULL checking */112
113 return pygobject_new ((GObject *)ret);113 /* pygobject_new handles NULL checking */
114 py_ret = pygobject_new ((GObject *)ret);
115 if (ret != NULL)
116 g_object_unref (ret);
117 return py_ret;
114}118}
115%%119%%
116define DesktopAgnosticColor.from_string kwargs staticmethod120define DesktopAgnosticColor.from_string kwargs staticmethod
@@ -122,6 +126,7 @@
122 char *spec;126 char *spec;
123 GError *error = NULL;127 GError *error = NULL;
124 DesktopAgnosticColor *ret;128 DesktopAgnosticColor *ret;
129 PyObject *py_ret;
125130
126 if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string",131 if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string",
127 kwlist, &spec))132 kwlist, &spec))
@@ -137,7 +142,10 @@
137 }142 }
138143
139 /* pygobject_new handles NULL checking */144 /* pygobject_new handles NULL checking */
140 return pygobject_new ((GObject *)ret);145 py_ret = pygobject_new ((GObject *)ret);
146 if (ret != NULL)
147 g_object_unref (ret);
148 return py_ret;
141}149}
142%%150%%
143override-slot DesktopAgnosticColor.tp_str151override-slot DesktopAgnosticColor.tp_str
144152
=== modified file 'python/fdo.override'
--- python/fdo.override 2009-10-06 18:53:45 +0000
+++ python/fdo.override 2011-02-13 20:22:06 +0000
@@ -197,6 +197,7 @@
197{197{
198 DesktopAgnosticFDODesktopEntry *ret;198 DesktopAgnosticFDODesktopEntry *ret;
199 GError *error = NULL;199 GError *error = NULL;
200 PyObject *py_ret;
200201
201 ret = desktop_agnostic_fdo_desktop_entry_new (&error);202 ret = desktop_agnostic_fdo_desktop_entry_new (&error);
202203
@@ -206,7 +207,10 @@
206 }207 }
207208
208 /* pygobject_new handles NULL checking */209 /* pygobject_new handles NULL checking */
209 return pygobject_new ((GObject *)ret);210 py_ret = pygobject_new ((GObject *)ret);
211 if (ret != NULL)
212 g_object_unref (ret);
213 return py_ret;
210}214}
211%%215%%
212define DesktopAgnosticFDODesktopEntry.for_data kwargs staticmethod216define DesktopAgnosticFDODesktopEntry.for_data kwargs staticmethod
@@ -218,6 +222,7 @@
218 static char *kwlist[] = { "data", NULL };222 static char *kwlist[] = { "data", NULL };
219 char *data;223 char *data;
220 DesktopAgnosticFDODesktopEntry *ret;224 DesktopAgnosticFDODesktopEntry *ret;
225 PyObject *py_ret;
221 GError *error = NULL;226 GError *error = NULL;
222227
223 if (!PyArg_ParseTupleAndKeywords (args, kwargs,228 if (!PyArg_ParseTupleAndKeywords (args, kwargs,
@@ -235,7 +240,10 @@
235 }240 }
236241
237 /* pygobject_new handles NULL checking */242 /* pygobject_new handles NULL checking */
238 return pygobject_new ((GObject *)ret);243 py_ret = pygobject_new ((GObject *)ret);
244 if (ret != NULL)
245 g_object_unref (ret);
246 return py_ret;
239}247}
240%%248%%
241define DesktopAgnosticFDODesktopEntry.for_file onearg staticmethod249define DesktopAgnosticFDODesktopEntry.for_file onearg staticmethod
@@ -244,6 +252,7 @@
244 PyGObject *file)252 PyGObject *file)
245{253{
246 DesktopAgnosticFDODesktopEntry *ret;254 DesktopAgnosticFDODesktopEntry *ret;
255 PyObject *py_ret;
247 GError *error = NULL;256 GError *error = NULL;
248257
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),
@@ -255,7 +264,10 @@
255 }264 }
256265
257 /* pygobject_new handles NULL checking */266 /* pygobject_new handles NULL checking */
258 return pygobject_new ((GObject *)ret);267 py_ret = pygobject_new ((GObject *)ret);
268 if (ret != NULL)
269 g_object_unref (ret);
270 return py_ret;
259}271}
260%%272%%
261define DesktopAgnosticFDODesktopEntry.type_to_string onearg staticmethod273define DesktopAgnosticFDODesktopEntry.type_to_string onearg staticmethod
262274
=== modified file 'python/ui.override'
--- python/ui.override 2009-10-21 22:09:04 +0000
+++ python/ui.override 2011-02-13 20:22:06 +0000
@@ -46,9 +46,13 @@
46 PyGObject *color)46 PyGObject *color)
47{47{
48 DesktopAgnosticUIColorButton *ret;48 DesktopAgnosticUIColorButton *ret;
49 PyObject *py_ret;
4950
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));
5152
52 /* pygobject_new handles NULL checking */53 /* pygobject_new handles NULL checking */
53 return pygobject_new((GObject *)ret);54 py_ret = pygobject_new ((GObject *)ret);
55 if (ret != NULL)
56 g_object_unref (ret);
57 return py_ret;
54}58}
5559
=== modified file 'python/vfs.defs'
--- python/vfs.defs 2009-09-08 03:28:50 +0000
+++ python/vfs.defs 2011-02-13 20:22:06 +0000
@@ -199,6 +199,36 @@
199 )199 )
200)200)
201201
202(define-method is_native
203 (of-object "DesktopAgnosticVFSFile")
204 (c-name "desktop_agnostic_vfs_file_is_native")
205 (return-type "gboolean")
206)
207
208(define-method get_mime_type
209 (of-object "DesktopAgnosticVFSFile")
210 (c-name "desktop_agnostic_vfs_file_get_mime_type")
211 (return-type "char*")
212 (parameters
213 '("GError**" "error")
214 )
215)
216
217(define-method get_icon_names
218 (of-object "DesktopAgnosticVFSFile")
219 (c-name "desktop_agnostic_vfs_file_get_icon_names")
220 (return-type "GStrv")
221 (parameters
222 '("GError**" "error")
223 )
224)
225
226(define-method get_thumbnail_path
227 (of-object "DesktopAgnosticVFSFile")
228 (c-name "desktop_agnostic_vfs_file_get_thumbnail_path")
229 (return-type "char*")
230)
231
202(define-function file_new_for_path232(define-function file_new_for_path
203 (c-name "desktop_agnostic_vfs_file_new_for_path")233 (c-name "desktop_agnostic_vfs_file_new_for_path")
204 (return-type "DesktopAgnosticVFSFile*")234 (return-type "DesktopAgnosticVFSFile*")
@@ -217,6 +247,14 @@
217 )247 )
218)248)
219249
250(define-function get_icon_names_for_mime_type
251 (c-name "desktop_agnostic_vfs_get_icon_names_for_mime_type")
252 (return-type "char*")
253 (parameters
254 '("const-char*" "mime_type")
255 )
256)
257
220(define-method changed258(define-method changed
221 (of-object "DesktopAgnosticVFSFileMonitor")259 (of-object "DesktopAgnosticVFSFileMonitor")
222 (c-name "desktop_agnostic_vfs_file_monitor_emit")260 (c-name "desktop_agnostic_vfs_file_monitor_emit")
223261
=== modified file 'python/vfs.override'
--- python/vfs.override 2009-09-08 03:28:50 +0000
+++ python/vfs.override 2011-02-13 20:22:06 +0000
@@ -117,6 +117,7 @@
117{117{
118 char *path;118 char *path;
119 DesktopAgnosticVFSFile *ret;119 DesktopAgnosticVFSFile *ret;
120 PyObject *py_ret;
120 GError *error = NULL;121 GError *error = NULL;
121122
122 if (!PyString_Check (arg))123 if (!PyString_Check (arg))
@@ -136,16 +137,20 @@
136 }137 }
137138
138 /* pygobject_new handles NULL checking */139 /* pygobject_new handles NULL checking */
139 return pygobject_new ((GObject *)ret);140 py_ret = pygobject_new ((GObject *)ret);
141 if (ret != NULL)
142 g_object_unref (ret);
143 return py_ret;
140}144}
141%%145%%
142define DesktopAgnosticVFSFile.for_uri onearg staticmethod146define DesktopAgnosticVFSFile.for_uri onearg staticmethod
143static PyObject *147static PyObject *
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)
145{149{
146 char *uri;150 char *uri;
147 DesktopAgnosticVFSFile *ret;151 DesktopAgnosticVFSFile *ret;
148 GError *error = NULL;152 PyObject *py_ret;
153 GError *error = NULL;
149154
150 if (!PyString_Check (arg))155 if (!PyString_Check (arg))
151 {156 {
@@ -164,8 +169,39 @@
164 }169 }
165170
166 /* pygobject_new handles NULL checking */171 /* pygobject_new handles NULL checking */
167 return pygobject_new ((GObject *)ret);172 py_ret = pygobject_new ((GObject *)ret);
168}173 if (ret != NULL)
174 g_object_unref (ret);
175 return py_ret;
176}
177%%
178override desktop_agnostic_vfs_get_icon_names_for_mime_type kwargs
179static PyObject *
180_wrap_desktop_agnostic_vfs_get_icon_names_for_mime_type(PyObject *self, PyObject *args, PyObject *kwargs)
181{
182 static char *kwlist[] = { "mime_type", NULL };
183 char *mime_type;
184 gchar **ret;
185 int ret_length = 0;
186 int i;
187 PyObject *py_ret;
188
189 if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:get_icon_names_for_mime_type", kwlist, &mime_type))
190 return NULL;
191
192 ret = desktop_agnostic_vfs_get_icon_names_for_mime_type(mime_type, &ret_length);
193
194 py_ret = PyList_New (ret_length);
195 if (ret) {
196 for (i=0; i<ret_length; i++) {
197 PyList_SetItem (py_ret, i, PyString_FromString (ret[i]));
198 g_free (ret[i]);
199 }
200 g_free(ret);
201 }
202 return py_ret;
203}
204
169%%205%%
170override desktop_agnostic_vfs_file_enumerate_children noargs206override desktop_agnostic_vfs_file_enumerate_children noargs
171static PyObject *207static PyObject *
@@ -209,6 +245,34 @@
209 return PyString_FromStringAndSize (data, length);245 return PyString_FromStringAndSize (data, length);
210}246}
211%%247%%
248override desktop_agnostic_vfs_file_get_icon_names noargs
249static PyObject *
250_wrap_desktop_agnostic_vfs_file_get_icon_names (PyGObject *self)
251{
252 int i, res_length;
253 char **result;
254 PyObject *py_result;
255 GError *error = NULL;
256
257 result = desktop_agnostic_vfs_file_get_icon_names (DESKTOP_AGNOSTIC_VFS_FILE (self->obj),
258 &res_length, &error);
259
260 if (pyg_error_check (&error))
261 {
262 return NULL;
263 }
264
265 py_result = PyList_New (res_length);
266 for (i=0; i<res_length; i++)
267 {
268 PyList_SetItem (py_result, i, PyString_FromString (result[i]));
269 g_free (result[i]);
270 }
271 if (result != NULL) g_free (result);
272
273 return py_result;
274}
275%%
212define DesktopAgnosticVFSTrash.get_default noargs staticmethod276define DesktopAgnosticVFSTrash.get_default noargs staticmethod
213static PyObject *277static PyObject *
214_wrap_desktop_agnostic_v_f_s_trash_get_default (PyObject *self)278_wrap_desktop_agnostic_v_f_s_trash_get_default (PyObject *self)
215279
=== modified file 'tools/lda-desktop-entry-editor.vala'
--- tools/lda-desktop-entry-editor.vala 2009-10-21 22:09:04 +0000
+++ tools/lda-desktop-entry-editor.vala 2011-02-13 20:22:06 +0000
@@ -51,9 +51,9 @@
51 {51 {
52 output = VFS.file_new_for_path (args[2]);52 output = VFS.file_new_for_path (args[2]);
53 }53 }
54 editor = new LauncherEditorDialog (file, output, true);54 editor = new LauncherEditorDialog (file, output);
55 editor.show_all ();55 editor.show_all ();
56 Gtk.main ();56 editor.run ();
5757
58 VFS.shutdown ();58 VFS.shutdown ();
59 }59 }
6060
=== modified file 'wscript'
--- wscript 2010-04-18 20:00:06 +0000
+++ wscript 2011-02-13 20:22:06 +0000
@@ -15,7 +15,7 @@
15API_VERSION = '1.0'15API_VERSION = '1.0'
1616
17# the following two variables are used by the target "waf dist"17# the following two variables are used by the target "waf dist"
18VERSION = '0.3.90'18VERSION = '0.3.91'
19VNUM = '0.4.0'19VNUM = '0.4.0'
2020
21CFG_BACKENDS = ','.join(['gconf', 'keyfile'])21CFG_BACKENDS = ','.join(['gconf', 'keyfile'])
@@ -70,6 +70,8 @@
70 dest='profiling', default=False,70 dest='profiling', default=False,
71 help='Enables the library to be built so that it is '71 help='Enables the library to be built so that it is '
72 'instrumented to measure performance.')72 'instrumented to measure performance.')
73 opt.add_option('--disable-gi', action='store_true',
74 dest='no_gi', default=False)
7375
7476
75def configure(conf):77def configure(conf):
@@ -88,12 +90,13 @@
88 conf.env['DEBUG'] = Options.options.debug90 conf.env['DEBUG'] = Options.options.debug
89 conf.env['EXTRA_WARNINGS'] = Options.options.extra_warnings91 conf.env['EXTRA_WARNINGS'] = Options.options.extra_warnings
90 conf.env['PROFILING'] = Options.options.profiling92 conf.env['PROFILING'] = Options.options.profiling
93 conf.env['INTROSPECTION'] = not Options.options.no_gi
91 conf.env['VNUM'] = str(VNUM)94 conf.env['VNUM'] = str(VNUM)
9295
93 conf.check_tool('gnu_dirs')96 conf.check_tool('gnu_dirs')
94 conf.check_tool('compiler_cc intltool misc python vala')97 conf.check_tool('compiler_cc intltool misc python vala')
9598
96 MIN_VALA_VERSION = (0, 7, 10)99 MIN_VALA_VERSION = (0, 8, 1)
97100
98 conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE',101 conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE',
99 atleast_version='2.6.0', mandatory=True,102 atleast_version='2.6.0', mandatory=True,
@@ -131,12 +134,16 @@
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',
132 atleast_version='2.6.0', mandatory=True,135 atleast_version='2.6.0', mandatory=True,
133 args='--cflags --libs')136 args='--cflags --libs')
137 if 'gio' in conf.env['BACKENDS_DE']:
138 conf.check_cfg(package='gio-unix-2.0', uselib_store='GIO_UNIX',
139 atleast_version='2.18.0', mandatory=True,
140 args='--cflags --libs')
134 if 'gnome' in conf.env['BACKENDS_DE']:141 if 'gnome' in conf.env['BACKENDS_DE']:
135 conf.check_cfg(package='gnome-desktop-2.0',142 conf.check_cfg(package='gnome-desktop-2.0',
136 uselib_store='GNOME_DESKTOP', mandatory=True,143 uselib_store='GNOME_DESKTOP', mandatory=True,
137 args='--cflags --libs')144 args='--cflags --libs')
138 # make sure we have the proper Vala version145 # make sure we have the proper Vala version
139 if conf.env['VALAC_VERSION'] != MIN_VALA_VERSION and \146 if conf.env['VALAC_VERSION'] < MIN_VALA_VERSION and \
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)):
141 conf.fatal('''\148 conf.fatal('''\
142Your Vala compiler version %s is too old. The project requires149Your Vala compiler version %s is too old. The project requires

Subscribers

People subscribed via source and target branches