[Xfce4-commits] <xfmpc:master> Fix compilation with Vala 0.14

Vincent Legout noreply at xfce.org
Sat Oct 22 14:42:02 CEST 2011


Updating branch refs/heads/master
         to 2590f5347d68c6eada143c23c2eea484bb263fe7 (commit)
       from 7ff0ad1c5370b5274ebccfc43bca18ae83a56a40 (commit)

commit 2590f5347d68c6eada143c23c2eea484bb263fe7
Author: Vincent Legout <vincent at legout.info>
Date:   Sat Oct 22 14:34:26 2011 +0200

    Fix compilation with Vala 0.14

 src/dbbrowser.vala          |   14 ++++++--------
 src/extended-interface.vala |    8 ++++----
 src/interface.vala          |   10 +++++-----
 src/main-window.vala        |    4 ++--
 src/main.vala               |    8 ++++----
 src/playlist.vala           |   12 ++++++------
 src/preferences-dialog.vala |    4 ++--
 src/shortcuts-dialog.vala   |    2 +-
 src/song-dialog.vala        |    2 +-
 src/xfce-arrow-button.vapi  |    3 +--
 10 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/src/dbbrowser.vala b/src/dbbrowser.vala
index 9202aba..db32735 100644
--- a/src/dbbrowser.vala
+++ b/src/dbbrowser.vala
@@ -89,16 +89,16 @@ namespace Xfmpc {
 
 			this.menu = new Gtk.Menu ();
 
-			var mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ADD, null);
+			var mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.ADD, null);
 			this.menu.append (mi);
 			mi.activate.connect (add_selected_rows);
 			mi = new Gtk.ImageMenuItem.with_mnemonic (_("Replace"));
-			var image = new Gtk.Image.from_stock (Gtk.STOCK_CUT, Gtk.IconSize.MENU);
+			var image = new Gtk.Image.from_stock (Gtk.Stock.CUT, Gtk.IconSize.MENU);
 			mi.set_image (image);
 			this.menu.append (mi);
 			mi.activate.connect (cb_replace_with_selected_rows);
 			this.mi_browse = new Gtk.ImageMenuItem.with_mnemonic (_("Browse"));
-			image = new Gtk.Image.from_stock (Gtk.STOCK_OPEN, Gtk.IconSize.MENU);
+			image = new Gtk.Image.from_stock (Gtk.Stock.OPEN, Gtk.IconSize.MENU);
 			this.mi_browse.set_image (image);
 			this.menu.append (this.mi_browse);
 			this.mi_browse.activate.connect (cb_browse);
@@ -106,7 +106,7 @@ namespace Xfmpc {
 			this.menu.show_all ();
 
 			this.search_entry = new Entry ();
-			this.search_entry.set_icon_from_stock (EntryIconPosition.PRIMARY, Gtk.STOCK_FIND);
+			this.search_entry.set_icon_from_stock (EntryIconPosition.PRIMARY, Gtk.Stock.FIND);
 			this.search_entry.set_icon_activatable (EntryIconPosition.PRIMARY, false);
 
 			scrolled.add (this.treeview);
@@ -170,9 +170,7 @@ namespace Xfmpc {
 		}
 
 		public string get_parent_wdir () {
-			string filename = wdir.str ("/");
-
-			if (filename == null)
+			if (wdir.index_of("/", 0) == -1)
 				return "";
 			else
 				return GLib.Path.get_dirname (wdir);
@@ -181,7 +179,7 @@ namespace Xfmpc {
 		public void append (string filename, string basename, bool is_dir, bool is_bold) {
 			Gtk.TreeIter iter;
 
-			var pixbuf = this.treeview.render_icon (is_dir ? Gtk.STOCK_DIRECTORY : Gtk.STOCK_FILE,
+			var pixbuf = this.treeview.render_icon (is_dir ? Gtk.Stock.DIRECTORY : Gtk.Stock.FILE,
 					                        Gtk.IconSize.MENU, null);
 
 			this.store.append (out iter);
diff --git a/src/extended-interface.vala b/src/extended-interface.vala
index 90d8aa5..5fa3a0a 100644
--- a/src/extended-interface.vala
+++ b/src/extended-interface.vala
@@ -60,7 +60,7 @@ namespace Xfmpc {
 			button.clicked.connect (cb_playlist_clear);
 			hbox.pack_start (button, false, false, 0);
 
-			var image = new Gtk.Image.from_stock (Gtk.STOCK_NEW, Gtk.IconSize.MENU);
+			var image = new Gtk.Image.from_stock (Gtk.Stock.NEW, Gtk.IconSize.MENU);
 			button.set_image (image);
 
 			button = new Gtk.Button ();
@@ -68,7 +68,7 @@ namespace Xfmpc {
 			button.clicked.connect (cb_database_refresh);
 			hbox.pack_start (button, false, false, 0);
 
-			image = new Gtk.Image.from_stock (Gtk.STOCK_REFRESH, Gtk.IconSize.MENU);
+			image = new Gtk.Image.from_stock (Gtk.Stock.REFRESH, Gtk.IconSize.MENU);
 			button.set_image (image);
 
 			this.context_button = new Xfce.ArrowButton (Gtk.ArrowType.DOWN);
@@ -182,7 +182,7 @@ namespace Xfmpc {
 			var separator = new Gtk.SeparatorMenuItem ();
 			this.context_menu.append (separator);
 
-			var imi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_PREFERENCES, null);
+			var imi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.PREFERENCES, null);
 			imi.activate.connect (cb_preferences);
 			this.context_menu.append (imi);
 
@@ -190,7 +190,7 @@ namespace Xfmpc {
 			mi.activate.connect (cb_shortcuts);
 			this.context_menu.append (mi);
 
-			imi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ABOUT, null);
+			imi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.ABOUT, null);
 			imi.activate.connect (cb_about);
 			this.context_menu.append (imi);
 
diff --git a/src/interface.vala b/src/interface.vala
index 505f15f..266bfba 100644
--- a/src/interface.vala
+++ b/src/interface.vala
@@ -42,17 +42,17 @@ namespace Xfmpc {
 
 			set_border_width (4);
 
-			var image = new Gtk.Image.from_stock (Gtk.STOCK_MEDIA_PREVIOUS, Gtk.IconSize.BUTTON);
+			var image = new Gtk.Image.from_stock (Gtk.Stock.MEDIA_PREVIOUS, Gtk.IconSize.BUTTON);
 			this.button_prev = new Gtk.Button ();
 			this.button_prev.set_relief (Gtk.ReliefStyle.NONE);
 			this.button_prev.add (image);
 
-			image = new Gtk.Image.from_stock (Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON);
+			image = new Gtk.Image.from_stock (Gtk.Stock.MEDIA_PLAY, Gtk.IconSize.BUTTON);
 			this.button_pp = new Gtk.Button ();
 			this.button_pp.set_relief (Gtk.ReliefStyle.NONE);
 			this.button_pp.add (image);
 
-			image = new Gtk.Image.from_stock (Gtk.STOCK_MEDIA_NEXT, Gtk.IconSize.BUTTON);
+			image = new Gtk.Image.from_stock (Gtk.Stock.MEDIA_NEXT, Gtk.IconSize.BUTTON);
 			this.button_next = new Gtk.Button ();
 			this.button_next.set_relief (Gtk.ReliefStyle.NONE);
 			this.button_next.add (image);
@@ -151,9 +151,9 @@ namespace Xfmpc {
 			var image = (Gtk.Image) this.button_pp.get_child ();
 
 			if (play == true)
-				image.set_from_stock (Gtk.STOCK_MEDIA_PAUSE, Gtk.IconSize.BUTTON);
+				image.set_from_stock (Gtk.Stock.MEDIA_PAUSE, Gtk.IconSize.BUTTON);
 			else
-				image.set_from_stock (Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON);
+				image.set_from_stock (Gtk.Stock.MEDIA_PLAY, Gtk.IconSize.BUTTON);
 		}
 
 		private bool cb_progress_box_motion_event (Gdk.EventMotion event) {
diff --git a/src/main-window.vala b/src/main-window.vala
index f04c739..a275a7b 100644
--- a/src/main-window.vala
+++ b/src/main-window.vala
@@ -151,7 +151,7 @@ namespace Xfmpc {
 		private void status_icon_popup_menu (uint button, uint activate_time) {
 			if (this.status_icon_menu == null) {
 				this.status_icon_menu = new Gtk.Menu ();
-				var mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_QUIT, null);
+				var mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.QUIT, null);
 				mi.activate.connect (Gtk.main_quit);
 				this.status_icon_menu.add (mi);
 				this.status_icon_menu.show_all ();
@@ -252,7 +252,7 @@ namespace Xfmpc {
 			this. at interface.popup_volume ();
 		}
 
-		private void action_statusbar (Action action) {
+		private void action_statusbar (Gtk.Action action) {
 			bool active = ((Gtk.ToggleAction) action).get_active ();
 
 			if (!active && this.statusbar != null) {
diff --git a/src/main.vala b/src/main.vala
index d192f27..7239e6b 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -21,15 +21,15 @@ using Gtk;
 
 namespace Xfmpc {
 
-	static void transform_string_to_int (GLib.Value src, out GLib.Value dst) {
-		dst.set_int ((int) (src.get_string ()).to_ulong ());
+	static void transform_string_to_int (GLib.Value src, GLib.Value dst) {
+		dst.set_int (int.parse (src.get_string ()));
 	}
 
-	static void transform_string_to_boolean (GLib.Value src, out GLib.Value dst) {
+	static void transform_string_to_boolean (GLib.Value src, GLib.Value dst) {
 		dst.set_boolean ((src.get_string ()).collate ("FALSE") != 0);
 	}
 
-	static void transform_string_to_enum (GLib.Value src, out GLib.Value dst) {
+	static void transform_string_to_enum (GLib.Value src, GLib.Value dst) {
 		GLib.EnumClass klass = (GLib.EnumClass) (dst.type ()).class_ref ();
 		int i = 0;
 		unowned EnumValue enum_value;
diff --git a/src/playlist.vala b/src/playlist.vala
index 49968cf..1558be2 100644
--- a/src/playlist.vala
+++ b/src/playlist.vala
@@ -100,22 +100,22 @@ namespace Xfmpc {
 
 			this.menu = new Menu ();
 
-			var mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_REMOVE, null);
+			var mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.REMOVE, null);
 			this.menu.append (mi);
 			mi.activate.connect (delete_selection);
 			this.mi_browse = new Gtk.ImageMenuItem.with_mnemonic (_("Browse"));
-			var image = new Gtk.Image.from_stock (Gtk.STOCK_OPEN, Gtk.IconSize.MENU);
+			var image = new Gtk.Image.from_stock (Gtk.Stock.OPEN, Gtk.IconSize.MENU);
 			this.mi_browse.set_image (image);
 			this.menu.append (this.mi_browse);
 			this.mi_browse.activate.connect (cb_browse_selection);
-			this.mi_information = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_INFO, null);
+			this.mi_information = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.INFO, null);
 			this.menu.append (mi_information);
 			this.mi_information.activate.connect (cb_info_selection);
 
 			this.menu.show_all ();
 
 			this.filter_entry = new Entry ();
-			this.filter_entry.set_icon_from_stock (EntryIconPosition.PRIMARY, Gtk.STOCK_FIND);
+			this.filter_entry.set_icon_from_stock (EntryIconPosition.PRIMARY, Gtk.Stock.FIND);
 			this.filter_entry.set_icon_activatable (EntryIconPosition.PRIMARY, false);
 
 			scrolled.add (this.treeview);
@@ -140,7 +140,7 @@ namespace Xfmpc {
 			this.preferences.notify["song-format-custom"].connect (cb_playlist_changed);
 		}
 
-		private static bool visible_func_filter_tree (Gtk.TreeModel model, out Gtk.TreeIter iter) {
+		private static bool visible_func_filter_tree (Gtk.TreeModel model, Gtk.TreeIter iter) {
   			string song = "", search = "";
 			bool result = true;
 
@@ -154,7 +154,7 @@ namespace Xfmpc {
 			if (search != "") {
 				song = song.casefold (-1);
 
-				if (song.str (search) == null)
+				if (song.index_of (search, 0) == -1)
 					result = false;
 			}
 
diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala
index 62a9b18..1d65210 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -102,7 +102,7 @@ namespace Xfmpc {
 				this.entry_passwd.set_text (this.preferences.mpd_password);
 			hbox.pack_start (this.entry_passwd, true, true, 0);
 
-			var button = new Gtk.Button.from_stock (Gtk.STOCK_APPLY);
+			var button = new Gtk.Button.from_stock (Gtk.Stock.APPLY);
 			button.clicked.connect (cb_update_mpd);
 			vbox2.pack_start (button, true, true, 0);
 
@@ -215,7 +215,7 @@ namespace Xfmpc {
 
 			vbox2.pack_start (table, true, true, 0);
 
-        		add_button (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
+			add_button (Gtk.Stock.CLOSE, Gtk.ResponseType.CLOSE);
 
 			show_all ();
 
diff --git a/src/shortcuts-dialog.vala b/src/shortcuts-dialog.vala
index 61e40d7..be32d3a 100644
--- a/src/shortcuts-dialog.vala
+++ b/src/shortcuts-dialog.vala
@@ -29,7 +29,7 @@ namespace Xfmpc {
 			this.title = _("Xfmpc Shortcuts");
 			this.subtitle = _("Control your MPD client with your keyboard");
 
-			add_button (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
+			add_button (Gtk.Stock.CLOSE, Gtk.ResponseType.CLOSE);
 			this.response.connect ((response) => {
 				switch (response) {
 					case Gtk.ResponseType.CLOSE:
diff --git a/src/song-dialog.vala b/src/song-dialog.vala
index 0b08f0a..9b99295 100644
--- a/src/song-dialog.vala
+++ b/src/song-dialog.vala
@@ -100,7 +100,7 @@ namespace Xfmpc {
 
 			vbox.pack_start (frame, true, true, 0);
 
-        		add_button (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
+			add_button (Gtk.Stock.CLOSE, Gtk.ResponseType.CLOSE);
 
 			show_all ();
 
diff --git a/src/xfce-arrow-button.vapi b/src/xfce-arrow-button.vapi
index a520b34..7fd269c 100644
--- a/src/xfce-arrow-button.vapi
+++ b/src/xfce-arrow-button.vapi
@@ -2,9 +2,8 @@
 
 [CCode (cprefix = "Xfce", lower_case_cprefix = "xfce_")]
 namespace Xfce {
-	[CCode (free_function = "")]
+	[CCode (unref_function = "", free_function = "", cheader_filename = "xfce-arrow-button.h")]
 	[Compact]
-	[CCode (cheader_filename = "xfce-arrow-button.h")]
 	public class ArrowButton {
 		public Gtk.ArrowType arrow_type;
 		public weak Gtk.ToggleButton parent;


More information about the Xfce4-commits mailing list