diff options
author | Jonas Danielsson <jonas.danielsson@threetimestwo.org> | 2014-10-16 01:00:44 -0400 |
---|---|---|
committer | Jonas Danielsson <jonas@threetimestwo.org> | 2014-11-01 12:33:59 +0100 |
commit | 572fdf84ffb09f8083b01a35468e93a783becdc3 (patch) | |
tree | 977070d13d8e49baf1852549d07d6e0c8cf7bf8f /src/mapBubble.js | |
parent | 0ccbecd4d5b53ed78cca8083523e6d274f411a1d (diff) | |
download | gnome-maps-572fdf84ffb09f8083b01a35468e93a783becdc3.tar.gz |
Add button template to MapBubble
This adds a template ui to MapBubble with an icon, a content area
and a button area.
The button area contains standard buttons, which bubble sub classes
will opt-in to using the buttons parameter:
params.buttons = MapBubble.button.ROUTE | ... ;
this.parent(params);
Bubble sub classes add their own content by:
this.image.[property] = ...;
this.content.add(...);
https://bugzilla.gnome.org/show_bug.cgi?id=737775
Diffstat (limited to 'src/mapBubble.js')
-rw-r--r-- | src/mapBubble.js | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/mapBubble.js b/src/mapBubble.js index f7473272..49fd6762 100644 --- a/src/mapBubble.js +++ b/src/mapBubble.js @@ -21,9 +21,15 @@ */ const Gtk = imports.gi.Gtk; - const Lang = imports.lang; +const Application = imports.application; +const Utils = imports.utils; + +const Button = { + NONE: 0 +}; + const MapBubble = new Lang.Class({ Name: "MapBubble", Extends: Gtk.Popover, @@ -37,12 +43,34 @@ const MapBubble = new Lang.Class({ params.relative_to = params.mapView; delete params.mapView; + let buttonFlags = params.buttons || Button.NONE; + delete params.buttons; + params.modal = false; this.parent(params); + let ui = Utils.getUIObject('map-bubble', [ 'bubble-main-grid', + 'bubble-image', + 'bubble-content-area', + 'bubble-button-area']); + this._image = ui.bubbleImage; + this._content = ui.bubbleContentArea; + + if (!buttonFlags) + ui.bubbleButtonArea.visible = false; + + this.add(ui.bubbleMainGrid); + }, + + get image() { + return this._image; }, get place() { return this._place; + }, + + get content() { + return this._content; } -});
\ No newline at end of file +}); |