aboutsummaryrefslogtreecommitdiff
path: root/libmap/cc-timezone-map.c
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-06-15 10:44:57 -0400
committerMichael Terry <mike@mterry.name>2011-06-15 10:44:57 -0400
commit7f2f5fbb5d6df00f9697bd604b437bbd250cf528 (patch)
tree5dda9b9d7f68c22776a812726adc36b697298a6a /libmap/cc-timezone-map.c
parent7b878caf9f39ee8d8a799f6454e079e35fe2a962 (diff)
downloadayatana-indicator-datetime-7f2f5fbb5d6df00f9697bd604b437bbd250cf528.tar.gz
ayatana-indicator-datetime-7f2f5fbb5d6df00f9697bd604b437bbd250cf528.tar.bz2
ayatana-indicator-datetime-7f2f5fbb5d6df00f9697bd604b437bbd250cf528.zip
finish port to gtk3
Diffstat (limited to 'libmap/cc-timezone-map.c')
-rw-r--r--libmap/cc-timezone-map.c52
1 files changed, 9 insertions, 43 deletions
diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c
index 7b7d704..5ce1354 100644
--- a/libmap/cc-timezone-map.c
+++ b/libmap/cc-timezone-map.c
@@ -601,7 +601,6 @@ cc_timezone_map_finalize (GObject *object)
}
/* GtkWidget functions */
-#ifdef CCGTK3
static void
cc_timezone_map_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -634,25 +633,6 @@ cc_timezone_map_get_preferred_height (GtkWidget *widget,
*natural = size;
}
-#else
-
-static void
-cc_timezone_map_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
-
- if (!requisition)
- return;
-
- /* The + 20 here is a slight tweak to make the map fill the
- * panel better without causing horizontal growing
- */
- requisition->height = 300 * gdk_pixbuf_get_height (priv->orig_background) / gdk_pixbuf_get_width (priv->orig_background) + 20;
- requisition->width = 300;
-}
-#endif
-
static void
cc_timezone_map_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
@@ -853,21 +833,6 @@ cc_timezone_map_draw (GtkWidget *widget,
return TRUE;
}
-#ifndef CCGTK3
-static gboolean
-cc_timezone_map_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- gboolean rv;
- cairo_t *cr;
- cr = gdk_cairo_create (widget->window);
- rv = cc_timezone_map_draw (widget, cr);
- cairo_destroy (cr);
- return rv;
-}
-#endif
-
-
static void
cc_timezone_map_class_init (CcTimezoneMapClass *klass)
{
@@ -881,19 +846,11 @@ cc_timezone_map_class_init (CcTimezoneMapClass *klass)
object_class->dispose = cc_timezone_map_dispose;
object_class->finalize = cc_timezone_map_finalize;
-#ifdef CCGTK3
widget_class->get_preferred_width = cc_timezone_map_get_preferred_width;
widget_class->get_preferred_height = cc_timezone_map_get_preferred_height;
-#else
- widget_class->size_request = cc_timezone_map_size_request;
-#endif
widget_class->size_allocate = cc_timezone_map_size_allocate;
widget_class->realize = cc_timezone_map_realize;
-#ifdef CCGTK3
widget_class->draw = cc_timezone_map_draw;
-#else
- widget_class->expose_event = cc_timezone_map_expose_event;
-#endif
signals[LOCATION_CHANGED] = g_signal_new ("location-changed",
CC_TYPE_TIMEZONE_MAP,
@@ -1015,6 +972,13 @@ button_press_event (GtkWidget *widget,
}
static void
+state_flags_changed (GtkWidget *widget)
+{
+ // To catch sensitivity changes
+ gtk_widget_queue_draw (widget);
+}
+
+static void
load_backward_tz (CcTimezoneMap *self)
{
GError *error = NULL;
@@ -1108,6 +1072,8 @@ cc_timezone_map_init (CcTimezoneMap *self)
g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event),
NULL);
+ g_signal_connect (self, "state-flags-changed", G_CALLBACK (state_flags_changed),
+ NULL);
load_backward_tz (self);
}