diff options
author | Tomasz Sterna <tomek@xiaoka.com> | 2012-01-16 01:48:40 +0100 |
---|---|---|
committer | Tomasz Sterna <tomek@xiaoka.com> | 2012-05-30 23:10:21 +0300 |
commit | 2603dde466c82ed60c41f9540a68f803d3510bf5 (patch) | |
tree | 3b018bcddbf6495b391a6fa324ff38c5eb8a8ea5 /hildon/hildon-banner.c | |
parent | 66b5569ee4af3c6044c8e94b749fe8f22659a24a (diff) |
Widget porting to GTK+ 3
with some added fixes for strict compiler checks
Diffstat (limited to 'hildon/hildon-banner.c')
-rw-r--r-- | hildon/hildon-banner.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/hildon/hildon-banner.c b/hildon/hildon-banner.c index 8339866..305d46c 100644 --- a/hildon/hildon-banner.c +++ b/hildon/hildon-banner.c @@ -144,8 +144,8 @@ hildon_banner_get_property (GObject *object, GParamSpec *pspec); static void -hildon_banner_destroy (GtkObject *object); - +hildon_banner_destroy (GtkWidget *object); + static GObject* hildon_banner_real_get_instance (GObject *window, gboolean timed); @@ -261,10 +261,10 @@ simulate_close (GtkWidget* widget) we simulate clicking the close button of the window. This allows applications to reuse the banner by prevent closing it etc */ - if (GTK_WIDGET_DRAWABLE (widget)) + if (gtk_widget_is_drawable (widget)) { GdkEvent *event = gdk_event_new (GDK_DELETE); - event->any.window = g_object_ref (widget->window); + event->any.window = g_object_ref (gtk_widget_get_window (widget)); event->any.send_event = FALSE; result = gtk_widget_event (widget, event); gdk_event_free (event); @@ -274,11 +274,12 @@ simulate_close (GtkWidget* widget) } static void -hildon_banner_size_request (GtkWidget *self, - GtkRequisition *req) +hildon_banner_get_preferred_width (GtkWidget *self, + gint *minimal_width, + gint *natural_width) { - GTK_WIDGET_CLASS (hildon_banner_parent_class)->size_request (self, req); - req->width = gdk_screen_get_width (gtk_widget_get_screen (self)); + GTK_WIDGET_CLASS (hildon_banner_parent_class)->get_preferred_width (self, minimal_width, natural_width); + *natural_width = gdk_screen_get_width (gtk_widget_get_screen (self)); } static gboolean @@ -406,7 +407,7 @@ hildon_banner_get_property (GObject *object, } static void -hildon_banner_destroy (GtkObject *object) +hildon_banner_destroy (GtkWidget *object) { HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (object); g_assert (priv); @@ -434,8 +435,8 @@ hildon_banner_destroy (GtkObject *object) (void) hildon_banner_clear_timeout (self); - if (GTK_OBJECT_CLASS (hildon_banner_parent_class)->destroy) - GTK_OBJECT_CLASS (hildon_banner_parent_class)->destroy (object); + if (GTK_WIDGET_CLASS (hildon_banner_parent_class)->destroy) + GTK_WIDGET_CLASS (hildon_banner_parent_class)->destroy (object); } /* Search a previous banner instance */ @@ -644,7 +645,7 @@ screen_size_changed (GdkScreen *screen, { HildonBanner *hbanner = HILDON_BANNER (banner); banner_set_label_size_request (hbanner); - if (GTK_WIDGET_VISIBLE (banner)) { + if (gtk_widget_get_visible (GTK_WIDGET (banner))) { hildon_banner_bind_style (hbanner); reshow_banner (hbanner); } @@ -661,15 +662,15 @@ hildon_banner_realize (GtkWidget *widget) HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (widget); g_assert (priv); - /* We let the parent to init widget->window before we need it */ + /* We let the parent to init gtk_widget_get_window (widget) before we need it */ if (GTK_WIDGET_CLASS (hildon_banner_parent_class)->realize) GTK_WIDGET_CLASS (hildon_banner_parent_class)->realize (widget); /* We use special hint to turn the banner into information notification. */ - gdk_window_set_type_hint (widget->window, GDK_WINDOW_TYPE_HINT_NOTIFICATION); + gdk_window_set_type_hint (gtk_widget_get_window (widget), GDK_WINDOW_TYPE_HINT_NOTIFICATION); gtk_window_set_transient_for (GTK_WINDOW (widget), (GtkWindow *) priv->parent); - gdkwin = widget->window; + gdkwin = gtk_widget_get_window (widget); /* Set the _HILDON_NOTIFICATION_TYPE property so Matchbox places the window correctly */ atom = gdk_atom_intern ("_HILDON_NOTIFICATION_TYPE", FALSE); @@ -721,12 +722,13 @@ hildon_banner_class_init (HildonBannerClass *klass) object_class->finalize = hildon_banner_finalize; object_class->set_property = hildon_banner_set_property; object_class->get_property = hildon_banner_get_property; - GTK_OBJECT_CLASS (klass)->destroy = hildon_banner_destroy; - widget_class->size_request = hildon_banner_size_request; + + widget_class->get_preferred_width = hildon_banner_get_preferred_width; widget_class->map_event = hildon_banner_map_event; widget_class->realize = hildon_banner_realize; widget_class->unrealize = hildon_banner_unrealize; widget_class->button_press_event = hildon_banner_button_press_event; + widget_class->destroy = hildon_banner_destroy; /* Install properties. We need construct properties for singleton purposes */ @@ -868,7 +870,7 @@ hildon_banner_set_override_flag (HildonBanner *banner) { guint32 state = 1; - gdk_property_change (GTK_WIDGET (banner)->window, + gdk_property_change (gtk_widget_get_window (GTK_WIDGET (banner)), gdk_atom_intern_static_string ("_HILDON_DO_NOT_DISTURB_OVERRIDE"), gdk_x11_xatom_to_atom (XA_INTEGER), 32, @@ -1081,7 +1083,7 @@ hildon_banner_set_text (HildonBanner *self, banner_do_set_text (self, text, FALSE); - if (GTK_WIDGET_VISIBLE (self)) + if (gtk_widget_get_visible (GTK_WIDGET (self))) reshow_banner (self); } @@ -1101,7 +1103,7 @@ hildon_banner_set_markup (HildonBanner *self, banner_do_set_text (self, markup, TRUE); - if (GTK_WIDGET_VISIBLE (self)) + if (gtk_widget_get_visible (GTK_WIDGET (self))) reshow_banner (self); } |