mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-22 00:50:59 +00:00
pluginlist: avoid mulitple init
Allow only one initialization of the plugin list.
This commit is contained in:
parent
914fc1f077
commit
c16102928b
2 changed files with 53 additions and 45 deletions
|
@ -24,6 +24,7 @@ use gtk::{
|
|||
AboutDialog, Application, ApplicationWindow, Builder, Button, FileChooserAction,
|
||||
FileChooserDialog, PopoverMenu, ResponseType, Statusbar, Viewport,
|
||||
};
|
||||
use once_cell::unsync::OnceCell;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::rc::{Rc, Weak};
|
||||
|
@ -40,6 +41,7 @@ pub struct GPSAppInner {
|
|||
pub graphview: RefCell<GraphView>,
|
||||
pub builder: Builder,
|
||||
pub pipeline: RefCell<Pipeline>,
|
||||
pub plugin_list_initialized: OnceCell<bool>,
|
||||
}
|
||||
|
||||
// This represents our main application window.
|
||||
|
@ -82,6 +84,7 @@ impl GPSApp {
|
|||
graphview: RefCell::new(GraphView::new()),
|
||||
builder,
|
||||
pipeline: RefCell::new(pipeline),
|
||||
plugin_list_initialized: OnceCell::new(),
|
||||
}));
|
||||
Ok(app)
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ pub fn display_plugin_list(app: &GPSApp, elements: &[ElementInfo]) {
|
|||
.object("dialog-plugin-list")
|
||||
.expect("Couldn't get window");
|
||||
|
||||
if app.plugin_list_initialized.get().is_none() {
|
||||
dialog.set_title(Some("Plugin list"));
|
||||
dialog.set_default_size(640, 480);
|
||||
|
||||
|
@ -118,6 +119,10 @@ pub fn display_plugin_list(app: &GPSApp, elements: &[ElementInfo]) {
|
|||
}
|
||||
}),
|
||||
);
|
||||
app.plugin_list_initialized
|
||||
.set(true)
|
||||
.expect("Should never happen");
|
||||
}
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue