[gnome-system-tools] Sync EMap widget with Evolution
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-tools] Sync EMap widget with Evolution
- Date: Tue, 13 Apr 2010 10:22:57 +0000 (UTC)
commit 5da76998b97baa08fa2c5c2561110834792d825a
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Thu Apr 8 17:28:40 2010 +0200
Sync EMap widget with Evolution
Cherry-picking commits would really be too hard, so just sync and re-apply our changes. They are actually very limited, only changing the pixmaps dir and C headers includes. Make two integers unsigned to remove warnings.
The main benefit of this update is to get rid of deprecated GTK+ symbols, to build correclty with -DGSEAL_ENABLE.
https://bugzilla.gnome.org/show_bug.cgi?id=612483
src/time/e-map/e-map.c | 854 +++++++++++++++++++++++-------------------------
src/time/e-map/e-map.h | 92 +++---
src/time/time-tool.c | 2 +-
src/time/tz-map.c | 8 +-
4 files changed, 461 insertions(+), 495 deletions(-)
---
diff --git a/src/time/e-map/e-map.c b/src/time/e-map/e-map.c
index 2a6315b..0efb81b 100644
--- a/src/time/e-map/e-map.c
+++ b/src/time/e-map/e-map.c
@@ -1,31 +1,33 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Map widget.
- *
- * Copyright (C) 2000-2001 Ximian, Inc.
- *
- * Authors: Hans Petter Jansson <hpj ximian com>
+/*
+ * Map widget (to keep in sync with Evolution).
*
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
*
* This program 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ * Hans Petter Jansson <hpj ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <math.h>
#include <stdlib.h>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <glib/gi18n.h>
#include "e-map.h"
#include "e-map-marshal.h"
@@ -34,13 +36,11 @@
#define SCROLL_STEP_SIZE 32
-
/* */
#define E_MAP_GET_WIDTH(map) gdk_pixbuf_get_width(((EMapPrivate *) E_MAP(map)->priv)->map_render_pixbuf)
#define E_MAP_GET_HEIGHT(map) gdk_pixbuf_get_height(((EMapPrivate *) E_MAP(map)->priv)->map_render_pixbuf)
-
/* Zoom state - keeps track of animation hacks */
typedef enum
@@ -52,11 +52,9 @@ typedef enum
}
EMapZoomState;
-
/* Private part of the EMap structure */
-typedef struct
-{
+struct _EMapPrivate {
/* Pointer to map image */
GdkPixbuf *map_pixbuf, *map_render_pixbuf;
@@ -67,40 +65,24 @@ typedef struct
GtkAdjustment *hadj;
GtkAdjustment *vadj;
- /* Signal ids for adjustments */
- gulong hadj_signal_id;
- gulong vadj_signal_id;
-
/* Current scrolling offsets */
- int xofs, yofs;
+ gint xofs, yofs;
/* Realtime zoom data */
EMapZoomState zoom_state;
- double zoom_target_long, zoom_target_lat;
+ gdouble zoom_target_long, zoom_target_lat;
/* Dots */
GPtrArray *points;
-}
-EMapPrivate;
-
-
-/* Signal IDs */
-
-enum
-{
- BOGUS,
- LAST_SIGNAL
};
-static guint e_map_signals[LAST_SIGNAL];
-
-
/* Internal prototypes */
static void e_map_class_init (EMapClass *class);
static void e_map_init (EMap *view);
-static void e_map_destroy (GtkObject *object);
static void e_map_finalize (GObject *object);
+static void e_map_destroy (GtkObject *object);
+static void e_map_unmap (GtkWidget *widget);
static void e_map_realize (GtkWidget *widget);
static void e_map_unrealize (GtkWidget *widget);
static void e_map_size_request (GtkWidget *widget, GtkRequisition *requisition);
@@ -112,12 +94,12 @@ static gint e_map_expose (GtkWidget *widget, GdkEventExpose *event);
static gint e_map_key_press (GtkWidget *widget, GdkEventKey *event);
static void e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustment *vadj);
-static void update_render_pixbuf (EMap *map, gboolean render_overlays);
+static void update_render_pixbuf (EMap *map, GdkInterpType interp, gboolean render_overlays);
static void set_scroll_area (EMap *view);
static void request_paint_area (EMap *view, GdkRectangle *area);
-static void center_at (EMap *map, int x, int y, gboolean scroll);
-static void smooth_center_at (EMap *map, int x, int y);
-static void scroll_to (EMap *view, int x, int y);
+static void center_at (EMap *map, gint x, gint y, gboolean scroll);
+static void smooth_center_at (EMap *map, gint x, gint y);
+static void scroll_to (EMap *view, gint x, gint y);
static void zoom_do (EMap *map);
static gint load_map_background (EMap *view, gchar *name);
static void adjustment_changed_cb (GtkAdjustment *adj, gpointer data);
@@ -127,49 +109,44 @@ static void repaint_point (EMap *map, EMapPoint *point);
static GtkWidgetClass *parent_class;
-
/* ----------------- *
* Widget management *
* ----------------- */
-
/**
* e_map_get_type:
- * @void:
- *
+ * @void:
+ *
* Registers the #EMap class if necessary, and returns the type ID
* associated to it.
- *
+ *
* Return value: The type ID of the #EMap class.
**/
GType
e_map_get_type (void)
{
- static GType e_map_type = 0;
+ static GType type = 0;
- if (!e_map_type)
- {
- static const GTypeInfo e_map_info =
- {
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
sizeof (EMapClass),
- NULL, /* base init */
- NULL, /* base finalize */
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
(GClassInitFunc) e_map_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
sizeof (EMap),
- 0,
+ 0, /* n_preallocs */
(GInstanceInitFunc) e_map_init,
- NULL, /* value table */
+ NULL /* value_table */
};
- e_map_type = g_type_register_static (GTK_TYPE_WIDGET,
- "EMap",
- &e_map_info, 0);
+ type = g_type_register_static (
+ GTK_TYPE_WIDGET, "EMap", &type_info, 0);
}
- return e_map_type;
+ return type;
}
/* Class initialization function for the map view */
@@ -177,40 +154,32 @@ e_map_get_type (void)
static void
e_map_class_init (EMapClass *class)
{
- GObjectClass *g_object_class;
+ GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- g_object_class = (GObjectClass*) class;
+ gobject_class = (GObjectClass *) class;
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
- parent_class = g_type_class_peek (GTK_TYPE_WIDGET);
+ parent_class = g_type_class_ref(GTK_TYPE_WIDGET);
+
+ gobject_class->finalize = e_map_finalize;
object_class->destroy = e_map_destroy;
-
- g_object_class->finalize = e_map_finalize;
class->set_scroll_adjustments = e_map_set_scroll_adjustments;
- widget_class->set_scroll_adjustments_signal =
- g_signal_new ("set_scroll_adjustments",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMapClass, set_scroll_adjustments),
- NULL, NULL,
- g_cclosure_user_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-/*
- g_signal_new ("set_scroll_adjustments",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMapClass, set_scroll_adjustments),
- NULL, NULL,
- _gtk_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-*/
+ widget_class->set_scroll_adjustments_signal = g_signal_new ("set_scroll_adjustments",
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMapClass, set_scroll_adjustments),
+ NULL, NULL,
+ g_cclosure_user_marshal_VOID__OBJECT_OBJECT,
+ G_TYPE_NONE, 2,
+ GTK_TYPE_ADJUSTMENT,
+ GTK_TYPE_ADJUSTMENT);
+
+ widget_class->unmap = e_map_unmap;
widget_class->realize = e_map_realize;
widget_class->unrealize = e_map_unrealize;
widget_class->size_request = e_map_size_request;
@@ -222,18 +191,19 @@ e_map_class_init (EMapClass *class)
widget_class->key_press_event = e_map_key_press;
}
-
/* Object initialization function for the map view */
static void
e_map_init (EMap *view)
{
EMapPrivate *priv;
+ gchar *map_file_name = g_build_filename (PIXMAPS_DIR, "world_map-960.png", NULL);
priv = g_new0 (EMapPrivate, 1);
view->priv = priv;
- load_map_background (view, PIXMAPS_DIR"/world_map-960.png");
+ load_map_background (view, map_file_name);
+ g_free (map_file_name);
priv->frozen = FALSE;
priv->smooth_zoom = TRUE;
priv->zoom_state = E_MAP_ZOOMED_OUT;
@@ -243,7 +213,6 @@ e_map_init (EMap *view)
GTK_WIDGET_UNSET_FLAGS (view, GTK_NO_WINDOW);
}
-
/* Destroy handler for the map view */
static void
@@ -253,19 +222,18 @@ e_map_destroy (GtkObject *object)
EMapPrivate *priv;
g_return_if_fail (object != NULL);
- g_return_if_fail (IS_E_MAP (object));
+ g_return_if_fail (E_IS_MAP (object));
view = E_MAP (object);
priv = view->priv;
- g_signal_handler_disconnect (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- g_signal_handler_disconnect (G_OBJECT (priv->vadj), priv->vadj_signal_id);
+ g_signal_handlers_disconnect_by_func (priv->hadj, adjustment_changed_cb, view);
+ g_signal_handlers_disconnect_by_func (priv->vadj, adjustment_changed_cb, view);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
-
/* Finalize handler for the map view */
static void
@@ -275,15 +243,15 @@ e_map_finalize (GObject *object)
EMapPrivate *priv;
g_return_if_fail (object != NULL);
- g_return_if_fail (IS_E_MAP (object));
+ g_return_if_fail (E_IS_MAP (object));
view = E_MAP (object);
priv = view->priv;
- g_object_unref (G_OBJECT (priv->hadj));
+ g_object_unref((priv->hadj));
priv->hadj = NULL;
- g_object_unref (G_OBJECT (priv->vadj));
+ g_object_unref((priv->vadj));
priv->vadj = NULL;
if (priv->map_pixbuf)
@@ -302,7 +270,19 @@ e_map_finalize (GObject *object)
view->priv = NULL;
if (G_OBJECT_CLASS (parent_class)->finalize)
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ (*G_OBJECT_CLASS (parent_class)->finalize) (object);
+}
+
+/* Unmap handler for the map view */
+
+static void
+e_map_unmap (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (E_IS_MAP (widget));
+
+ if (GTK_WIDGET_CLASS (parent_class)->unmap)
+ (*GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
}
/* Realize handler for the map view */
@@ -310,51 +290,58 @@ e_map_finalize (GObject *object)
static void
e_map_realize (GtkWidget *widget)
{
+ GtkAllocation allocation;
GdkWindowAttr attr;
- int attr_mask;
+ GdkWindow *window;
+ GtkStyle *style;
+ gint attr_mask;
g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
+ g_return_if_fail (E_IS_MAP (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_get_allocation (widget, &allocation);
+
attr.window_type = GDK_WINDOW_CHILD;
- attr.x = widget->allocation.x;
- attr.y = widget->allocation.y;
- attr.width = widget->allocation.width;
- attr.height = widget->allocation.height;
+ attr.x = allocation.x;
+ attr.y = allocation.y;
+ attr.width = allocation.width;
+ attr.height = allocation.height;
attr.wclass = GDK_INPUT_OUTPUT;
attr.visual = gdk_rgb_get_visual ();
attr.colormap = gdk_rgb_get_colormap ();
attr.event_mask = gtk_widget_get_events (widget) |
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK |
- GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK;
+ GDK_POINTER_MOTION_MASK;
attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attr, attr_mask);
- gdk_window_set_user_data (widget->window, widget);
+ window = gdk_window_new (
+ gtk_widget_get_parent_window (widget), &attr, attr_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
- widget->style = gtk_style_attach (widget->style, widget->window);
+ style = gtk_widget_get_style (widget);
+ style = gtk_style_attach (style, window);
+ gtk_widget_set_style (widget, style);
- gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
- update_render_pixbuf (E_MAP (widget), TRUE);
+ gdk_window_set_back_pixmap (window, NULL, FALSE);
+ update_render_pixbuf (E_MAP (widget), GDK_INTERP_BILINEAR, TRUE);
}
-
/* Unrealize handler for the map view */
static void
e_map_unrealize (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
+ g_return_if_fail (E_IS_MAP (widget));
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (*GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+ (*GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
-
/* Size_request handler for the map view */
static void
@@ -364,7 +351,7 @@ e_map_size_request (GtkWidget *widget, GtkRequisition *requisition)
EMapPrivate *priv;
g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
+ g_return_if_fail (E_IS_MAP (widget));
g_return_if_fail (requisition != NULL);
view = E_MAP (widget);
@@ -376,34 +363,32 @@ e_map_size_request (GtkWidget *widget, GtkRequisition *requisition)
requisition->height = gdk_pixbuf_get_height (priv->map_pixbuf);
}
-
/* Size_allocate handler for the map view */
static void
e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
EMap *view;
- EMapPrivate *priv;
- int xofs, yofs;
GdkRectangle area;
g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
+ g_return_if_fail (E_IS_MAP (widget));
g_return_if_fail (allocation != NULL);
view = E_MAP (widget);
- priv = view->priv;
-
- xofs = priv->xofs;
- yofs = priv->yofs;
/* Resize the window */
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
+ if (gtk_widget_get_realized (widget)) {
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+
+ gdk_window_move_resize (
+ window, allocation->x, allocation->y,
+ allocation->width, allocation->height);
area.x = 0;
area.y = 0;
@@ -412,55 +397,34 @@ e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
request_paint_area (E_MAP (widget), &area);
}
- update_render_pixbuf (view, TRUE);
+ update_render_pixbuf (view, GDK_INTERP_BILINEAR, TRUE);
}
-
/* Button press handler for the map view */
static gint
e_map_button_press (GtkWidget *widget, GdkEventButton *event)
{
- EMap *view;
- EMapPrivate *priv;
-
- view = E_MAP (widget);
- priv = view->priv;
-
- if (!GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget);
- return TRUE;
+ if (!gtk_widget_has_focus (widget)) gtk_widget_grab_focus (widget);
+ return TRUE;
}
-
/* Button release handler for the map view */
static gint
e_map_button_release (GtkWidget *widget, GdkEventButton *event)
{
- EMap *view;
- EMapPrivate *priv;
-
- view = E_MAP (widget);
- priv = view->priv;
-
if (event->button != 1) return FALSE;
gdk_pointer_ungrab (event->time);
return TRUE;
}
-
/* Motion handler for the map view */
static gint
e_map_motion (GtkWidget *widget, GdkEventMotion *event)
{
- EMap *view;
- EMapPrivate *priv;
-
- view = E_MAP (widget);
- priv = view->priv;
-
return FALSE;
/*
@@ -476,7 +440,6 @@ e_map_motion (GtkWidget *widget, GdkEventMotion *event)
*/
}
-
/* Expose handler for the map view */
static gint
@@ -485,7 +448,7 @@ e_map_expose (GtkWidget *widget, GdkEventExpose *event)
EMap *view;
g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (IS_E_MAP (widget), FALSE);
+ g_return_val_if_fail (E_IS_MAP (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
view = E_MAP (widget);
@@ -494,7 +457,6 @@ e_map_expose (GtkWidget *widget, GdkEventExpose *event)
return TRUE;
}
-
/* Set_scroll_adjustments handler for the map view */
static void
@@ -505,7 +467,7 @@ e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustm
gboolean need_adjust;
g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
+ g_return_if_fail (E_IS_MAP (widget));
view = E_MAP (widget);
priv = view->priv;
@@ -518,14 +480,18 @@ e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustm
if (priv->hadj && priv->hadj != hadj)
{
- g_signal_handler_disconnect (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- g_object_unref (G_OBJECT (priv->hadj));
+ g_signal_handlers_disconnect_by_func (priv->hadj,
+ adjustment_changed_cb,
+ view);
+ g_object_unref (priv->hadj);
}
if (priv->vadj && priv->vadj != vadj)
{
- g_signal_handler_disconnect (G_OBJECT (priv->vadj), priv->vadj_signal_id);
- g_object_unref (G_OBJECT (priv->vadj));
+ g_signal_handlers_disconnect_by_func (priv->vadj,
+ adjustment_changed_cb,
+ view);
+ g_object_unref (priv->vadj);
}
need_adjust = FALSE;
@@ -533,14 +499,10 @@ e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustm
if (priv->hadj != hadj)
{
priv->hadj = hadj;
- g_object_ref (G_OBJECT (priv->hadj));
- g_object_ref_sink (G_OBJECT (priv->hadj));
- g_object_unref (G_OBJECT (priv->hadj));
+ g_object_ref_sink (priv->hadj);
- priv->hadj_signal_id = g_signal_connect (G_OBJECT (priv->hadj),
- "value_changed",
- G_CALLBACK (adjustment_changed_cb),
- view);
+ g_signal_connect (priv->hadj, "value_changed",
+ G_CALLBACK (adjustment_changed_cb), view);
need_adjust = TRUE;
}
@@ -548,14 +510,10 @@ e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustm
if (priv->vadj != vadj)
{
priv->vadj = vadj;
- g_object_ref (G_OBJECT (priv->vadj));
- g_object_ref_sink (G_OBJECT (priv->vadj));
- g_object_unref (G_OBJECT (priv->vadj));
+ g_object_ref_sink (priv->vadj);
- priv->vadj_signal_id = g_signal_connect (G_OBJECT (priv->vadj),
- "value_changed",
- G_CALLBACK (adjustment_changed_cb),
- view);
+ g_signal_connect (priv->vadj, "value_changed",
+ G_CALLBACK (adjustment_changed_cb), view);
need_adjust = TRUE;
}
@@ -563,7 +521,6 @@ e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustm
if (need_adjust) adjustment_changed_cb (NULL, view);
}
-
/* Key press handler for the map view */
static gint
@@ -572,14 +529,11 @@ e_map_key_press (GtkWidget *widget, GdkEventKey *event)
EMap *view;
EMapPrivate *priv;
gboolean do_scroll;
- int xofs, yofs;
+ gint xofs, yofs;
view = E_MAP (widget);
priv = view->priv;
- do_scroll = FALSE;
- xofs = yofs = 0;
-
switch (event->keyval)
{
case GDK_Up:
@@ -612,89 +566,96 @@ e_map_key_press (GtkWidget *widget, GdkEventKey *event)
if (do_scroll)
{
- int x, y;
+ gint page_size;
+ gint upper;
+ gint x, y;
- x = CLAMP (priv->xofs + xofs, 0, priv->hadj->upper - priv->hadj->page_size);
- y = CLAMP (priv->yofs + yofs, 0, priv->vadj->upper - priv->vadj->page_size);
+ page_size = gtk_adjustment_get_page_size (priv->hadj);
+ upper = gtk_adjustment_get_upper (priv->hadj);
+ x = CLAMP (priv->xofs + xofs, 0, upper - page_size);
+
+ page_size = gtk_adjustment_get_page_size (priv->vadj);
+ upper = gtk_adjustment_get_upper (priv->vadj);
+ y = CLAMP (priv->yofs + yofs, 0, upper - page_size);
scroll_to (view, x, y);
- g_signal_handler_block (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- g_signal_handler_block (G_OBJECT (priv->vadj), priv->vadj_signal_id);
+ g_signal_handlers_block_matched (priv->hadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
+ g_signal_handlers_block_matched (priv->vadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
- priv->hadj->value = x;
- priv->vadj->value = y;
+ gtk_adjustment_set_value (priv->hadj, x);
+ gtk_adjustment_set_value (priv->vadj, y);
- g_signal_emit_by_name (GTK_OBJECT (priv->hadj), "value_changed");
- g_signal_emit_by_name (GTK_OBJECT (priv->vadj), "value_changed");
+ g_signal_emit_by_name (priv->hadj, "value_changed");
+ g_signal_emit_by_name (priv->vadj, "value_changed");
- g_signal_handler_unblock (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- g_signal_handler_unblock (G_OBJECT (priv->vadj), priv->vadj_signal_id);
+ g_signal_handlers_unblock_matched (priv->hadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
+ g_signal_handlers_unblock_matched (priv->vadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
}
return TRUE;
}
-
/* ---------------- *
* Widget interface *
* ---------------- */
-
/**
* e_map_new:
- * @void:
- *
+ * @void:
+ *
* Creates a new empty map widget.
- *
+ *
* Return value: A newly-created map widget.
**/
EMap *
-e_map_new ()
+e_map_new (void)
{
GtkWidget *widget;
+ AtkObject *a11y;
- widget = GTK_WIDGET (g_type_create_instance (TYPE_E_MAP));
+ widget = g_object_new (E_TYPE_MAP, NULL);
+ a11y = gtk_widget_get_accessible (widget);
+ atk_object_set_name (a11y, _("World Map"));
+ atk_object_set_role (a11y, ATK_ROLE_IMAGE);
+ atk_object_set_description (a11y, _("Mouse-based interactive map widget for selecting timezone. Keyboard users should instead select the timezone from the drop-down combination box below."));
return (E_MAP (widget));
}
-
/* --- Coordinate translation --- */
-
/* These functions translate coordinates between longitude/latitude and
* the image x/y offsets, using the equidistant cylindrical projection.
- *
+ *
* Longitude E <-180, 180]
* Latitude E <-90, 90] */
void
-e_map_window_to_world (EMap *map, double win_x, double win_y, double *world_longitude, double *world_latitude)
+e_map_window_to_world (EMap *map, gdouble win_x, gdouble win_y, gdouble *world_longitude, gdouble *world_latitude)
{
EMapPrivate *priv;
- int width, height;
+ gint width, height;
g_return_if_fail (map);
priv = map->priv;
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
- *world_longitude = (win_x + priv->xofs - (double) width / 2.0) /
- ((double) width / 2.0) * 180.0;
- *world_latitude = ((double) height / 2.0 - win_y - priv->yofs) /
- ((double) height / 2.0) * 90.0;
+ *world_longitude = (win_x + priv->xofs - (gdouble) width / 2.0) /
+ ((gdouble) width / 2.0) * 180.0;
+ *world_latitude = ((gdouble) height / 2.0 - win_y - priv->yofs) /
+ ((gdouble) height / 2.0) * 90.0;
}
-
void
-e_map_world_to_window (EMap *map, double world_longitude, double world_latitude, double *win_x, double *win_y)
+e_map_world_to_window (EMap *map, gdouble world_longitude, gdouble world_latitude, gdouble *win_x, gdouble *win_y)
{
EMapPrivate *priv;
- int width, height;
+ gint width, height;
g_return_if_fail (map);
@@ -714,38 +675,31 @@ e_map_world_to_window (EMap *map, double world_longitude, double world_latitude,
#endif
}
-
/* --- Zoom --- */
-
-double
+gdouble
e_map_get_magnification (EMap *map)
{
EMapPrivate *priv;
-
+
priv = map->priv;
if (priv->zoom_state == E_MAP_ZOOMED_IN) return 2.0;
else return 1.0;
}
-
void
-e_map_zoom_to_location (EMap *map, double longitude, double latitude)
+e_map_zoom_to_location (EMap *map, gdouble longitude, gdouble latitude)
{
EMapPrivate *priv;
- int width, height;
g_return_if_fail (map);
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
priv = map->priv;
if (priv->zoom_state == E_MAP_ZOOMED_IN) e_map_zoom_out (map);
else if (priv->zoom_state != E_MAP_ZOOMED_OUT) return;
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-
priv->zoom_state = E_MAP_ZOOMING_IN;
priv->zoom_target_long = longitude;
priv->zoom_target_lat = latitude;
@@ -753,50 +707,41 @@ e_map_zoom_to_location (EMap *map, double longitude, double latitude)
zoom_do (map);
}
-
void
e_map_zoom_out (EMap *map)
{
EMapPrivate *priv;
- int width, height;
g_return_if_fail (map);
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
priv = map->priv;
if (priv->zoom_state != E_MAP_ZOOMED_IN) return;
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-
priv->zoom_state = E_MAP_ZOOMING_OUT;
zoom_do (map);
priv->zoom_state = E_MAP_ZOOMED_OUT;
}
-
void
e_map_set_smooth_zoom (EMap *map, gboolean state)
{
((EMapPrivate *) map->priv)->smooth_zoom = state;
}
-
gboolean
e_map_get_smooth_zoom (EMap *map)
{
return (((EMapPrivate *) map->priv)->smooth_zoom);
}
-
void
e_map_freeze (EMap *map)
{
((EMapPrivate *) map->priv)->frozen = TRUE;
}
-
void
e_map_thaw (EMap *map)
{
@@ -804,12 +749,10 @@ e_map_thaw (EMap *map)
update_and_paint (map);
}
-
/* --- Point manipulation --- */
-
EMapPoint *
-e_map_add_point (EMap *map, gchar *name, double longitude, double latitude, guint32 color_rgba)
+e_map_add_point (EMap *map, gchar *name, gdouble longitude, gdouble latitude, guint32 color_rgba)
{
EMapPrivate *priv;
EMapPoint *point;
@@ -833,7 +776,6 @@ e_map_add_point (EMap *map, gchar *name, double longitude, double latitude, guin
return point;
}
-
void
e_map_remove_point (EMap *map, EMapPoint *point)
{
@@ -847,36 +789,32 @@ e_map_remove_point (EMap *map, EMapPoint *point)
/* FIXME: Re-scaling the whole pixbuf is more than a little
* overkill when just one point is removed */
- update_render_pixbuf (map, TRUE);
+ update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
repaint_point (map, point);
}
-
+
g_free (point);
}
-
void
-e_map_point_get_location (EMapPoint *point, double *longitude, double *latitude)
+e_map_point_get_location (EMapPoint *point, gdouble *longitude, gdouble *latitude)
{
*longitude = point->longitude;
*latitude = point->latitude;
}
-
gchar *
e_map_point_get_name (EMapPoint *point)
{
return point->name;
}
-
guint32
e_map_point_get_color_rgba (EMapPoint *point)
{
return point->rgba;
}
-
void
e_map_point_set_color_rgba (EMap *map, EMapPoint *point, guint32 color_rgba)
{
@@ -891,48 +829,46 @@ e_map_point_set_color_rgba (EMap *map, EMapPoint *point, guint32 color_rgba)
}
}
-
void
e_map_point_set_data (EMapPoint *point, gpointer data)
{
point->user_data = data;
}
-
gpointer
e_map_point_get_data (EMapPoint *point)
{
return point->user_data;
}
-
gboolean
e_map_point_is_in_view (EMap *map, EMapPoint *point)
{
EMapPrivate *priv;
- double x, y;
+ GtkAllocation allocation;
+ gdouble x, y;
priv = map->priv;
if (!priv->map_render_pixbuf) return FALSE;
e_map_world_to_window (map, point->longitude, point->latitude, &x, &y);
-
- if (x >= 0 && x < GTK_WIDGET (map)->allocation.width &&
- y >= 0 && y < GTK_WIDGET (map)->allocation.height)
- return TRUE;
-
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
+
+ if (x >= 0 && x < allocation.width &&
+ y >= 0 && y < allocation.height)
+ return TRUE;
+
return FALSE;
}
-
EMapPoint *
-e_map_get_closest_point (EMap *map, double longitude, double latitude, gboolean in_view)
+e_map_get_closest_point (EMap *map, gdouble longitude, gdouble latitude, gboolean in_view)
{
EMapPrivate *priv;
EMapPoint *point_chosen = NULL, *point;
- double min_dist = 0.0, dist;
- double dx, dy;
- int i;
+ gdouble min_dist = 0.0, dist;
+ gdouble dx, dy;
+ guint i;
priv = map->priv;
@@ -955,34 +891,33 @@ e_map_get_closest_point (EMap *map, double longitude, double latitude, gboolean
return point_chosen;
}
-
/* ------------------ *
* Internal functions *
* ------------------ */
-
static void
repaint_visible (EMap *map)
{
GdkRectangle area;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
area.x = 0;
area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
-
+ area.width = allocation.width;
+ area.height = allocation.height;
+
request_paint_area (map, &area);
}
-
static void
update_and_paint (EMap *map)
{
- update_render_pixbuf (map, TRUE);
+ update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
repaint_visible (map);
}
-
static gint
load_map_background (EMap *view, gchar *name)
{
@@ -992,48 +927,50 @@ load_map_background (EMap *view, gchar *name)
priv = view->priv;
pb0 = gdk_pixbuf_new_from_file (name, NULL);
-/* pb0 = tool_load_image (name);*/
- if (!pb0) return (FALSE);
+ if (!pb0)
+ return FALSE;
if (priv->map_pixbuf) g_object_unref (priv->map_pixbuf);
priv->map_pixbuf = pb0;
- update_render_pixbuf (view, TRUE);
+ update_render_pixbuf (view, GDK_INTERP_BILINEAR, TRUE);
- return (TRUE);
+ return TRUE;
}
-
static void
-update_render_pixbuf (EMap *map, gboolean render_overlays)
+update_render_pixbuf (EMap *map,
+ GdkInterpType interp,
+ gboolean render_overlays)
{
EMapPrivate *priv;
EMapPoint *point;
- int width, height, orig_width, orig_height;
- double zoom;
- int i;
+ GtkAllocation allocation;
+ gint width, height, orig_width, orig_height;
+ gdouble zoom;
+ guint i;
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (map))) return;
+ if (!gtk_widget_get_realized (GTK_WIDGET (map)))
+ return;
+
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
/* Set up value shortcuts */
priv = map->priv;
- width = GTK_WIDGET (map)->allocation.width;
- height = GTK_WIDGET (map)->allocation.height;
+ width = allocation.width;
+ height = allocation.height;
orig_width = gdk_pixbuf_get_width (priv->map_pixbuf);
orig_height = gdk_pixbuf_get_height (priv->map_pixbuf);
/* Compute scaled width and height based on the extreme dimension */
- if ((double) width / orig_width > (double) height / orig_height)
- {
- zoom = (double) width / (double) orig_width;
- }
+ if ((gdouble) width / orig_width > (gdouble) height / orig_height)
+ zoom = (gdouble) width / (gdouble) orig_width;
else
- {
- zoom = (double) height / (double) orig_height;
- }
+ zoom = (gdouble) height / (gdouble) orig_height;
- if (priv->zoom_state == E_MAP_ZOOMED_IN) zoom *= 2.0;
+ if (priv->zoom_state == E_MAP_ZOOMED_IN)
+ zoom *= 2.0;
height = (orig_height * zoom) + 0.5;
width = (orig_width * zoom) + 0.5;
@@ -1048,11 +985,11 @@ update_render_pixbuf (EMap *map, gboolean render_overlays)
if (width > 1 && height > 1)
{
gdk_pixbuf_scale (priv->map_pixbuf, priv->map_render_pixbuf, 0, 0, /* Dest (x, y) */
- width, height, 0, 0, /* Offset (x, y) */
- zoom, zoom, /* Scale (x, y) */
- GDK_INTERP_BILINEAR);
+ width, height, 0, 0, /* Offset (x, y) */
+ zoom, zoom, /* Scale (x, y) */
+ interp);
}
-
+
if (render_overlays)
{
/* Add points */
@@ -1069,17 +1006,16 @@ update_render_pixbuf (EMap *map, gboolean render_overlays)
set_scroll_area (map);
}
-
/* Queues a repaint of the specified area in window coordinates */
static void
request_paint_area (EMap *view, GdkRectangle *area)
{
EMapPrivate *priv;
- int width, height;
+ gint width, height;
- if (!GTK_WIDGET_DRAWABLE (GTK_WIDGET (view)) ||
- !GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
+ if (!gtk_widget_is_drawable (GTK_WIDGET (view)) ||
+ !gtk_widget_get_realized (GTK_WIDGET (view))) return;
priv = view->priv;
if (!priv->map_render_pixbuf) return;
@@ -1094,19 +1030,29 @@ request_paint_area (EMap *view, GdkRectangle *area)
if (priv->yofs + height > gdk_pixbuf_get_height (priv->map_render_pixbuf))
height = gdk_pixbuf_get_height (priv->map_render_pixbuf) - priv->yofs;
-
+
/* We rely on the fast case always being the case, since we load and
* preprocess the source pixbuf ourselves */
if (gdk_pixbuf_get_colorspace (priv->map_render_pixbuf) == GDK_COLORSPACE_RGB && !gdk_pixbuf_get_has_alpha (priv->map_render_pixbuf) &&
gdk_pixbuf_get_bits_per_sample (priv->map_render_pixbuf) == 8)
{
+ GtkStyle *style;
+ GdkWindow *window;
guchar *pixels;
- int rowstride;
+ gint rowstride;
+
+ style = gtk_widget_get_style (GTK_WIDGET (view));
+ window = gtk_widget_get_window (GTK_WIDGET (view));
rowstride = gdk_pixbuf_get_rowstride (priv->map_render_pixbuf);
- pixels = gdk_pixbuf_get_pixels (priv->map_render_pixbuf) + (area->y + priv->yofs) * rowstride + 3 * (area->x + priv->xofs);
- gdk_draw_rgb_image_dithalign (GTK_WIDGET (view)->window, GTK_WIDGET (view)->style->black_gc, area->x, area->y, width, height, GDK_RGB_DITHER_NORMAL, pixels, rowstride, 0, 0);
+ pixels = gdk_pixbuf_get_pixels (priv->map_render_pixbuf) +
+ (area->y + priv->yofs) * rowstride + 3 *
+ (area->x + priv->xofs);
+ gdk_draw_rgb_image_dithalign (
+ window, style->black_gc, area->x, area->y,
+ width, height, GDK_RGB_DITHER_NORMAL, pixels,
+ rowstride, 0, 0);
return;
}
@@ -1143,7 +1089,6 @@ put_pixel_with_clipping (GdkPixbuf *pixbuf, gint x, gint y, guint rgba)
}
}
-
/* Redraw point in client pixbuf */
static void
@@ -1151,16 +1096,12 @@ update_render_point (EMap *map, EMapPoint *point)
{
EMapPrivate *priv;
GdkPixbuf *pb;
- int width, height;
- double px, py;
+ gdouble px, py;
priv = map->priv;
pb = priv->map_render_pixbuf;
if (!pb) return;
- width = gdk_pixbuf_get_width (pb);
- height = gdk_pixbuf_get_height (pb);
-
e_map_world_to_window (map, point->longitude, point->latitude, &px, &py);
px += priv->xofs;
py += priv->yofs;
@@ -1181,99 +1122,92 @@ update_render_point (EMap *map, EMapPoint *point)
put_pixel_with_clipping (pb, px + 1, py + 1, 0x000000ff);
}
-
/* Repaint point on X server */
static void
repaint_point (EMap *map, EMapPoint *point)
{
- EMapPrivate *priv;
GdkRectangle area;
- double px, py;
+ gdouble px, py;
- if (!e_map_point_is_in_view (map, point)) return;
- priv = map->priv;
+ if (!e_map_point_is_in_view (map, point)) return;
e_map_world_to_window (map, point->longitude, point->latitude, &px, &py);
- area.x = (int) px - 2;
- area.y = (int) py - 2;
+ area.x = (gint) px - 2;
+ area.y = (gint) py - 2;
area.width = 5;
area.height = 5;
request_paint_area (map, &area);
}
-
static void
-center_at (EMap *map, int x, int y, gboolean scroll)
+center_at (EMap *map, gint x, gint y, gboolean scroll)
{
EMapPrivate *priv;
- int pb_width, pb_height,
- view_width, view_height;
+ GtkAllocation allocation;
+ gint pb_width, pb_height;
priv = map->priv;
pb_width = E_MAP_GET_WIDTH (map);
pb_height = E_MAP_GET_HEIGHT (map);
- view_width = GTK_WIDGET (map)->allocation.width;
- view_height = GTK_WIDGET (map)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
- x = CLAMP (x - (view_width / 2), 0, pb_width - view_width);
- y = CLAMP (y - (view_height / 2), 0, pb_height - view_height);
+ x = CLAMP (x - (allocation.width / 2), 0, pb_width - allocation.width);
+ y = CLAMP (y - (allocation.height / 2), 0, pb_height - allocation.height);
- if (scroll) scroll_to (map, x, y);
- else
- {
+ if (scroll)
+ scroll_to (map, x, y);
+ else {
priv->xofs = x;
priv->yofs = y;
}
}
-
static void
-smooth_center_at (EMap *map, int x, int y)
+smooth_center_at (EMap *map, gint x, gint y)
{
EMapPrivate *priv;
- int pb_width, pb_height,
- view_width, view_height;
- int dx, dy;
+ GtkAllocation allocation;
+ gint pb_width, pb_height;
+ gint dx, dy;
priv = map->priv;
pb_width = E_MAP_GET_WIDTH (map);
pb_height = E_MAP_GET_HEIGHT (map);
- view_width = GTK_WIDGET (map)->allocation.width;
- view_height = GTK_WIDGET (map)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
- x = CLAMP (x - (view_width / 2), 0, pb_width - view_width);
- y = CLAMP (y - (view_height / 2), 0, pb_height - view_height);
+ x = CLAMP (x - (allocation.width / 2), 0, pb_width - allocation.width);
+ y = CLAMP (y - (allocation.height / 2), 0, pb_height - allocation.height);
for (;;)
{
- if (priv->xofs == x && priv->yofs == y) break;
+ if (priv->xofs == x && priv->yofs == y)
+ break;
dx = (x < priv->xofs) ? -1 : (x > priv->xofs) ? 1 : 0;
dy = (y < priv->yofs) ? -1 : (y > priv->yofs) ? 1 : 0;
-
+
scroll_to (map, priv->xofs + dx, priv->yofs + dy);
}
}
-
/* Scrolls the view to the specified offsets. Does not perform range checking! */
static void
-scroll_to (EMap *view, int x, int y)
+scroll_to (EMap *view, gint x, gint y)
{
EMapPrivate *priv;
- int xofs, yofs;
+ gint xofs, yofs;
GdkWindow *window;
+ GtkAllocation allocation;
GdkGC *gc;
- int width, height;
- int src_x, src_y;
- int dest_x, dest_y;
+ gint src_x, src_y;
+ gint dest_x, dest_y;
#if 0 /* see comment below */
GdkEvent *event;
#endif
@@ -1285,30 +1219,31 @@ scroll_to (EMap *view, int x, int y)
xofs = x - priv->xofs;
yofs = y - priv->yofs;
- if (xofs == 0 && yofs == 0) return;
+ if (xofs == 0 && yofs == 0)
+ return;
priv->xofs = x;
priv->yofs = y;
- if (!GTK_WIDGET_DRAWABLE (view)) return;
+ if (!gtk_widget_is_drawable (GTK_WIDGET (view)))
+ return;
- width = GTK_WIDGET (view)->allocation.width;
- height = GTK_WIDGET (view)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
- if (abs (xofs) >= width || abs (yofs) >= height)
+ if (abs (xofs) >= allocation.width || abs (yofs) >= allocation.height)
{
GdkRectangle area;
area.x = 0;
area.y = 0;
- area.width = width;
- area.height = height;
+ area.width = allocation.width;
+ area.height = allocation.height;
request_paint_area (view, &area);
return;
}
- window = GTK_WIDGET (view)->window;
+ window = gtk_widget_get_window (GTK_WIDGET (view));
/* Copy the window area */
@@ -1320,7 +1255,12 @@ scroll_to (EMap *view, int x, int y)
gc = gdk_gc_new (window);
gdk_gc_set_exposures (gc, TRUE);
- gdk_draw_drawable (window, gc, window, src_x, src_y, dest_x, dest_y, width - abs (xofs), height - abs (yofs));
+ gdk_draw_drawable (
+ GDK_DRAWABLE (window),
+ gc, GDK_DRAWABLE (window),
+ src_x, src_y, dest_x, dest_y,
+ allocation.width - abs (xofs),
+ allocation.height - abs (yofs));
g_object_unref (gc);
@@ -1330,10 +1270,10 @@ scroll_to (EMap *view, int x, int y)
{
GdkRectangle r;
- r.x = xofs < 0 ? 0 : width - xofs;
+ r.x = xofs < 0 ? 0 : allocation.width - xofs;
r.y = 0;
r.width = abs (xofs);
- r.height = height;
+ r.height = allocation.height;
request_paint_area (view, &r);
}
@@ -1343,8 +1283,8 @@ scroll_to (EMap *view, int x, int y)
GdkRectangle r;
r.x = 0;
- r.y = yofs < 0 ? 0 : height - yofs;
- r.width = width;
+ r.y = yofs < 0 ? 0 : allocation.height - yofs;
+ r.width = allocation.width;
r.height = abs (yofs);
request_paint_area (view, &r);
@@ -1372,8 +1312,7 @@ scroll_to (EMap *view, int x, int y)
#endif
}
-
-static int divide_seq[] =
+static gint divide_seq[] =
{
/* Dividends for divisor of 2 */
@@ -1448,7 +1387,6 @@ static int divide_seq[] =
0
};
-
typedef enum
{
AXIS_X,
@@ -1456,7 +1394,6 @@ typedef enum
}
AxisType;
-
static void
blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x, gint target_y, gint total_width, gint total_height, gfloat zoom_factor)
{
@@ -1468,8 +1405,7 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
gint divide_width_index, divide_height_index;
gint area_width, area_height;
gint i, j;
- int line;
-
+ gint line;
/* Set up the GC we'll be using */
@@ -1478,7 +1414,7 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
/* Get area constraints */
- gdk_drawable_get_size (window, &area_width, &area_height);
+ gdk_drawable_get_size (GDK_DRAWABLE (window), &area_width, &area_height);
/* Initialize area division array indexes */
@@ -1497,14 +1433,14 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
if (area_width > area_height)
{
strong_axis = AXIS_X;
- axis_factor = (double) area_height / (double) area_width;
+ axis_factor = (gdouble) area_height / (gdouble) area_width;
zoom_chunk = MAX (1, area_width / 250);
i = (area_width * (zoom_factor - 1.0)) / zoom_chunk;
}
else
{
strong_axis = AXIS_Y;
- axis_factor = (double) area_width / (double) area_height;
+ axis_factor = (gdouble) area_width / (gdouble) area_height;
zoom_chunk = MAX (1, area_height / 250);
i = (area_height * (zoom_factor - 1.0)) / zoom_chunk;
}
@@ -1536,9 +1472,9 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
/* Push left */
for (j = 0; j < zoom_chunk - 1; j++)
- gdk_draw_drawable (window, gc, window, line, 0, line + j +1, 0, 1, area_height);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_DRAWABLE (window), line, 0, line + j + 1, 0, 1, area_height);
- gdk_draw_drawable (window, gc, window, zoom_chunk, 0, 0, 0, line, area_height);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_DRAWABLE (window), zoom_chunk, 0, 0, 0, line, area_height);
if (line > target_x) target_x -= zoom_chunk;
}
else
@@ -1546,9 +1482,9 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
/* Push right */
for (j = 0; j < zoom_chunk - 1; j++)
- gdk_draw_drawable (window, gc, window, line - zoom_chunk, 0, line + j - (zoom_chunk - 1), 0, 1, area_height);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_DRAWABLE (window), line - zoom_chunk, 0, line + j - (zoom_chunk - 1), 0, 1, area_height);
- gdk_draw_drawable (window, gc, window, line - zoom_chunk, 0, line, 0, area_width - line, area_height);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_DRAWABLE (window), line - zoom_chunk, 0, line, 0, area_width - line, area_height);
if (line < target_x) target_x += zoom_chunk;
}
}
@@ -1564,9 +1500,9 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
/* Push up */
for (j = 0; j < zoom_chunk - 1; j++)
- gdk_draw_drawable (window, gc, window, 0, line, 0, line + j + 1, area_width, 1);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_DRAWABLE (window), 0, line, 0, line + j + 1, area_width, 1);
- gdk_draw_drawable (window, gc, window, 0, zoom_chunk, 0, 0, area_width, line);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_DRAWABLE (window), 0, zoom_chunk, 0, 0, area_width, line);
if (line > target_y) target_y -= zoom_chunk;
}
else
@@ -1574,9 +1510,9 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
/* Push down */
for (j = 0; j < zoom_chunk - 1; j++)
- gdk_draw_drawable (window, gc, window, 0, line - zoom_chunk, 0, line + j - (zoom_chunk - 1), area_width, 1);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_WINDOW (window), 0, line - zoom_chunk, 0, line + j - (zoom_chunk - 1), area_width, 1);
- gdk_draw_drawable (window, gc, window, 0, line - zoom_chunk, 0, line, area_width, area_height - line);
+ gdk_draw_drawable (GDK_DRAWABLE (window), gc, GDK_DRAWABLE (window), 0, line - zoom_chunk, 0, line, area_width, area_height - line);
if (line < target_y) target_y += zoom_chunk;
}
}
@@ -1592,62 +1528,58 @@ blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x,
g_object_unref (gc);
}
-
static void
zoom_in_smooth (EMap *map)
{
+ GtkAllocation allocation;
GdkRectangle area;
EMapPrivate *priv;
GdkWindow *window;
- int width, height;
- int win_width, win_height;
- int target_width, target_height;
- double x, y;
+ gint width, height;
+ gdouble x, y;
g_return_if_fail (map);
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
+
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
area.x = 0;
area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
+ area.width = allocation.width;
+ area.height = allocation.height;
priv = map->priv;
- window = GTK_WIDGET (map)->window;
+ window = gtk_widget_get_window (GTK_WIDGET (map));
width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
- win_width = GTK_WIDGET (map)->allocation.width;
- win_height = GTK_WIDGET (map)->allocation.height;
- target_width = win_width / 4;
- target_height = win_height / 4;
/* Center the target point as much as possible */
-
+
e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
smooth_center_at (map, x + priv->xofs, y + priv->yofs);
/* Render and paint a temporary map without overlays, so they don't get in
* the way (look ugly) while zooming */
-
- update_render_pixbuf (map, FALSE);
+
+ update_render_pixbuf (map, GDK_INTERP_BILINEAR, FALSE);
request_paint_area (map, &area);
-
+
/* Find out where in the area we're going to zoom to */
e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
-
+
/* Pre-render the zoomed-in map, so we can put it there quickly when the
* blowup sequence ends */
-
+
priv->zoom_state = E_MAP_ZOOMED_IN;
- update_render_pixbuf (map, TRUE);
-
+ update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
+
/* Do the blowup */
-
+
blowup_window_area (window, priv->xofs, priv->yofs, x, y, width, height, 1.68);
/* Set new scroll offsets and paint the zoomed map */
-
+
e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
priv->xofs = CLAMP (priv->xofs + x - area.width / 2.0, 0, E_MAP_GET_WIDTH (map) - area.width);
priv->yofs = CLAMP (priv->yofs + y - area.height / 2.0, 0, E_MAP_GET_HEIGHT (map) - area.height);
@@ -1655,55 +1587,66 @@ zoom_in_smooth (EMap *map)
request_paint_area (map, &area);
}
-
static void
zoom_in (EMap *map)
{
+ GtkAllocation allocation;
GdkRectangle area;
EMapPrivate *priv;
- double x, y;
+ gdouble x, y;
priv = map->priv;
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
+
area.x = 0;
area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
+ area.width = allocation.width;
+ area.height = allocation.height;
priv->zoom_state = E_MAP_ZOOMED_IN;
- update_render_pixbuf (map, TRUE);
+ update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
- e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
- priv->xofs = CLAMP (priv->xofs + x - area.width / 2.0, 0, E_MAP_GET_WIDTH (map) - area.width);
- priv->yofs = CLAMP (priv->yofs + y - area.height / 2.0, 0, E_MAP_GET_HEIGHT (map) - area.height);
+ e_map_world_to_window (
+ map, priv->zoom_target_long,
+ priv->zoom_target_lat, &x, &y);
+ priv->xofs = CLAMP (
+ priv->xofs + x - area.width / 2.0,
+ 0, E_MAP_GET_WIDTH (map) - area.width);
+ priv->yofs = CLAMP (
+ priv->yofs + y - area.height / 2.0,
+ 0, E_MAP_GET_HEIGHT (map) - area.height);
request_paint_area (map, &area);
}
-
static void
zoom_out (EMap *map)
{
+ GtkAllocation allocation;
GdkRectangle area;
EMapPrivate *priv;
- double longitude, latitude;
- double x, y;
+ gdouble longitude, latitude;
+ gdouble x, y;
priv = map->priv;
+ gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
+
area.x = 0;
area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
+ area.width = allocation.width;
+ area.height = allocation.height;
/* Must be done before update_render_pixbuf() */
- e_map_window_to_world (map, area.width / 2, area.height / 2,
- &longitude, &latitude);
+ e_map_window_to_world (
+ map, area.width / 2, area.height / 2,
+ &longitude, &latitude);
priv->zoom_state = E_MAP_ZOOMED_OUT;
- update_render_pixbuf (map, TRUE);
+ update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
e_map_world_to_window (map, longitude, latitude, &x, &y);
center_at (map, x + priv->xofs, y + priv->yofs, FALSE);
@@ -1711,16 +1654,14 @@ zoom_out (EMap *map)
repaint_visible (map);
}
-
static void
zoom_do (EMap *map)
{
EMapPrivate *priv;
priv = map->priv;
-
- g_signal_handler_block (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- g_signal_handler_block (G_OBJECT (priv->vadj), priv->vadj_signal_id);
+ g_signal_handlers_block_matched (priv->hadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, map);
+ g_signal_handlers_block_matched (priv->vadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, map);
if (priv->zoom_state == E_MAP_ZOOMING_IN)
{
@@ -1729,83 +1670,94 @@ zoom_do (EMap *map)
}
else if (priv->zoom_state == E_MAP_ZOOMING_OUT)
{
- /* if (e_map_get_smooth_zoom(map)) zoom_out_smooth(map); */
+/* if (e_map_get_smooth_zoom(map)) zoom_out_smooth(map); */
zoom_out (map);
}
- g_signal_handler_unblock (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- g_signal_handler_unblock (G_OBJECT (priv->vadj), priv->vadj_signal_id);
+ g_signal_handlers_unblock_matched (priv->hadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, map);
+ g_signal_handlers_unblock_matched (priv->vadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, map);
set_scroll_area(map);
}
-
/* Callback used when an adjustment is changed */
static void
adjustment_changed_cb (GtkAdjustment *adj, gpointer data)
{
EMap *view;
- EMapPrivate *priv;
+ gint hadj_value;
+ gint vadj_value;
view = E_MAP (data);
- priv = view->priv;
- scroll_to (view, priv->hadj->value, priv->vadj->value);
-}
+ hadj_value = gtk_adjustment_get_value (view->priv->hadj);
+ vadj_value = gtk_adjustment_get_value (view->priv->vadj);
+ scroll_to (view, hadj_value, vadj_value);
+}
static void
set_scroll_area (EMap *view)
{
EMapPrivate *priv;
+ GtkAllocation allocation;
+ gint upper, page_size;
priv = view->priv;
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
+ if (!gtk_widget_get_realized (GTK_WIDGET (view))) return;
if (!priv->hadj || !priv->vadj) return;
+ g_object_freeze_notify (G_OBJECT (priv->hadj));
+ g_object_freeze_notify (G_OBJECT (priv->vadj));
+
+ gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
+
/* Set scroll increments */
- priv->hadj->page_size = GTK_WIDGET (view)->allocation.width;
- priv->hadj->page_increment = GTK_WIDGET (view)->allocation.width / 2;
- priv->hadj->step_increment = SCROLL_STEP_SIZE;
+ gtk_adjustment_set_page_size (priv->hadj, allocation.width);
+ gtk_adjustment_set_page_increment (priv->hadj, allocation.width / 2);
+ gtk_adjustment_set_step_increment (priv->hadj, SCROLL_STEP_SIZE);
- priv->vadj->page_size = GTK_WIDGET (view)->allocation.height;
- priv->vadj->page_increment = GTK_WIDGET (view)->allocation.height / 2;
- priv->vadj->step_increment = SCROLL_STEP_SIZE;
+ gtk_adjustment_set_page_size (priv->vadj, allocation.height);
+ gtk_adjustment_set_page_increment (priv->vadj, allocation.height / 2);
+ gtk_adjustment_set_step_increment (priv->vadj, SCROLL_STEP_SIZE);
/* Set scroll bounds and new offsets */
- priv->hadj->lower = 0;
- if (priv->map_render_pixbuf)
- priv->hadj->upper = gdk_pixbuf_get_width (priv->map_render_pixbuf);
-
- priv->vadj->lower = 0;
- if (priv->map_render_pixbuf)
- priv->vadj->upper = gdk_pixbuf_get_height (priv->map_render_pixbuf);
+ gtk_adjustment_set_lower (priv->hadj, 0);
+ if (priv->map_render_pixbuf) {
+ gint width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
+ gtk_adjustment_set_upper (priv->hadj, width);
+ }
- g_signal_emit_by_name(G_OBJECT(priv->hadj), "changed");
- g_signal_emit_by_name(G_OBJECT(priv->vadj), "changed");
+ gtk_adjustment_set_lower (priv->vadj, 0);
+ if (priv->map_render_pixbuf) {
+ gint height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
+ gtk_adjustment_set_upper (priv->vadj, height);
+ }
- priv->xofs = CLAMP (priv->xofs, 0, priv->hadj->upper - priv->hadj->page_size);
- priv->yofs = CLAMP (priv->yofs, 0, priv->vadj->upper - priv->vadj->page_size);
+ g_object_thaw_notify (G_OBJECT (priv->hadj));
+ g_object_thaw_notify (G_OBJECT (priv->vadj));
- if (priv->hadj->value != priv->xofs)
- {
- priv->hadj->value = priv->xofs;
+ upper = gtk_adjustment_get_upper (priv->hadj);
+ page_size = gtk_adjustment_get_page_size (priv->hadj);
+ priv->xofs = CLAMP (priv->xofs, 0, upper - page_size);
- g_signal_handler_block (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- g_signal_emit_by_name (GTK_OBJECT (priv->hadj), "value_changed");
- g_signal_handler_unblock (G_OBJECT (priv->hadj), priv->hadj_signal_id);
- }
+ upper = gtk_adjustment_get_upper (priv->vadj);
+ page_size = gtk_adjustment_get_page_size (priv->vadj);
+ priv->yofs = CLAMP (priv->yofs, 0, upper - page_size);
- if (priv->vadj->value != priv->yofs)
- {
- priv->vadj->value = priv->yofs;
+ g_signal_handlers_block_matched (
+ priv->hadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
+ gtk_adjustment_set_value (priv->hadj, priv->xofs);
+ g_signal_handlers_unblock_matched (
+ priv->hadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
- g_signal_handler_block (G_OBJECT (priv->vadj), priv->vadj_signal_id);
- g_signal_emit_by_name (GTK_OBJECT (priv->vadj), "value_changed");
- g_signal_handler_unblock (G_OBJECT (priv->vadj), priv->vadj_signal_id);
- }
+ g_signal_handlers_block_matched (
+ priv->vadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
+ gtk_adjustment_set_value (priv->vadj, priv->yofs);
+ g_signal_handlers_unblock_matched (
+ priv->vadj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
}
diff --git a/src/time/e-map/e-map.h b/src/time/e-map/e-map.h
index 4376b0d..9914208 100644
--- a/src/time/e-map/e-map.h
+++ b/src/time/e-map/e-map.h
@@ -1,23 +1,25 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Map widget.
+/*
*
- * Copyright (C) 2000-2001 Ximian, Inc.
- *
- * Authors: Hans Petter Jansson <hpj ximian com>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
*
* This program 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ * Hans Petter Jansson <hpj ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef E_MAP_H
@@ -25,26 +27,38 @@
#include <gtk/gtk.h>
-#define TYPE_E_MAP (e_map_get_type ())
-#define E_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_E_MAP, EMap))
-#define E_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_E_MAP, EMapClass))
-#define IS_E_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_E_MAP))
-#define IS_E_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_E_MAP))
+/* Standard GObject macros */
+#define E_TYPE_MAP \
+ (e_map_get_type ())
+#define E_MAP(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAP, EMap))
+#define E_MAP_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAP, EMapClass))
+#define E_IS_MAP(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAP))
+#define E_IS_MAP_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAP))
+#define E_MAP_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAP, EMapClass))
+
+G_BEGIN_DECLS
typedef struct _EMap EMap;
typedef struct _EMapClass EMapClass;
+typedef struct _EMapPrivate EMapPrivate;
typedef struct _EMapPoint EMapPoint;
-struct _EMap
-{
+struct _EMap {
GtkWidget widget;
-
- /* Private data */
- gpointer priv;
+ EMapPrivate *priv;
};
-struct _EMapClass
-{
+struct _EMapClass {
GtkWidgetClass parent_class;
/* Notification signals */
@@ -58,15 +72,13 @@ struct _EMapClass
/* The definition of Dot */
-struct _EMapPoint
-{
+struct _EMapPoint {
gchar *name; /* Can be NULL */
- double longitude, latitude;
+ gdouble longitude, latitude;
guint32 rgba;
gpointer user_data;
};
-
/* --- Widget --- */
GType e_map_get_type (void);
@@ -83,19 +95,19 @@ void e_map_thaw (EMap *map);
/* Translates window-relative coords to lat/long */
void e_map_window_to_world (EMap *map,
- double win_x, double win_y,
- double *world_longitude, double *world_latitude);
+ gdouble win_x, gdouble win_y,
+ gdouble *world_longitude, gdouble *world_latitude);
/* Translates lat/long to window-relative coordinates. Note that the
* returned coordinates can be negative or greater than the current size
* of the allocation area */
void e_map_world_to_window (EMap *map,
- double world_longitude, double world_latitude,
- double *win_x, double *win_y);
+ gdouble world_longitude, gdouble world_latitude,
+ gdouble *win_x, gdouble *win_y);
/* --- Zoom --- */
-double e_map_get_magnification (EMap *map);
+gdouble e_map_get_magnification (EMap *map);
/* Pass TRUE if we want the smooth zoom hack */
void e_map_set_smooth_zoom (EMap *map, gboolean state);
@@ -104,7 +116,7 @@ void e_map_set_smooth_zoom (EMap *map, gboolean state);
gboolean e_map_get_smooth_zoom (EMap *map);
/* NB: Function definition will change shortly */
-void e_map_zoom_to_location (EMap *map, double longitude, double latitude);
+void e_map_zoom_to_location (EMap *map, gdouble longitude, gdouble latitude);
/* Zoom to mag factor 1.0 */
void e_map_zoom_out (EMap *map);
@@ -112,13 +124,13 @@ void e_map_zoom_out (EMap *map);
/* --- Points --- */
EMapPoint *e_map_add_point (EMap *map, gchar *name,
- double longitude, double latitude,
+ gdouble longitude, gdouble latitude,
guint32 color_rgba);
void e_map_remove_point (EMap *map, EMapPoint *point);
void e_map_point_get_location (EMapPoint *point,
- double *longitude, double *latitude);
+ gdouble *longitude, gdouble *latitude);
gchar *e_map_point_get_name (EMapPoint *point);
@@ -132,7 +144,9 @@ gpointer e_map_point_get_data (EMapPoint *point);
gboolean e_map_point_is_in_view (EMap *map, EMapPoint *point);
-EMapPoint *e_map_get_closest_point (EMap *map, double longitude, double latitude,
+EMapPoint *e_map_get_closest_point (EMap *map, gdouble longitude, gdouble latitude,
gboolean in_view);
+G_END_DECLS
+
#endif
diff --git a/src/time/time-tool.c b/src/time/time-tool.c
index f36895d..cf9767f 100644
--- a/src/time/time-tool.c
+++ b/src/time/time-tool.c
@@ -347,7 +347,7 @@ init_timezone (GstTimeTool *time_tool)
GtkWidget *w;
GtkCellRenderer *cell;
GPtrArray *locs;
- int i;
+ guint i;
time_tool->tzmap = e_tz_map_new (tool);
g_return_if_fail (time_tool->tzmap != NULL);
diff --git a/src/time/tz-map.c b/src/time/tz-map.c
index ba0fd02..a345aa6 100644
--- a/src/time/tz-map.c
+++ b/src/time/tz-map.c
@@ -59,7 +59,7 @@ e_tz_map_new (GstTool *tool)
GPtrArray *locs;
TzLocation *tzl;
GtkWidget *location_combo;
- int i;
+ guint i;
tzmap = g_new0 (ETzMap, 1);
tzmap->tool = GST_TOOL (tool);
@@ -140,7 +140,7 @@ e_tz_map_get_location_by_name (ETzMap *tzmap, const gchar *name)
TzLocation *tz_loc = NULL;
TzDB *tz_db;
GPtrArray *locs;
- int i;
+ guint i;
tz_db = e_tz_map_get_tz_db (tzmap);
locs = tz_get_locations (tz_db);
@@ -195,7 +195,7 @@ e_tz_map_set_tz_from_name (ETzMap *tzmap, const gchar *name)
TzDB *tz_db;
GPtrArray *locs;
double l_longitude = 0.0, l_latitude = 0.0;
- int i;
+ guint i;
g_return_if_fail (tzmap != NULL);
@@ -269,7 +269,7 @@ e_tz_map_location_from_point (ETzMap *tzmap, EMapPoint *point)
GPtrArray *locs;
double p_longitude, p_latitude;
double l_longitude, l_latitude;
- int i;
+ guint i;
tz_db = e_tz_map_get_tz_db (tzmap);
locs = tz_get_locations (tz_db);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]