Mercurial > audlegacy
comparison audacious/prefswin.c @ 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 | 4f232f256771 |
children | 42d4b152c14d |
comparison
equal
deleted
inserted
replaced
1183:ddd9ece3ce55 | 1184:b146ec74d778 |
---|---|
57 #include "mainwin.h" | 57 #include "mainwin.h" |
58 #include "ui_playlist.h" | 58 #include "ui_playlist.h" |
59 #include "skinwin.h" | 59 #include "skinwin.h" |
60 #include "playlist_list.h" | 60 #include "playlist_list.h" |
61 #include "build_stamp.h" | 61 #include "build_stamp.h" |
62 | 62 #include "prefswin.h" |
63 | 63 |
64 enum CategoryViewCols { | 64 enum CategoryViewCols { |
65 CATEGORY_VIEW_COL_ICON, | 65 CATEGORY_VIEW_COL_ICON, |
66 CATEGORY_VIEW_COL_NAME, | 66 CATEGORY_VIEW_COL_NAME, |
67 CATEGORY_VIEW_COL_ID, | 67 CATEGORY_VIEW_COL_ID, |
116 { N_("Date") , "%d" }, | 116 { N_("Date") , "%d" }, |
117 { N_("Year") , "%y" }, | 117 { N_("Year") , "%y" }, |
118 { N_("Comment") , "%c" } | 118 { N_("Comment") , "%c" } |
119 }; | 119 }; |
120 | 120 |
121 typedef struct { | |
122 GtkWidget *container; | |
123 char *pg_name; | |
124 char *img_url; | |
125 } CategoryQueueEntry; | |
126 | |
127 static GList *category_queue = NULL; | |
128 | |
121 static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags); | 129 static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags); |
122 | 130 |
123 /* GLib 2.6 compatibility */ | 131 /* GLib 2.6 compatibility */ |
124 #if (! ((GLIB_MAJOR_VERSION > 2) || ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 8)))) | 132 #if (! ((GLIB_MAJOR_VERSION > 2) || ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 8)))) |
125 static const char * | 133 static const char * |
130 return _("localhost"); | 138 return _("localhost"); |
131 } | 139 } |
132 return hostname; | 140 return hostname; |
133 } | 141 } |
134 #endif | 142 #endif |
143 | |
144 static void prefswin_page_queue_destroy(CategoryQueueEntry *ent); | |
135 | 145 |
136 static GladeXML * | 146 static GladeXML * |
137 prefswin_get_xml(void) | 147 prefswin_get_xml(void) |
138 { | 148 { |
139 return GLADE_XML(g_object_get_data(G_OBJECT(prefswin), "glade-xml")); | 149 return GLADE_XML(g_object_get_data(G_OBJECT(prefswin), "glade-xml")); |
1765 GtkCellRenderer *renderer; | 1775 GtkCellRenderer *renderer; |
1766 GtkTreeViewColumn *column; | 1776 GtkTreeViewColumn *column; |
1767 GtkTreeSelection *selection; | 1777 GtkTreeSelection *selection; |
1768 GtkTreeIter iter; | 1778 GtkTreeIter iter; |
1769 GdkPixbuf *img; | 1779 GdkPixbuf *img; |
1780 GList *qlist; | |
1770 gint i; | 1781 gint i; |
1771 | 1782 |
1772 column = gtk_tree_view_column_new(); | 1783 column = gtk_tree_view_column_new(); |
1773 gtk_tree_view_column_set_title(column, _("Category")); | 1784 gtk_tree_view_column_set_title(column, _("Category")); |
1774 gtk_tree_view_append_column(treeview, column); | 1785 gtk_tree_view_append_column(treeview, column); |
1802 g_signal_connect_swapped(selection, "changed", | 1813 g_signal_connect_swapped(selection, "changed", |
1803 G_CALLBACK(change_category), notebook); | 1814 G_CALLBACK(change_category), notebook); |
1804 | 1815 |
1805 /* mark the treeview widget as available to third party plugins */ | 1816 /* mark the treeview widget as available to third party plugins */ |
1806 category_treeview = GTK_WIDGET(treeview); | 1817 category_treeview = GTK_WIDGET(treeview); |
1818 | |
1819 for (qlist = category_queue; qlist != NULL && qlist->data; qlist = g_list_next(qlist)) | |
1820 { | |
1821 CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist->data; | |
1822 | |
1823 prefswin_page_new(ent->container, ent->pg_name, ent->img_url); | |
1824 prefswin_page_queue_destroy(ent); | |
1825 } | |
1807 } | 1826 } |
1808 | 1827 |
1809 static void | 1828 static void |
1810 mainwin_drag_data_received1(GtkWidget * widget, | 1829 mainwin_drag_data_received1(GtkWidget * widget, |
1811 GdkDragContext * context, | 1830 GdkDragContext * context, |
2277 { | 2296 { |
2278 prefswin_set_skin_update(TRUE); | 2297 prefswin_set_skin_update(TRUE); |
2279 gtk_widget_show(prefswin); | 2298 gtk_widget_show(prefswin); |
2280 } | 2299 } |
2281 | 2300 |
2301 static void | |
2302 prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl) | |
2303 { | |
2304 CategoryQueueEntry *ent = g_new0(CategoryQueueEntry, 1); | |
2305 | |
2306 ent->container = container; | |
2307 ent->pg_name = name; | |
2308 ent->img_url = imgurl; | |
2309 category_queue = g_list_append(category_queue, ent); | |
2310 } | |
2311 | |
2312 static void | |
2313 prefswin_page_queue_destroy(CategoryQueueEntry *ent) | |
2314 { | |
2315 category_queue = g_list_remove(category_queue, ent); | |
2316 g_free(ent); | |
2317 } | |
2318 | |
2282 /* | 2319 /* |
2283 * Public APIs for adding new pages to the prefs window. | 2320 * Public APIs for adding new pages to the prefs window. |
2284 * | 2321 * |
2285 * Basically, the concept here is that third party components can register themselves in the root | 2322 * Basically, the concept here is that third party components can register themselves in the root |
2286 * preferences window. | 2323 * preferences window. |
2298 GdkPixbuf *img = NULL; | 2335 GdkPixbuf *img = NULL; |
2299 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | 2336 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); |
2300 gint id; | 2337 gint id; |
2301 | 2338 |
2302 if (treeview == NULL || container == NULL || category_notebook == NULL) | 2339 if (treeview == NULL || container == NULL || category_notebook == NULL) |
2340 { | |
2341 prefswin_page_queue_new(container, name, imgurl); | |
2303 return FALSE; | 2342 return FALSE; |
2343 } | |
2304 | 2344 |
2305 model = gtk_tree_view_get_model(treeview); | 2345 model = gtk_tree_view_get_model(treeview); |
2306 | 2346 |
2307 if (model == NULL) | 2347 if (model == NULL) |
2348 { | |
2349 prefswin_page_queue_new(container, name, imgurl); | |
2308 return FALSE; | 2350 return FALSE; |
2351 } | |
2309 | 2352 |
2310 gtk_widget_show(container); | 2353 gtk_widget_show(container); |
2311 id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL); | 2354 id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL); |
2312 | 2355 |
2313 if (id == -1) | 2356 if (id == -1) |