[gnome-boxes] Add SharedFolderPopover
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Add SharedFolderPopover
- Date: Thu, 15 Jun 2017 14:57:04 +0000 (UTC)
commit 20dfa5d6a651ae2037efda4da4e6822d9404ead5
Author: Visarion Alexandru <viorel visarion gmail com>
Date: Mon May 15 00:14:19 2017 +0300
Add SharedFolderPopover
Let's add a custom popover to aid us when adding/editing
shared folders.
https://bugzilla.gnome.org/show_bug.cgi?id=730259
data/gnome-boxes.gresource.xml | 1 +
data/ui/shared-folder-popover.ui | 141 ++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 1 +
src/shared-folder-popover.vala | 35 +++++++++
4 files changed, 178 insertions(+), 0 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 8222d63..818e0e0 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -24,6 +24,7 @@
<file preprocess="xml-stripblanks">ui/searchbar.ui</file>
<file preprocess="xml-stripblanks">ui/selectionbar.ui</file>
<file preprocess="xml-stripblanks">ui/selection-toolbar.ui</file>
+ <file preprocess="xml-stripblanks">ui/shared-folder-popover.ui</file>
<file preprocess="xml-stripblanks">ui/snapshot-list-row.ui</file>
<file preprocess="xml-stripblanks">ui/topbar.ui</file>
<file preprocess="xml-stripblanks">ui/troubleshoot-log.ui</file>
diff --git a/data/ui/shared-folder-popover.ui b/data/ui/shared-folder-popover.ui
new file mode 100644
index 0000000..a92a0e2
--- /dev/null
+++ b/data/ui/shared-folder-popover.ui
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.19"/>
+ <template class="BoxesSharedFolderPopover" parent="GtkPopover">
+ <property name="can_focus">False</property>
+ <property name="modal">True</property>
+ <property name="position">bottom</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">36</property>
+ <property name="margin_right">16</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+ <property name="spacing">23</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="valign">start</property>
+ <property name="margin_top">6</property>
+ <property name="label" translatable="yes">Local Folder</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <property name="margin_top">20</property>
+ <property name="label" translatable="yes">Name</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkFileChooserButton" id="file_chooser_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action">select-folder</property>
+ <property name="title" translatable="yes">Select Shared Folder</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkButton">
+ <property name="label" translatable="yes">Cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_cancel"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="label" translatable="yes">Save</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_save"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index 5323d52..312f9e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -162,6 +162,7 @@ gnome_boxes_SOURCES = \
empty-boxes.vala \
tracker-iso-query.vala \
troubleshoot-log.vala \
+ shared-folder-popover.vala \
snapshot-list-row.vala \
snapshots-property.vala \
$(NULL)
diff --git a/src/shared-folder-popover.vala b/src/shared-folder-popover.vala
new file mode 100644
index 0000000..d257b1d
--- /dev/null
+++ b/src/shared-folder-popover.vala
@@ -0,0 +1,35 @@
+// This file is part of GNOME Boxes. License: LGPLv2+
+using Gtk;
+
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/shared-folder-popover.ui")]
+private class Boxes.SharedFolderPopover: Gtk.Popover {
+ public signal void saved (string local_folder, string name, int target_position);
+
+ [GtkChild]
+ public Gtk.FileChooserButton file_chooser_button;
+ [GtkChild]
+ public Gtk.Entry name_entry;
+
+ public int target_position;
+
+ [GtkCallback]
+ public void on_cancel (Gtk.Button cancel_button) {
+ popdown ();
+ }
+
+ [GtkCallback]
+ public void on_save (Gtk.Button save_button) {
+ var path = file_chooser_button.get_uri ();
+ var name = name_entry.get_text ();
+
+ if (path != null) {
+ path.scanf ("file://%s", path);
+ if (name == "")
+ name = Path.get_basename (path);
+
+ saved (path, name, target_position);
+ }
+
+ popdown ();
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]