[gnome-maps] sendToDialog: Various UI tweaks and fixes
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] sendToDialog: Various UI tweaks and fixes
- Date: Thu, 13 Jun 2019 19:07:06 +0000 (UTC)
commit 3e78f6fb0f180eb21e54470cf5bd858032bc009a
Author: James Westman <flyingpimonster flyingpimonster net>
Date: Sun Jun 9 21:04:51 2019 -0500
sendToDialog: Various UI tweaks and fixes
- Fix margins
- Don't show listbox if it's empty
- Fix an issue where listbox rows were shown even if they should be
hidden, because showing the dialog used show_all() instead of show()
- Remove "Open" button. Instead, rows activate on single click.
- In the dialog, use action buttons instead of a custom headerbar widget
- Change button tooltip from "Open with another application" to "Share
location"
Part of the share dialog overhaul, #167.
data/ui/map-bubble.ui | 2 +-
data/ui/open-with-row.ui | 2 ++
data/ui/send-to-dialog.ui | 67 ++++++++++++++++-------------------------------
src/mapBubble.js | 2 +-
src/sendToDialog.js | 20 +++++++-------
5 files changed, 36 insertions(+), 57 deletions(-)
---
diff --git a/data/ui/map-bubble.ui b/data/ui/map-bubble.ui
index d7109be..06bf37f 100644
--- a/data/ui/map-bubble.ui
+++ b/data/ui/map-bubble.ui
@@ -59,7 +59,7 @@
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip-text" translatable="yes" comments="Translators: This is a
tooltip">Open with another application</property>
+ <property name="tooltip-text" translatable="yes" comments="Translators: This is a
tooltip">Share location</property>
<child>
<object class="GtkImage" id="bubble-send-to-button-image">
<property name="visible">True</property>
diff --git a/data/ui/open-with-row.ui b/data/ui/open-with-row.ui
index 00cce1a..d236a2a 100644
--- a/data/ui/open-with-row.ui
+++ b/data/ui/open-with-row.ui
@@ -7,6 +7,8 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <property name="margin">6</property>
<child>
<object class="GtkImage" id="icon">
<property name="visible">True</property>
diff --git a/data/ui/send-to-dialog.ui b/data/ui/send-to-dialog.ui
index 3ca9ebb..c5192b6 100644
--- a/data/ui/send-to-dialog.ui
+++ b/data/ui/send-to-dialog.ui
@@ -7,64 +7,39 @@
<property name="can_focus">False</property>
<property name="use_header_bar">1</property>
<property name="width-request">400</property>
- <child internal-child="headerbar">
- <object class="GtkHeaderBar" id="headerBar">
+ <property name="title" translatable="yes">Open Location</property>
+ <child type="action">
+ <object class="GtkButton" id="cancelButton">
+ <property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_close_button">False</property>
- <property name="title" translatable="yes">Open location</property>
+ <property name="can_focus">True</property>
+ <property name="use_underline">True</property>
<style>
- <class name="titlebar"/>
+ <class name="text-button"/>
</style>
- <child>
- <object class="GtkButton" id="cancelButton">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_underline">True</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="chooseButton">
- <property name="label" translatable="yes">_Open</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="valign">center</property>
- <property name="use_underline">True</property>
- <style>
- <class name="suggested-action"/>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
</object>
</child>
+ <action-widgets>
+ <action-widget response="cancel">cancelButton</action-widget>
+ </action-widgets>
<child internal-child="vbox">
<object class="GtkBox" id="contentArea">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="margin">18</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="summaryLabel">
+ <property name="visible">True</property>
<property name="selectable">true</property>
<property name="label">…</property>
<property name="justify">left</property>
@@ -73,6 +48,7 @@
</child>
<child>
<object class="GtkLabel" id="summaryUrl">
+ <property name="visible">True</property>
<property name="selectable">true</property>
<property name="use-markup">true</property>
<property name="label">…</property>
@@ -85,15 +61,18 @@
</child>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="copyButton">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Copy</property>
</object>
</child>
<child>
<object class="GtkButton" id="emailButton">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Send To…</property>
</object>
</child>
@@ -109,22 +88,22 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hscrollbar_policy">never</property>
+ <property name="vexpand">True</property>
<child>
<object class="GtkListBox" id="list">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="activate_on_single_click">False</property>
<property name="selection_mode">single</property>
<child>
<object class="GtkListBoxRow" id="weatherRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="height_request">40</property>
<child>
<object class="GtkGrid" id="weatherGrid">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
- <property name="column_spacing">10</property>
+ <property name="column_spacing">12</property>
+ <property name="margin">6</property>
<child>
<object class="GtkImage" id="weatherIcon">
<property name="visible">True</property>
@@ -146,12 +125,12 @@
<object class="GtkListBoxRow" id="clocksRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="height_request">40</property>
<child>
<object class="GtkGrid" id="clocksGrid">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
- <property name="column_spacing">10</property>
+ <property name="column_spacing">12</property>
+ <property name="margin">6</property>
<child>
<object class="GtkImage" id="clocksIcon">
<property name="visible">True</property>
diff --git a/src/mapBubble.js b/src/mapBubble.js
index c62e683..211acc3 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -150,7 +150,7 @@ class MapBubble extends Gtk.Popover {
button.visible = true;
button.connect('clicked', () => {
dialog.connect('response', () => dialog.hide());
- dialog.show_all();
+ dialog.show();
});
}
diff --git a/src/sendToDialog.js b/src/sendToDialog.js
index 5a3eca9..7780980 100644
--- a/src/sendToDialog.js
+++ b/src/sendToDialog.js
@@ -38,7 +38,7 @@ var Response = {
CANCEL: 1
};
-const _NUM_VISIBLE = 6;
+const _NUM_VISIBLE = 4;
var SendToDialog = GObject.registerClass({
Template: 'resource:///org/gnome/Maps/ui/send-to-dialog.ui',
@@ -49,9 +49,7 @@ var SendToDialog = GObject.registerClass({
'clocksRow',
'clocksLabel',
'clocksIcon',
- 'headerBar',
'cancelButton',
- 'chooseButton',
'summaryLabel',
'summaryUrl',
'copyButton',
@@ -70,16 +68,11 @@ var SendToDialog = GObject.registerClass({
super._init(params);
this._scrolledWindow.min_content_height = 40 * _NUM_VISIBLE;
- this._headerBar.subtitle = this._place.name;
+ this.get_header_bar().subtitle = this._place.name;
this._cancelButton.connect('clicked',
() => this.response(Response.CANCEL));
- this._chooseButton.connect('clicked', () => {
- let row = this._list.get_selected_row();
- this._activateRow(row);
- });
-
this._list.connect('row-activated', (list, row) => this._activateRow(row));
this._list.set_header_func((row, before) => {
@@ -111,7 +104,7 @@ var SendToDialog = GObject.registerClass({
let weatherInfo = Gio.DesktopAppInfo.new(_WEATHER_APPID + '.desktop');
if (!weatherInfo) {
- this._weatherRow.hide();
+ this._list.remove(this._weatherRow);
} else {
this._weatherLabel.label = label.format(this._city.get_name(),
weatherInfo.get_name());
@@ -120,7 +113,7 @@ var SendToDialog = GObject.registerClass({
let clocksInfo = Gio.DesktopAppInfo.new(_CLOCKS_APPID + '.desktop');
if (!clocksInfo) {
- this._clocksRow.hide();
+ this._list.remove(this._clocksRow);
} else {
this._clocksLabel.label = label.format(this._city.get_name(),
clocksInfo.get_name());
@@ -140,6 +133,11 @@ var SendToDialog = GObject.registerClass({
this._list.add(new OpenWithRow({ appinfo: app }));
}
+
+ /* Hide the list box if it is empty */
+ if (this._list.get_children().length == 0) {
+ this._scrolledWindow.hide();
+ }
}
_getSummary(markup) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]