[Muine] Some old patches
- From: Joachim Beckers <joachim beckers gmail com>
- To: muine-list gnome org
- Subject: [Muine] Some old patches
- Date: Mon, 11 Dec 2006 10:57:48 +0100
Hi,
I've been building muine cvs packages for ubuntu edgy, and in the
process I fixed up some patches that didn't apply any longer.
betterabout.jbeckers1.patch changes the about dialog. however, this
patch bumps the dependency on gtk-sharp.
muine-add-albumname.jbeckers1.patch add the album name to the playlist
window. however, this patch has difficulties with bigger font sizes
(text doesn't fit next to album cover).
muine-more-informative-title.jbeckers1.patch changes the window title.
this patch has difficulties on smaller screens (text doesn't fit in
window title).
process-name.jbeckers1.patch changes the process name. I thought this
was in cvs, but it seems it's not.
repeat_current2.jbeckers.part{1,2}.diff adds repeat-one-track
functionality.
enjoy,
Joachim Beckers
--- About.cs.orig 2006-12-10 21:33:37.000000000 +0100
+++ About.cs 2006-12-10 21:40:22.000000000 +0100
@@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
+using System.Diagnostics;
using Gtk;
using Gdk;
@@ -24,7 +25,7 @@ using Mono.Unix;
namespace Muine
{
- public class About : Gnome.About
+ public class About : AboutDialog
{
// Strings
private static readonly string string_translators =
@@ -32,7 +33,10 @@ namespace Muine
private static readonly string string_muine =
Catalog.GetString ("Muine");
-
+
+ private static readonly string string_website =
+ Catalog.GetString ("http://muine-player.org/");
+
private static readonly string string_copyright =
Catalog.GetString ("Copyright � 2003-2006 Jorn Baayen");
@@ -47,7 +51,7 @@ namespace Muine
Catalog.GetString ("Tamara Roberson <tamara roberson gmail com>"),
Catalog.GetString ("Peter Johanson <peter peterjohanson com>"),
"",
- Catalog.GetString ("Album covers are provided by amazon.com and musicbrainz.org."),
+ Catalog.GetString ("Album covers are provided by:\n \thttp://amazon.com\n\thttp://musicbrainz.org."),
null,
};
@@ -80,13 +84,29 @@ namespace Muine
/// <param name="parent">
/// The parent window
/// </param>
- public About (Gtk.Window parent)
- : base (string_muine, Defines.VERSION, string_copyright,
- string_description, authors, documenters, translators, pixbuf)
- {
- TransientFor = parent;
- Show ();
+ public About (Gtk.Window parent)
+ : base ()
+ {
+ SetUrlHook(new AboutDialogActivateLinkFunc (UrlHook));
+ SetEmailHook(new AboutDialogActivateLinkFunc (UrlHook));
+
+ Logo = pixbuf;
+ Name = string_muine;
+ Version = Defines.VERSION;
+ Comments = string_description;
+ Copyright = string_copyright;
+ Website = string_website;
+ Authors = authors;
+ TranslatorCredits = translators;
+
+ TransientFor = parent;
+ Show ();
+ }
+
+ private void UrlHook (Gtk.AboutDialog about, string link)
+ {
+ Process.Start (new ProcessStartInfo ("gnome-open", link));
}
}
}
--- PlaylistWindow.cs.orig 2006-12-10 21:56:23.000000000 +0100
+++ PlaylistWindow.cs 2006-12-10 21:55:57.000000000 +0100
@@ -1213,10 +1213,12 @@ namespace Muine
string artists = StringUtils.EscapeForPango (artists_tmp);
+ string album = StringUtils.EscapeForPango (song.Album);
+
string fmt =
- "<span size=\"large\" weight=\"bold\">{0}</span>\n{1}";
+ "<span size=\"large\" weight=\"bold\">{0}</span>\n<i>{1}</i>\n{2}";
- song_label.Markup = String.Format (fmt, title, artists);
+ song_label.Markup = String.Format (fmt, title, album, artists);
// Title
this.Title = String.Format (string_title_main, song.Title);
--- PlaylistWindow.cs.orig 2006-12-10 21:55:57.000000000 +0100
+++ PlaylistWindow.cs 2006-12-10 21:59:17.000000000 +0100
@@ -94,7 +94,7 @@ namespace Muine
// Strings :: Window Titles
private static readonly string string_title_main =
- Catalog.GetString ("{0} - Muine Music Player");
+ Catalog.GetString ("{0} by {1} - Muine Music Player");
// Strings :: Tooltips
private static readonly string string_tooltip_toggle_play =
@@ -1221,7 +1221,7 @@ namespace Muine
song_label.Markup = String.Format (fmt, title, album, artists);
// Title
- this.Title = String.Format (string_title_main, song.Title);
+ this.Title = String.Format (string_title_main, song.Title, StringUtils.JoinHumanReadable (song.Artists));
if (player.Song != song || restart)
player.Song = song;
--- Global.cs.orig 2006-12-10 22:10:19.000000000 +0100
+++ Global.cs 2006-12-10 22:51:48.000000000 +0100
@@ -19,6 +19,8 @@
using System;
using System.IO;
+using System.Runtime.InteropServices;
+using System.Text;
using Gtk;
using GLib;
@@ -109,6 +111,7 @@ namespace Muine
/// </param>
public static void Main (string [] args)
{
+ Global.SetProcessName ("muine");
Application.Init ();
Gnome.Vfs.Vfs.Initialize ();
@@ -379,5 +382,18 @@ namespace Muine
session_client.SetRestartCommand (1, argv);
}
+
+ [DllImport ("libc")]
+ private static extern int prctl (int option,
+ byte[] arg2,
+ ulong arg3,
+ ulong arg4,
+ ulong arg5);
+ public static void SetProcessName (string name)
+ {
+ if (prctl (15, Encoding.ASCII.GetBytes (name + "\0"), 0, 0, 0) != 0) {
+ throw new ApplicationException ("Error setting process name: " + Mono.Unix.Native.Stdlib.GetLastError ());
+ }
+ }
}
}
--- muine.in.orig 2006-12-10 22:54:30.000000000 +0100
+++ muine.in 2006-12-10 22:51:48.000000000 +0100
@@ -2,4 +2,4 @@
export MONO_GAC_PREFIX=$MONO_GAC_PREFIX:@prefix@
-exec @mono@ @mono_flags@ @pkglibdir@/@target@ "$@"
+exec -a "muine" @mono@ @mono_flags@ @pkglibdir@/@target@ "$@"
--- Actions.cs.orig 2006-12-10 22:10:19.000000000 +0100
+++ Actions.cs 2006-12-10 22:28:10.000000000 +0100
@@ -94,6 +94,9 @@ namespace Muine
private static readonly string string_toggle_repeat =
Catalog.GetString ("R_epeat");
+
+ private static readonly string string_toggle_repeat_current =
+ Catalog.GetString ("Repeat Curren_t");
private static readonly string string_shuffle =
Catalog.GetString ("Shu_ffle");
@@ -174,6 +177,9 @@ namespace Muine
new ToggleActionEntry ("ToggleRepeat", null, string_toggle_repeat,
"<control>R", null, null, false),
+
+ new ToggleActionEntry ("ToggleRepeatCurrent", null, string_toggle_repeat_current,
+ "<control>T", null, null, false),
new ToggleActionEntry ("ToggleVisible", null, string_toggle_visible,
"Escape", null, null, true),
@@ -240,6 +246,7 @@ namespace Muine
this ["About" ].Activated += OnAbout;
this ["TogglePlay" ].Activated += OnTogglePlay;
this ["ToggleRepeat" ].Activated += OnToggleRepeat;
+ this ["ToggleRepeatCurrent" ].Activated += OnToggleRepeatCurrent;
}
// Properties
@@ -626,5 +633,28 @@ namespace Muine
Global.Playlist.Repeat = a.Active;
}
+ // Handlers :: OnToggleRepeatCurrent
+ /// <summary>
+ /// Handler called when the ToggleRepeatCurrent action is activated.
+ /// </summary>
+ /// <remarks>
+ /// This sets <see cref="PlaylistWindow.RepeatCurrent" /> to the
+ /// state of the ToggleRepeat action.
+ /// </remarks>
+ /// <param name="o">
+ /// The calling object.
+ /// </param>
+ /// <param name="args">
+ /// The <see cref="EventArgs" />.
+ /// </param>
+ private void OnToggleRepeatCurrent (object o, EventArgs args)
+ {
+ ToggleAction a = (ToggleAction) o;
+
+ if (a.Active == Global.Playlist.RepeatCurrent)
+ return;
+
+ Global.Playlist.RepeatCurrent = a.Active;
+ }
}
}
--- PlaylistWindow.cs.orig 2006-12-10 22:18:53.000000000 +0100
+++ PlaylistWindow.cs 2006-12-10 22:40:45.000000000 +0100
@@ -66,6 +66,9 @@ namespace Muine
// GConf :: Repeat
private const string GConfKeyRepeat = "/apps/muine/repeat";
private const bool GConfDefaultRepeat = false;
+
+ private const string GConfKeyRepeatCurrent = "/apps/muine/repeat_current";
+ private const bool GConfDefaultRepeatCurrent = false;
// Strings
private static readonly string string_program =
@@ -79,6 +82,9 @@ namespace Muine
private static readonly string string_playlist_repeating =
Catalog.GetString ("<b>Playlist</b> (Repeating)");
+
+ private static readonly string string_playlist_repeating_current =
+ Catalog.GetString ("<b>Playlist</b> (Repeating Current Song - < 1 minute)");
private static readonly string string_playlist_under_minute =
Catalog.GetString ("<b>Playlist</b> (Less than one minute remaining)");
@@ -229,6 +235,7 @@ namespace Muine
private Hashtable random_sort_keys;
private bool repeat;
+ private bool repeat_current = false;
// Constructor
public PlaylistWindow () : base (WindowType.Toplevel)
@@ -422,6 +429,21 @@ namespace Muine
get { return repeat; }
}
+
+ // Properties :: RepeatCurrent (set; get;)
+ public bool RepeatCurrent {
+ set {
+ repeat_current = value;
+
+ ((ToggleAction) Global.Actions ["ToggleRepeatCurrent"]).Active = value;
+
+ Config.Set (GConfKeyRepeatCurrent, value);
+
+ PlaylistChanged ();
+ }
+
+ get { return repeat_current; }
+ }
// Methods
// Methods :: Public
@@ -1066,6 +1088,8 @@ namespace Muine
if (this.repeat)
r_seconds = remaining_songs_time;
+ else if (this.repeat_current)
+ r_seconds = song.Duration;
else
r_seconds = remaining_songs_time + song.Duration - time;
@@ -1088,6 +1112,16 @@ namespace Muine
"<b>Playlist</b> (Repeating {0} minutes)",
minutes);
+ string string_repeat_one_hour = Catalog.GetPluralString (
+ "<b>Playlist</b> (Repeating Current Song - {0} hours)",
+ "<b>Playlist</b> (Repeating Current Song - {0} hour)",
+ hours);
+
+ string string_repeat_one_minute = Catalog.GetPluralString (
+ "<b>Playlist</b> (Repeating Current Song - {0} minute)",
+ "<b>Playlist</b> (Repeating Current Song - {0} minutes)",
+ minutes);
+
string string_normal_hour = Catalog.GetPluralString (
"<b>Playlist</b> ({0} hour remaining)",
"<b>Playlist</b> ({0} hours remaining)",
@@ -1105,11 +1139,15 @@ namespace Muine
string string_second;
if (repeat) {
- string_hour = string_repeat_hour ;
+ string_hour = string_repeat_hour;
string_minute = string_repeat_minute;
string_second = string_playlist_repeating;
+ } else if (repeat_current) {
+ string_hour = string_repeat_one_hour;
+ string_minute = string_repeat_one_minute;
+ string_second = string_playlist_repeating_current;
} else {
- string_hour = string_normal_hour ;
+ string_hour = string_normal_hour;
string_minute = string_normal_minute;
string_second = string_playlist_under_minute;
}
@@ -1432,6 +1470,11 @@ namespace Muine
// Methods :: Private :: EndOfStream
private void EndOfStream (Song song, bool update_time)
{
+ if (repeat_current) {
+ playlist.Model.Playing = song.Handle;
+ PlaylistChanged ();
+ return;
+ }
// If we can, go to the next song
if (playlist.Model.HasNext) {
playlist.Model.Next ();
@@ -1511,6 +1554,12 @@ namespace Muine
Config.AddNotify (GConfKeyRepeat,
new GConf.NotifyEventHandler (OnConfigRepeatChanged));
+
+ // Repeat Current
+ RepeatCurrent = (bool) Config.Get (GConfKeyRepeatCurrent, GConfDefaultRepeatCurrent);
+
+ Config.AddNotify (GConfKeyRepeatCurrent,
+ new GConf.NotifyEventHandler (OnConfigRepeatCurrentChanged));
}
// Handlers
@@ -1762,6 +1811,19 @@ namespace Muine
this.Repeat = val;
}
+
+ // Handlers :: OnConfigRepeatCurrentChanged
+ private void OnConfigRepeatCurrentChanged (object o, GConf.NotifyEventArgs args)
+ {
+ // Get new repeat setting from GConf
+ bool val = (bool) args.Value;
+
+ // If it changed, update.
+ if (val == this.repeat_current)
+ return;
+
+ this.RepeatCurrent = val;
+ }
// Handlers :: OnPlaylistRowActivated
private void OnPlaylistRowActivated (object o, RowActivatedArgs args)
--- PlaylistWindow.xml.orig 2006-12-10 22:44:21.000000000 +0100
+++ PlaylistWindow.xml 2006-12-10 22:25:50.000000000 +0100
@@ -30,6 +30,7 @@
<menuitem action="Clear" />
<separator />
<menuitem action="ToggleRepeat" />
+ <menuitem action="ToggleRepeatCurrent" />
<menuitem action="Shuffle" />
</menu>
<menu action="HelpMenu">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]