diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-04-02 16:53:06 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-04-02 16:53:06 +0200 |
commit | ab9f5abcf64ed36193f270d621c06c4b8fd5e82d (patch) | |
tree | 13ac08f7e291b4e1168f4045c9e0766380f3c50d | |
parent | a5ad305f67147af0bf36f69a37f61fe68c4f3486 (diff) |
gtkui plugin_start waits until gtk_main starts to prevent random behavior during playlist loading
-rw-r--r-- | plugins/gtkui/gtkui.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index adeccc7f..12afe93d 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -28,6 +28,7 @@ #include <stdlib.h> #include <math.h> #include <sys/time.h> +#include <unistd.h> #include "gtkui.h" #include "ddblistview.h" #include "mainplaylist.h" @@ -666,6 +667,8 @@ redraw_seekbar_cb (gpointer nothing) { return FALSE; } +static int gtk_initialized = 0; + void gtkui_thread (void *ctx) { // let's start some gtk @@ -765,11 +768,13 @@ gtkui_thread (void *ctx) { searchwin = create_searchwin (); gtk_window_set_transient_for (GTK_WINDOW (searchwin), GTK_WINDOW (mainwin)); +#if 0 // get saved scrollpos before creating listview, to avoid reset int curr = deadbeef->plt_get_curr (); char conf[100]; snprintf (conf, sizeof (conf), "playlist.scroll.%d", curr); int scroll = deadbeef->conf_get_int (conf, 0); +#endif DdbListview *main_playlist = DDB_LISTVIEW (lookup_widget (mainwin, "playlist")); main_playlist_init (GTK_WIDGET (main_playlist)); @@ -791,10 +796,9 @@ gtkui_thread (void *ctx) { deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_OUTPUTCHANGED, DB_CALLBACK (gtkui_on_outputchanged), 0); deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTSWITCH, DB_CALLBACK (gtkui_on_playlistswitch), 0); - playlist_refresh (); - - ddb_listview_set_vscroll (main_playlist, scroll); - +// playlist_refresh (); +// ddb_listview_set_vscroll (main_playlist, scroll); + gtk_initialized = 1; gtk_main (); cover_art_free (); eq_window_destroy (); @@ -820,7 +824,12 @@ gtkui_start (void) { } // gtk must be running in separate thread + gtk_initialized = 0; gtk_tid = deadbeef->thread_start (gtkui_thread, NULL); + // wait until gtk finishes initializing + while (!gtk_initialized) { + usleep (10000); + } return 0; } |