summaryrefslogtreecommitdiff
path: root/plugins/converter
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-12-10 21:52:44 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-12-10 21:52:44 +0100
commit9df1c5f116cebcc8acb399627e61bb6e3d3613ce (patch)
tree0b5eb7a8ce1e9d923e81006ed2fe97a7cde77520 /plugins/converter
parenteb2d14ec17066a64122c6b2a3e5496a1bb25f6d4 (diff)
converter: block spawning multiple instances
Diffstat (limited to 'plugins/converter')
-rw-r--r--plugins/converter/converter.glade2
-rw-r--r--plugins/converter/convgui.c11
-rw-r--r--plugins/converter/interface.c1
3 files changed, 11 insertions, 3 deletions
diff --git a/plugins/converter/converter.glade b/plugins/converter/converter.glade
index 667dbcf8..af771399 100644
--- a/plugins/converter/converter.glade
+++ b/plugins/converter/converter.glade
@@ -7,7 +7,7 @@
<property name="visible">True</property>
<property name="title">Converter</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="modal">True</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">True</property>
diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c
index a8546549..b461dcb7 100644
--- a/plugins/converter/convgui.c
+++ b/plugins/converter/convgui.c
@@ -41,6 +41,8 @@ DB_functions_t *deadbeef;
ddb_converter_t *converter_plugin;
ddb_gtkui_t *gtkui_plugin;
+static int converter_active;
+
typedef struct {
GtkWidget *converter;
ddb_encoder_preset_t *current_encoder_preset;
@@ -335,7 +337,7 @@ on_write_to_source_folder_toggled (GtkToggleButton *togglebutton,
static gboolean
converter_show_cb (void *data) {
- int ctx = (int)data;
+ int ctx = (intptr_t)data;
converter_ctx_t *conv = malloc (sizeof (converter_ctx_t));
current_ctx = conv;
memset (conv, 0, sizeof (converter_ctx_t));
@@ -474,11 +476,16 @@ converter_show_cb (void *data) {
current_ctx = NULL;
break;
}
+ converter_active = 0;
return FALSE;
}
static int
converter_show (DB_plugin_action_t *act, int ctx) {
+ if (converter_active) {
+ return -1;
+ }
+ converter_active = 1;
if (converter_plugin->misc.plugin.version_minor >= 1) {
// reload all presets
converter_plugin->free_encoder_presets ();
@@ -487,7 +494,7 @@ converter_show (DB_plugin_action_t *act, int ctx) {
converter_plugin->load_dsp_presets ();
}
// this can be called from non-gtk thread
- gdk_threads_add_idle (converter_show_cb, (void *)ctx);
+ gdk_threads_add_idle (converter_show_cb, (void *)(intptr_t)ctx);
return 0;
}
diff --git a/plugins/converter/interface.c b/plugins/converter/interface.c
index dc17c11f..4e693e3b 100644
--- a/plugins/converter/interface.c
+++ b/plugins/converter/interface.c
@@ -72,6 +72,7 @@ create_converterdlg (void)
converterdlg = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (converterdlg), "Converter");
+ gtk_window_set_position (GTK_WINDOW (converterdlg), GTK_WIN_POS_MOUSE);
gtk_window_set_modal (GTK_WINDOW (converterdlg), TRUE);
gtk_window_set_destroy_with_parent (GTK_WINDOW (converterdlg), TRUE);
gtk_window_set_type_hint (GTK_WINDOW (converterdlg), GDK_WINDOW_TYPE_HINT_DIALOG);