[shotwell/wip/dedeprecate: 23/38] common: Add BuilderPane



commit 04dc71f3ed181dccd659a5d01c1bc2e49b297171
Author: Jens Georg <mail jensge org>
Date:   Sat Oct 29 02:28:30 2016 +0200

    common: Add BuilderPane
    
    Signed-off-by: Jens Georg <mail jensge org>

 Makefile.am                     |    1 +
 plugins/common/BuilderPane.vala |   53 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index e47126b..b93c80b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -55,6 +55,7 @@ plugins_common_libshotwell_plugin_common_la_SOURCES = \
        plugins/common/RESTSupport.vala \
        plugins/common/Resources.vala \
        plugins/common/WebAuthenticationPane.vala \
+       plugins/common/BuilderPane.vala \
        plugins/shotwell-plugin-dev-1.0.vapi
 
 $(top_srcdir)/plugins/shotwell-plugin-common.vapi plugins/shotwell-plugin-common.h: \
diff --git a/plugins/common/BuilderPane.vala b/plugins/common/BuilderPane.vala
new file mode 100644
index 0000000..28f4907
--- /dev/null
+++ b/plugins/common/BuilderPane.vala
@@ -0,0 +1,53 @@
+/* Copyright 2016 Jens Georg <mail jensge org>
+ *
+ * This software is licensed under the GNU LGPL (version 2.1 or later).
+ * See the COPYING file in this distribution.
+ */
+using Spit.Publishing;
+
+namespace Shotwell.Plugins.Common {
+    public abstract class BuilderPane : Spit.Publishing.DialogPane, Object {
+        public DialogPane.GeometryOptions preferred_geometry {
+            get; construct; default = DialogPane.GeometryOptions.NONE;
+        }
+        public string resource_path { owned get; construct; }
+        public bool connect_signals { get; construct; default = false; }
+
+        private Gtk.Builder builder;
+        private Gtk.Widget content;
+
+        public override void constructed () {
+            base.constructed ();
+
+            debug ("Adding new builder from path %s", resource_path);
+
+            this.builder = new Gtk.Builder.from_resource (resource_path);
+            if (this.connect_signals) {
+                this.builder.connect_signals (null);
+            }
+
+            this.content = this.builder.get_object ("content") as Gtk.Widget;
+
+            // Just to be sure, if we still use old-style Builder files
+            if (this.content.parent != null) {
+                this.content.parent.remove (this.content);
+            }
+        }
+
+        public DialogPane.GeometryOptions get_preferred_geometry () {
+            return this.preferred_geometry;
+        }
+
+        public Gtk.Widget get_widget () {
+            return this.content;
+        }
+
+        public Gtk.Builder get_builder () {
+            return this.builder;
+        }
+
+        public virtual void on_pane_installed () {}
+
+        public virtual void on_pane_uninstalled () {}
+    }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]