[niepce] mapmodule: minimise deprecation warnings caused by libchamplain
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] mapmodule: minimise deprecation warnings caused by libchamplain
- Date: Mon, 30 Dec 2019 23:03:49 +0000 (UTC)
commit 882eca610e96ee617dec61ec2c5942d637b7b930
Author: Hubert Figuière <hub figuiere net>
Date: Mon Dec 30 18:03:37 2019 -0500
mapmodule: minimise deprecation warnings caused by libchamplain
src/fwk/toolkit/mapcontroller.cpp | 60 ++++++++++++++++++++++++++++-----------
src/fwk/toolkit/mapcontroller.hpp | 23 ++++++---------
2 files changed, 52 insertions(+), 31 deletions(-)
---
diff --git a/src/fwk/toolkit/mapcontroller.cpp b/src/fwk/toolkit/mapcontroller.cpp
index 1599c98..2f7f109 100644
--- a/src/fwk/toolkit/mapcontroller.cpp
+++ b/src/fwk/toolkit/mapcontroller.cpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/mapcontroller.cpp
*
- * Copyright (C) 2014 Hubert Figuiere
+ * Copyright (C) 2014-2019 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,44 +25,70 @@
namespace fwk {
+class MapController::Priv {
+public:
+ Priv()
+ : m_clutter_map(nullptr)
+ {
+ }
+ ~Priv()
+ {
+ if (m_clutter_map) {
+ g_object_unref(G_OBJECT(m_clutter_map));
+ }
+ }
+ ChamplainView* m_clutter_map;
+};
+
+MapController::MapController()
+ : UiController()
+ , m_priv(new Priv)
+{
+}
+
+MapController::~MapController()
+{
+ delete m_priv;
+}
+
Gtk::Widget *
MapController::buildWidget()
{
- if(m_widget) {
- return m_widget;
- }
+ if (m_widget) {
+ return m_widget;
+ }
- auto embed = gtk_champlain_embed_new();
- m_widget = Gtk::manage(Glib::wrap(embed));
+ auto embed = gtk_champlain_embed_new();
+ m_widget = Gtk::manage(Glib::wrap(embed));
- m_clutter_map = gtk_champlain_embed_get_view(GTK_CHAMPLAIN_EMBED(embed));
- g_object_ref(G_OBJECT(m_clutter_map));
+ m_priv->m_clutter_map = gtk_champlain_embed_get_view(GTK_CHAMPLAIN_EMBED(embed));
+ g_object_ref(G_OBJECT(m_priv->m_clutter_map));
- // Default position. Somewhere over Montréal, QC
- setZoomLevel(10);
- centerOn(45.5030854,-73.5698944);
+ // Default position. Somewhere over Montréal, QC
+ setZoomLevel(10);
+ centerOn(45.5030854, -73.5698944);
- return m_widget;
+ return m_widget;
}
void MapController::centerOn(double lat, double longitude)
{
- champlain_view_center_on(m_clutter_map, lat, longitude);
+ champlain_view_center_on(m_priv->m_clutter_map, lat, longitude);
}
void MapController::zoomIn()
{
- champlain_view_zoom_in(m_clutter_map);
+ champlain_view_zoom_in(m_priv->m_clutter_map);
}
void MapController::zoomOut()
{
- champlain_view_zoom_out(m_clutter_map);
+ champlain_view_zoom_out(m_priv->m_clutter_map);
}
void MapController::setZoomLevel(uint8_t level)
{
- champlain_view_set_zoom_level(m_clutter_map, level);
+ champlain_view_set_zoom_level(m_priv->m_clutter_map, level);
}
}
@@ -71,6 +97,8 @@ void MapController::setZoomLevel(uint8_t level)
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0))
+ c-basic-offset:4
+ tab-width:4
indent-tabs-mode:nil
fill-column:99
End:
diff --git a/src/fwk/toolkit/mapcontroller.hpp b/src/fwk/toolkit/mapcontroller.hpp
index aff6f96..a5b31d7 100644
--- a/src/fwk/toolkit/mapcontroller.hpp
+++ b/src/fwk/toolkit/mapcontroller.hpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/mapcontroller.hpp
*
- * Copyright (C) 2014 Hubert Figuiere
+ * Copyright (C) 2014-2019 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,8 +19,6 @@
#pragma once
-#include <champlain-gtk/champlain-gtk.h>
-
#include "fwk/toolkit/uicontroller.hpp"
namespace fwk {
@@ -31,17 +29,9 @@ class MapController
public:
typedef std::shared_ptr<MapController> Ptr;
- MapController()
- : UiController()
- , m_clutter_map(nullptr)
- {
- }
- ~MapController()
- {
- if (m_clutter_map) {
- g_object_unref(G_OBJECT(m_clutter_map));
- }
- }
+ MapController();
+ virtual ~MapController();
+
virtual Gtk::Widget * buildWidget() override;
void centerOn(double lat, double longitude);
@@ -51,7 +41,8 @@ public:
void setZoomLevel(uint8_t level); // 1 to 20
private:
- ChamplainView* m_clutter_map;
+ class Priv;
+ Priv* m_priv;
};
@@ -61,6 +52,8 @@ private:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0))
+ c-basic-offset:4
+ tab-width:4
indent-tabs-mode:nil
fill-column:99
End:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]