[Muine] "Remember window position" patch
- From: Johan Hammar <johan enterprise hb se>
- To: muine-list gnome org
- Subject: [Muine] "Remember window position" patch
- Date: Wed, 7 Apr 2004 23:31:14 +0200
Hi!
Attached is patch that implement two things
* A "remember window position" patch. When you quit Muine the playlist
window position is remembered so that the next time you start Muine you don't have to
move it again.
* More menu item sensitivity. If there are no songs in the playlist the
"Save playlist as", "Remove played songs" and "clear playlist"-menu
items will be disabled.
Regards
Johan
---------------------------
Johan Hammar
staff enterprise hb se
? various.patch
Index: data/glade/PlaylistWindow.glade
===================================================================
RCS file: /cvs/gnome/muine/data/glade/PlaylistWindow.glade,v
retrieving revision 1.22
diff -u -b -B -p -r1.22 PlaylistWindow.glade
--- data/glade/PlaylistWindow.glade 14 Mar 2004 22:02:22 -0000 1.22
+++ data/glade/PlaylistWindow.glade 7 Apr 2004 17:28:15 -0000
@@ -86,7 +86,7 @@
</child>
<child>
- <widget class="GtkImageMenuItem" id="save_playlist_as1">
+ <widget class="GtkImageMenuItem" id="save_playlist_as_menu_item">
<property name="visible">True</property>
<property name="label" translatable="yes">_Save Playlist As...</property>
<property name="use_underline">True</property>
@@ -408,7 +408,7 @@
</child>
<child>
- <widget class="GtkMenuItem" id="clear_played1">
+ <widget class="GtkMenuItem" id="remove_played_songs_menu_item">
<property name="visible">True</property>
<property name="label" translatable="yes">Remove _Played Songs</property>
<property name="use_underline">True</property>
Index: src/PlaylistWindow.cs
===================================================================
RCS file: /cvs/gnome/muine/src/PlaylistWindow.cs,v
retrieving revision 1.98
diff -u -b -B -p -r1.98 PlaylistWindow.cs
--- src/PlaylistWindow.cs 3 Apr 2004 11:29:15 -0000 1.98
+++ src/PlaylistWindow.cs 7 Apr 2004 17:28:16 -0000
@@ -46,6 +46,12 @@ public class PlaylistWindow : Window
[Glade.Widget]
private ImageMenuItem remove_song_menu_item;
[Glade.Widget]
+ private MenuItem remove_played_songs_menu_item;
+ [Glade.Widget]
+ private MenuItem clear_playlist_menu_item;
+ [Glade.Widget]
+ private ImageMenuItem save_playlist_as_menu_item;
+ [Glade.Widget]
private CheckMenuItem repeat_menu_item;
private bool setting_repeat_menu_item;
@@ -110,6 +116,7 @@ public class PlaylistWindow : Window
icon = new NotificationAreaIcon ();
SetupWindowSize ();
+ SetupWindowPosition ();
SetupPlayer (glade_xml);
SetupButtonsAndMenuItems (glade_xml);
SetupPlaylist (glade_xml);
@@ -221,6 +228,18 @@ public class PlaylistWindow : Window
SizeAllocated += new SizeAllocatedHandler (HandleSizeAllocated);
}
+ private void SetupWindowPosition ()
+ {
+ int pos_x, pos_y;
+ try {
+ pos_x = (int) Muine.GConfClient.Get ("/apps/muine/playlist_window/pos_x");
+ pos_y = (int) Muine.GConfClient.Get ("/apps/muine/playlist_window/pos_y");
+ Move (pos_x, pos_y);
+ } catch {
+ // Let the windowmanager place the playlistwindow if no position is found.
+ }
+ }
+
private int last_x = -1;
private int last_y = -1;
@@ -576,6 +595,10 @@ public class PlaylistWindow : Window
information_menu_item.Sensitive = has_first;
icon.information_menu_item.Sensitive = has_first;
+ remove_played_songs_menu_item.Sensitive = has_first;
+ clear_playlist_menu_item.Sensitive = has_first;
+ save_playlist_as_menu_item.Sensitive = has_first;
+
UpdateTimeLabels (player.Position);
SavePlaylist (playlist_filename, !repeat_menu_item.Active, true);
@@ -1346,6 +1369,13 @@ public class PlaylistWindow : Window
private void HandleQuitCommand (object o, EventArgs args)
{
+ int pos_x, pos_y;
+
+ GetPosition (out pos_x, out pos_y);
+
+ Muine.GConfClient.Set ("/apps/muine/playlist_window/pos_x", pos_x);
+ Muine.GConfClient.Set ("/apps/muine/playlist_window/pos_y", pos_y);
+
Muine.Exit ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]