[maemo-commits] [maemo-commits] r15318 - in projects/haf/trunk/hildon-1: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Mar 25 11:52:10 EET 2008
- Previous message: [maemo-commits] r15317 - in projects/haf/trunk/hildon-1: . src
- Next message: [maemo-commits] r15319 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: herzi Date: 2008-03-25 11:52:06 +0200 (Tue, 25 Mar 2008) New Revision: 15318 Modified: projects/haf/trunk/hildon-1/ChangeLog projects/haf/trunk/hildon-1/src/hildon-banner.c Log: 2008-03-25 Sven Herzberg <sven at imendio.com> Fixes: MB#1212: Hide info banners (infoprints) on click * src/hildon-banner.c: (simulate_close), (hildon_banner_timeout): extracted the close event simulation into an extra function (hildon_banner_button_press_event): simulate a close event and destroy the widget if the event wasn't handled (hildon_banner_class_init): added the button_press_event handler (hildon_banner_init): added button-press events to the widget Modified: projects/haf/trunk/hildon-1/ChangeLog =================================================================== --- projects/haf/trunk/hildon-1/ChangeLog 2008-03-25 08:02:17 UTC (rev 15317) +++ projects/haf/trunk/hildon-1/ChangeLog 2008-03-25 09:52:06 UTC (rev 15318) @@ -1,5 +1,16 @@ 2008-03-25 Sven Herzberg <sven at imendio.com> + Fixes: MB#1212: Hide info banners (infoprints) on click + + * src/hildon-banner.c: (simulate_close), (hildon_banner_timeout): + extracted the close event simulation into an extra function + (hildon_banner_button_press_event): simulate a close event and destroy + the widget if the event wasn't handled + (hildon_banner_class_init): added the button_press_event handler + (hildon_banner_init): added button-press events to the widget + +2008-03-25 Sven Herzberg <sven at imendio.com> + Fixes: MB:#924: Hildon widgets doesn't support RTL mode Patch from: Mohammad Anwari <mdamt at maemo.org> Modified: projects/haf/trunk/hildon-1/src/hildon-banner.c =================================================================== --- projects/haf/trunk/hildon-1/src/hildon-banner.c 2008-03-25 08:02:17 UTC (rev 15317) +++ projects/haf/trunk/hildon-1/src/hildon-banner.c 2008-03-25 09:52:06 UTC (rev 15318) @@ -133,6 +133,10 @@ static void hildon_banner_finalize (GObject *object); +static gboolean +hildon_banner_button_press_event (GtkWidget* widget, + GdkEventButton* event); + static gboolean hildon_banner_map_event (GtkWidget *widget, GdkEventAny *event); @@ -164,11 +168,6 @@ hildon_banner_get_instance_for_widget (GtkWidget *widget, gboolean timed); -static gint -hildon_banner_delete_event (GtkWidget *widget, - GdkEvent *event); - - G_DEFINE_TYPE (HildonBanner, hildon_banner, GTK_TYPE_WINDOW) /* copy/paste from old infoprint implementation: Use matchbox @@ -276,11 +275,31 @@ } /* In timeout function we automatically destroy timed banners */ +static gboolean +simulate_close (GtkWidget* widget) +{ + gboolean result = FALSE; + + /* If the banner is currently visible (it normally should), + 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)) + { + GdkEvent *event = gdk_event_new (GDK_DELETE); + event->any.window = g_object_ref (widget->window); + event->any.send_event = FALSE; + result = gtk_widget_event (widget, event); + gdk_event_free (event); + } + + return result; +} + static gboolean hildon_banner_timeout (gpointer data) { GtkWidget *widget; - GdkEvent *event; gboolean continue_timeout = FALSE; GDK_THREADS_ENTER (); @@ -290,18 +309,7 @@ widget = GTK_WIDGET (data); g_object_ref (widget); - /* If the banner is currently visible (it normally should), - 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)) - { - event = gdk_event_new (GDK_DELETE); - event->any.window = g_object_ref (widget->window); - event->any.send_event = FALSE; - continue_timeout = gtk_widget_event (widget, event); - gdk_event_free (event); - } + continue_timeout = simulate_close (widget); if (! continue_timeout) { HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (data); @@ -544,6 +552,21 @@ G_OBJECT_CLASS (hildon_banner_parent_class)->finalize (object); } +static gboolean +hildon_banner_button_press_event (GtkWidget* widget, + GdkEventButton* event) +{ + gboolean result = simulate_close (widget); + + if (!result) { + /* signal emission not stopped - basically behave like + * gtk_main_do_event() for a delete event */ + gtk_widget_destroy (widget); + } + + return result; +} + /* We start the timer for timed notifications after the window appears on screen */ static gboolean hildon_banner_map_event (GtkWidget *widget, @@ -682,6 +705,7 @@ GTK_OBJECT_CLASS (klass)->destroy = hildon_banner_destroy; widget_class->map_event = hildon_banner_map_event; widget_class->realize = hildon_banner_realize; + widget_class->button_press_event = hildon_banner_button_press_event; #if defined(MAEMO_GTK) widget_class->client_event = hildon_banner_client_event; #endif @@ -754,6 +778,8 @@ #if defined(MAEMO_GTK) gtk_window_set_is_temporary (GTK_WINDOW (self), TRUE); #endif + + gtk_widget_add_events (GTK_WIDGET (self), GDK_BUTTON_PRESS_MASK); } /* Makes sure that icon/progress item contains the desired type
- Previous message: [maemo-commits] r15317 - in projects/haf/trunk/hildon-1: . src
- Next message: [maemo-commits] r15319 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]