changeset 1186:d7848ff5bbe5 trunk

[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
author nenolod
date Sun, 11 Jun 2006 23:35:05 -0700
parents 42d4b152c14d
children 4c58ab006563
files ChangeLog audacious/prefswin.c audacious/prefswin.h
diffstat 3 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 11 23:19:33 2006 -0700
+++ b/ChangeLog	Sun Jun 11 23:35:05 2006 -0700
@@ -1,3 +1,13 @@
+2006-06-12 06:19:33 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1280]
+  - API change, please move along
+  
+
+  Changes:        Modified:
+  +5 -5           trunk/audacious/prefswin.c  
+  +1 -1           trunk/audacious/prefswin.h  
+
+
 2006-06-12 05:50:31 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1278]
   - place plugins we cannot register UIs for right now in a queue and register them later
--- a/audacious/prefswin.c	Sun Jun 11 23:19:33 2006 -0700
+++ b/audacious/prefswin.c	Sun Jun 11 23:35:05 2006 -0700
@@ -2350,6 +2350,7 @@
         return -1;
     }
 
+    /* Make sure the widgets are visible. */
     gtk_widget_show(container);
     id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL);
 
@@ -2370,3 +2371,36 @@
 
     return id;
 }
+
+void
+prefswin_page_destroy(gint id)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview);
+    gboolean ret;
+
+    if (category_notebook == NULL || treeview == NULL)
+        return;
+
+    gtk_notebook_remove_page(GTK_NOTEBOOK(category_notebook), id);
+
+    model = gtk_tree_view_get_model(treeview);
+
+    if (model == NULL)
+        return;
+
+    ret = gtk_tree_model_get_iter_first(model, &iter);
+
+    while (ret == TRUE)
+    {
+        gint index = -1;
+
+        gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1);
+
+        if (index == id)
+            gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
+
+        ret = gtk_tree_model_iter_next(model, &iter);
+    }
+}
--- a/audacious/prefswin.h	Sun Jun 11 23:19:33 2006 -0700
+++ b/audacious/prefswin.h	Sun Jun 11 23:35:05 2006 -0700
@@ -23,5 +23,6 @@
 void show_prefs_window(void);
 
 gint prefswin_page_new(GtkWidget *container, gchar *name, gchar *imgurl);
+void prefswin_page_destroy(gint id);
 
 #endif