mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-06-11 04:09:23 +00:00
mainwindow: connect button to actions
Connect: - add plugin dialog - open file dialog - about dialog
This commit is contained in:
parent
12e7958886
commit
bdd183075e
133
src/gps.ui
133
src/gps.ui
|
@ -2,6 +2,122 @@
|
|||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<object class="GtkAboutDialog" id="dialog-about">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="type-hint">dialog</property>
|
||||
<property name="program-name">GstPipelineStudio</property>
|
||||
<property name="authors">Stéphane Cerveau</property>
|
||||
<property name="logo-icon-name">image-missing</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="layout-style">end</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="dialog-add-plugin">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="default-width">320</property>
|
||||
<property name="default-height">260</property>
|
||||
<property name="type-hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="layout-style">end</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkFileChooserDialog" id="dialog-open-file">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="type-hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="layout-style">end</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkApplicationWindow" id="mainwindow">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="border-width">6</property>
|
||||
|
@ -219,7 +335,7 @@
|
|||
<property name="can-focus">False</property>
|
||||
<property name="layout-style">start</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button-add">
|
||||
<object class="GtkButton" id="button-add-plugin">
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
|
@ -234,7 +350,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button-open">
|
||||
<object class="GtkButton" id="button-open-file">
|
||||
<property name="label">gtk-open</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
|
@ -269,13 +385,13 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="button-pause">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="button-pause">
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-media-pause</property>
|
||||
|
@ -289,13 +405,13 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="button-stop">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="button-stop">
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-media-stop</property>
|
||||
|
@ -309,12 +425,12 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="button-clear">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="button-clear">
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-clear</property>
|
||||
|
@ -358,6 +474,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -2,8 +2,8 @@ use gtk::cairo::Context;
|
|||
use gtk::glib;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{
|
||||
AboutDialog, AccelFlags, AccelGroup, ApplicationWindow, Builder, DrawingArea, EventBox,
|
||||
MenuItem, Viewport, WindowPosition,
|
||||
AboutDialog, AccelFlags, AccelGroup, ApplicationWindow, Builder, Button, Dialog, DrawingArea,
|
||||
EventBox, FileChooserDialog, MenuItem, ResponseType, Viewport, WindowPosition,
|
||||
};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
@ -59,6 +59,46 @@ pub fn build_ui(application: >k::Application) {
|
|||
|
||||
let quit: MenuItem = builder.object("menu-quit").expect("Couldn't get window");
|
||||
let about: MenuItem = builder.object("menu-about").expect("Couldn't get window");
|
||||
let about_dialog: AboutDialog = builder.object("dialog-about").expect("Couldn't get window");
|
||||
about.connect_activate(move |_| {
|
||||
about_dialog.show();
|
||||
});
|
||||
// Create a dialog to select GStreamer elements.
|
||||
let add_button: Button = builder
|
||||
.object("button-add-plugin")
|
||||
.expect("Couldn't get app_button");
|
||||
let add_dialog: Dialog = builder
|
||||
.object("dialog-add-plugin")
|
||||
.expect("Couldn't get window");
|
||||
add_button.connect_clicked(glib::clone!(@weak window => move |_| {
|
||||
// entry.set_text("Clicked!");
|
||||
add_dialog.connect_response(|dialog, _| dialog.close());
|
||||
add_dialog.show_all();
|
||||
}));
|
||||
// Create a dialog to open a file
|
||||
let open_button: Button = builder
|
||||
.object("button-open-file")
|
||||
.expect("Couldn't get app_button");
|
||||
let open_dialog: FileChooserDialog = builder
|
||||
.object("dialog-open-file")
|
||||
.expect("Couldn't get window");
|
||||
open_button.connect_clicked(glib::clone!(@weak window => move |_| {
|
||||
// entry.set_text("Clicked!");
|
||||
open_dialog.connect_response(|dialog, _| dialog.close());
|
||||
open_dialog.add_buttons(&[
|
||||
("Open", ResponseType::Ok),
|
||||
("Cancel", ResponseType::Cancel)
|
||||
]);
|
||||
open_dialog.set_select_multiple(true);
|
||||
open_dialog.connect_response(|open_dialog, response| {
|
||||
if response == ResponseType::Ok {
|
||||
let files = open_dialog.filenames();
|
||||
println!("Files: {:?}", files);
|
||||
}
|
||||
open_dialog.close();
|
||||
});
|
||||
open_dialog.show_all();
|
||||
}));
|
||||
|
||||
let accel_group = AccelGroup::new();
|
||||
window.add_accel_group(&accel_group);
|
||||
|
@ -72,15 +112,4 @@ pub fn build_ui(application: >k::Application) {
|
|||
// different values on different platforms.
|
||||
let (key, modifier) = gtk::accelerator_parse("<Primary>Q");
|
||||
quit.add_accelerator("activate", &accel_group, key, modifier, AccelFlags::VISIBLE);
|
||||
|
||||
about.connect_activate(move |_| {
|
||||
let p = AboutDialog::new();
|
||||
p.set_authors(&["gtk-rs developers"]);
|
||||
p.set_website_label(Some("gtk-rs"));
|
||||
p.set_website(Some("http://gtk-rs.org"));
|
||||
p.set_authors(&["gtk-rs developers"]);
|
||||
p.set_title("About!");
|
||||
p.set_transient_for(Some(&window));
|
||||
p.show_all();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue