[gnome-maps] sendToDialog: Open on row activate
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] sendToDialog: Open on row activate
- Date: Thu, 5 Nov 2015 16:12:08 +0000 (UTC)
commit 9f3233ee6a6f7c1d28c5c51242befbafa2a6bca0
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Fri Nov 6 00:11:28 2015 +0800
sendToDialog: Open on row activate
data/ui/send-to-dialog.ui | 2 +-
src/sendToDialog.js | 23 +++++++++++++----------
2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/send-to-dialog.ui b/data/ui/send-to-dialog.ui
index 15e0060..a0f1d7e 100644
--- a/data/ui/send-to-dialog.ui
+++ b/data/ui/send-to-dialog.ui
@@ -68,7 +68,7 @@
<object class="GtkListBox" id="list">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="activate_on_single_click">True</property>
+ <property name="activate_on_single_click">False</property>
<property name="selection_mode">single</property>
<child>
<object class="GtkListBoxRow" id="weatherRow">
diff --git a/src/sendToDialog.js b/src/sendToDialog.js
index 4940641..0f140b2 100644
--- a/src/sendToDialog.js
+++ b/src/sendToDialog.js
@@ -70,8 +70,14 @@ const SendToDialog = new Lang.Class({
this._cancelButton.connect('clicked',
this.response.bind(this, Response.CANCEL));
- this._chooseButton.connect('clicked',
- this._onChooseButtonClicked.bind(this));
+ this._chooseButton.connect('clicked', (function() {
+ let row = this._list.get_selected_row();
+ this._activateRow(row);
+ }).bind(this));
+
+ this._list.connect('row-activated', (function(list, row) {
+ this._activateRow(row);
+ }).bind(this));
this._list.set_header_func(function(row, before) {
let horizontal = Gtk.Orientation.HORIZONTAL;
@@ -127,21 +133,18 @@ const SendToDialog = new Lang.Class({
}
},
- _onChooseButtonClicked: function() {
- let rows = this._list.get_selected_rows();
- if (rows.length === 0)
- this.response(Response.CANCEL);
-
+ _activateRow: function(row) {
let timestamp = Gtk.get_current_event_time();
- if (rows[0] === this._weatherRow || rows[0] === this._clocksRow) {
+ if (row === this._weatherRow || row === this._clocksRow) {
let location = this._place.location;
let city = GWeather.Location.new_detached(this._place.name,
null,
location.latitude,
location.longitude);
let action;
- if (rows[0] === this._weatherRow) {
+ let appId;
+ if (row === this._weatherRow) {
action = 'show-location';
appId = _WEATHER_APPID;
} else {
@@ -153,7 +156,7 @@ const SendToDialog = new Lang.Class({
action,
new GLib.Variant('v', city.serialize()),
timestamp);
- } else if (rows[0] === this._browserRow) {
+ } else if (row === this._browserRow) {
try {
let display = Gdk.Display.get_default();
let ctx = Gdk.Display.get_default().get_app_launch_context();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]