diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-08-24 21:57:32 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-08-24 21:57:32 +0200 |
commit | 7d1c36432826595f52277fe56a26800a7514d321 (patch) | |
tree | 6a9ced89ef5abd5de074a1d9c5df66654caca0bf /plugins | |
parent | 3b408021472d18d229e16860116ec88c4f25cb5a (diff) |
added hscale widget support too gtkui plugin configuration dialogs (Steven McDonald <steven.mcdonald@libremail.me>)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gtkui/pluginconf.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/gtkui/pluginconf.c b/plugins/gtkui/pluginconf.c index 72ad0aae..59a69175 100644 --- a/plugins/gtkui/pluginconf.c +++ b/plugins/gtkui/pluginconf.c @@ -122,6 +122,9 @@ static void apply_conf (GtkWidget *w, DB_plugin_t *p) { else if (!strcmp (type, "checkbox")) { deadbeef->conf_set_int (key, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))); } + else if (!strncmp (type, "hscale[", 7)) { + deadbeef->conf_set_float (key, gtk_range_get_value (GTK_RANGE (widget))); + } } } deadbeef->sendmessage (M_CONFIGCHANGED, 0, 0, 0); @@ -236,6 +239,30 @@ plugin_configure (GtkWidget *parentwin, DB_plugin_t *p) { g_signal_connect (G_OBJECT (btn), "clicked", G_CALLBACK (on_prop_browse_file), prop); } } + else if (!strncmp (type, "hscale[", 7)) { + float min, max, step; + if (3 != sscanf (type+6, "[%f,%f,%f]", &min, &max, &step)) { + min = 0; + max = 100; + step = 1; + } + if (min >= max) { + float tmp = min; + min = max; + max = tmp; + break; + } + if (step <= 0) { + step = 1; + } + prop = gtk_hscale_new_with_range (min, max, step); + label = gtk_label_new (labeltext); + gtk_widget_show (label); + g_signal_connect (G_OBJECT (prop), "value-changed", G_CALLBACK (prop_changed), win); + gtk_widget_show (prop); + gtk_range_set_value (GTK_RANGE (prop), (gdouble)deadbeef->conf_get_float (key, (float)*def)); + gtk_scale_set_value_pos (GTK_SCALE (prop), GTK_POS_RIGHT); + } if (!strcmp (type, "password")) { gtk_entry_set_visibility (GTK_ENTRY (prop), FALSE); } |