diff options
-rw-r--r-- | plugins/gtkui/actionhandlers.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/actions.c | 9 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.c | 21 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 27 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.h | 3 | ||||
-rw-r--r-- | plugins/gtkui/prefwin.c | 5 |
6 files changed, 29 insertions, 38 deletions
diff --git a/plugins/gtkui/actionhandlers.c b/plugins/gtkui/actionhandlers.c index c2b3fcf5..b60617bf 100644 --- a/plugins/gtkui/actionhandlers.c +++ b/plugins/gtkui/actionhandlers.c @@ -824,7 +824,7 @@ action_toggle_designmode_handler (DB_plugin_action_t *act, int ctx) { gboolean action_preferences_handler_cb (void *data) { - on_preferences_activate (NULL, NULL); + gtkui_run_preferences_dlg (); return FALSE; } diff --git a/plugins/gtkui/actions.c b/plugins/gtkui/actions.c index 969e489e..a85851e9 100644 --- a/plugins/gtkui/actions.c +++ b/plugins/gtkui/actions.c @@ -32,6 +32,13 @@ g_object_set_data_full (G_OBJECT (component), name, \ g_object_ref(G_OBJECT(widget)), (GDestroyNotify) g_object_unref) +static gboolean +menu_action_cb (void *ctx) { + DB_plugin_action_t *action = ctx; + action->callback (action, DDB_ACTION_CTX_MAIN); + return FALSE; +} + static void on_actionitem_activate (GtkMenuItem *menuitem, DB_plugin_action_t *action) @@ -39,7 +46,7 @@ on_actionitem_activate (GtkMenuItem *menuitem, // these actions are always in the MAIN context, or they are coming from new // plugins, so we don't have to care about the user data for <=1.4 plugins. // aren't we?.. - action->callback (action, DDB_ACTION_CTX_MAIN); + gdk_threads_add_idle (menu_action_cb, action); } void diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index 42fb4dca..b551f7d7 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -67,7 +67,7 @@ void on_open_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_open_files_handler_cb (NULL); + gdk_threads_add_idle (action_open_files_handler_cb, NULL); } @@ -75,14 +75,14 @@ void on_add_files_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_add_files_handler_cb (NULL); + gdk_threads_add_idle (action_add_files_handler_cb, NULL); } void on_add_folders_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_add_folders_handler_cb (NULL); + gdk_threads_add_idle (action_add_folders_handler_cb, NULL); } @@ -90,7 +90,7 @@ void on_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_quit_handler_cb (NULL); + gdk_threads_add_idle (action_quit_handler_cb, NULL); } @@ -99,7 +99,7 @@ void on_select_all1_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_select_all_handler_cb (NULL); + gdk_threads_add_idle (action_select_all_handler_cb, NULL); } @@ -322,7 +322,7 @@ void on_help1_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_show_help_handler_cb (NULL); + gdk_threads_add_idle (action_show_help_handler_cb, NULL); } static GtkWidget *aboutwindow; @@ -778,7 +778,7 @@ void on_sort_by_custom_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_sort_custom_handler_cb (NULL); + gdk_threads_add_idle (action_sort_custom_handler_cb, NULL); } void @@ -789,4 +789,9 @@ on_design_mode1_activate (GtkMenuItem *menuitem, w_set_design_mode (act ? 1 : 0); } - +void +on_preferences_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + gdk_threads_add_idle (action_preferences_handler_cb, NULL); +} diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 910b4fe7..3d958163 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -633,30 +633,9 @@ outputchanged_cb (gpointer nothing) { void save_playlist_as (void) { - action_save_playlist_handler_cb (NULL); + gdk_threads_add_idle (action_save_playlist_handler_cb, NULL); } -#if 0 -void -on_playlist_save_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - char last_playlist_save_name[1024]; - deadbeef->conf_get_str ("gtkui.last_playlist_save_name", "", last_playlist_save_name, sizeof (last_playlist_save_name)); - if (!last_playlist_save_name[0]) { - save_playlist_as (); - } - else { - ddb_playlist_t *plt = deadbeef->plt_get_curr (); - if (plt) { - deadbeef->plt_save (plt, NULL, NULL, last_playlist_save_name, NULL, NULL, NULL); - deadbeef->plt_unref (plt); - } - } -} -#endif - - void on_playlist_save_as_activate (GtkMenuItem *menuitem, gpointer user_data) @@ -668,14 +647,14 @@ void on_playlist_load_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_load_playlist_handler_cb (NULL); + gdk_threads_add_idle (action_load_playlist_handler_cb, NULL); } void on_add_location_activate (GtkMenuItem *menuitem, gpointer user_data) { - action_add_location_handler_cb (NULL); + gdk_threads_add_idle (action_add_location_handler_cb, NULL); } static gboolean diff --git a/plugins/gtkui/gtkui.h b/plugins/gtkui/gtkui.h index 4cb01d36..2d768c40 100644 --- a/plugins/gtkui/gtkui.h +++ b/plugins/gtkui/gtkui.h @@ -173,4 +173,7 @@ plt_get_title_wrapper (int plt, char *buffer, int len); void gtkui_quit (void); +void +gtkui_run_preferences_dlg (void); + #endif diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index bd48aec8..850de341 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -132,9 +132,7 @@ unescape_forward_slash (const char *src, char *dst, int size) { } void -on_preferences_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ +gtkui_run_preferences_dlg (void) { if (prefwin) { return; } @@ -365,7 +363,6 @@ on_preferences_activate (GtkMenuItem *menuitem, prefwin = NULL; } - void on_pref_soundcard_changed (GtkComboBox *combobox, gpointer user_data) |