blob: 72b4b6faa200ee904c41fcf04a39f4177b08210c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* 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; }
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 () {}
}
}
|