[gnome-maps] Add LocationServiceNotification



commit a912b6cc5ac63fb3b85fa36c8cdb4f1fd316eacc
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Sun Jan 11 20:21:55 2015 +0100

    Add LocationServiceNotification
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740379

 data/org.gnome.Maps.data.gresource.xml   |    1 +
 data/ui/location-service-notification.ui |   26 ++++++++++++++
 po/POTFILES.in                           |    1 +
 src/locationServiceNotification.js       |   56 ++++++++++++++++++++++++++++++
 src/org.gnome.Maps.src.gresource.xml     |    1 +
 5 files changed, 85 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Maps.data.gresource.xml b/data/org.gnome.Maps.data.gresource.xml
index 61ef503..a5fb64d 100644
--- a/data/org.gnome.Maps.data.gresource.xml
+++ b/data/org.gnome.Maps.data.gresource.xml
@@ -7,6 +7,7 @@
     <file preprocess="xml-stripblanks">ui/context-menu.ui</file>
     <file preprocess="xml-stripblanks">ui/favorites-popover.ui</file>
     <file preprocess="xml-stripblanks">ui/layers-popover.ui</file>
+    <file preprocess="xml-stripblanks">ui/location-service-notification.ui</file>
     <file preprocess="xml-stripblanks">ui/main-window.ui</file>
     <file preprocess="xml-stripblanks">ui/map-bubble.ui</file>
     <file preprocess="xml-stripblanks">ui/notification.ui</file>
diff --git a/data/ui/location-service-notification.ui b/data/ui/location-service-notification.ui
new file mode 100644
index 0000000..dfb062a
--- /dev/null
+++ b/data/ui/location-service-notification.ui
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <object class="GtkGrid" id="grid">
+    <property name="visible">True</property>
+    <property name="orientation">horizontal</property>
+    <property name="hexpand">False</property>
+    <child>
+      <object class="GtkLabel" id="label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin-end">30</property>
+        <property name="label" translatable="yes">Turn on location services to find your location</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkButton" id="button">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Location Settings</property>
+        <property name="focus-on-click">False</property>
+        <property name="margin-end">5</property>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8193dba..9413ff5 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,6 +5,7 @@ data/org.gnome.Maps.gschema.xml.in
 [type: gettext/glade]data/ui/app-menu.ui
 [type: gettext/glade]data/ui/check-in-dialog.ui
 [type: gettext/glade]data/ui/context-menu.ui
+[type: gettext/glade]data/ui/location-service-notification.ui
 [type: gettext/glade]data/ui/main-window.ui
 [type: gettext/glade]data/ui/map-bubble.ui
 [type: gettext/glade]data/ui/search-popup.ui
diff --git a/src/locationServiceNotification.js b/src/locationServiceNotification.js
new file mode 100644
index 0000000..185c78f
--- /dev/null
+++ b/src/locationServiceNotification.js
@@ -0,0 +1,56 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2011, 2012, 2013 Red Hat, Inc.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Jonas Danielsson <jonas threetimestwo org>
+ */
+
+const Gdk = imports.gi.Gdk;
+const Gio = imports.gi.Gio;
+const Lang = imports.lang;
+
+const Notification = imports.notification;
+const Utils = imports.utils;
+
+const _PRIVACY_PANEL = 'gnome-privacy-panel.desktop';
+
+const LocationServiceNotification = new Lang.Class({
+    Name: 'LocationServiceNotification',
+    Extends: Notification.Notification,
+
+    _init: function() {
+        this.parent();
+
+        let ui = Utils.getUIObject('location-service-notification',
+                                   [ 'button', 'grid' ]);
+
+        ui.button.connect('clicked', (function() {
+            let privacyInfo = Gio.DesktopAppInfo.new(_PRIVACY_PANEL);
+
+            try {
+                let display = Gdk.Display.get_default();
+
+                privacyInfo.launch([], display.get_app_launch_context());
+            } catch(e) {
+                Utils.debug('launching privacy panel failed: ' + e);
+            }
+        }).bind(this));
+
+        this._ui.body.add(ui.grid);
+    }
+});
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 3bd9f70..38faa17 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -15,6 +15,7 @@
     <file>geocodeService.js</file>
     <file>http.js</file>
     <file>layersPopover.js</file>
+    <file>locationServiceNotification.js</file>
     <file>main.js</file>
     <file>mainWindow.js</file>
     <file>mapBubble.js</file>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]