changeset 1184:b146ec74d778 trunk

[svn] - place plugins we cannot register UIs for right now in a queue and register them later
author nenolod
date Sun, 11 Jun 2006 22:50:31 -0700
parents ddd9ece3ce55
children 42d4b152c14d
files ChangeLog audacious/prefswin.c
diffstat 2 files changed, 53 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 11 22:10:48 2006 -0700
+++ b/ChangeLog	Sun Jun 11 22:50:31 2006 -0700
@@ -1,3 +1,12 @@
+2006-06-12 05:10:48 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1276]
+  - ok...
+  
+
+  Changes:        Modified:
+  +3 -1           trunk/Plugins/General/scrobbler/Makefile.in  
+
+
 2006-06-12 05:03:53 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1274]
   - scrobbler icon of doom (since it's part of the scrobbler bundle, it 
--- a/audacious/prefswin.c	Sun Jun 11 22:10:48 2006 -0700
+++ b/audacious/prefswin.c	Sun Jun 11 22:50:31 2006 -0700
@@ -59,7 +59,7 @@
 #include "skinwin.h"
 #include "playlist_list.h"
 #include "build_stamp.h"
-
+#include "prefswin.h"
 
 enum CategoryViewCols {
     CATEGORY_VIEW_COL_ICON,
@@ -118,6 +118,14 @@
     { N_("Comment")    , "%c" }
 };
 
+typedef struct {
+    GtkWidget *container;
+    char *pg_name;
+    char *img_url;
+} CategoryQueueEntry;
+
+static GList *category_queue = NULL;
+
 static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags);
 
 /* GLib 2.6 compatibility */
@@ -133,6 +141,8 @@
 }
 #endif
 
+static void prefswin_page_queue_destroy(CategoryQueueEntry *ent);
+
 static GladeXML *
 prefswin_get_xml(void)
 {
@@ -1767,6 +1777,7 @@
     GtkTreeSelection *selection;
     GtkTreeIter iter;
     GdkPixbuf *img;
+    GList *qlist;
     gint i;
 
     column = gtk_tree_view_column_new();
@@ -1804,6 +1815,14 @@
 
     /* mark the treeview widget as available to third party plugins */
     category_treeview = GTK_WIDGET(treeview);
+
+    for (qlist = category_queue; qlist != NULL && qlist->data; qlist = g_list_next(qlist))
+    {
+         CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist->data;
+
+         prefswin_page_new(ent->container, ent->pg_name, ent->img_url);
+         prefswin_page_queue_destroy(ent);
+    }
 }
 
 static void
@@ -2279,6 +2298,24 @@
     gtk_widget_show(prefswin);
 }
 
+static void
+prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl)
+{
+    CategoryQueueEntry *ent = g_new0(CategoryQueueEntry, 1);
+
+    ent->container = container;
+    ent->pg_name = name;
+    ent->img_url = imgurl;
+    category_queue = g_list_append(category_queue, ent);
+}
+
+static void
+prefswin_page_queue_destroy(CategoryQueueEntry *ent)
+{
+    category_queue = g_list_remove(category_queue, ent);
+    g_free(ent);
+}
+
 /*
  * Public APIs for adding new pages to the prefs window.
  *
@@ -2300,12 +2337,18 @@
     gint id;
 
     if (treeview == NULL || container == NULL || category_notebook == NULL)
+    {
+        prefswin_page_queue_new(container, name, imgurl);
         return FALSE;
+    }
 
     model = gtk_tree_view_get_model(treeview);
 
     if (model == NULL)
+    {
+        prefswin_page_queue_new(container, name, imgurl);
         return FALSE;
+    }
 
     gtk_widget_show(container);
     id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL);