xmpedit

GTK+ editor for XMP metadata embedded in images
git clone https://code.djc.id.au/git/xmpedit/
commit cae7dddf28ced310887150a96c4e167f9bf56531
parent 232faf0c48fa31eed316a5f21f28aba4f7e993e2
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sun, 24 Oct 2010 17:00:23 +1000

fix deprecations for vala-0.11

Diffstat:
MREADME.markdown | 3+--
Msrc/ImageMetadata.vala | 8++++----
Msrc/MainWindow.vala | 12++++++------
Msrc/RDF_Parser.vala | 2+-
4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/README.markdown b/README.markdown
@@ -20,8 +20,7 @@ xmpedit depends on the following packages:
 
 The following additional dependencies are required to build xmpedit:
 
-* [Vala](http://live.gnome.org/Vala) version 0.10
-  (0.11 is [broken](https://bugzilla.gnome.org/show_bug.cgi?id=633013))
+* [Vala](http://live.gnome.org/Vala) version 0.11.1 or higher
 * A C/C++ compiler (only tested with gcc)
 * Python
 
diff --git a/src/ImageMetadata.vala b/src/ImageMetadata.vala
@@ -129,9 +129,9 @@ private class Description : Gtk.Table, PropertyEditor {
         graph.remove_matching_statements(subject, DC_DESCRIPTION, null);
         string value = text_view.buffer.text;
         string lang = lang_entry.text;
-        if (value.size() > 0) {
+        if (value.length > 0) {
             RDF.PlainLiteral object;
-            if (lang.size() > 0)
+            if (lang.length > 0)
                 object = new RDF.PlainLiteral.with_lang(value, lang);
             else
                 object = new RDF.PlainLiteral(value);
@@ -196,7 +196,7 @@ public class ImageMetadata : Object, Gtk.TreeModel {
         image = new Exiv2.Image.from_path(path);
         image.read_metadata();
         unowned string xmp = image.xmp_packet;
-        xmp_packet_size = xmp.size();
+        xmp_packet_size = xmp.length;
 #if DEBUG
         stderr.puts("=== Extracted XMP packet:\n");
         stderr.puts(xmp);
@@ -240,7 +240,7 @@ public class ImageMetadata : Object, Gtk.TreeModel {
                 """<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="xmpedit 0.0-dev">""");
         xml.append(graph.to_xml(subject));
         xml.append("</x:xmpmeta>");
-        var new_size = xml.str.size() + 19; // plus trailing PI
+        var new_size = xml.str.length + 19; // plus trailing PI
         size_t padding;
         if (new_size <= xmp_packet_size)
             padding = xmp_packet_size - new_size;
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
@@ -51,11 +51,11 @@ public class MainWindow : Gtk.Window {
         var tree_view_scrolled = new Gtk.ScrolledWindow(null, null);
         tree_view_scrolled.add(tree_view);
         tree_view_scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
-        var revert_button = new Gtk.Button.from_stock(Gtk.STOCK_REVERT_TO_SAVED);
+        var revert_button = new Gtk.Button.from_stock(Gtk.Stock.REVERT_TO_SAVED);
         revert_button.clicked.connect(() => {
             critical("IMPLEMENTME");
         });
-        var save_button = new Gtk.Button.from_stock(Gtk.STOCK_SAVE);
+        var save_button = new Gtk.Button.from_stock(Gtk.Stock.SAVE);
         save_button.clicked.connect(() => {
             image_metadata.save();
         });
@@ -98,8 +98,8 @@ public class MainWindow : Gtk.Window {
                         "Save changes before closing?",
                         file.get_basename());
                 dialog.add_button(STOCK_CLOSE_WITHOUT_SAVING, 1);
-                dialog.add_button(Gtk.STOCK_CANCEL, 2);
-                dialog.add_button(Gtk.STOCK_SAVE, 3);
+                dialog.add_button(Gtk.Stock.CANCEL, 2);
+                dialog.add_button(Gtk.Stock.SAVE, 3);
                 dialog.set_default_response(3);
                 var response = dialog.run();
                 dialog.destroy();
@@ -132,11 +132,11 @@ public class MainWindow : Gtk.Window {
     
     /** Create custom stock entries used in the application. */
     private static void add_stock() {
-        Gtk.stock_add_static(STOCK);
+        Gtk.Stock.add_static(STOCK);
     
         var icon_factory = new Gtk.IconFactory();
         icon_factory.add(STOCK_CLOSE_WITHOUT_SAVING,
-                Gtk.IconFactory.lookup_default(Gtk.STOCK_CLOSE));
+                Gtk.IconFactory.lookup_default(Gtk.Stock.CLOSE));
         icon_factory.add_default();
     }
     
diff --git a/src/RDF_Parser.vala b/src/RDF_Parser.vala
@@ -28,7 +28,7 @@ private struct Parser {
     }
 
     public void parse(string xml) throws ParseError {
-        Xml.Doc* doc = Xml.Parser.parse_memory(xml, (int) xml.size());
+        Xml.Doc* doc = Xml.Parser.parse_memory(xml, (int) xml.length);
         if (doc == null)
             throw new ParseError.UNPARSEABLE_XML("doc == null");
         try {