[gnome-internet-radio-locator] GNOME Internet Radio Locator version 11.10 (Geoclue locatable view)



commit d0206f2f095b37e1ad1b3f7ead951ad2ea9f5828
Author: Ole Aamot <ole gnome org>
Date:   Thu Jun 17 19:22:38 2021 +0200

    GNOME Internet Radio Locator version 11.10 (Geoclue locatable view)

 NEWS                                 |   8 +++
 configure.ac                         |   7 ++-
 gnome-internet-radio-locator.spec.in |   4 ++
 src/gnome-internet-radio-locator.c   | 113 +++++++++++++++++++++++++++++++++--
 src/gnome-internet-radio-locator.xml |   2 +-
 5 files changed, 124 insertions(+), 10 deletions(-)
---
diff --git a/NEWS b/NEWS
index 4081772..3d2b3c6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+=============
+Version 11.10
+=============
+
+GUI
+
+       * src/gnome-internet-radio-locator.c: Use Geoclue to locate view.
+
 =============
 Version 5.0.3
 =============
diff --git a/configure.ac b/configure.ac
index aac2e38..3ff81a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT(gnome-internet-radio-locator,10.0.1)
+AC_INIT(gnome-internet-radio-locator,11.10)
 AM_INIT_AUTOMAKE([-Wno-portability 1.11 no-dist-gzip dist-xz tar-ustar subdir-objects])
 AM_MAINTAINER_MODE
 AC_CONFIG_SRCDIR([src/gnome-internet-radio-locator.c])
@@ -97,11 +97,12 @@ PKG_CHECK_MODULES(GNOME_INTERNET_RADIO_LOCATOR,
                  gstreamer-plugins-bad-1.0 \
                  gstreamer-plugins-base-1.0 \
                  gtk+-3.0 >= 3.24.28 \
-                 libgeoclue-2.0 >= 0.29.1 \
+                 geoclue-2.0 >= 2.5.7 \
+                 libgeoclue-2.0 >= 2.5.7 \
                  libxml-2.0 >= 2.0 \
                  pangoft2 >= 0.28)
 
-GNOME_INTERNET_RADIO_LOCATOR_PKG_DEPS="champlain-gtk-0.12 geocode-glib-1.0 glib-2.0 gobject-2.0 
gstreamer-1.0 gstreamer-player-1.0 gstreamer-plugins-bad-1.0 gstreamer-plugins-base-1.0 
gstreamer-plugins-good-1.0 gstreamer-video-1.0 gtk+-3.0 libgeoclue-2.0 libxml-2.0 pangoft2"
+GNOME_INTERNET_RADIO_LOCATOR_PKG_DEPS="champlain-gtk-0.12 geocode-glib-1.0 glib-2.0 gobject-2.0 
gstreamer-1.0 gstreamer-player-1.0 gstreamer-plugins-bad-1.0 gstreamer-plugins-base-1.0 
gstreamer-plugins-good-1.0 gstreamer-video-1.0 gtk+-3.0 geoclue-2.0 libgeoclue-2.0 libxml-2.0 pangoft2"
 
 GTK_DOC_CHECK([1.16], [--flavour no-tmpl])
 
diff --git a/gnome-internet-radio-locator.spec.in b/gnome-internet-radio-locator.spec.in
index 689cc1d..299d438 100644
--- a/gnome-internet-radio-locator.spec.in
+++ b/gnome-internet-radio-locator.spec.in
@@ -23,6 +23,7 @@ Requires:       gstreamer1 >= 1.8.3
 Requires:       gstreamer1-plugins-ugly-free >= 1.8.3
 Requires:       geocode-glib >= 3.20.1
 Requires:       gtk3 >= 3.24.28
+Requires:       geoclue2 >= 2.5.7
 
 %description
 GNOME Internet Radio Locator is a Free Software program that allows
@@ -58,6 +59,9 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
 %{_mandir}/man1/%{name}.1*
 
 %changelog
+* Thu Jun 17 2021 Ole Aamot <ole gnome org> - 10.0.2-1
+- gnome-internet-radio-locator 10.0.2 build on Fedora Linux 34
+
 * Sat May 15 2021 Ole Aamot <ole gnome org> - 5.0.2-1
 - gnome-internet-radio-locator 5.0.2 build on Fedora Linux 34
 
diff --git a/src/gnome-internet-radio-locator.c b/src/gnome-internet-radio-locator.c
index 9d00420..a981c7b 100644
--- a/src/gnome-internet-radio-locator.c
+++ b/src/gnome-internet-radio-locator.c
@@ -127,6 +127,58 @@ GClueSimple *simple = NULL;
 GClueClient *client = NULL;
 GMainLoop *main_loop;
 
+static void
+print_location (GClueSimple *simple)
+{
+        GClueLocation *location;
+        gdouble altitude, speed, heading;
+        GVariant *timestamp;
+        GTimeVal tv = { 0 };
+        const char *desc;
+
+        location = gclue_simple_get_location (simple);
+        g_print ("\nNew location:\n");
+        g_print ("Latitude:    %f°\nLongitude:   %f°\nAccuracy:    %f meters\n",
+                 gclue_location_get_latitude (location),
+                 gclue_location_get_longitude (location),
+                 gclue_location_get_accuracy (location));
+
+       champlain_view_center_on (CHAMPLAIN_VIEW (view),
+                                 gclue_location_get_latitude (location),
+                                 gclue_location_get_longitude (location));
+       
+        altitude = gclue_location_get_altitude (location);
+        if (altitude != -G_MAXDOUBLE)
+                g_print ("Altitude:    %f meters\n", altitude);
+        speed = gclue_location_get_speed (location);
+        if (speed >= 0)
+                g_print ("Speed:       %f meters/second\n", speed);
+        heading = gclue_location_get_heading (location);
+        if (heading >= 0)
+                g_print ("Heading:     %f°\n", heading);
+
+        desc = gclue_location_get_description (location);
+        if (strlen (desc) > 0)
+                g_print ("Description: %s\n", desc);
+
+        timestamp = gclue_location_get_timestamp (location);
+        if (timestamp) {
+                GDateTime *date_time;
+                gchar *str;
+
+                g_variant_get (timestamp, "(tt)", &tv.tv_sec, &tv.tv_usec);
+
+                date_time = g_date_time_new_from_timeval_local (&tv);
+                str = g_date_time_format
+                      (date_time,
+                       "%c (%s seconds since the Epoch)");
+                g_date_time_unref (date_time);
+
+                g_print ("Timestamp:   %s\n", str);
+                g_free (str);
+        }
+}
+
 static gboolean
 on_location_timeout (gpointer user_data)
 {
@@ -835,6 +887,51 @@ on_search_matches(GtkEntryCompletion *widget,
        return FALSE;
 }
 
+
+static void
+on_client_active_notify (GClueClient *client,
+                         GParamSpec *pspec,
+                         gpointer    user_data)
+{
+        if (gclue_client_get_active (client))
+                return;
+
+        g_print ("Geolocation disabled. Quitting..\n");
+        on_location_timeout (NULL);
+}
+
+static void
+on_simple_ready (GObject      *source_object,
+                 GAsyncResult *res,
+                 gpointer      user_data)
+{
+        GError *error = NULL;
+
+        simple = gclue_simple_new_finish (res, &error);
+        if (error != NULL) {
+            g_critical ("Failed to connect to GeoClue2 service: %s", error->message);
+
+            exit (-1);
+        }
+        client = gclue_simple_get_client (simple);
+        if (client) {
+                g_object_ref (client);
+                g_print ("Client object: %s\n",
+                         g_dbus_proxy_get_object_path (G_DBUS_PROXY (client)));
+
+                g_signal_connect (client,
+                                  "notify::active",
+                                  G_CALLBACK (on_client_active_notify),
+                                  NULL);
+        }
+        print_location (simple);
+
+        g_signal_connect (simple,
+                          "notify::location",
+                          G_CALLBACK (print_location),
+                          user_data);
+}
+
 int
 main (int argc,
       char **argv)
@@ -879,7 +976,7 @@ main (int argc,
 
        g_object_set (G_OBJECT (view),
                      "kinetic-mode", TRUE,
-                     "zoom-level", 6,
+                     "zoom-level", 3,
                      NULL);
 
        g_object_set_data (G_OBJECT (view), "window", window);
@@ -899,11 +996,15 @@ main (int argc,
        license_actor = champlain_view_get_license_actor (view);
        champlain_license_set_extra_text (license_actor, "Free Internet Radio");
        /* FIXME: New Haven, Connecticut */
-       champlain_view_center_on (CHAMPLAIN_VIEW (view), 41.298434349999994,-72.93102342707913);
-       /* location = gclue_simple_get_location (simple); */
-       /* champlain_view_center_on (CHAMPLAIN_VIEW (view), */
-       /*                        gclue_location_get_latitude (location), */
-       /*                        gclue_location_get_longitude (location)); */
+       // champlain_view_center_on (CHAMPLAIN_VIEW (view), 41.298434349999994,-72.93102342707913);
+       gclue_simple_new ("gnome-internet-radio-locator",
+                         accuracy_level,
+                         time_threshold,
+                         on_simple_ready,
+                         CHAMPLAIN_VIEW (view));
+       
+       // location = gclue_simple_get_location (simple);
+       
        layer = create_marker_layer (view, &path);
        champlain_view_add_layer (view, CHAMPLAIN_LAYER (path));
        champlain_view_add_layer (view, CHAMPLAIN_LAYER (layer));
diff --git a/src/gnome-internet-radio-locator.xml b/src/gnome-internet-radio-locator.xml
index 2c3795f..0be036d 100644
--- a/src/gnome-internet-radio-locator.xml
+++ b/src/gnome-internet-radio-locator.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet type="text/xsl" 
href="https://people.gnome.org/~ole/gnome-internet-radio-locator/gnome-internet-radio-locator.xsl"; ?>
 <!DOCTYPE gnome_internet_radio_locator SYSTEM "gnome-internet-radio-locator-5.0.dtd">
-<gnome_internet_radio_locator version="10.0.1">
+<gnome_internet_radio_locator version="11.10">
   <station band="Online" id="bbcradio1" name="BBC - Radio 1" rank="1.0" type="gov">
     <location>United Kingdom</location>
     <stream mime="audio/mpeg" uri="http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one"; codec="MPEG 1 Audio, 
Layer 3 (MP3)" samplerate="24000 Hz" channels="Stereo" bitrate="56 kbps" />


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