summaryrefslogtreecommitdiff
path: root/plugins/gtkui
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-12-27 18:46:36 +0100
committerGravatar waker <wakeroid@gmail.com>2010-12-27 18:46:36 +0100
commitf097d2946c4eaa4bb418f6ad9330ba8b7bf08fe1 (patch)
tree33927a21fb5d4773f00aea4e0b7c94845401e5fe /plugins/gtkui
parent8990244b8aff1ed931bc49a419b9d729887702c1 (diff)
added new API for displaying GUI dialogs;
deleted channel remapping widgets from converter gui
Diffstat (limited to 'plugins/gtkui')
-rw-r--r--plugins/gtkui/convgui.c15
-rw-r--r--plugins/gtkui/deadbeef.glade98
-rw-r--r--plugins/gtkui/gtkui.c2
-rw-r--r--plugins/gtkui/interface.c45
-rw-r--r--plugins/gtkui/pluginconf.c54
-rw-r--r--plugins/gtkui/pluginconf.h12
-rw-r--r--plugins/gtkui/prefwin.c4
7 files changed, 64 insertions, 166 deletions
diff --git a/plugins/gtkui/convgui.c b/plugins/gtkui/convgui.c
index 4edb42a8..546d2b14 100644
--- a/plugins/gtkui/convgui.c
+++ b/plugins/gtkui/convgui.c
@@ -73,10 +73,6 @@ converter_show (void) {
gtk_combo_box_set_active (combo, deadbeef->conf_get_int ("converter.dsp_preset", -1) + 1);
- // fill channel maps
- combo = GTK_COMBO_BOX (lookup_widget (converter, "channelmap"));
- gtk_combo_box_set_active (combo, deadbeef->conf_get_int ("converter.channelmap_preset", 0));
-
// select output format
combo = GTK_COMBO_BOX (lookup_widget (converter, "output_format"));
gtk_combo_box_set_active (combo, deadbeef->conf_get_int ("converter.output_format", 0));
@@ -660,13 +656,13 @@ on_dsp_preset_plugin_configure_clicked (GtkButton *button,
return;
}
current_dsp_context = p;
- pluginconf_t conf = {
+ ddb_dialog_t conf = {
.title = p->plugin->plugin.name,
.layout = p->plugin->configdialog,
.set_param = dsp_ctx_set_param,
.get_param = dsp_ctx_get_param,
};
- plugin_configure (toplevel, &conf);
+ gtkui_run_dialog (toplevel, &conf, 0);
current_dsp_context = NULL;
#if 0
@@ -1005,10 +1001,3 @@ on_converter_output_format_changed (GtkComboBox *combobox,
deadbeef->conf_set_int ("converter.output_format", idx);
}
-
-void
-on_edit_channel_maps_clicked (GtkButton *button,
- gpointer user_data)
-{
-}
-
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade
index 4b4cb1c9..32917903 100644
--- a/plugins/gtkui/deadbeef.glade
+++ b/plugins/gtkui/deadbeef.glade
@@ -6449,99 +6449,7 @@ SOCKS5_HOSTNAME</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox87">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child>
- <widget class="GtkLabel" id="label115">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Channel Map</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox92">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkComboBox" id="channelmap">
- <property name="visible">True</property>
- <property name="items" translatable="yes"></property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="edit_channel_maps">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <signal name="clicked" handler="on_edit_channel_maps_clicked" last_modification_time="Sat, 04 Dec 2010 15:20:57 GMT"/>
-
- <child>
- <widget class="GtkImage" id="image471">
- <property name="visible">True</property>
- <property name="stock">gtk-edit</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@@ -6598,7 +6506,7 @@ SOCKS5_HOSTNAME</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@@ -6656,7 +6564,7 @@ SOCKS5_HOSTNAME</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 79a9075b..b175bc51 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -44,6 +44,7 @@
#include "ddbtabstrip.h"
#include "eq.h"
#include "actions.h"
+#include "pluginconf.h"
#define trace(...) { fprintf(stderr, __VA_ARGS__); }
//#define trace(fmt,...)
@@ -1265,4 +1266,5 @@ static DB_gui_t plugin = {
.plugin.stop = gtkui_stop,
.plugin.connect = gtkui_connect,
.plugin.configdialog = settings_dlg,
+ .run_dialog = gtkui_run_dialog_root,
};
diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c
index f2877b01..0e0cc76e 100644
--- a/plugins/gtkui/interface.c
+++ b/plugins/gtkui/interface.c
@@ -3273,12 +3273,6 @@ create_converterdlg (void)
GtkWidget *dsp_preset;
GtkWidget *edit_dsp_presets;
GtkWidget *image470;
- GtkWidget *hbox87;
- GtkWidget *label115;
- GtkWidget *hbox92;
- GtkWidget *channelmap;
- GtkWidget *edit_channel_maps;
- GtkWidget *image471;
GtkWidget *hbox88;
GtkWidget *label116;
GtkObject *numthreads_adj;
@@ -3350,7 +3344,7 @@ create_converterdlg (void)
hbox86 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox86);
- gtk_box_pack_start (GTK_BOX (vbox26), hbox86, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox26), hbox86, FALSE, TRUE, 0);
label114 = gtk_label_new (_("DSP preset"));
gtk_widget_show (label114);
@@ -3372,33 +3366,9 @@ create_converterdlg (void)
gtk_widget_show (image470);
gtk_container_add (GTK_CONTAINER (edit_dsp_presets), image470);
- hbox87 = gtk_hbox_new (FALSE, 8);
- gtk_widget_show (hbox87);
- gtk_box_pack_start (GTK_BOX (vbox26), hbox87, TRUE, TRUE, 0);
-
- label115 = gtk_label_new (_("Channel Map"));
- gtk_widget_show (label115);
- gtk_box_pack_start (GTK_BOX (hbox87), label115, FALSE, FALSE, 0);
-
- hbox92 = gtk_hbox_new (FALSE, 0);
- gtk_widget_show (hbox92);
- gtk_box_pack_start (GTK_BOX (hbox87), hbox92, TRUE, TRUE, 0);
-
- channelmap = gtk_combo_box_new_text ();
- gtk_widget_show (channelmap);
- gtk_box_pack_start (GTK_BOX (hbox92), channelmap, TRUE, TRUE, 0);
-
- edit_channel_maps = gtk_button_new ();
- gtk_widget_show (edit_channel_maps);
- gtk_box_pack_start (GTK_BOX (hbox92), edit_channel_maps, FALSE, FALSE, 0);
-
- image471 = gtk_image_new_from_stock ("gtk-edit", GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (image471);
- gtk_container_add (GTK_CONTAINER (edit_channel_maps), image471);
-
hbox88 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox88);
- gtk_box_pack_start (GTK_BOX (vbox26), hbox88, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox26), hbox88, FALSE, TRUE, 0);
label116 = gtk_label_new (_("Number of threads"));
gtk_widget_show (label116);
@@ -3411,7 +3381,7 @@ create_converterdlg (void)
hbox89 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox89);
- gtk_box_pack_start (GTK_BOX (vbox26), hbox89, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox26), hbox89, FALSE, TRUE, 0);
label117 = gtk_label_new (_("Output sample format"));
gtk_widget_show (label117);
@@ -3459,9 +3429,6 @@ create_converterdlg (void)
g_signal_connect ((gpointer) edit_dsp_presets, "clicked",
G_CALLBACK (on_edit_dsp_presets_clicked),
NULL);
- g_signal_connect ((gpointer) edit_channel_maps, "clicked",
- G_CALLBACK (on_edit_channel_maps_clicked),
- NULL);
g_signal_connect ((gpointer) output_format, "changed",
G_CALLBACK (on_converter_output_format_changed),
NULL);
@@ -3493,12 +3460,6 @@ create_converterdlg (void)
GLADE_HOOKUP_OBJECT (converterdlg, dsp_preset, "dsp_preset");
GLADE_HOOKUP_OBJECT (converterdlg, edit_dsp_presets, "edit_dsp_presets");
GLADE_HOOKUP_OBJECT (converterdlg, image470, "image470");
- GLADE_HOOKUP_OBJECT (converterdlg, hbox87, "hbox87");
- GLADE_HOOKUP_OBJECT (converterdlg, label115, "label115");
- GLADE_HOOKUP_OBJECT (converterdlg, hbox92, "hbox92");
- GLADE_HOOKUP_OBJECT (converterdlg, channelmap, "channelmap");
- GLADE_HOOKUP_OBJECT (converterdlg, edit_channel_maps, "edit_channel_maps");
- GLADE_HOOKUP_OBJECT (converterdlg, image471, "image471");
GLADE_HOOKUP_OBJECT (converterdlg, hbox88, "hbox88");
GLADE_HOOKUP_OBJECT (converterdlg, label116, "label116");
GLADE_HOOKUP_OBJECT (converterdlg, numthreads, "numthreads");
diff --git a/plugins/gtkui/pluginconf.c b/plugins/gtkui/pluginconf.c
index b024bcf8..4d2bf488 100644
--- a/plugins/gtkui/pluginconf.c
+++ b/plugins/gtkui/pluginconf.c
@@ -66,7 +66,7 @@ on_prop_browse_file (GtkButton *button, gpointer user_data) {
}
}
-static void apply_conf (GtkWidget *w, pluginconf_t *conf) {
+static void apply_conf (GtkWidget *w, ddb_dialog_t *conf) {
// parse script
char token[MAX_TOKEN];
const char *script = conf->layout;
@@ -189,13 +189,37 @@ prop_changed (GtkWidget *editable, gpointer user_data) {
gtk_dialog_set_response_sensitive (GTK_DIALOG (user_data), GTK_RESPONSE_APPLY, TRUE);
}
-void
-plugin_configure (GtkWidget *parentwin, pluginconf_t *conf) {
+int
+gtkui_run_dialog (GtkWidget *parentwin, ddb_dialog_t *conf, uint32_t buttons) {
// create window
char title[200];
snprintf (title, sizeof (title), _("Configure %s"), conf->title);
- GtkWidget *win = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parentwin), GTK_DIALOG_MODAL, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (win), GTK_RESPONSE_OK);
+ GtkWidget *win;
+ if (!buttons) {
+ win = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parentwin), GTK_DIALOG_MODAL, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (win), GTK_RESPONSE_OK);
+ }
+ else {
+ win = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parentwin), GTK_DIALOG_MODAL, NULL);
+ if (buttons & (1<<ddb_button_ok)) {
+ gtk_dialog_add_button (GTK_DIALOG (win), GTK_STOCK_OK, GTK_RESPONSE_OK);
+ }
+ if (buttons & (1<<ddb_button_cancel)) {
+ gtk_dialog_add_button (GTK_DIALOG (win), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ }
+ if (buttons & (1<<ddb_button_close)) {
+ gtk_dialog_add_button (GTK_DIALOG (win), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+ }
+ if (buttons & (1<<ddb_button_apply)) {
+ gtk_dialog_add_button (GTK_DIALOG (win), GTK_STOCK_APPLY, GTK_RESPONSE_APPLY);
+ }
+ if (buttons & (1<<ddb_button_yes)) {
+ gtk_dialog_add_button (GTK_DIALOG (win), GTK_STOCK_YES, GTK_RESPONSE_YES);
+ }
+ if (buttons & (1<<ddb_button_no)) {
+ gtk_dialog_add_button (GTK_DIALOG (win), GTK_STOCK_NO, GTK_RESPONSE_NO);
+ }
+ }
gtk_window_set_type_hint (GTK_WINDOW (win), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_container_set_border_width (GTK_CONTAINER(win), 12);
@@ -474,6 +498,24 @@ plugin_configure (GtkWidget *parentwin, pluginconf_t *conf) {
}
} while (response == GTK_RESPONSE_APPLY);
gtk_widget_destroy (win);
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ return ddb_button_ok;
+ case GTK_RESPONSE_CANCEL:
+ return ddb_button_cancel;
+ case GTK_RESPONSE_CLOSE:
+ return ddb_button_close;
+ case GTK_RESPONSE_APPLY:
+ return ddb_button_apply;
+ case GTK_RESPONSE_YES:
+ return ddb_button_yes;
+ case GTK_RESPONSE_NO:
+ return ddb_button_no;
+ }
+ return -1;
}
-
+int
+gtkui_run_dialog_root (ddb_dialog_t *conf, uint32_t buttons) {
+ return gtkui_run_dialog (mainwin, conf, buttons);
+}
diff --git a/plugins/gtkui/pluginconf.h b/plugins/gtkui/pluginconf.h
index 66a64f1f..0af2f394 100644
--- a/plugins/gtkui/pluginconf.h
+++ b/plugins/gtkui/pluginconf.h
@@ -19,14 +19,10 @@
#ifndef __PLUGINCONF_H
#define __PLUGINCONF_H
-typedef struct {
- const char *title;
- const char *layout;
- void (*set_param) (const char *key, const char *value);
- void (*get_param) (const char *key, char *value, int len, const char *def);
-} pluginconf_t;
+int
+gtkui_run_dialog (GtkWidget *parentwin, ddb_dialog_t *dlg, uint32_t buttons);
-void
-plugin_configure (GtkWidget *parentwin, pluginconf_t *conf);
+int
+gtkui_run_dialog_root (ddb_dialog_t *dlg, uint32_t buttons);
#endif
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index 411ca284..163459d9 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -835,13 +835,13 @@ on_configure_plugin_clicked (GtkButton *button,
DB_plugin_t **plugins = deadbeef->plug_get_list ();
DB_plugin_t *p = plugins[*indices];
if (p->configdialog) {
- pluginconf_t conf = {
+ ddb_dialog_t conf = {
.title = p->name,
.layout = p->configdialog,
.set_param = deadbeef->conf_set_str,
.get_param = gtkui_conf_get_str,
};
- plugin_configure (prefwin, &conf);
+ gtkui_run_dialog (prefwin, &conf, 0);
}
}