[gnome-boxes] topbar: Split out properties toolbar
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] topbar: Split out properties toolbar
- Date: Fri, 6 Jun 2014 12:29:42 +0000 (UTC)
commit 8c8ea346eac4129e50341e62545ea6c0d436f3f3
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Mar 12 15:30:51 2014 +0100
topbar: Split out properties toolbar
Put properites toolbar code and UI definition into a seperate class and
template, respectively.
https://bugzilla.gnome.org/show_bug.cgi?id=726252
data/gnome-boxes.gresource.xml | 1 +
data/ui/properties-toolbar.ui | 35 +++++++++++++++++++++++++++++++++++
data/ui/topbar.ui | 29 +----------------------------
src/Makefile.am | 1 +
src/properties-toolbar.vala | 18 ++++++++++++++++++
src/topbar.vala | 12 ------------
6 files changed, 56 insertions(+), 40 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index c21115b..40a73ab 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -14,6 +14,7 @@
<file preprocess="xml-stripblanks">ui/editable-entry.ui</file>
<file preprocess="xml-stripblanks">ui/mini-graph.ui</file>
<file preprocess="xml-stripblanks">ui/notification.ui</file>
+ <file preprocess="xml-stripblanks">ui/properties-toolbar.ui</file>
<file preprocess="xml-stripblanks">ui/searchbar.ui</file>
<file preprocess="xml-stripblanks">ui/selectionbar.ui</file>
<file preprocess="xml-stripblanks">ui/sidebar.ui</file>
diff --git a/data/ui/properties-toolbar.ui b/data/ui/properties-toolbar.ui
new file mode 100644
index 0000000..f537c24
--- /dev/null
+++ b/data/ui/properties-toolbar.ui
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.9 -->
+ <template class="BoxesPropertiesToolbar" parent="GtkHeaderBar">
+ <property name="visible">True</property>
+ <property name="show-close-button">True</property>
+ <style>
+ <class name="titlebar"/>
+ <class name="menubar"/>
+ </style>
+
+ <child>
+ <object class="GtkButton" id="back">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="on_back_clicked"/>
+ <style>
+ <class name="image-button"/>
+ </style>
+
+ <child internal-child="accessible">
+ <object class="AtkObject" id="a11y-button5">
+ <property name="accessible-name" translatable="yes">Back</property>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkImage" id="back_image">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/data/ui/topbar.ui b/data/ui/topbar.ui
index 0f6e94f..494219d 100644
--- a/data/ui/topbar.ui
+++ b/data/ui/topbar.ui
@@ -348,36 +348,9 @@
<!-- Properties -->
<child>
- <object class="GtkHeaderBar" id="props_toolbar">
+ <object class="BoxesPropertiesToolbar" id="props_toolbar">
<property name="visible">True</property>
<property name="show-close-button">True</property>
- <style>
- <class name="titlebar"/>
- <class name="menubar"/>
- </style>
-
- <child>
- <object class="GtkButton" id="props_back_btn">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="on_props_back_btn_clicked"/>
- <style>
- <class name="image-button"/>
- </style>
-
- <child internal-child="accessible">
- <object class="AtkObject" id="a11y-button5">
- <property name="accessible-name" translatable="yes">Back</property>
- </object>
- </child>
-
- <child>
- <object class="GtkImage" id="props_back_image">
- <property name="visible">True</property>
- </object>
- </child>
- </object>
- </child>
</object>
<packing>
diff --git a/src/Makefile.am b/src/Makefile.am
index 4b3d6f4..2504934 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -117,6 +117,7 @@ gnome_boxes_SOURCES = \
notificationbar.vala \
os-database.vala \
properties.vala \
+ properties-toolbar.vala \
remote-machine.vala \
searchbar.vala \
selectionbar.vala \
diff --git a/src/properties-toolbar.vala b/src/properties-toolbar.vala
new file mode 100644
index 0000000..ce7a4fb
--- /dev/null
+++ b/src/properties-toolbar.vala
@@ -0,0 +1,18 @@
+// This file is part of GNOME Boxes. License: LGPLv2+
+using Gtk;
+
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/properties-toolbar.ui")]
+private class Boxes.PropertiesToolbar: HeaderBar {
+ [GtkChild]
+ private Image back_image;
+
+ construct {
+ back_image.icon_name = (get_direction () == TextDirection.RTL)? "go-previous-rtl-symbolic" :
+ "go-previous-symbolic";
+ }
+
+ [GtkCallback]
+ private void on_back_clicked () {
+ App.app.set_state (App.app.previous_ui_state);
+ }
+}
diff --git a/src/topbar.vala b/src/topbar.vala
index 344008f..6926a65 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -26,9 +26,6 @@ private class Boxes.Topbar: Gtk.Stack, Boxes.UI {
public Gtk.Button wizard_create_btn;
[GtkChild]
- private Gtk.Button props_back_btn;
-
- [GtkChild]
private Gtk.Button search_btn;
[GtkChild]
private Gtk.Button search2_btn;
@@ -49,8 +46,6 @@ private class Boxes.Topbar: Gtk.Stack, Boxes.UI {
[GtkChild]
private Gtk.HeaderBar props_toolbar;
- [GtkChild]
- private Gtk.Image props_back_image;
private GLib.Binding props_name_bind;
@@ -58,7 +53,6 @@ private class Boxes.Topbar: Gtk.Stack, Boxes.UI {
public void click_back_button () {
switch (App.app.ui_state) {
case UIState.PROPERTIES:
- props_back_btn.clicked ();
break;
case UIState.CREDS:
back_btn.clicked ();
@@ -129,7 +123,6 @@ private class Boxes.Topbar: Gtk.Stack, Boxes.UI {
var back_icon = (get_direction () == Gtk.TextDirection.RTL)? "go-previous-rtl-symbolic" :
"go-previous-symbolic";
back_image.set_from_icon_name (back_icon, Gtk.IconSize.MENU);
- props_back_image.set_from_icon_name (back_icon, Gtk.IconSize.MENU);
assert (App.window != null);
assert (App.window.searchbar != null);
@@ -231,9 +224,4 @@ private class Boxes.Topbar: Gtk.Stack, Boxes.UI {
private void on_cancel_btn_clicked () {
App.app.selection_mode = false;
}
-
- [GtkCallback]
- private void on_props_back_btn_clicked () {
- App.app.set_state (App.app.previous_ui_state);
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]