Sort headers using clang-tidy
[geeqie.git] / src / bar-gps.cc
index a0d2951..b17e006 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "main.h"
+#include <config.h>
+
 #ifdef HAVE_LIBCHAMPLAIN
 #ifdef HAVE_LIBCHAMPLAIN_GTK
 
 #include "bar-gps.h"
 
 #include "bar.h"
+#include "compat.h"
+#include "debug.h"
 #include "filedata.h"
+#include "intl.h"
 #include "layout.h"
-#include "metadata.h"
+#include "main-defines.h"
 #include "menu.h"
+#include "metadata.h"
 #include "misc.h"
 #include "rcfile.h"
 #include "thumb.h"
 #include "ui-menu.h"
-#include "uri-utils.h"
 #include "ui-utildlg.h"
+#include "uri-utils.h"
 
-#include <clutter-gtk/clutter-gtk.h>
-#include <champlain/champlain.h>
 #include <champlain-gtk/champlain-gtk.h>
+#include <champlain/champlain.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #define MARKER_COLOUR 0x00, 0x00, 0xff, 0xff
 #define TEXT_COLOUR 0x00, 0x00, 0x00, 0xff
@@ -132,10 +137,14 @@ static void bar_pane_gps_close_save_cb(GenericDialog *, gpointer data)
 {
        PaneGPSData *pgd;
        GenericDialog *gd;
-       FileData *fd, *fd_found;
-       GList *work, *list;
-       gint count, geocoded_count;
-       gdouble latitude, longitude;
+       FileData *fd;
+       FileData *fd_found;
+       GList *work;
+       GList *list;
+       gint count;
+       gint geocoded_count;
+       gdouble latitude;
+       gdouble longitude;
        GString *message;
        gchar *location;
        gchar **latlong;
@@ -289,15 +298,18 @@ static void bar_pane_gps_thumb_error_cb(ThumbLoader *tl, gpointer)
 static gboolean bar_pane_gps_marker_keypress_cb(GtkWidget *widget, ClutterButtonEvent *bevent, gpointer)
 {
        FileData *fd;
-       ClutterActor *label_marker, *parent_marker;
+       ClutterActor *label_marker;
+       ClutterActor *parent_marker;
        ClutterColor marker_colour = { MARKER_COLOUR };
        ClutterColor text_colour = { TEXT_COLOUR };
        ClutterColor thumb_colour = { THUMB_COLOUR };
        gchar *current_text;
-       ClutterActor *actor, *direction;
+       ClutterActor *actor;
+       ClutterActor *direction;
        ClutterActor *current_image;
        GString *text;
-       gint height, width;
+       gint height;
+       gint width;
        GdkPixbufRotation rotate;
        gchar *altitude = nullptr;
        ThumbLoader *tl;
@@ -327,7 +339,7 @@ static gboolean bar_pane_gps_marker_keypress_cb(GtkWidget *widget, ClutterButton
                         * If not, call the thumb_loader to generate a thumbnail and update the marker later in the
                         * thumb_loader callback
                         */
-                        if (fd->thumb_pixbuf != nullptr)
+                       if (fd->thumb_pixbuf != nullptr)
                                {
                                actor = gtk_clutter_texture_new();
                                gtk_clutter_texture_set_from_pixbuf(GTK_CLUTTER_TEXTURE(actor), fd->thumb_pixbuf, nullptr);
@@ -425,7 +437,8 @@ static gboolean bar_pane_gps_create_markers_cb(gpointer data)
        gdouble longitude;
        gdouble compass;
        FileData *fd;
-       ClutterActor *parent_marker, *label_marker;
+       ClutterActor *parent_marker;
+       ClutterActor *label_marker;
        ClutterActor *direction;
        ClutterColor marker_colour = { MARKER_COLOUR };
        ClutterColor thumb_colour = { THUMB_COLOUR };
@@ -501,7 +514,7 @@ static gboolean bar_pane_gps_create_markers_cb(gpointer data)
                        champlain_bounding_box_get_center(pgd->bbox, &latitude, &longitude);
                        champlain_view_go_to(CHAMPLAIN_VIEW(pgd->gps_view), latitude, longitude);
                        }
-                else if (pgd->num_added > 1)
+               else if (pgd->num_added > 1)
                        {
                        champlain_view_ensure_visible(CHAMPLAIN_VIEW(pgd->gps_view), pgd->bbox, TRUE);
                        }
@@ -664,7 +677,8 @@ static void bar_pane_gps_write_config(GtkWidget *pane, GString *outstr, gint ind
        const gchar *map_id;
        gdouble position;
        gint int_position;
-       gint w, h;
+       gint w;
+       gint h;
 
        pgd = static_cast<PaneGPSData *>(g_object_get_data(G_OBJECT(pane), "pane_data"));
        if (!pgd) return;
@@ -872,12 +886,14 @@ static gboolean bar_pane_gps_map_keypress_cb(GtkWidget *, GdkEventButton *bevent
                gtk_menu_popup_at_pointer(GTK_MENU(menu), nullptr);
                return TRUE;
                }
-       else if (bevent->button == MOUSE_BUTTON_MIDDLE)
+
+       if (bevent->button == MOUSE_BUTTON_MIDDLE)
                {
                bar_pane_gps_map_centreing(pgd);
                return TRUE;
                }
-       else if (bevent->button == MOUSE_BUTTON_LEFT)
+
+       if (bevent->button == MOUSE_BUTTON_LEFT)
                {
                clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
                geo_coords = g_strdup_printf("%lf %lf",
@@ -891,10 +907,8 @@ static gboolean bar_pane_gps_map_keypress_cb(GtkWidget *, GdkEventButton *bevent
 
                return TRUE;
                }
-       else
-               {
-               return FALSE;
-               }
+
+       return FALSE;
 }
 #endif
 
@@ -922,9 +936,13 @@ GtkWidget *bar_pane_gps_new(const gchar *id, const gchar *title, const gchar *ma
                                        gboolean expanded, gint height)
 {
        PaneGPSData *pgd;
-       GtkWidget *vbox, *frame;
+       GtkWidget *vbox;
+       GtkWidget *frame;
        GtkWidget *gpswidget;
-       GtkWidget *status, *state, *progress, *slider;
+       GtkWidget *status;
+       GtkWidget *state;
+       GtkWidget *progress;
+       GtkWidget *slider;
        ChamplainMarkerLayer *layer;
        ChamplainView *view;
        const gchar *slider_list[] = {GQ_ICON_ZOOM_IN, GQ_ICON_ZOOM_OUT, nullptr};
@@ -1077,8 +1095,10 @@ void bar_pane_gps_update_from_config(GtkWidget *pane, const gchar **attribute_na
 {
        PaneGPSData *pgd;
        gint zoom;
-       gint int_longitude, int_latitude;
-       gdouble longitude, latitude;
+       gint int_longitude;
+       gint int_latitude;
+       gdouble longitude;
+       gdouble latitude;
 
        pgd = static_cast<PaneGPSData *>(g_object_get_data(G_OBJECT(pane), "pane_data"));
        if (!pgd)
@@ -1108,13 +1128,13 @@ void bar_pane_gps_update_from_config(GtkWidget *pane, const gchar **attribute_na
                        }
                if (READ_INT_CLAMP_FULL("longitude", int_longitude, -90000000, +90000000))
                        {
-                       longitude = int_longitude / 1000000;
+                       longitude = int_longitude / 1000000.0;
                        g_object_set(G_OBJECT(CHAMPLAIN_VIEW(pgd->gps_view)), "longitude", longitude, NULL);
                        continue;
                        }
                if (READ_INT_CLAMP_FULL("latitude", int_latitude, -90000000, +90000000))
                        {
-                       latitude = int_latitude / 1000000;
+                       latitude = int_latitude / 1000000.0;
                        g_object_set(G_OBJECT(CHAMPLAIN_VIEW(pgd->gps_view)), "latitude", latitude, NULL);
                        continue;
                        }