[maemo-commits] [maemo-commits] r13120 - in projects/haf/trunk/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Aug 10 16:36:34 EEST 2007
Author: jobi
Date: 2007-08-10 16:36:31 +0300 (Fri, 10 Aug 2007)
New Revision: 13120

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-desktop.c
Log:

2007-08-10  Johan Bilien  <johan.bilien at nokia.com>

	* src/hd-desktop.c: add a weak reference to the window
	when creating a ping note, so the note can be destroyed
	when the window is removed.
	Fixes: NB#65383



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-10 13:33:50 UTC (rev 13119)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-10 13:36:31 UTC (rev 13120)
@@ -1,5 +1,12 @@
 2007-08-10  Johan Bilien  <johan.bilien at nokia.com>
 
+	* src/hd-desktop.c: add a weak reference to the window
+	when creating a ping note, so the note can be destroyed
+	when the window is removed.
+	Fixes: NB#65383
+
+2007-08-10  Johan Bilien  <johan.bilien at nokia.com>
+
 	* libhildondesktop/hildon-desktop-home-item.c:
 	- fixed adding the settings menu to the context-sensitive menu
 

Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-08-10 13:33:50 UTC (rev 13119)
+++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-08-10 13:36:31 UTC (rev 13120)
@@ -123,21 +123,23 @@
 hd_desktop_launch_banner_close (GtkWidget *parent, HDDesktopBannerInfo *info);
 
 static void
-hd_desktop_ping_timeout_dialog_response (GtkDialog *note, gint ret, gpointer data)
+hd_desktop_ping_timeout_dialog_response (GtkDialog *note,
+                                         gint ret,
+                                         gpointer data)
 {
   HDWMWindow *win = (HDWMWindow *)data;
 
-  /* This is for NB#64333: If the application recover once the dialog 
-   * has been shown we end up having the situation where we try to kill an 
+  /* This is for NB#64333: If the application recover once the dialog
+   * has been shown we end up having the situation where we try to kill an
    * application that has already been gone, hence destroyed.
    */
 
   if (!HD_WM_IS_WINDOW (win))
-  {	  
+  {
     gtk_widget_destroy (GTK_WIDGET(note));
     return;
   }
-	  
+
   HDWMApplication *app = hd_wm_window_get_application (win);
 
   gtk_widget_destroy (GTK_WIDGET(note));
@@ -145,13 +147,22 @@
 
   if (ret == GTK_RESPONSE_OK)
   {
-    /* Kill the app */	  
+    /* Kill the app */
     if (!hd_wm_window_attempt_signal_kill (win, SIGKILL, FALSE))
       g_debug ("hd_wm_ping_timeout:failed to kill application '%s'.", hd_wm_window_get_name (win));
   }
 }
 
 static void
+destroy_note (HDWMApplication *app)
+{
+  GtkWidget *note;
+  note = GTK_WIDGET (hd_wm_application_get_ping_timeout_note (app));
+  gtk_widget_destroy (note);
+  hd_wm_application_set_ping_timeout_note (app, NULL);
+}
+
+static void
 hd_desktop_application_frozen (HDWM *hdwm, HDWMWindow *win, gpointer data)
 {
   GtkWidget *note;
@@ -159,12 +170,12 @@
 
   HDWMApplication *app = hd_wm_window_get_application (win);
 
-  gchar *timeout_message = 
+  gchar *timeout_message =
     g_strdup_printf (HD_DESKTOP_PING_TIMEOUT_MESSAGE_STRING, hd_wm_window_get_name (win));
 
   /* FIXME: Do we need to check if the note already exists? */
   note = GTK_WIDGET (hd_wm_application_get_ping_timeout_note (app));
-  
+
   if (note && GTK_IS_WIDGET (note))
   {
     g_debug ("hd_wm_ping_timeout: the note already exists.");
@@ -174,6 +185,7 @@
   note = hildon_note_new_confirmation (NULL, timeout_message);
 
   hd_wm_application_set_ping_timeout_note (app, G_OBJECT (note));
+  g_object_weak_ref (G_OBJECT (win), (GWeakNotify)destroy_note, app);
 
   hildon_note_set_button_texts (HILDON_NOTE (note),
                                 HD_DESKTOP_PING_TIMEOUT_BUTTON_OK_STRING,


More information about the maemo-commits mailing list