[maemo-commits] [maemo-commits] r9308 - projects/haf/branches/hildon-fm/1.x/hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jan 24 17:17:25 EET 2007
Author: marivoll
Date: 2007-01-24 17:17:24 +0200 (Wed, 24 Jan 2007)
New Revision: 9308

Modified:
   projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.c
   projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.h
Log:
	* hildon-fm/hildon-file-system-settings.h,
	hildon-fm/hildon-file-system-settings.c
	(banner_toplevel_window, banner_toplevel_window_destroy,
	_hildon_file_system_set_banner_toplevel): New, to maintain the
	toplevel window to use with the updating banner.
	(_hildon_file_system_prepare_banner): Include XID of
	banner_toplevel_window in message.


Modified: projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.c
===================================================================
--- projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.c	2007-01-24 15:12:33 UTC (rev 9307)
+++ projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.c	2007-01-24 15:17:24 UTC (rev 9308)
@@ -42,6 +42,8 @@
 #include <libintl.h>
 #include <string.h>
 
+#include <gdk/gdkx.h>
+
 #define DBUS_API_SUBJECT_TO_CHANGE
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
@@ -882,6 +884,37 @@
 #define BANNER_HIDE "cancel_delayed_infobanner"
 #define BANNER_TIMEOUT 500
 
+/* We need to make the updating banner transient to a toplevel window
+   but the HildonFileSystemModel knows nothing about the widget that
+   it is displayed in.  Thus the HildonFileSelection widget informs us
+   when it is displayed.
+*/
+
+static GtkWindow *banner_toplevel_window = NULL;
+
+static void
+banner_toplevel_window_destroy (GtkWindow *win, gpointer unused)
+{
+  if (banner_toplevel_window == win)
+    {
+      banner_toplevel_window = NULL;
+      g_object_unref (win);
+    }
+}
+
+void
+_hildon_file_system_set_banner_toplevel (GtkWindow *win)
+{
+  if (banner_toplevel_window == NULL)
+    {
+      g_object_ref (win);
+      banner_toplevel_window = win;
+      g_signal_connect (win, "destroy",
+			G_CALLBACK (banner_toplevel_window_destroy),
+			NULL);
+    }
+}
+
 /* Communication with tasknavigator for displaying possible
    banner while making blocking calls */
 void _hildon_file_system_prepare_banner(guint *timeout_id)
@@ -892,8 +925,9 @@
   static const dbus_int32_t initial_value = 1000;
   static const dbus_int32_t display_timeout = 30000;
   const char *ckdg_pb_updating_str;
+  dbus_int32_t xid = 0;
   dbus_bool_t ret;
-
+  
   if (timeout_id == NULL) return;
 
   /* just refresh the timeout if there is already a timeout */
@@ -925,10 +959,18 @@
   if (banner_pid == 0)
     banner_pid = getpid(); /* id */
 
+  if (banner_toplevel_window)
+    {
+      GdkWindow *win = GTK_WIDGET (banner_toplevel_window)->window;
+      if (win)
+	xid = GDK_WINDOW_XID (win);
+    }
+
   ret = dbus_message_append_args(message, DBUS_TYPE_INT32, &banner_pid,
                                  DBUS_TYPE_INT32, &initial_value,
                                  DBUS_TYPE_INT32, &display_timeout,
                                  DBUS_TYPE_STRING, &ckdg_pb_updating_str,
+                                 DBUS_TYPE_INT32, &xid,
                                  DBUS_TYPE_INVALID);
   if (!ret)
   {

Modified: projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.h
===================================================================
--- projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.h	2007-01-24 15:12:33 UTC (rev 9307)
+++ projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-settings.h	2007-01-24 15:17:24 UTC (rev 9308)
@@ -36,6 +36,7 @@
 #define __HILDON_FILE_SYSTEM_SETTINGS_H__
 
 #include <glib-object.h>
+#include <gtk/gtk.h>
 
 G_BEGIN_DECLS
 
@@ -79,6 +80,7 @@
    banner while making blocking calls */
 void _hildon_file_system_prepare_banner(guint *timeout_id);
 void _hildon_file_system_cancel_banner(guint *timeout_id);
+void _hildon_file_system_set_banner_toplevel (GtkWindow *win);
 
 G_END_DECLS
 


More information about the maemo-commits mailing list