[Rhythmbox-devel] Hide playlist



I have a patch here to hide the playlist, it works fine except the menu
entry doesn't work (I'm guessing I botched a callback somewhere) but
/apps/rhythmbox/ui/playlist_hidden can be toggled in its place. if
anyone is interested in it do whatever you want with it. 
Index: data/ui/rhythmbox-ui.xml.in
===================================================================
RCS file: /cvs/gnome/rhythmbox/data/ui/rhythmbox-ui.xml.in,v
retrieving revision 1.50
diff -u -r1.50 rhythmbox-ui.xml.in
--- data/ui/rhythmbox-ui.xml.in	19 Jul 2003 04:14:17 -0000	1.50
+++ data/ui/rhythmbox-ui.xml.in	22 Jul 2003 06:09:05 -0000
@@ -117,6 +117,10 @@
 	     _tip="Change the visibility of the source list"
 	     type="toggle"/>
 
+       <cmd name="ShowPlayList"
+             _tip="Change the visibility of the playlist"
+             type="toggle"/>
+
 	<cmd name="ViewBrowser"
 	     _tip="Change the visibility of the browser"
 	     type="toggle"/>
@@ -187,6 +191,8 @@
 <submenu name="View" _label="_View">
 
 	<menuitem name="SourceList" verb="ShowSourceList" _label="_Source List" accel="F9"/>
+
+	<menuitem name="PlayList" verb="ShowPlayList" _label="_Playlist" accel="F8"/>
 
 	<menuitem name="ViewBrowser" verb="ViewBrowser" _label="_Browser" accel="F7"/>
         
Index: shell/rb-shell-preferences.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-preferences.h,v
retrieving revision 1.4
diff -u -r1.4 rb-shell-preferences.h
--- shell/rb-shell-preferences.h	11 May 2003 00:17:53 -0000	1.4
+++ shell/rb-shell-preferences.h	22 Jul 2003 06:09:06 -0000
@@ -29,6 +29,7 @@
 #define CONF_UI_DIR               CONF_PREFIX "/ui"
 #define CONF_UI_STATUSBAR_HIDDEN  CONF_PREFIX "/ui/statusbar_hidden"
 #define CONF_UI_SOURCELIST_HIDDEN CONF_PREFIX "/ui/sourcelist_hidden"
+#define CONF_UI_PLAYLIST_HIDDEN   CONF_PREFIX "/ui/playlist_hidden"
 #define CONF_UI_COLUMNS_SETUP CONF_PREFIX "/ui/columns_setup"
 
 #define RB_TYPE_SHELL_PREFERENCES         (rb_shell_preferences_get_type ())
Index: shell/rb-shell.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v
retrieving revision 1.119
diff -u -r1.119 rb-shell.c
--- shell/rb-shell.c	19 Jul 2003 04:14:10 -0000	1.119
+++ shell/rb-shell.c	22 Jul 2003 06:09:08 -0000
@@ -168,6 +168,11 @@
 						 Bonobo_UIComponent_EventType type,
 						 const char *state,
 						 RBShell *shell);
+static void rb_shell_view_playlist_changed_cb (BonoboUIComponent *component,
+                                                 const char *path,
+                                                 Bonobo_UIComponent_EventType type,
+                                                 const char *state,
+                                                 RBShell *shell);
 static void rb_shell_show_window_changed_cb (BonoboUIComponent *component,
 				             const char *path,
 				             Bonobo_UIComponent_EventType type,
@@ -176,12 +181,17 @@
 static void rb_shell_load_music_groups (RBShell *shell);
 static void rb_shell_save_music_groups (RBShell *shell);
 static void rb_shell_sync_sourcelist_visibility (RBShell *shell);
+static void rb_shell_sync_playlist_visibility (RBShell *shell);
 static void rb_shell_sync_window_visibility (RBShell *shell);
 static gboolean rb_shell_update_source_status (RBShell *shell);
 static void sourcelist_visibility_changed_cb (GConfClient *client,
 					      guint cnxn_id,
 					      GConfEntry *entry,
 					      RBShell *shell);
+static void playlist_visibility_changed_cb (GConfClient *client,
+                                              guint cnxn_id,
+                                              GConfEntry *entry,
+                                              RBShell *shell);
 static void window_visibility_changed_cb (GConfClient *client,
 			                  guint cnxn_id,
 			                  GConfEntry *entry,
@@ -227,6 +237,7 @@
 } CreateGroupType;
 
 #define CMD_PATH_VIEW_SOURCELIST   "/commands/ShowSourceList"
+#define CMD_PATH_VIEW_PLAYLIST   "/commands/ShowPlayList"
 #define CMD_PATH_SHOW_WINDOW    "/commands/ShowWindow"
 
 /* prefs */
@@ -299,7 +310,9 @@
 static RBBonoboUIListener rb_shell_listeners[] =
 {
 	RB_BONOBO_UI_LISTENER ("ShowSourceList",(BonoboUIListenerFn) rb_shell_view_sourcelist_changed_cb),
-	RB_BONOBO_UI_LISTENER_END
+	RB_BONOBO_UI_LISTENER_END,
+        RB_BONOBO_UI_LISTENER ("ShowPlayList",(BonoboUIListenerFn) rb_shell_view_playlist_changed_cb),
+        RB_BONOBO_UI_LISTENER_END
 };
 
 static RBBonoboUIListener rb_tray_listeners[] =
@@ -689,6 +702,9 @@
 	eel_gconf_notification_add (CONF_UI_SOURCELIST_HIDDEN,
 				    (GConfClientNotifyFunc) sourcelist_visibility_changed_cb,
 				    shell);
+	eel_gconf_notification_add (CONF_UI_PLAYLIST_HIDDEN,
+                                    (GConfClientNotifyFunc) playlist_visibility_changed_cb,
+                                    shell);
 	eel_gconf_notification_add (CONF_STATE_WINDOW_VISIBLE,
 				    (GConfClientNotifyFunc) window_visibility_changed_cb,
 				    shell);
@@ -698,7 +714,7 @@
 
 	rb_debug ("shell: syncing with gconf");
 	rb_shell_sync_sourcelist_visibility (shell);
-
+	rb_shell_sync_playlist_visibility (shell);
 	rb_debug ("shell: creating library");
 	shell->priv->library = rb_library_new ();
 
@@ -1052,6 +1068,17 @@
 }
 
 static void
+rb_shell_view_playlist_changed_cb (BonoboUIComponent *component,
+                                     const char *path,
+                                     Bonobo_UIComponent_EventType type,
+                                     const char *state,
+                                     RBShell *shell)
+{
+        eel_gconf_set_boolean (CONF_UI_PLAYLIST_HIDDEN,
+                               !rb_bonobo_get_active (component, CMD_PATH_VIEW_PLAYLIST));
+}
+
+static void
 rb_shell_show_window_changed_cb (BonoboUIComponent *component,
 				 const char *path,
 				 Bonobo_UIComponent_EventType type,
@@ -1523,6 +1550,27 @@
 			      visible);
 }
 
+static void
+rb_shell_sync_playlist_visibility (RBShell *shell)
+{
+	gboolean visible;
+	visible = !eel_gconf_get_boolean(CONF_UI_PLAYLIST_HIDDEN);
+	if (visible)
+	{
+		gtk_widget_show (GTK_WIDGET (shell->priv->source_header));
+                gtk_widget_show (shell->priv->notebook);
+	}
+	else
+	{
+                gtk_widget_hide (GTK_WIDGET (shell->priv->source_header));
+                gtk_widget_hide (shell->priv->notebook);
+                gtk_window_resize (GTK_WINDOW (shell->priv->window),1,1);
+        }
+	rb_bonobo_set_active (shell->priv->ui_component,
+                              CMD_PATH_VIEW_PLAYLIST,
+                              visible);
+}
+
 /* REWRITEFIXME */
 /* static void */
 /* rb_shell_source_status_changed_cb (RBViewStatus *status, */
@@ -1572,6 +1620,16 @@
 {
 	rb_debug ("sourcelist visibility changed"); 
 	rb_shell_sync_sourcelist_visibility (shell);
+}
+
+static void
+playlist_visibility_changed_cb (GConfClient *client,
+                                  guint cnxn_id,
+                                  GConfEntry *entry,
+                                  RBShell *shell)
+{
+        rb_debug ("playlist visibility changed");
+        rb_shell_sync_playlist_visibility (shell);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]