audacious-plugins
changeset 5512:f68ae8e04738
gtkui: Fix iface.show(), implement iface.is_shown().
| author | John Lindgren <john.lindgren@tds.net> |
|---|---|
| date | Fri Apr 22 21:38:13 2011 -0400 (13 months ago) |
| parents | 262b7a484275 |
| children | 02b5600e007d |
| files | src/gtkui/ui_gtk.c |
line diff
1.1 --- a/src/gtkui/ui_gtk.c Fri Apr 22 12:45:48 2011 -0400 1.2 +++ b/src/gtkui/ui_gtk.c Fri Apr 22 21:38:13 2011 -0400 1.3 @@ -74,6 +74,7 @@ 1.4 static gboolean init (void); 1.5 static void cleanup (void); 1.6 static void ui_show (gboolean show); 1.7 +static gboolean ui_is_shown (void); 1.8 static void ui_show_error (const gchar * text); 1.9 1.10 AUD_IFACE_PLUGIN 1.11 @@ -82,6 +83,7 @@ 1.12 .init = init, 1.13 .cleanup = cleanup, 1.14 .show = ui_show, 1.15 + .is_shown = ui_is_shown, 1.16 .show_error = ui_show_error, 1.17 .show_filebrowser = audgui_run_filebrowser, 1.18 .show_jump_to_track = audgui_jump_to_track, 1.19 @@ -171,23 +173,31 @@ 1.20 1.21 static void ui_show (gboolean show) 1.22 { 1.23 + config.player_visible = show; 1.24 + 1.25 if (show) 1.26 { 1.27 - if (config.save_window_position) 1.28 - gtk_window_move(GTK_WINDOW(window), config.player_x, config.player_y); 1.29 + if (config.save_window_position && ! gtk_widget_get_visible (window)) 1.30 + gtk_window_move ((GtkWindow *) window, config.player_x, 1.31 + config.player_y); 1.32 1.33 - gtk_widget_show(window); 1.34 - gtk_window_present(GTK_WINDOW(window)); 1.35 + gtk_window_present ((GtkWindow *) window); 1.36 } 1.37 - else 1.38 + else if (gtk_widget_get_visible (window)) 1.39 { 1.40 if (config.save_window_position) 1.41 - gtk_window_get_position(GTK_WINDOW(window), &config.player_x, &config.player_y); 1.42 + gtk_window_get_position ((GtkWindow *) window, & config.player_x, 1.43 + & config.player_y); 1.44 1.45 - gtk_widget_hide(window); 1.46 + gtk_widget_hide (window); 1.47 } 1.48 } 1.49 1.50 +static gboolean ui_is_shown (void) 1.51 +{ 1.52 + return config.player_visible; 1.53 +} 1.54 + 1.55 static void ui_show_error (const gchar * text) 1.56 { 1.57 audgui_simple_message (& error_win, GTK_MESSAGE_ERROR, _("Error"), _(text));
