From 4a3f1fdfe1eb3743564adcee35d5513224339260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 25 Nov 2016 04:10:33 +0100 Subject: New upstream version 0.25.1 --- plugins/common/BuilderPane.vala | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 plugins/common/BuilderPane.vala (limited to 'plugins/common/BuilderPane.vala') diff --git a/plugins/common/BuilderPane.vala b/plugins/common/BuilderPane.vala new file mode 100644 index 0000000..72b4b6f --- /dev/null +++ b/plugins/common/BuilderPane.vala @@ -0,0 +1,60 @@ +/* Copyright 2016 Jens Georg + * + * 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; } + public string default_id { + owned get; construct; default = "default"; + } + + 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 Gtk.Widget get_default_widget () { + return this.get_builder ().get_object (this.default_id) as Gtk.Widget; + } + + public virtual void on_pane_installed () {} + + public virtual void on_pane_uninstalled () {} + } +} -- cgit v1.2.3