changeset 3353:1cd5fb04e05b trunk

double click on plugin row opens plugin config (if available)
author Tomasz Mon <desowin@gmail.com>
date Thu, 16 Aug 2007 13:34:48 +0200
parents 7a4fcf84a34f
children 3834652ddd53
files src/audacious/ui_preferences.c
diffstat 1 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_preferences.c	Mon Aug 13 23:24:50 2007 +0300
+++ b/src/audacious/ui_preferences.c	Thu Aug 16 13:34:48 2007 +0200
@@ -80,6 +80,12 @@
     PLUGIN_VIEW_N_COLS
 };
 
+enum PluginViewType {
+    PLUGIN_VIEW_TYPE_INPUT,
+    PLUGIN_VIEW_TYPE_GENERAL,
+    PLUGIN_VIEW_TYPE_VIS,
+    PLUGIN_VIEW_TYPE_EFFECT
+};
 
 typedef struct {
     const gchar *icon_path;
@@ -1176,6 +1182,35 @@
 }
 
 static void
+plugin_treeview_row_activate(GtkTreeView *treeview)
+{
+    GtkTreeSelection *selection;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    gint id;
+
+    selection = gtk_tree_view_get_selection(treeview);
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+        return;
+    gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1);
+
+    switch(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(treeview), "plugin_type"))) {
+        case PLUGIN_VIEW_TYPE_INPUT:
+            input_configure(id);
+            break;
+        case PLUGIN_VIEW_TYPE_GENERAL:
+            general_configure(id);
+            break;
+        case PLUGIN_VIEW_TYPE_VIS:
+            vis_configure(id);
+            break;
+        case PLUGIN_VIEW_TYPE_EFFECT:
+            effect_configure(id);
+            break;
+    }
+}
+
+static void
 input_plugin_enable_prefs(GtkTreeView * treeview,
                           GtkButton * button)
 {
@@ -2445,6 +2480,10 @@
 
     widget = glade_xml_get_widget(xml, "input_plugin_view");
     widget2 = glade_xml_get_widget(xml, "input_plugin_prefs");
+    g_object_set_data(G_OBJECT(widget), "plugin_type" , GINT_TO_POINTER(PLUGIN_VIEW_TYPE_INPUT));
+    g_signal_connect(G_OBJECT(widget), "row-activated",
+                     G_CALLBACK(plugin_treeview_row_activate),
+                     NULL);
     g_signal_connect(G_OBJECT(widget), "cursor-changed",
                      G_CALLBACK(input_plugin_enable_prefs),
                      widget2);
@@ -2483,11 +2522,16 @@
     /* plugin->general page */
 
     widget = glade_xml_get_widget(xml, "general_plugin_view");
+    g_object_set_data(G_OBJECT(widget), "plugin_type" , GINT_TO_POINTER(PLUGIN_VIEW_TYPE_GENERAL));
+    g_signal_connect(G_OBJECT(widget), "row-activated",
+                     G_CALLBACK(plugin_treeview_row_activate),
+                     NULL);
 
     widget2 = glade_xml_get_widget(xml, "general_plugin_prefs");
     g_signal_connect(G_OBJECT(widget), "cursor-changed",
                      G_CALLBACK(general_plugin_enable_prefs),
                      widget2);
+
     g_signal_connect_swapped(G_OBJECT(widget2), "clicked",
                              G_CALLBACK(general_plugin_open_prefs),
                              widget);
@@ -2506,6 +2550,10 @@
     widget = glade_xml_get_widget(xml, "vis_plugin_view");
     widget2 = glade_xml_get_widget(xml, "vis_plugin_prefs");
 
+    g_object_set_data(G_OBJECT(widget), "plugin_type" , GINT_TO_POINTER(PLUGIN_VIEW_TYPE_VIS));
+    g_signal_connect(G_OBJECT(widget), "row-activated",
+                     G_CALLBACK(plugin_treeview_row_activate),
+                     NULL);
     g_signal_connect_swapped(G_OBJECT(widget2), "clicked",
                              G_CALLBACK(vis_plugin_open_prefs),
                              widget);
@@ -2526,6 +2574,10 @@
     widget = glade_xml_get_widget(xml, "effect_plugin_view");
     widget2 = glade_xml_get_widget(xml, "effect_plugin_prefs");
 
+    g_object_set_data(G_OBJECT(widget), "plugin_type" , GINT_TO_POINTER(PLUGIN_VIEW_TYPE_EFFECT));
+    g_signal_connect(G_OBJECT(widget), "row-activated",
+                     G_CALLBACK(plugin_treeview_row_activate),
+                     NULL);
     g_signal_connect_swapped(G_OBJECT(widget2), "clicked",
                              G_CALLBACK(effect_plugin_open_prefs),
                              widget);