[Goodies-commits] r7846 - in xfmpc/branches/xfmpc-plugins: . src

Mike Massonnet mmassonnet at xfce.org
Sun Jul 26 22:49:25 CEST 2009


Author: mmassonnet
Date: 2009-07-26 20:49:25 +0000 (Sun, 26 Jul 2009)
New Revision: 7846

Modified:
   xfmpc/branches/xfmpc-plugins/
   xfmpc/branches/xfmpc-plugins/ChangeLog
   xfmpc/branches/xfmpc-plugins/src/dbbrowser.vala
   xfmpc/branches/xfmpc-plugins/src/extended-interface.vala
   xfmpc/branches/xfmpc-plugins/src/interface.vala
   xfmpc/branches/xfmpc-plugins/src/main-window.vala
   xfmpc/branches/xfmpc-plugins/src/mpdclient.c
   xfmpc/branches/xfmpc-plugins/src/mpdclient.h
   xfmpc/branches/xfmpc-plugins/src/mpdclient.vapi
   xfmpc/branches/xfmpc-plugins/src/playlist.vala
   xfmpc/branches/xfmpc-plugins/src/plugin-loader.vala
   xfmpc/branches/xfmpc-plugins/src/preferences-dialog.vala
   xfmpc/branches/xfmpc-plugins/src/preferences.vala
   xfmpc/branches/xfmpc-plugins/src/song-dialog.vala
Log:
Some fixes here and there


Property changes on: xfmpc/branches/xfmpc-plugins
___________________________________________________________________
Added: svn:mergeinfo
   + /xfmpc/trunk:7776-7844

Modified: xfmpc/branches/xfmpc-plugins/ChangeLog
===================================================================
--- xfmpc/branches/xfmpc-plugins/ChangeLog	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/ChangeLog	2009-07-26 20:49:25 UTC (rev 7846)
@@ -1,5 +1,18 @@
 2009-07-26	Mike Massonnet <mmassonnet at xfce.org>
 
+Some fixes here and there
+
+- MainWindow had an unused preferences1 object.
+- The Preferences singleton function get_default missed a call to
+add_weak_pointer to reset the static variable to null once the ref count
+reaches 0.
+- The default custom format was empty.
+- Renamed singleton functions _get to _get_default in Preferences and
+Mpdclient.
+- Fix add_weak_pointer call in PluginLoader.
+
+2009-07-26	Mike Massonnet <mmassonnet at xfce.org>
+
 Drop Gee requirement
 
 2009-07-26	Mike Massonnet <mmassonnet at xfce.org>

Modified: xfmpc/branches/xfmpc-plugins/src/dbbrowser.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/dbbrowser.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/dbbrowser.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -49,8 +49,8 @@
 		}
 
 		construct {
-			this.mpdclient = Xfmpc.Mpdclient.get ();
-			this.preferences = Xfmpc.Preferences.get ();
+			this.mpdclient = Xfmpc.Mpdclient.get_default ();
+			this.preferences = Xfmpc.Preferences.get_default ();
 
 			this.wdir = preferences.dbbrowser_last_path;
 			if (this.wdir != null)
@@ -133,7 +133,7 @@
 		}
 
 		public void reload () {
-			string filename = "", basename = "";
+			string filename = null, basename = null;
 			bool is_dir = false, is_bold = false;
 			int i = 0;
 			Xfmpc.Playlist playlist = (Xfmpc.Playlist) get_data ("XfmpcPlaylist");
@@ -151,7 +151,7 @@
 				i ++;
 			}
 
-			while (this.mpdclient.database_read (wdir, &filename, &basename, &is_dir)) {
+			while (this.mpdclient.database_read (wdir, &filename, &basename, out is_dir)) {
 				is_bold = playlist.has_filename (filename, is_dir);
 				append (filename, basename, is_dir, is_bold);
 
@@ -218,7 +218,7 @@
 		}
 
 		public void search (string query) {
-			string filename = "", basename = "";
+			string filename = null, basename = null;
 			bool is_bold;
 			int i = 0;
 			Xfmpc.Playlist playlist = (Xfmpc.Playlist) get_data ("XfmpcPlaylist");

Modified: xfmpc/branches/xfmpc-plugins/src/extended-interface.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/extended-interface.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/extended-interface.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -44,8 +44,8 @@
 		}
 
 		construct {
-			this.mpdclient = Xfmpc.Mpdclient.get ();
-			this.preferences = Xfmpc.Preferences.get ();
+			this.mpdclient = Xfmpc.Mpdclient.get_default ();
+			this.preferences = Xfmpc.Preferences.get_default ();
 
 			var hbox = new Gtk.HBox (false, 2);
 			pack_start (hbox, false, false, 2);

Modified: xfmpc/branches/xfmpc-plugins/src/interface.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/interface.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/interface.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -35,8 +35,8 @@
 		private Gtk.Label subtitle;
 
 		construct {
-			this.mpdclient = Xfmpc.Mpdclient.get ();
-			this.preferences = Xfmpc.Preferences.get ();
+			this.mpdclient = Xfmpc.Mpdclient.get_default ();
+			this.preferences = Xfmpc.Preferences.get_default ();
 
 			set_border_width (4);
 

Modified: xfmpc/branches/xfmpc-plugins/src/main-window.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/main-window.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/main-window.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -61,9 +61,9 @@
 </ui>
 """;
 
-		public MainWindow () {
-			this.mpdclient = Xfmpc.Mpdclient.get ();
-			this.preferences = Xfmpc.Preferences.get ();
+		construct {
+			mpdclient = Xfmpc.Mpdclient.get_default ();
+			preferences = Xfmpc.Preferences.get_default ();
 
 			/* Window */
 			set_default_icon_name ("xfmpc");

Modified: xfmpc/branches/xfmpc-plugins/src/mpdclient.c
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/mpdclient.c	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/mpdclient.c	2009-07-26 20:49:25 UTC (rev 7846)
@@ -264,7 +264,7 @@
 
 
 XfmpcMpdclient *
-xfmpc_mpdclient_get ()
+xfmpc_mpdclient_get_default ()
 {
   static XfmpcMpdclient *mpdclient = NULL;
 
@@ -283,7 +283,7 @@
 xfmpc_mpdclient_initenv (XfmpcMpdclient *mpdclient)
 {
   XfmpcMpdclientPrivate *priv = XFMPC_MPDCLIENT (mpdclient)->priv;
-  XfmpcPreferences *preferences = xfmpc_preferences_get ();
+  XfmpcPreferences *preferences = xfmpc_preferences_get_default ();
   gboolean use_defaults;
 
   g_object_get (preferences, "mpd-use-defaults", &use_defaults, NULL);
@@ -945,7 +945,7 @@
 static gchar *
 _get_formatted_name (mpd_Song *song)
 {
-  XfmpcPreferences *preferences = xfmpc_preferences_get ();
+  XfmpcPreferences *preferences = xfmpc_preferences_get_default ();
   XfmpcPreferencesSongFormat song_format;
   gchar *format_custom;
   gchar *formatted_name;

Modified: xfmpc/branches/xfmpc-plugins/src/mpdclient.h
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/mpdclient.h	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/mpdclient.h	2009-07-26 20:49:25 UTC (rev 7846)
@@ -51,7 +51,7 @@
 
 GType                   xfmpc_mpdclient_get_type                () G_GNUC_CONST;
 
-XfmpcMpdclient *        xfmpc_mpdclient_get                     ();
+XfmpcMpdclient *        xfmpc_mpdclient_get_default             ();
 gboolean                xfmpc_mpdclient_connect                 (XfmpcMpdclient *mpdclient);
 void                    xfmpc_mpdclient_disconnect              (XfmpcMpdclient *mpdclient);
 gboolean                xfmpc_mpdclient_is_connected            (XfmpcMpdclient *mpdclient);

Modified: xfmpc/branches/xfmpc-plugins/src/mpdclient.vapi
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/mpdclient.vapi	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/mpdclient.vapi	2009-07-26 20:49:25 UTC (rev 7846)
@@ -1,4 +1,6 @@
-/* mpdclient.vapi generated by vapigen, do not modify. */
+/* mpdclient.vapi initially generated with:
+   /usr/lib/vala/gen-introspect --namespace=Xfmpc mpdclient.h `pkg-config --cflags gobject-2.0` > mpdclient.gi
+   vapigen --library=mpdclient mpdclient.gi */
 
 [CCode (cprefix = "Xfmpc", lower_case_cprefix = "xfmpc_")]
 namespace Xfmpc {
@@ -6,11 +8,11 @@
 	[CCode (cheader_filename = "mpdclient.h")]
 	public class Mpdclient {
 		public bool connect ();
-		public bool database_read (string dir, string *filename, string *basename, bool *is_dir);
+		public bool database_read (string dir, string *filename, string *basename, out bool is_dir);
 		public bool database_refresh ();
 		public bool database_search (string query, string *filename, string *basename);
 		public void disconnect ();
-		public static unowned Xfmpc.Mpdclient get ();
+		public static unowned Xfmpc.Mpdclient get_default ();
 		public unowned string get_album ();
 		public unowned string get_artist ();
 		public unowned string get_date ();
@@ -32,7 +34,7 @@
 		public bool playlist_clear ();
 		public int playlist_get_length ();
 		public int playlist_get_total_time ();
-		public bool playlist_read (int *id, int *pos, string *filename, string *song, string *length);
+		public bool playlist_read (out int id, out int pos, string *filename, string *song, string *length);
 		public bool pp ();
 		public bool previous ();
 		public bool queue_add (string path);

Modified: xfmpc/branches/xfmpc-plugins/src/playlist.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/playlist.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/playlist.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -49,8 +49,8 @@
 		}
 
 		construct {
-			this.mpdclient = Xfmpc.Mpdclient.get ();
-			this.preferences = Xfmpc.Preferences.get ();
+			this.mpdclient = Xfmpc.Mpdclient.get_default ();
+			this.preferences = Xfmpc.Preferences.get_default ();
 
 			this.autocenter = this.preferences.playlist_autocenter;
 
@@ -233,14 +233,14 @@
 		}
 
 		private void cb_playlist_changed () {
-			string filename = "", song = "", length = "";
+			string filename = null, song = null, length = null;
 			int id = 0, pos = 0;
 
 			this.current = this.mpdclient.get_id ();
 
 			this.store.clear ();
 
-			while (this.mpdclient.playlist_read (&id, &pos, &filename, &song, &length)) {
+			while (this.mpdclient.playlist_read (out id, out pos, &filename, &song, &length)) {
 				append (id, pos, filename, song, length);
 			}
 

Modified: xfmpc/branches/xfmpc-plugins/src/plugin-loader.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/plugin-loader.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/plugin-loader.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -61,7 +61,7 @@
 		public static unowned PluginLoader get_default () {
 			if (singleton == null) {
 				singleton = new PluginLoader ();
-				singleton.add_weak_pointer (singleton);
+				singleton.add_weak_pointer (&singleton);
 			}
 			else
 				singleton.ref ();

Modified: xfmpc/branches/xfmpc-plugins/src/preferences-dialog.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/preferences-dialog.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/preferences-dialog.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -44,7 +44,7 @@
 			this.resizable = false;
 			this.title = "Xfmpc Preferences";
 
-			this.preferences = Xfmpc.Preferences.get ();
+			this.preferences = Xfmpc.Preferences.get_default ();
 
 			var notebook = new Gtk.Notebook ();
 			notebook.set_border_width (6);
@@ -231,7 +231,7 @@
         	}
 
 		private void cb_update_mpd (Gtk.Button source) {
-			unowned Xfmpc.Mpdclient mpdclient = Xfmpc.Mpdclient.get ();
+			unowned Xfmpc.Mpdclient mpdclient = Xfmpc.Mpdclient.get_default ();
 
 			this.preferences.mpd_hostname = this.entry_host.get_text ();
 			this.preferences.mpd_port = this.entry_port.get_value_as_int ();

Modified: xfmpc/branches/xfmpc-plugins/src/preferences.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/preferences.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/preferences.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -107,7 +107,7 @@
 			set { _song_format_custom = value; store (); }
 		}
 
-		public Preferences () {
+		construct {
 			_last_window_posx = 200;
 			_last_window_posy = 100;
 			_last_window_width = 330;
@@ -121,14 +121,18 @@
 			_mpd_use_defaults = true;
 			_show_statusbar = true;
 			_song_format = SongFormat.ARTIST_TITLE;
-			_song_format_custom = "";
+			_song_format_custom = "%a - %t";
+		}
 
+		public Preferences () {
 			load ();
 		}
 
-		public new static unowned Preferences get () {
-			if (preferences == null)
+		public static unowned Preferences get_default () {
+			if (preferences == null) {
 				preferences = new Preferences ();
+				preferences.add_weak_pointer (&preferences);
+			}
 			else
 				preferences.ref ();
 

Modified: xfmpc/branches/xfmpc-plugins/src/song-dialog.vala
===================================================================
--- xfmpc/branches/xfmpc-plugins/src/song-dialog.vala	2009-07-26 20:47:09 UTC (rev 7845)
+++ xfmpc/branches/xfmpc-plugins/src/song-dialog.vala	2009-07-26 20:49:25 UTC (rev 7846)
@@ -32,7 +32,7 @@
 			this.icon_name = "stock_volume";
 			this.resizable = false;
 
-			this.mpdclient = Xfmpc.Mpdclient.get ();
+			this.mpdclient = Xfmpc.Mpdclient.get_default ();
 			this.song = mpdclient.get_song_info (song_id);
 
 			this.title = this.song.title;




More information about the Goodies-commits mailing list