summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2022-04-06 22:27:13 +0200
committerMarcus Lundblad <ml@dfupdate.se>2022-04-13 22:14:13 +0200
commit1ed2dba471f2ec5eb84a22137db3b71549fa34f7 (patch)
treeed28ccb2307cf85f48ecaf0d057f44bed20cbc7a
parenta41b4949f1be90054b8c57e1c7ee5c98e6120d22 (diff)
downloadgnome-maps-1ed2dba471f2ec5eb84a22137db3b71549fa34f7.tar.gz
Remove Check-in functionallity
Remove the CheckInManager, CheckInDialog, and related widgets.
-rw-r--r--data/org.gnome.Maps.data.gresource.xml.in2
-rw-r--r--data/ui/account-row.ui76
-rw-r--r--data/ui/check-in-dialog.ui370
-rw-r--r--po/POTFILES.in3
-rw-r--r--src/accountListBox.js77
-rw-r--r--src/application.js3
-rw-r--r--src/checkIn.js174
-rw-r--r--src/checkInDialog.js277
-rw-r--r--src/foursquareBackend.js118
-rw-r--r--src/org.gnome.Maps.src.gresource.xml.in5
-rw-r--r--src/serviceBackend.js127
11 files changed, 0 insertions, 1232 deletions
diff --git a/data/org.gnome.Maps.data.gresource.xml.in b/data/org.gnome.Maps.data.gresource.xml.in
index b6586e4a..44b4b7e5 100644
--- a/data/org.gnome.Maps.data.gresource.xml.in
+++ b/data/org.gnome.Maps.data.gresource.xml.in
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Maps">
- <file preprocess="xml-stripblanks">ui/account-row.ui</file>
- <file preprocess="xml-stripblanks">ui/check-in-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/context-menu.ui</file>
<file preprocess="xml-stripblanks">ui/export-view-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/favorites-popover.ui</file>
diff --git a/data/ui/account-row.ui b/data/ui/account-row.ui
deleted file mode 100644
index 60afd7c6..00000000
--- a/data/ui/account-row.ui
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk+" version="3.12"/>
- <template class="Gjs_AccountRow" parent="GtkListBoxRow">
- <property name="visible">True</property>
- <child>
- <object class="GtkGrid" id="grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">10</property>
- <property name="margin_end">10</property>
- <property name="margin_top">10</property>
- <property name="margin_bottom">10</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkGrid" id="labelsGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <child>
- <object class="GtkLabel" id="providerLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="identityLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkImage" id="providerImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pixel_size">32</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkImage" id="attentionNeededImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">dialog-warning-symbolic</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- </child>
- </template>
-</interface>
diff --git a/data/ui/check-in-dialog.ui b/data/ui/check-in-dialog.ui
deleted file mode 100644
index 026f3679..00000000
--- a/data/ui/check-in-dialog.ui
+++ /dev/null
@@ -1,370 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk+" version="3.12"/>
- <template class="Gjs_CheckInDialog" parent="GtkDialog">
- <property name="can_focus">False</property>
- <property name="type">popup</property>
- <property name="type_hint">dialog</property>
- <property name="width_request">500</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="contentArea">
- <child>
- <object class="GtkStack" id="stack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">True</property>
- <property name="transition_type">crossfade</property>
- <child>
- <object class="GtkGrid" id="loadingGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkSpinner" id="loadingSpinner">
- <property name="height_request">32</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="active">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">loading</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="accountGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">15</property>
- <property name="margin_end">15</property>
- <property name="margin_top">15</property>
- <property name="margin_bottom">15</property>
- <child>
- <object class="GtkFrame" id="accountFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <child type="label_item">
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">account</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="placeGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">15</property>
- <property name="margin_end">15</property>
- <property name="margin_top">15</property>
- <property name="margin_bottom">15</property>
- <child>
- <object class="GtkInfoBar" id="placeNotFoundInfoBar">
- <property name="visible">True</property>
- <property name="app_paintable">True</property>
- <property name="can_focus">False</property>
- <property name="margin_bottom">5</property>
- <property name="hexpand">True</property>
- <property name="message_type">warning</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="placeNotFoundInfoBarActionArea">
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <property name="layout_style">end</property>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- <child internal-child="content_area">
- <object class="GtkBox" id="placeNotFoundInfoBarContentArea">
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage" id="placeNotFoundInfoBarImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">6</property>
- <property name="icon_name">dialog-warning-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="placeNotFoundLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="wrap">True</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="placeScrolledWindow">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="shadow_type">in</property>
- <property name="min_content_height">300</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">place</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="messageGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">15</property>
- <property name="margin_end">15</property>
- <property name="margin_top">8</property>
- <property name="margin_bottom">10</property>
- <property name="row_spacing">8</property>
- <child>
- <object class="GtkGrid" id="messageInfoGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="column_spacing">5</property>
- <child>
- <object class="GtkImage" id="messageInfoAccountImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pixel_size">32</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="messageInfoLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="margin_start">5</property>
- <property name="hexpand">True</property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkFrame" id="messageTextViewFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTextView" id="messageTextView">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="pixels_above_lines">10</property>
- <property name="wrap_mode">word-char</property>
- <property name="left_margin">10</property>
- <property name="right_margin">15</property>
- <property name="input_hints">GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_NONE</property>
- </object>
- </child>
- <child type="label_item">
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="messageOptionsGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkGrid" id="foursquareOptionsGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="row_spacing">8</property>
- <child>
- <object class="GtkGrid" id="foursquareOptionsPrivacyGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="column_spacing">10</property>
- <child>
- <object class="GtkLabel" id="foursquareOptionsPrivacyLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Visibility</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="foursquareOptionsPrivacyComboBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="model">foursquareOptionsPrivacyListStore</property>
- <property name="active">0</property>
- <property name="id_column">0</property>
- <child>
- <object class="GtkCellRendererText" id="foursquareOptionsPrivacyComboBoxCellRendererText"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="foursquareOptionsBroadcastFacebookCheckButton">
- <property name="label" translatable="yes">Post on Facebook</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="foursquareOptionsBroadcastTwitterCheckButton">
- <property name="label" translatable="yes">Post on Twitter</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">message</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="titlebar">
- <object class="GtkHeaderBar" id="headerBar">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="show-close-button">False</property>
- <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>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="okButton">
- <property name="label" translatable="yes">C_heck in</property>
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="use_underline">True</property>
- <style>
- <class name="default"/>
- </style>
- </object>
- </child>
- </object>
- </child>
- <style>
- <class name="maps-check-in"/>
- </style>
- </template>
- <object class="GtkListStore" id="foursquareOptionsPrivacyListStore">
- <columns>
- <!-- column-name id -->
- <column type="gchararray"/>
- <!-- column-name name -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0">public</col>
- <col id="1" translatable="yes">Public</col>
- </row>
- <row>
- <col id="0">followers</col>
- <col id="1" translatable="yes">Followers</col>
- </row>
- <row>
- <col id="0">private</col>
- <col id="1" translatable="yes">Private</col>
- </row>
- </data>
- </object>
-</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a6241d47..acc4129d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,7 +3,6 @@
data/org.gnome.Maps.appdata.xml.in.in
data/org.gnome.Maps.desktop.in.in
data/org.gnome.Maps.gschema.xml
-data/ui/check-in-dialog.ui
data/ui/context-menu.ui
data/ui/export-view-dialog.ui
data/ui/headerbar-left.ui
@@ -31,8 +30,6 @@ data/ui/zoom-in-dialog.ui
lib/maps-file-tile-source.c
lib/maps-osm.c
src/application.js
-src/checkInDialog.js
-src/checkIn.js
src/contextMenu.js
src/exportViewDialog.js
src/geoclue.js
diff --git a/src/accountListBox.js b/src/accountListBox.js
deleted file mode 100644
index 8a032f37..00000000
--- a/src/accountListBox.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
-/* vim: set et ts=4 sw=4: */
-/*
- * Copyright (c) 2014 Damián Nohales
- *
- * GNOME Maps is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * GNOME Maps is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Damián Nohales <damiannohales@gmail.com>
- */
-
-const Gio = imports.gi.Gio;
-const Goa = imports.gi.Goa;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
-
-const Application = imports.application;
-
-var AccountRow = GObject.registerClass({
- Template: 'resource:///org/gnome/Maps/ui/account-row.ui',
- InternalChildren: [ 'providerLabel',
- 'identityLabel',
- 'providerImage',
- 'attentionNeededImage' ],
-}, class AccountRow extends Gtk.ListBoxRow {
- _init(params) {
- this.account = params.account;
- delete params.account;
-
- super._init(params);
-
- let account = this.account.get_account();
-
- this._providerLabel.label = account.provider_name;
- this._identityLabel.label = account.presentation_identity;
- this._providerImage.gicon = Gio.Icon.new_for_string(account.provider_icon);
- this._attentionNeededImage.visible = account.attention_needed;
- }
-});
-
-var AccountListBox = GObject.registerClass({
- Signals: {
- 'account-selected': { param_types: [Goa.Object] }
- },
-}, class AccountListBox extends Gtk.ListBox {
- _init(params) {
- params.activate_on_single_click = true;
- super._init(params);
-
- Application.checkInManager.connect('accounts-refreshed', () => this.refresh());
-
- this.connect('row-activated',
- (list, row) => this.emit('account-selected', row.account));
-
- this.refresh();
- }
-
- refresh() {
- let accounts = Application.checkInManager.accounts;
-
- this.foreach((row) => this.remove(row));
-
- accounts.forEach((account) => {
- this.insert(new AccountRow({ account: account }), -1);
- });
- }
-});
diff --git a/src/application.js b/src/application.js
index 866bc69a..888fde61 100644
--- a/src/application.js
+++ b/src/application.js
@@ -29,7 +29,6 @@ const GtkClutter = imports.gi.GtkClutter;
const Hdy = imports.gi.Handy;
const WebKit2 = imports.gi.WebKit2;
-const CheckIn = imports.checkIn;
const ContactPlace = imports.contactPlace;
const Format = imports.format;
const Geoclue = imports.geoclue;
@@ -51,7 +50,6 @@ var settings = null;
var placeStore = null;
var routingDelegator = null;
var geoclue = null;
-var checkInManager = null;
var contactStore = null;
var osmEdit = null;
var normalStartup = true;
@@ -264,7 +262,6 @@ var Application = GObject.registerClass({
routeQuery = new RouteQuery.RouteQuery();
routingDelegator = new RoutingDelegator.RoutingDelegator({ query: routeQuery });
geoclue = new Geoclue.Geoclue();
- checkInManager = new CheckIn.CheckInManager();
contactStore = new Maps.ContactStore();
contactStore.load();
osmEdit = new OSMEdit.OSMEdit();
diff --git a/src/checkIn.js b/src/checkIn.js
deleted file mode 100644
index cc2f119c..00000000
--- a/src/checkIn.js
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
-/* vim: set et ts=4 sw=4: */
-/*
- * Copyright (c) 2014 Damián Nohales
- *
- * GNOME Maps is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * GNOME Maps is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Damián Nohales <damiannohales@gmail.com>
- */
-
-const GObject = imports.gi.GObject;
-const Goa = imports.gi.Goa;
-const Gtk = imports.gi.Gtk;
-
-const CheckInDialog = imports.checkInDialog;
-const FoursquareBackend = imports.foursquareBackend;
-
-var CheckInManager = GObject.registerClass({
- Signals: {
- 'accounts-refreshed': { }
- },
- Properties: {
- 'hasCheckIn': GObject.ParamSpec.boolean('hasCheckIn',
- '',
- '',
- GObject.ParamFlags.READABLE)
- }
-}, class CheckInManager extends GObject.Object {
- _init() {
- super._init();
-
- try {
- this._goaClient = Goa.Client.new_sync(null);
- } catch (e) {
- log('Error creating GOA client: %s'.format(e.message));
- }
-
- this._accounts = [];
- this._authorizers = {};
- this._backends = {};
-
- this._initBackends();
-
- if (this._goaClient) {
- this._goaClient.connect('account-added',
- this._refreshGoaAccounts.bind(this));
- this._goaClient.connect('account-changed',
- this._refreshGoaAccounts.bind(this));
- this._goaClient.connect('account-removed',
- this._refreshGoaAccounts.bind(this));
- }
-
- this._refreshGoaAccounts();
- }
-
- _initBackends() {
- let foursquareBackend = new FoursquareBackend.FoursquareBackend();
- this._backends[foursquareBackend.name] = foursquareBackend;
- }
-
- _refreshGoaAccounts() {
- if (!this._goaClient)
- return;
- let accounts = this._goaClient.get_accounts();
- this._accounts = [];
- this._accountsCount = 0;
- this._authorizers = {};
-
- accounts.forEach((object) => {
- if (!object.get_account())
- return;
-
- if (!object.get_maps())
- return;
-
- let accountId = object.get_account().id;
- this._accounts.push(object);
-
- this._authorizers[accountId] = this._getBackend(object).createAuthorizer(object);
- });
-
- this.emit('accounts-refreshed');
- this.notify('hasCheckIn');
- }
-
- get client() {
- return this._goaClient;
- }
-
- get accounts() {
- return this._accounts;
- }
-
- get hasCheckIn() {
- return this._accounts.length > 0;
- }
-
- _getAuthorizer(account) {
- return this._authorizers[account.get_account().id];
- }
-
- _getBackend(account) {
- return this._backends[account.get_account().provider_type];
- }
-
- performCheckIn(account, checkIn, callback, cancellable) {
- this._getBackend(account)
- .performCheckIn(this._getAuthorizer(account), checkIn, callback, cancellable);
- }
-
- findPlaces(account, latitude, longitude, distance, callback, cancellable) {
- this._getBackend(account)
- .findPlaces(this._getAuthorizer(account), latitude, longitude, distance, callback, cancellable);
- }
-
- showCheckInDialog(parentWindow, place, matchPlace) {
- let dialog = new CheckInDialog.CheckInDialog({ transient_for: parentWindow,
- matchPlace: matchPlace,
- place: place });
- let response = dialog.run();
- dialog.destroy();
-
- let message = null;
-
- switch (response) {
- case CheckInDialog.Response.FAILURE_NO_PLACES:
- if (matchPlace)
- /* Translators: %s is the place name that user wanted to check-in */
- message = _("Cannot find “%s” in the social service").format(place.name);
- else
- message = _("Cannot find a suitable place to check-in in this location");
- break;
- case CheckInDialog.Response.FAILURE_GET_PLACES:
- if (dialog.error.code === 401)
- message = _("Credentials have expired, please open Online Accounts to sign in and enable this account");
- else
- message = dialog.error.message;
- break;
- }
-
- if (message) {
- let messageDialog = new Gtk.MessageDialog({ transient_for: parentWindow,
- destroy_with_parent: true,
- message_type: Gtk.MessageType.ERROR,
- buttons: Gtk.ButtonsType.OK,
- modal: true,
- text: _("An error has occurred"),
- secondary_text: message });
- messageDialog.run();
- messageDialog.destroy();
- }
- }
-});
-
-var CheckIn = class {
- _init() {
- this.message = null;
- this.place = null;
- this.privacy = null;
- this.broadcastFacebook = false;
- this.broadcastTwitter = false;
- }
-};
diff --git a/src/checkInDialog.js b/src/checkInDialog.js
deleted file mode 100644
index 7ace6a7a..00000000
--- a/src/checkInDialog.js
+++ /dev/null
@@ -1,277 +0,0 @@
-/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
-/* vim: set et ts=4 sw=4: */
-/*
- * Copyright (c) 2014 Damián Nohales
- *
- * GNOME Maps is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * GNOME Maps is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Damián Nohales <damiannohales@gmail.com>
- */
-
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
-const Mainloop = imports.mainloop;
-
-const AccountListBox = imports.accountListBox;
-const Application = imports.application;
-const CheckIn = imports.checkIn;
-const SocialPlaceListBox = imports.socialPlaceListBox;
-const SocialPlaceMatcher = imports.socialPlaceMatcher;
-
-var Response = {
- SUCCESS: 0,
- CANCELLED: 1,
- FAILURE_NO_PLACES: 2,
- FAILURE_GET_PLACES: 3,
- FAILURE_ACCOUNT_DISABLED: 4,
- FAILURE_CHECKIN_DISABLED: 5
-};
-
-var CheckInDialog = GObject.registerClass({
- Template: 'resource:///org/gnome/Maps/ui/check-in-dialog.ui',
- InternalChildren: [ 'cancelButton',
- 'okButton',
- 'stack',
- 'accountFrame',
- 'placeScrolledWindow',
- 'placeNotFoundInfoBar',
- 'placeNotFoundLabel',
- 'messageInfoLabel',
- 'messageInfoAccountImage',
- 'messageTextView',
- 'foursquareOptionsGrid',
- 'foursquareOptionsPrivacyComboBox',
- 'foursquareOptionsBroadcastFacebookCheckButton',
- 'foursquareOptionsBroadcastTwitterCheckButton' ],
-}, class CheckInDialog extends Gtk.Dialog {
- _init(params) {
- this._place = params.place;
- delete params.place;
-
- this._matchPlace = params.matchPlace;
- delete params.matchPlace;
-
- // This is a construct-only property and cannot be set by GtkBuilder
- params.use_header_bar = true;
-
- super._init(params);
-
- this._account = null;
- this._checkIn = new CheckIn.CheckIn();
- this.error = null;
-
- this._cancellable = new Gio.Cancellable();
- this._cancellable.connect(() => this.response(Response.CANCELLED));
-
- this.connect('delete-event', () => this._cancellable.cancel());
-
- Application.checkInManager.connect('accounts-refreshed',
- () => this._onAccountRefreshed());
-
- this._initHeaderBar();
- this._initWidgets();
- }
-
- _initHeaderBar() {
- this._cancelButton.connect('clicked',
- () => this._cancellable.cancel());
-
- this._okButton.connect('clicked', () => this._startCheckInStep());
- }
-
- _initWidgets() {
- // Limitations in Gjs means we can't do this in UI files yet
- this._accountListBox = new AccountListBox.AccountListBox({ visible: true });
- this._accountFrame.add(this._accountListBox);
-
- this._placeListBox = new SocialPlaceListBox.SocialPlaceListBox({ visible: true });
- this._placeScrolledWindow.add(this._placeListBox);
-
- Application.settings.bind('checkin-foursquare-privacy',
- this._foursquareOptionsPrivacyComboBox,
- 'active_id', Gio.SettingsBindFlags.DEFAULT);
-
- Application.settings.bind('checkin-foursquare-broadcast-facebook',
- this._foursquareOptionsBroadcastFacebookCheckButton,
- 'active', Gio.SettingsBindFlags.DEFAULT);
-
- Application.settings.bind('checkin-foursquare-broadcast-twitter',
- this._foursquareOptionsBroadcastTwitterCheckButton,
- 'active', Gio.SettingsBindFlags.DEFAULT);
-
- this._accountListBox.connect('account-selected', (list, account) => {
- this._account = account;
- this._startPlaceStep();
- });
-
- this._placeListBox.connect('place-selected', (list, place) => {
- this._checkIn.place = place;
- this._startMessageStep();
- });
- }
-
- vfunc_show() {
- this._startup();
- super.vfunc_show();
- }
-
- _startup() {
- let accounts = Application.checkInManager.accounts;
-
- if (accounts.length > 1)
- this._startAccountStep();
- else if (accounts.length === 1) {
- this._account = Application.checkInManager.accounts[0];
- this._startPlaceStep();
- } else {
- Mainloop.idle_add(() => {
- this.response(Response.FAILURE_CHECKIN_DISABLED);
- });
- }
- }
-
- _onAccountRefreshed() {
- let accounts = Application.checkInManager.accounts;
-
- if (!Application.checkInManager.hasCheckIn)
- this.response(Response.FAILURE_CHECKIN_DISABLED);
- else if (this._account) {
- for (let account of accounts) {
- if (this._account.get_account().id === account.get_account().id)
- return;
- }
-
- this.response(Response.FAILURE_ACCOUNT_DISABLED);
- }
- }
-
- _startAccountStep() {
- this.set_title(_("Select an account"));
- this._stack.set_visible_child_name('account');
- }
-
- _startPlaceStep() {
- this.set_title(_("Loading"));
- this._stack.set_visible_child_name('loading');
-
- Application.checkInManager.findPlaces(this._account,
- this._place.location.latitude,
- this._place.location.longitude,
- 100,
- this._onFindPlacesFinished.bind(this),
- this._cancellable);
- }
-
- _onFindPlacesFinished(account, places, error) {
- if (!error) {
- if (places.length === 0) {
- this.response(Response.FAILURE_NO_PLACES);
- return;
- }
-
- let matches = SocialPlaceMatcher.match(this._place, places);
-
- if (matches.exactMatches.length === 1 && this._matchPlace) {
- this._checkIn.place = matches.exactMatches[0];
- this._startMessageStep();
- } else {
- this.set_title(_("Select a place"));
- this._placeListBox.matches = matches;
-
- if (this._matchPlace) {
- if (this._account.get_account().provider_type === 'foursquare')
- this._placeNotFoundLabel.label = _("Maps cannot find the place to check in to with Foursquare. Please select one from this list.");
- } else
- this._placeNotFoundInfoBar.hide();
-
- this._stack.set_visible_child_name('place');
- }
- } else {
- this.error = error;
- this.response(Response.FAILURE_GET_PLACES);
- }
- }
-
- _startMessageStep() {
- /* Translators: %s is the name of the place to check in.
- */
- this.set_title(_("Check in to %s").format(this._checkIn.place.name));
- this._stack.set_visible_child_name('message');
-
- this._messageTextView.grab_focus();
- this._okButton.show();
-
- let account = this._account.get_account();
-
- /* Translators: %s is the name of the place to check in.
- */
- let labelMessageInfo = _("Write an optional message to check in to %s.");
- this._messageInfoLabel.label = labelMessageInfo.format('<a href="%s">%s</a>'.format(this._checkIn.place.link,
- this._checkIn.place.name));
- this._messageInfoAccountImage.gicon = Gio.Icon.new_for_string(account.provider_icon);
-
- let optionsGrids = { 'foursquare': this._foursquareOptionsGrid };
-
- for (let provider in optionsGrids)
- if (provider === account.provider_type)
- optionsGrids[provider].show();
- else
- optionsGrids[provider].hide();
- }
-
- _startCheckInStep() {
- this.set_title(_("Loading"));
- this._stack.set_visible_child_name('loading');
-
- this._okButton.hide();
-
- let message = this._messageTextView.buffer.text;
- let privacy;
-
- if (this._account.get_account().provider_type === 'foursquare')
- privacy = this._foursquareOptionsPrivacyComboBox.active_id;
-
- let broadcastFacebook = this._foursquareOptionsBroadcastFacebookCheckButton.active;
- let broadcastTwitter = this._foursquareOptionsBroadcastTwitterCheckButton.active;
-
- this._checkIn.message = message;
- this._checkIn.privacy = privacy;
- this._checkIn.broadcastFacebook = broadcastFacebook;
- this._checkIn.broadcastTwitter = broadcastTwitter;
-
- Application.checkInManager.performCheckIn(this._account,
- this._checkIn,
- this._onPerformCheckInFinished.bind(this),
- this._cancellable);
- }
-
- _onPerformCheckInFinished(account, data, error) {
- if (!error)
- this.response(Response.SUCCESS);
- else {
- let messageDialog = new Gtk.MessageDialog({ transient_for: this,
- destroy_with_parent: true,
- message_type: Gtk.MessageType.ERROR,
- buttons: Gtk.ButtonsType.OK,
- modal: true,
- text: _("An error has occurred"),
- secondary_text: error.message });
- messageDialog.run();
- messageDialog.destroy();
-
- this._startMessageStep();
- }
- }
-});
diff --git a/src/foursquareBackend.js b/src/foursquareBackend.js
deleted file mode 100644
index 164ddfb6..00000000
--- a/src/foursquareBackend.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
-/* vim: set et ts=4 sw=4: */
-/*
- * Copyright (c) 2014 Damián Nohales
- *
- * GNOME Maps is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * GNOME Maps is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Damián Nohales <damiannohales@gmail.com>
- */
-
-const GObject = imports.gi.GObject;
-
-const FoursquareGoaAuthorizer = imports.foursquareGoaAuthorizer;
-const ServiceBackend = imports.serviceBackend;
-const SocialPlace = imports.socialPlace;
-
-const _PLACE_LINK_FORMAT = 'https://foursquare.com/v/foursquare-hq/%s';
-
-var FoursquareBackend = GObject.registerClass(
-class SocialServiceFoursquareBackend extends ServiceBackend.ServiceBackend {
-
- get name() {
- return 'foursquare';
- }
-
- createRestCall(authorizer) {
- return FoursquareGoaAuthorizer.newRestCall(authorizer);
- }
-
- refreshAuthorization(authorizer, cancellable) {
- return authorizer.refreshAuthorization(cancellable);
- }
-
- getAuthorizerAccount(authorizer) {
- return authorizer.goaObject;
- }
-
- createAuthorizer(account) {
- return new FoursquareGoaAuthorizer.FoursquareGoaAuthorizer({ goaObject: account });
- }
-
- isTokenInvalid(restCall, data) {
- return data.meta.code === 401 || data.meta.code === 403;
- }
-
- isInvalidCall(restCall, data) {
- return !data || data.meta.code !== 200;
- }
-
- getCallResultCode(restCall, data) {
- return data ? data.meta.code : restCall.get_status_code();
- }
-
- getCallResultMessage(restCall, data) {
- return data ? data.meta.errorDetail : restCall.get_status_message();
- }
-
- _realPerformCheckIn(authorizer, checkIn, callback, cancellable) {
- let broadcast = checkIn.privacy;
-
- if (checkIn.broadcastFacebook)
- broadcast += ',facebook';
-
- if (checkIn.broadcastTwitter)
- broadcast += ',twitter';
-
- this.callAsync(authorizer,
- 'POST',
- 'checkins/add',
- {
- 'shout': checkIn.message,
- 'venueId': checkIn.place.id,
- 'broadcast': broadcast
- },
- callback,
- cancellable);
- }
-
- _realFindPlaces(authorizer, latitude, longitude, distance, callback, cancellable) {
- this.callAsync(authorizer,
- 'GET',
- 'venues/search',
- {
- 'll': latitude + ',' + longitude,
- 'radius': distance,
- 'intent': 'checkin'
- },
- callback,
- cancellable);
- }
-
- createPlaces(rawData) {
- return rawData.response.venues.map(function(place) {
- let link = _PLACE_LINK_FORMAT.format(place.id);
-
- return new SocialPlace.SocialPlace({ id: place.id,
- name: place.name,
- latitude: place.location.lat,
- longitude: place.location.lng,
- category: place.categories.length > 0 ?
- place.categories[0].name :
- null,
- link: link,
- originalData: place });
- });
- }
-});
diff --git a/src/org.gnome.Maps.src.gresource.xml.in b/src/org.gnome.Maps.src.gresource.xml.in
index da8266e7..fd6e9bc4 100644
--- a/src/org.gnome.Maps.src.gresource.xml.in
+++ b/src/org.gnome.Maps.src.gresource.xml.in
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Maps@suffix@/js">
- <file>accountListBox.js</file>
<file>address.js</file>
<file>application.js</file>
<file>boundingBox.js</file>
- <file>checkIn.js</file>
- <file>checkInDialog.js</file>
<file>color.js</file>
<file>contactPlace.js</file>
<file>contextMenu.js</file>
@@ -14,7 +11,6 @@
<file>epaf.js</file>
<file>exportViewDialog.js</file>
<file>favoritesPopover.js</file>
- <file>foursquareBackend.js</file>
<file>foursquareGoaAuthorizer.js</file>
<file>geoclue.js</file>
<file>geocode.js</file>
@@ -76,7 +72,6 @@
<file>routeQuery.js</file>
<file>routingDelegator.js</file>
<file>searchPopover.js</file>
- <file>serviceBackend.js</file>
<file>settings.js</file>
<file>sendToDialog.js</file>
<file>service.js</file>
diff --git a/src/serviceBackend.js b/src/serviceBackend.js
deleted file mode 100644
index edcfdebe..00000000
--- a/src/serviceBackend.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
-/* vim: set et ts=4 sw=4: */
-/*
- * Copyright (c) 2014 Damián Nohales
- *
- * GNOME Maps is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * GNOME Maps is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Damián Nohales <damiannohales@gmail.com>
- */
-
-const GObject = imports.gi.GObject;
-
-const Utils = imports.utils;
-
-var ServiceBackend = GObject.registerClass({
- Abstract: true
-}, class ServiceBackend extends GObject.Object {
-
- //Abstract
- get name() { }
-
- //Abstract
- createRestCall(authorizer) { }
-
- //Abstract
- refreshAuthorization(authorizer, cancellable) { }
-
- //Abstract
- getAuthorizerAccount(authorizer) { }
-
- //Abstract
- createAuthorizer(account) { }
-
- //Abstract
- isTokenInvalid(restCall, parsedPayload) { }
-
- //Abstract
- isInvalidCall(restCall, parsedPayload) { }
-
- //Abstract
- getCallResultCode(restCall, parsedPayload) { }
-
- //Abstract
- getCallResultMessage(restCall, parsedPayload) { }
-
- callAsync(authorizer, method, func, params, callback, cancellable, mustRefreshToken) {
- mustRefreshToken = mustRefreshToken || true;
- cancellable = cancellable || null;
-
- let restCall = this.createRestCall(authorizer);
-
- method = method.toUpperCase();
- restCall.set_method(method);
-
- for (let key in params)
- restCall.add_param(key, params[key].toString());
-
- restCall.set_function(func);
-
- Utils.debug(this.name + ': ' + func);
-
- restCall.invoke_async(cancellable, (call, result) => {
- let data = JSON.parse(call.get_payload());
- let account = this.getAuthorizerAccount(authorizer);
-
- if (data && this.isTokenInvalid(call, data))
- if (mustRefreshToken) {
- //Unauthorized token error, we need to refresh the token
- Utils.debug(this.name + ': The token is not authorized, refreshing token');
- try {
- this.refreshAuthorization(authorizer, cancellable);
- this.callAsync(authorizer, method, func, params, callback, cancellable, false);
- } catch(error) {
- callback(account, data, { code: 401,
- message: null });
- }
- } else
- callback(account, data, { code: 401,
- message: null });
- else if (this.isInvalidCall(call, data))
- callback(account, data, { code: this.getCallResultCode(call, data),
- message: this.getCallResultMessage(call, data) });
- else
- callback(account, data, null);
- });
- }
-
- performCheckIn(authorizer, checkIn, callback, cancellable) {
- callback = callback || function() {};
- this._realPerformCheckIn(authorizer, checkIn, callback, cancellable);
- }
-
- //Abstract
- _realPerformCheckIn(authorizer, checkIn, callback, cancellable) { }
-
- findPlaces(authorizer, latitude, longitude, distance, callback, cancellable) {
- callback = callback || function() {};
- this._realFindPlaces(authorizer,
- latitude,
- longitude,
- distance,
- (account, data, error) => {
- if (!error)
- callback(account, this.createPlaces(data), error);
- else
- callback(account, [], error);
- },
- cancellable);
- }
-
- //Abstract
- _realFindPlaces(authorizer, latitude, longitude, distance, callback, cancellable) { }
-
- //Abstract
- createPlaces(rawData) { }
-});