changeset 2651:4d5e6a8717dd trunk

[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
author giacomo
date Thu, 05 Apr 2007 09:26:13 -0700
parents f41ca301852a
children 2d0c90f38824
files ChangeLog src/audacious/build_stamp.c src/audacious/main.c src/audacious/main.h src/audacious/ui_main.c src/audacious/ui_main.h src/audacious/ui_skinned_window.c
diffstat 7 files changed, 99 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 05 06:11:33 2007 -0700
+++ b/ChangeLog	Thu Apr 05 09:26:13 2007 -0700
@@ -1,3 +1,11 @@
+2007-04-05 13:11:33 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [4326]
+  - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
+  
+  trunk/src/audacious/ui_playlist.c |   10 ++++++++++
+  1 file changed, 10 insertions(+)
+
+
 2007-04-05 12:56:00 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [4324]
   - don't resample if source rate matches the internal clock rate. closes #881.
--- a/src/audacious/build_stamp.c	Thu Apr 05 06:11:33 2007 -0700
+++ b/src/audacious/build_stamp.c	Thu Apr 05 09:26:13 2007 -0700
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070405-4324";
+const gchar *svn_stamp = "20070405-4326";
--- a/src/audacious/main.c	Thu Apr 05 06:11:33 2007 -0700
+++ b/src/audacious/main.c	Thu Apr 05 09:26:13 2007 -0700
@@ -149,6 +149,7 @@
     TRUE,                       /* UNUSED (smooth title scrolling) */
     TRUE,                       /* use playlist metadata */
     TRUE,                       /* warn about unplayables */
+    TRUE,                       /* warn about windows visibility */
     FALSE,                      /* use \ as directory delimiter */
     FALSE,                      /* random skin on play */
     FALSE,                      /* use fontsets */
@@ -280,6 +281,7 @@
     {"sort_jump_to_file", &cfg.sort_jump_to_file, TRUE},
     {"use_pl_metadata", &cfg.use_pl_metadata, TRUE},
     {"warn_about_unplayables", &cfg.warn_about_unplayables, TRUE},
+    {"warn_about_win_visibility", &cfg.warn_about_win_visibility, TRUE},
     {"use_backslash_as_dir_delimiter", &cfg.use_backslash_as_dir_delimiter, TRUE},
     {"player_shaded", &cfg.player_shaded, TRUE},
     {"player_visible", &cfg.player_visible, TRUE},
@@ -679,23 +681,32 @@
     /* FIXME: we're looking up SkinnedWindow::x &c ourselves here.
      * this isn't exactly right. -nenolod
      */
-    bmp_cfg_db_set_int(db, NULL, "playlist_x",
-                       SKINNED_WINDOW(playlistwin)->x);
-
-    bmp_cfg_db_set_int(db, NULL, "playlist_y",
-                       SKINNED_WINDOW(playlistwin)->y);
-
-    bmp_cfg_db_set_int(db, NULL, "player_x",
-                       SKINNED_WINDOW(mainwin)->x);
+    if ( SKINNED_WINDOW(playlistwin)->x != -1 &&
+         SKINNED_WINDOW(playlistwin)->y != -1 )
+    {
+        bmp_cfg_db_set_int(db, NULL, "playlist_x",
+                           SKINNED_WINDOW(playlistwin)->x);
+        bmp_cfg_db_set_int(db, NULL, "playlist_y",
+                           SKINNED_WINDOW(playlistwin)->y);
+    }
+    
+    if ( SKINNED_WINDOW(mainwin)->x != -1 &&
+         SKINNED_WINDOW(mainwin)->y != -1 )
+    {
+        bmp_cfg_db_set_int(db, NULL, "player_x",
+                           SKINNED_WINDOW(mainwin)->x);
+        bmp_cfg_db_set_int(db, NULL, "player_y",
+                           SKINNED_WINDOW(mainwin)->y);
+    }
 
-    bmp_cfg_db_set_int(db, NULL, "player_y",
-                       SKINNED_WINDOW(mainwin)->y);
-
-    bmp_cfg_db_set_int(db, NULL, "equalizer_x",
-                       SKINNED_WINDOW(equalizerwin)->x);
-
-    bmp_cfg_db_set_int(db, NULL, "equalizer_y",
-                       SKINNED_WINDOW(equalizerwin)->y);
+    if ( SKINNED_WINDOW(equalizerwin)->x != -1 &&
+         SKINNED_WINDOW(equalizerwin)->y != -1 )
+    {
+        bmp_cfg_db_set_int(db, NULL, "equalizer_x",
+                           SKINNED_WINDOW(equalizerwin)->x);
+        bmp_cfg_db_set_int(db, NULL, "equalizer_y",
+                           SKINNED_WINDOW(equalizerwin)->y);
+    }
 
     bmp_cfg_db_set_bool(db, NULL, "mainwin_use_xfont",
             cfg.mainwin_use_xfont);
@@ -1182,7 +1193,10 @@
         if (cfg.player_visible)
             mainwin_show(TRUE);
         else if (!cfg.playlist_visible && !cfg.equalizer_visible)
-            mainwin_show(TRUE);
+        {
+          /* all of the windows are hidden... warn user about this */
+          mainwin_show_visibility_warning();
+        }
 
         if (cfg.equalizer_visible)
             equalizerwin_show(TRUE);
--- a/src/audacious/main.h	Thu Apr 05 06:11:33 2007 -0700
+++ b/src/audacious/main.h	Thu Apr 05 09:26:13 2007 -0700
@@ -67,6 +67,7 @@
     gboolean smooth_title_scroll;
     gboolean use_pl_metadata;
     gboolean warn_about_unplayables;
+    gboolean warn_about_win_visibility;
     gboolean use_backslash_as_dir_delimiter;
     gboolean random_skin_on_play;
     gboolean use_fontsets;
--- a/src/audacious/ui_main.c	Thu Apr 05 06:11:33 2007 -0700
+++ b/src/audacious/ui_main.c	Thu Apr 05 09:26:13 2007 -0700
@@ -1490,6 +1490,57 @@
     }
 }
 
+static void
+on_visibility_warning_toggle(GtkToggleButton *tbt, gpointer unused)
+{
+    cfg.warn_about_win_visibility = !gtk_toggle_button_get_active(tbt);
+}
+
+static void
+on_visibility_warning_response(GtkDialog *dlg, gint r_id, gpointer unused)
+{
+    switch (r_id)
+    {
+        case GTK_RESPONSE_OK:
+            mainwin_show(TRUE);
+            break;
+        case GTK_RESPONSE_CANCEL:
+        default:
+            break;
+    }
+    gtk_widget_destroy(GTK_WIDGET(dlg));
+}
+
+void
+mainwin_show_visibility_warning(void)
+{
+    if (cfg.warn_about_win_visibility)
+    {
+        GtkWidget *label, *checkbt, *vbox;
+        GtkWidget *warning_dlg = gtk_dialog_new_with_buttons( _("Audacious - visibility warning") ,
+            GTK_WINDOW(mainwin) , GTK_DIALOG_DESTROY_WITH_PARENT ,
+            _("Show main player window") , GTK_RESPONSE_OK ,
+            _("Ignore") , GTK_RESPONSE_CANCEL , NULL );
+        vbox = gtk_vbox_new( FALSE , 4 );
+        gtk_container_set_border_width( GTK_CONTAINER(vbox) , 4 );
+        gtk_box_pack_start( GTK_BOX(GTK_DIALOG(warning_dlg)->vbox) , vbox , TRUE , TRUE , 0 );
+        label = gtk_label_new( _("Audacious has been started with all of its windows hidden.\n"
+                                 "You may want to show the player window again to control Audacious; "
+                                 "otherwise, you'll have to control it remotely via audtool or "
+                                 "enabled plugins (such as the statusicon plugin).") );
+        gtk_label_set_line_wrap( GTK_LABEL(label) , TRUE );
+        gtk_misc_set_alignment( GTK_MISC(label) , 0.0 , 0.0 );
+        checkbt = gtk_check_button_new_with_label( _("Always ignore, show/hide is controlled remotely") );
+        gtk_box_pack_start( GTK_BOX(vbox) , label , TRUE , TRUE , 0 );
+        gtk_box_pack_start( GTK_BOX(vbox) , checkbt , TRUE , TRUE , 0 );
+        g_signal_connect( G_OBJECT(checkbt) , "toggled" ,
+            G_CALLBACK(on_visibility_warning_toggle) , NULL );
+        g_signal_connect( G_OBJECT(warning_dlg) , "response" ,
+            G_CALLBACK(on_visibility_warning_response) , NULL );
+        gtk_widget_show_all(warning_dlg);
+    }
+}
+
 void
 mainwin_show_add_url_window(void)
 {
@@ -1904,9 +1955,6 @@
         return;
     }
 
-    if (cfg.player_x != -1 && cfg.player_y != -1)
-        gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y);
-
     gtk_widget_show_all(mainwin);
 
     if (nullmask)
@@ -1923,6 +1971,9 @@
 
     draw_main_window(TRUE);
 
+    if (cfg.player_x != -1 && cfg.save_window_position)
+        gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y);
+
     gtk_window_present(GTK_WINDOW(mainwin));
 }
 
--- a/src/audacious/ui_main.h	Thu Apr 05 06:11:33 2007 -0700
+++ b/src/audacious/ui_main.h	Thu Apr 05 09:26:13 2007 -0700
@@ -184,6 +184,8 @@
 
 void mainwin_ewmh_activate(void);
 
+void mainwin_show_visibility_warning(void);
+
 /* FIXME: placed here for now */
 void playback_get_sample_params(gint * bitrate,
                                 gint * frequency,
--- a/src/audacious/ui_skinned_window.c	Thu Apr 05 06:11:33 2007 -0700
+++ b/src/audacious/ui_skinned_window.c	Thu Apr 05 09:26:13 2007 -0700
@@ -138,6 +138,8 @@
 {
     SkinnedWindow *window;
     window = SKINNED_WINDOW(widget);
+    window->x = -1;
+    window->y = -1;
 }
 
 GtkWidget *