Mercurial > audlegacy
changeset 3357:8e9f1b1a2d84 trunk
remove more duplicate code
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Thu, 16 Aug 2007 15:13:18 +0200 |
parents | 3d42ab53521d |
children | 7f6787eac9aa |
files | src/audacious/ui_preferences.c |
diffstat | 1 files changed, 33 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/ui_preferences.c Thu Aug 16 14:42:38 2007 +0200 +++ b/src/audacious/ui_preferences.c Thu Aug 16 15:13:18 2007 +0200 @@ -191,24 +191,6 @@ gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), index); } - -static void -input_plugin_open_info(GtkTreeView * treeview, - gpointer data) -{ - 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); - input_about(id); -} - static void output_plugin_open_prefs(GtkComboBox * cbox, gpointer data) @@ -224,23 +206,6 @@ } static void -general_plugin_open_info(GtkTreeView * treeview, - gpointer data) -{ - 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); - general_about(id); -} - -static void input_plugin_toggle(GtkCellRendererToggle * cell, const gchar * path_str, gpointer data) @@ -1177,6 +1142,35 @@ } static void +plugin_treeview_open_info(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_about(id); + break; + case PLUGIN_VIEW_TYPE_GENERAL: + general_about(id); + break; + case PLUGIN_VIEW_TYPE_VIS: + vis_about(id); + break; + case PLUGIN_VIEW_TYPE_EFFECT: + effect_about(id); + break; + } +} + +static void plugin_treeview_enable_prefs(GtkTreeView * treeview, GtkButton * button) { GtkTreeSelection *selection; @@ -1280,40 +1274,6 @@ } static void -vis_plugin_open_info(GtkTreeView * treeview, - gpointer data) -{ - 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); - vis_about(id); -} - -static void -effect_plugin_open_info(GtkTreeView * treeview, - gpointer data) -{ - 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); - effect_about(id); -} - -static void on_output_plugin_bufsize_realize(GtkSpinButton *button, gpointer data) { @@ -2308,7 +2268,7 @@ G_CALLBACK(plugin_treeview_enable_info), widget2); g_signal_connect_swapped(G_OBJECT(widget2), "clicked", - G_CALLBACK(input_plugin_open_info), + G_CALLBACK(plugin_treeview_open_info), widget); /* plugin->output page */ @@ -2353,7 +2313,7 @@ G_CALLBACK(plugin_treeview_enable_info), widget2); g_signal_connect_swapped(G_OBJECT(widget2), "clicked", - G_CALLBACK(general_plugin_open_info), + G_CALLBACK(plugin_treeview_open_info), widget); @@ -2377,7 +2337,7 @@ g_signal_connect(G_OBJECT(widget), "cursor-changed", G_CALLBACK(plugin_treeview_enable_info), widget2); g_signal_connect_swapped(G_OBJECT(widget2), "clicked", - G_CALLBACK(vis_plugin_open_info), + G_CALLBACK(plugin_treeview_open_info), widget); @@ -2401,7 +2361,7 @@ g_signal_connect(G_OBJECT(widget), "cursor-changed", G_CALLBACK(plugin_treeview_enable_info), widget2); g_signal_connect_swapped(G_OBJECT(widget2), "clicked", - G_CALLBACK(effect_plugin_open_info), + G_CALLBACK(plugin_treeview_open_info), widget); /* playlist page */