[gnome-photos] main-window: Port to template
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] main-window: Port to template
- Date: Wed, 10 May 2017 11:05:47 +0000 (UTC)
commit 884e87f0fe970223390561d96046abf2cdd5e72c
Author: Alessandro Bono <abono gnome org>
Date: Wed Mar 22 21:52:35 2017 +0100
main-window: Port to template
https://bugzilla.gnome.org/show_bug.cgi?id=780424
src/Makefile.am | 1 +
src/photos-main-window.c | 8 ++++----
src/photos-main-window.ui | 29 +++++++++++++++++++++++++++++
src/photos.gresource.xml | 1 +
4 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index c100eed..6bf99ef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -354,6 +354,7 @@ EXTRA_DIST = \
photos-embed.ui \
photos-export-dialog.ui \
photos-help-overlay.ui \
+ photos-main-window.ui \
photos-marshalers.list \
photos-menus.ui \
photos-preview-menu.ui \
diff --git a/src/photos-main-window.c b/src/photos-main-window.c
index 66a3c13..40f2b8d 100644
--- a/src/photos-main-window.c
+++ b/src/photos-main-window.c
@@ -377,8 +377,7 @@ photos_main_window_constructed (GObject *object)
self->load_next = g_action_map_lookup_action (G_ACTION_MAP (app), "load-next");
self->load_previous = g_action_map_lookup_action (G_ACTION_MAP (app), "load-previous");
- self->embed = photos_embed_new ();
- gtk_container_add (GTK_CONTAINER (self), self->embed);
+ gtk_widget_init_template (GTK_WIDGET (self));
}
@@ -458,6 +457,9 @@ photos_main_window_class_init (PhotosMainWindowClass *class)
widget_class->delete_event = photos_main_window_delete_event;
widget_class->key_press_event = photos_main_window_key_press_event;
widget_class->window_state_event = photos_main_window_window_state_event;
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Photos/main-window.ui");
+ gtk_widget_class_bind_template_child (widget_class, PhotosMainWindow, embed);
}
@@ -471,8 +473,6 @@ photos_main_window_new (GtkApplication *application)
"height_request", WINDOW_MIN_HEIGHT,
"application", application,
"title", _(PACKAGE_NAME),
- "window-position", GTK_WIN_POS_CENTER,
- "show-menubar", FALSE,
NULL);
}
diff --git a/src/photos-main-window.ui b/src/photos-main-window.ui
new file mode 100644
index 0000000..2a4accf
--- /dev/null
+++ b/src/photos-main-window.ui
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Photos - access, organize and share your photos on GNOME
+ Copyright © 2017 Alessandro Bono
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+-->
+<interface>
+ <template class="PhotosMainWindow" parent="GtkApplicationWindow">
+ <property name="show-menubar">0</property>
+ <property name="window-position">GTK_WIN_POS_CENTER</property>
+ <child>
+ <object class="PhotosEmbed" id="embed"/>
+ </child>
+ </template>
+</interface>
diff --git a/src/photos.gresource.xml b/src/photos.gresource.xml
index 0acdb03..3669c1a 100644
--- a/src/photos.gresource.xml
+++ b/src/photos.gresource.xml
@@ -26,6 +26,7 @@
<file alias="dropdown.ui" preprocess="xml-stripblanks" compressed="true">photos-dropdown.ui</file>
<file alias="embed.ui" preprocess="xml-stripblanks" compressed="true">photos-embed.ui</file>
<file alias="export-dialog.ui" preprocess="xml-stripblanks"
compressed="true">photos-export-dialog.ui</file>
+ <file alias="main-window.ui" preprocess="xml-stripblanks" compressed="true">photos-main-window.ui</file>
<file alias="preview-menu.ui" preprocess="xml-stripblanks"
compressed="true">photos-preview-menu.ui</file>
<file alias="selection-menu.ui" preprocess="xml-stripblanks"
compressed="true">photos-selection-menu.ui</file>
<file alias="selection-toolbar.ui" preprocess="xml-stripblanks"
compressed="true">photos-selection-toolbar.ui</file>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]