diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-04 19:12:08 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-04 19:12:08 +0100 |
commit | c15b169562da6c652c09835f507e88fc0cd28589 (patch) | |
tree | 3b3ecd17fe8d7dc5960c0a65633f314f6ad1455b /plugins | |
parent | f98bc015eebcb1fdbf09c5274e97532281374141 (diff) |
column format field is only sensitive if Custom type is selected
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gtkui/callbacks.c | 22 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.h | 4 | ||||
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 1 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 4 |
4 files changed, 31 insertions, 0 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index e302169a..f24ecea4 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -39,6 +39,9 @@ #include "gtkui.h" #include "parser.h" +#define trace(...) { fprintf (stderr, __VA_ARGS__); } +//#define trace(fmt,...) + #define SELECTED(it) (deadbeef->pl_is_selected(it)) #define SELECT(it, sel) (deadbeef->pl_set_selected(it,sel)) #define VSELECT(it, sel) {deadbeef->pl_set_selected(it,sel);gtk_pl_redraw_item_everywhere (it);} @@ -1843,6 +1846,24 @@ on_remove_column_activate (GtkMenuItem *menuitem, gtkpl_column_rewrite_config (ps); } +void +on_column_id_changed (GtkComboBox *combobox, + gpointer user_data) +{ + GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combobox)); + if (!toplevel) { + trace ("failed to get toplevel widget for column id combobox\n"); + return; + } + int act = gtk_combo_box_get_active (combobox) + 1; + GtkWidget *fmt = lookup_widget (toplevel, "format"); + if (!fmt) { + trace ("failed to get column format widget\n"); + return; + } + gtk_widget_set_sensitive (fmt, act > DB_COLUMN_ID_MAX ? FALSE : TRUE); +} + void on_pref_alsa_freewhenstopped_clicked (GtkButton *button, @@ -2401,3 +2422,4 @@ on_trackproperties_delete_event (GtkWidget *widget, return FALSE; } + diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h index f4667bde..f73b7c91 100644 --- a/plugins/gtkui/callbacks.h +++ b/plugins/gtkui/callbacks.h @@ -787,3 +787,7 @@ gboolean on_trackproperties_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); + +void +on_column_id_changed (GtkComboBox *combobox, + gpointer user_data); diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index f54f18bf..d2d0f274 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -3177,6 +3177,7 @@ Track Custom</property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> + <signal name="changed" handler="on_column_id_changed" last_modification_time="Mon, 04 Jan 2010 17:31:44 GMT"/> </widget> <packing> <property name="left_attach">1</property> diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index ed1bbb47..9750310e 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -2099,6 +2099,10 @@ create_editcolumndlg (void) gtk_dialog_add_action_widget (GTK_DIALOG (editcolumndlg), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); + g_signal_connect ((gpointer) id, "changed", + G_CALLBACK (on_column_id_changed), + NULL); + /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (editcolumndlg, editcolumndlg, "editcolumndlg"); GLADE_HOOKUP_OBJECT_NO_REF (editcolumndlg, dialog_vbox1, "dialog_vbox1"); |