[maemo-commits] [maemo-commits] r10233 - in projects/haf/trunk/hildon-desktop: . debian libhildonwm src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Feb 27 17:52:30 EET 2007
Author: lucasr
Date: 2007-02-27 17:52:29 +0200 (Tue, 27 Feb 2007)
New Revision: 10233

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/configure.ac
   projects/haf/trunk/hildon-desktop/debian/control
   projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am
   projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
   projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h
   projects/haf/trunk/hildon-desktop/src/Makefile.am
   projects/haf/trunk/hildon-desktop/src/hd-desktop.c
   projects/haf/trunk/hildon-desktop/src/hn-others-button.c
   projects/haf/trunk/hildon-desktop/src/main.c
Log:
2007-02-27  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-desktop.c, src/hn-others-button.c, libhildonwm/hd-wm.[ch],
	src/Makefile.am, libhildonwm/Makefile.am: get rid of hildon-base-lib 
	by using gnome-vfs file monitoring instead of dnotify.
	* src/main.c: initialize gnome-vfs.
	* debian/control: remove hildon-base-libs-dev build dependency.
	* configure.ac: remove hildon-base-lib dependency check.


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-02-27 15:52:29 UTC (rev 10233)
@@ -1,3 +1,12 @@
+2007-02-27  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-desktop.c, src/hn-others-button.c, libhildonwm/hd-wm.[ch],
+	src/Makefile.am, libhildonwm/Makefile.am: get rid of hildon-base-lib 
+	by using gnome-vfs file monitoring instead of dnotify.
+	* src/main.c: initialize gnome-vfs.
+	* debian/control: remove hildon-base-libs-dev build dependency.
+	* configure.ac: remove hildon-base-lib dependency check.
+
 2007-02-27  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/hildon-desktop-notification-manager.c:

Modified: projects/haf/trunk/hildon-desktop/configure.ac
===================================================================
--- projects/haf/trunk/hildon-desktop/configure.ac	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/configure.ac	2007-02-27 15:52:29 UTC (rev 10233)
@@ -104,10 +104,6 @@
 AC_SUBST(OSSO_HELP_CFLAGS)
 AC_SUBST(OSSO_HELP_LIBS)
 
-PKG_CHECK_MODULES(HILDONBASELIB, hildon-base-lib >= 0.7.4)
-AC_SUBST(HILDONBASELIB_LIBS)
-AC_SUBST(HILDONBASELIB_CFLAGS)
-
 PKG_CHECK_MODULES(HILDON,
                   [hildon-1], 
                   [AC_DEFINE(HAVE_LIBHILDON, [], [Whether libhildon-1 is present on the system])], 

Modified: projects/haf/trunk/hildon-desktop/debian/control
===================================================================
--- projects/haf/trunk/hildon-desktop/debian/control	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/debian/control	2007-02-27 15:52:29 UTC (rev 10233)
@@ -2,7 +2,7 @@
 Section: x11
 Priority: optional
 Maintainer: Johan Bilien <johan.bilien at nokia.com>
-Build-Depends: debhelper (>= 4.0.0), libhildon1-dev, pkg-config, libosso-dev (>= 0.9.19), libosso-gnomevfs2-dev, osso-af-settings, libhildonfm2-dev, libosso-help-dev, libxtst-dev, libxml2-dev, osso-esd-dev, hildon-base-lib-dev
+Build-Depends: debhelper (>= 4.0.0), libhildon1-dev, pkg-config, libosso-dev (>= 0.9.19), libosso-gnomevfs2-dev, osso-af-settings, libhildonfm2-dev, libosso-help-dev, libxtst-dev, libxml2-dev, osso-esd-dev
 Standards-Version: 3.6.0
  
 Package: hildon-desktop

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/Makefile.am	2007-02-27 15:52:29 UTC (rev 10233)
@@ -24,6 +24,7 @@
 	$(XLIBS_CFLAGS) \
 	$(XTEST_CFLAGS) \
 	$(DBUS_CFLAGS) \
+	$(GNOME_VFS_CFLAGS) \
 	-DLOCALEDIR=\"$(localedir)\" \
 	-DDESKTOPENTRYDIR=\"$(hildondesktopentrydir)\"
 
@@ -50,13 +51,13 @@
 	hd-wm-watchable-app.c \
 	hd-entry-info.c
 
-libhildonwm_la_LIBADD = \
-	$(HILDON_LIBS) \
-	$(HILDONBASELIB_LIBS) \
-	$(GCONF_LIBS) \
-	$(GNOME_VFS_LIBS) \
-	$(XLIBS_LIBS) \
-	$(XTEST_LIBS) \
+libhildonwm_la_LIBADD =     \
+	$(HILDON_LIBS)      \
+	$(GCONF_LIBS)       \
+	$(GNOME_VFS_LIBS)   \
+	$(XLIBS_LIBS)       \
+	$(XTEST_LIBS)       \
+	$(GNOME_VFS_LIBS)   \
 	$(DBUS_LIBS)
 
 CLEANFILES = *~

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-02-27 15:52:29 UTC (rev 10233)
@@ -35,8 +35,8 @@
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #include <gdk/gdkevents.h>
+#include <libgnomevfs/gnome-vfs.h>
 
-
 #ifdef HAVE_LIBHILDON
 #include <hildon/hildon-defines.h>
 #include <hildon/hildon-banner.h>
@@ -49,8 +49,6 @@
 #include <hildon-widgets/hildon-window.h>
 #endif
 
-#include <hildon-base-lib/hildon-base-dnotify.h>
-
 #ifdef HAVE_LIBOSSO
 #include <libosso.h>
 #endif
@@ -172,60 +170,61 @@
 struct _HDWMPrivate   /* Our main struct */
 {
  
-  Atom          atoms[HD_ATOM_COUNT];
+  Atom                    atoms[HD_ATOM_COUNT];
  
   /* WatchedWindows is a hash of watched windows hashed via in X window ID.
    * As most lookups happen via window ID's makes sense to hash on this,
    */
-  GHashTable   *watched_windows;
+  GHashTable             *watched_windows;
 
   /* watched windows that are 'hibernating' - i.e there actually not
    * running any more but still appear in HN as if they are ( for memory ).
    * Split into seperate hash for efficiency reasons.
    */
-  GHashTable   *watched_windows_hibernating;
+  GHashTable             *watched_windows_hibernating;
 
   /* curretnly active app window */
-  HDWMWatchedWindow *active_window;
+  HDWMWatchedWindow      *active_window;
 
   /* used to toggle between home and application */
-  HDWMWatchedWindow *last_active_window;
+  HDWMWatchedWindow      *last_active_window;
   
   /* A hash of valid watchable apps ( hashed on class name ). This is built
    * on startup by slurping in /usr/share/applications/hildon .desktop's
    * NOTE: previous code used service/exec/class to refer to class name so
    *       quite confusing.
    */
-  GHashTable   *watched_apps;
+  GHashTable             *watched_apps;
 
 
-  GtkWidget    *others_menu;
+  GtkWidget              *others_menu;
 
   /* stack for the launch banner messages. 
    * Needed to work round gtk(hindon)_infoprint issues.
    */
-  GList        *banner_stack;
+  GList                  *banner_stack;
 
   /* Key bindings and shortcuts */
-  HDKeysConfig  *keys;
-  HDKeyShortcut *shortcut;
-  gulong         power_key_timeout;
+  HDKeysConfig           *keys;
+  HDKeyShortcut          *shortcut;
+  gulong                  power_key_timeout;
 
   /* FIXME: Below memory management related not 100% sure what they do */
 
-  gulong        lowmem_banner_timeout;
-  gulong        lowmem_min_distance;
-  gulong        lowmem_timeout_multiplier;
-  gboolean      lowmem_situation;
+  gulong                 lowmem_banner_timeout;
+  gulong                 lowmem_min_distance;
+  gulong                 lowmem_timeout_multiplier;
+  gboolean               lowmem_situation;
 
-  gboolean      bg_kill_situation;
-  gint          timer_id;
-  gboolean      about_to_shutdown;
-  gboolean      has_focus;
-  guint         dnotify_timeout_id;
-  gboolean      modal_windows;
+  gboolean               bg_kill_situation;
+  gint                   timer_id;
+  gboolean               about_to_shutdown;
+  gboolean               has_focus;
+  GnomeVFSMonitorHandle *monitor;
+  guint                  monitor_timeout_id;
+  gboolean               modal_windows;
 
-  GList		*applications;
+  GList		        *applications;
 };
 
 static HDWMPrivate *hdwmpriv = NULL; 			/* Singleton instance */
@@ -695,7 +694,6 @@
 		     G_TYPE_NONE,
 		     1,
 		     G_TYPE_BOOLEAN);
-
 }
 
 static void hd_wm_register_object_path (HDWM *hdwm,
@@ -2473,7 +2471,7 @@
 
 /* iterates over the new hash and carries out updates on the old hash */
 static gboolean
-dnotify_hash_table_foreach_steal_func (gpointer key,
+monitor_hash_table_foreach_steal_func (gpointer key,
                                        gpointer value,
                                        gpointer user_data)
 {
@@ -2511,7 +2509,7 @@
 
 /* iterates over the old app hash and removes any apps that disappeared */
 static gboolean
-dnotify_hash_table_foreach_remove_func (gpointer key,
+monitor_hash_table_foreach_remove_func (gpointer key,
                                         gpointer value,
                                         gpointer user_data)
 {
@@ -2538,12 +2536,12 @@
 }
 
 static gboolean 
-hd_wm_dnotify_process (HDWM *hdwm)
+hd_wm_monitor_process (HDWM *hdwm)
 {
   GHashTable * new_apps;
   struct _cb_steal_data std;
 
-  hdwm->priv->dnotify_timeout_id = 0;
+  hdwm->priv->monitor_timeout_id = 0;
 
   /* reread all .desktop files and compare each agains existing apps; add any
    * new ones, updated existing ones
@@ -2573,7 +2571,7 @@
    * exist in the new one
    */
   g_hash_table_foreach_remove (hdwm->priv->watched_apps,
-                               dnotify_hash_table_foreach_remove_func,
+                               monitor_hash_table_foreach_remove_func,
                                new_apps);
   /*
    * then we do updates on what is left in the old hash
@@ -2582,7 +2580,7 @@
   std.update = FALSE;
   
   g_hash_table_foreach_steal (new_apps,
-                              dnotify_hash_table_foreach_steal_func,
+                              monitor_hash_table_foreach_steal_func,
                               &std);
 
   if (std.update)
@@ -2887,30 +2885,40 @@
   return FALSE;
 }
 
-/* Dnotify callback function -- we filter dnotify calls through a timout, see
- * comments on hd_wm_dnotify_process ()
+/* Dnotify callback function -- we filter monitor calls through a timout, see
+ * comments on hd_wm_monitor_process ()
  */
 static void
-hd_wm_dnotify_cb (char *path, void * data)
+hd_wm_monitor_cb (GnomeVFSMonitorHandle *handle,
+                  const gchar *monitor_uri,
+                  const gchar *info_uri,
+                  GnomeVFSMonitorEventType event_type,
+                  gpointer user_data)
 {
-  HDWM *hdwm = HD_WM (data);
+  HDWM *hdwm = hd_wm_get_singleton ();
 	
-  if (!hdwm->priv->dnotify_timeout_id)
+  if (!hdwm->priv->monitor_timeout_id)
     {
-      hdwm->priv->dnotify_timeout_id =
+      hdwm->priv->monitor_timeout_id =
       g_timeout_add(1000,
-                    (GSourceFunc)hd_wm_dnotify_process,
+                    (GSourceFunc)hd_wm_monitor_process,
                     NULL);
     }
 }
 
-/* Public function to register our dnotify callback (called from
+/* Public function to register our monitor callback (called from
  * hildon-navigator-main.c)
  */
 void
-hd_wm_dnotify_register ()
+hd_wm_monitor_register ()
 {
-  if (hildon_dnotify_set_cb ((hildon_dnotify_cb_f *)hd_wm_dnotify_cb,DESKTOPENTRYDIR,NULL) != HILDON_OK)
+  HDWM *hdwm = hd_wm_get_singleton ();
+
+  if (gnome_vfs_monitor_add (&hdwm->priv->monitor, 
+                             DESKTOPENTRYDIR,
+                             GNOME_VFS_MONITOR_DIRECTORY,
+                             (GnomeVFSMonitorCallback) hd_wm_monitor_cb,
+                             NULL) != GNOME_VFS_OK)
   {
     g_warning("unable to register TN callback for %s", DESKTOPENTRYDIR);
   }

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h	2007-02-27 15:52:29 UTC (rev 10233)
@@ -220,7 +220,7 @@
 					      HDWMWatchableApp *app);
 
 void
-hd_wm_dnotify_register (void);
+hd_wm_monitor_register (void);
 
 /* keyboard handling functions */
 

Modified: projects/haf/trunk/hildon-desktop/src/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-desktop/src/Makefile.am	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/src/Makefile.am	2007-02-27 15:52:29 UTC (rev 10233)
@@ -13,6 +13,7 @@
 	$(OSSO_HELP_CFLAGS)          					   \
 	$(GCONF_CFLAGS)                                                    \
 	$(LIBXML_CFLAGS)                                                   \
+	$(GNOME_VFS_CFLAGS)                                                \
 	$(DBUS_GLIB_CFLAGS)                                                \
 	-I$(top_srcdir) 						   \
 	-DLOCALEDIR=\"$(localedir)\" 					   \
@@ -26,14 +27,15 @@
 	-DHD_PLUGIN_LOADER_LEGACY_STATUSBAR_MODULE_PATH=\"$(hildonstatusbarlibdir)\" \
 	-DHD_PLUGIN_LOADER_LEGACY_NAVIGATOR_MODULE_PATH=\"$(hildonnavigatorlibdir)\"
 
-hildon_desktop_LDFLAGS  = \
-	-rdynamic         \
+hildon_desktop_LDFLAGS  =   \
+	-rdynamic           \
 	$(LAUNCHER_LDFLAGS) \
-	$(HILDON_LIBS)	  \
-	$(HILDON_FM_LIBS) \
-	$(OSSO_LIBS)	  \
-	$(GCONF_LIBS)     \
-	$(OSSO_HELP_LIBS) \
+	$(HILDON_LIBS)	    \
+	$(HILDON_FM_LIBS)   \
+	$(OSSO_LIBS)	    \
+	$(GCONF_LIBS)       \
+	$(OSSO_HELP_LIBS)   \
+	$(GNOME_VFS_LIBS)   \
 	$(DBUS_GLIB_LIBS)
 
 hildon_desktop_LDADD = \

Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-02-27 15:52:29 UTC (rev 10233)
@@ -31,12 +31,12 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <gtk/gtk.h>
+#include <libgnomevfs/gnome-vfs.h>
 
 #ifdef HAVE_LIBOSSO
 #include <libosso.h>
 #endif
 
-#include <hildon-base-lib/hildon-base-dnotify.h>
 #include <libhildondesktop/hildon-desktop-window.h>
 #include <libhildondesktop/hildon-desktop-notification-manager.h>
 
@@ -58,10 +58,11 @@
 
 typedef struct
 {
-  gchar      *config_file;
-  gchar      *plugin_dir;
-  GtkWidget  *container;
-  HDDesktop  *desktop;
+  gchar                  *config_file;
+  gchar                  *plugin_dir;
+  GtkWidget              *container;
+  HDDesktop              *desktop;
+  GnomeVFSMonitorHandle  *monitor;
 } HDDesktopContainerInfo;
 
 struct _HDDesktopPrivate 
@@ -312,6 +313,9 @@
   if (info->container)
     gtk_widget_destroy (info->container);
 
+  if (info->monitor)
+    gnome_vfs_monitor_cancel (info->monitor);
+  
   g_free (info);
 }
 
@@ -353,17 +357,21 @@
 }
 
 static void
-hd_desktop_plugin_dir_changed (gchar *plugin_dir, HDDesktopContainerInfo *info)
+hd_desktop_plugin_dir_changed (GnomeVFSMonitorHandle *handle,
+                               const gchar *monitor_uri,
+                               const gchar *info_uri,
+                               GnomeVFSMonitorEventType event_type,
+                               HDDesktopContainerInfo *info)
 {
   GDir *dir;
   GError *error = NULL;
   GList *plugin_list = NULL, *remove_list, *iter;
   const gchar *filename;
-
+  
   remove_list = gtk_container_get_children (
                   HILDON_DESKTOP_WINDOW (info->container)->container);
 
-  dir = g_dir_open (plugin_dir, 0, &error);
+  dir = g_dir_open (info->plugin_dir, 0, &error);
 
   if (!dir)
   {
@@ -380,7 +388,7 @@
     GList *found = NULL;
     gchar *desktop_path = NULL;
     
-    desktop_path = g_build_filename (plugin_dir, filename, NULL);
+    desktop_path = g_build_filename (info->plugin_dir, filename, NULL);
 
     found = g_list_find_custom (remove_list, 
                                 desktop_path,
@@ -424,31 +432,20 @@
                       gpointer  callback, 
                       gpointer  user_data)
 {
-  hildon_return_t ret;
+  HDDesktopContainerInfo *info = (HDDesktopContainerInfo *) user_data;
 
   g_return_if_fail (plugin_dir);
 
-  ret = hildon_dnotify_set_cb ((hildon_dnotify_cb_f *) hd_desktop_plugin_dir_changed,
-                               (gchar *) plugin_dir,
-                               user_data);
-
-  if (ret != HILDON_OK)
-  {
-    g_warning ("Error trying to watch plugin directory: %s", plugin_dir);
-  }
+  gnome_vfs_monitor_add  (&info->monitor, 
+                          plugin_dir,
+                          GNOME_VFS_MONITOR_DIRECTORY,
+                          (GnomeVFSMonitorCallback) callback,
+                          user_data);
 }
 
 static void 
 hd_desktop_dnotify_init () 
 {
-  hildon_return_t ret;
-
-  ret = hildon_dnotify_handler_init ();
-
-  if (ret != HILDON_OK)
-  {
-    g_warning ("Error on dnotify init");
-  }
 }
 
 static void 

Modified: projects/haf/trunk/hildon-desktop/src/hn-others-button.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-others-button.c	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/src/hn-others-button.c	2007-02-27 15:52:29 UTC (rev 10233)
@@ -37,14 +37,13 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkx.h>
+#include <libgnomevfs/gnome-vfs.h>
 
 #include <X11/X.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 
-#include <hildon-base-lib/hildon-base-dnotify.h>
-
 #ifdef HAVE_LIBHILDON
 #include <hildon/hildon-helper.h>
 #else
@@ -91,12 +90,16 @@
 
 struct _HNOthersButtonPrivate
 {
-  GtkWidget  *button;
-  guint       collapse_id;
-  gboolean    thumb_pressed;
-  guint       dnotify_update_timeout;
+  GtkWidget              *button;
+  guint                   collapse_id;
+  gboolean                thumb_pressed;
+  GnomeVFSMonitorHandle  *system_dir_monitor;
+  GnomeVFSMonitorHandle  *home_dir_monitor;
+  GnomeVFSMonitorHandle  *desktop_dir_monitor;
+  guint                   monitor_update_timeout;
 };
 
+static void hn_others_button_register_monitors (HNOthersButton *button);
 static void hn_others_button_create_menu (HNOthersButton *button);
 static void hn_others_button_button_toggled (GtkWidget *widget, HNOthersButton *button);
 static gboolean hn_others_button_key_press (GtkWidget* widget, GdkEventKey *event, HNOthersButton *button);
@@ -111,9 +114,18 @@
   if (button->priv->collapse_id)
     g_source_remove (button->priv->collapse_id);
 
-  if (button->priv->dnotify_update_timeout)
-    g_source_remove (button->priv->dnotify_update_timeout);
+  if (button->priv->monitor_update_timeout)
+    g_source_remove (button->priv->monitor_update_timeout);
   
+  if (button->priv->system_dir_monitor)
+    gnome_vfs_monitor_cancel (button->priv->system_dir_monitor);
+  
+  if (button->priv->home_dir_monitor)
+    gnome_vfs_monitor_cancel (button->priv->home_dir_monitor);
+  
+  if (button->priv->desktop_dir_monitor)
+    gnome_vfs_monitor_cancel (button->priv->desktop_dir_monitor);
+  
   if (TASKNAVIGATOR_ITEM (button)->menu)
     gtk_widget_destroy (GTK_WIDGET (TASKNAVIGATOR_ITEM (button)->menu));
   
@@ -140,6 +152,10 @@
 
   button->priv = priv;
 
+  button->priv->system_dir_monitor = NULL;
+  button->priv->home_dir_monitor = NULL;
+  button->priv->desktop_dir_monitor = NULL;
+  
   gtk_widget_set_name (GTK_WIDGET(button), NAVIGATOR_BUTTON_THREE);
 
   gtk_widget_set_extension_events (GTK_WIDGET (button),
@@ -182,11 +198,13 @@
 
   priv->collapse_id = 0;
   priv->thumb_pressed = FALSE;
-  priv->dnotify_update_timeout = 0;
+  priv->monitor_update_timeout = 0;
 
   TASKNAVIGATOR_ITEM (button)->menu = NULL;
 
   gtk_container_add (GTK_CONTAINER (button), priv->button);
+
+  hn_others_button_register_monitors (button);
 }
 
 GtkWidget *
@@ -961,7 +979,7 @@
 
   g_debug ("Creating menu");
   
-  button->priv->dnotify_update_timeout = 0;
+  button->priv->monitor_update_timeout = 0;
 
   hn_others_button_create_menu (button);
   
@@ -969,21 +987,23 @@
 }
 
 static void
-hn_others_button_dnotify_handler (char *path, gpointer data)
+hn_others_button_dir_changed (GnomeVFSMonitorHandle *handle,
+                              const gchar *monitor_uri,
+                              const gchar *info_uri,
+                              GnomeVFSMonitorEventType event_type,
+                              HNOthersButton *button)
 {
-  HNOthersButton * button = HN_OTHERS_BUTTON (data);
-  
-  if (!button->priv->dnotify_update_timeout)
+  if (!button->priv->monitor_update_timeout)
   {
-    button->priv->dnotify_update_timeout =
+    button->priv->monitor_update_timeout =
             g_timeout_add (1000,
-            	           (GSourceFunc)hn_others_button_menu_changed,
+            	           (GSourceFunc) hn_others_button_menu_changed,
             	           button);
   }
 }
 
 void
-hn_others_button_dnotify_register (HNOthersButton * button)
+hn_others_button_register_monitors (HNOthersButton * button)
 {
   const gchar *home_dir;
   gchar *dir;
@@ -1006,13 +1026,15 @@
   
   /* Watch systemwide menu conf */
   dir = g_path_get_dirname (SYSTEMWIDE_MENU_FILE);
-  
-  if (hildon_dnotify_set_cb (
-		(hildon_dnotify_cb_f *) hn_others_button_dnotify_handler,
-		dir, button) != HILDON_OK)
+ 
+  if (gnome_vfs_monitor_add (&button->priv->system_dir_monitor, 
+                             dir,
+                             GNOME_VFS_MONITOR_DIRECTORY,
+                             (GnomeVFSMonitorCallback) hn_others_button_dir_changed,
+                             button) != GNOME_VFS_OK)
   {
     g_error ("Others_menu_initialize_menu: "
-      	     "failed setting dnotify callback "
+      	     "failed setting monitor callback "
       	     "for systemwide menu conf." );
   }
 
@@ -1029,13 +1051,15 @@
 
     if (dir && *dir)
     {
-      if (hildon_dnotify_set_cb (
-    	  (hildon_dnotify_cb_f *) hn_others_button_dnotify_handler,
-    	  dir, button) != HILDON_OK)
+      if (gnome_vfs_monitor_add (&button->priv->home_dir_monitor, 
+                                 dir,
+                                 GNOME_VFS_MONITOR_DIRECTORY,
+                                 (GnomeVFSMonitorCallback) hn_others_button_dir_changed,
+                                 button) != GNOME_VFS_OK)
       {
         g_error ("Others_menu_initialize_menu: "
-      	         "failed setting dnotify callback "
-      	         "for user spesific menu conf." );
+      	         "failed setting monitor callback "
+      	         "for user specific menu conf." );
       }
     }
     else
@@ -1051,12 +1075,14 @@
   
   /* Monitor the .desktop directories, so we can regenerate the menu
    * when a new application is installed */
-  if (hildon_dnotify_set_cb (
-      (hildon_dnotify_cb_f *) hn_others_button_dnotify_handler,
-      HD_DESKTOP_ENTRY_PATH, button) != HILDON_OK)
+  if (gnome_vfs_monitor_add (&button->priv->desktop_dir_monitor, 
+                             HD_DESKTOP_ENTRY_PATH,
+                             GNOME_VFS_MONITOR_DIRECTORY,
+                             (GnomeVFSMonitorCallback) hn_others_button_dir_changed,
+                             button) != GNOME_VFS_OK)
   {
     g_error ("Others_menu_initialize_menu: "
-      	     "failed setting dnotify callback "
+      	     "failed setting monitor callback "
       	     "for .desktop directory." );
   }
 }

Modified: projects/haf/trunk/hildon-desktop/src/main.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/main.c	2007-02-27 14:55:34 UTC (rev 10232)
+++ projects/haf/trunk/hildon-desktop/src/main.c	2007-02-27 15:52:29 UTC (rev 10233)
@@ -30,6 +30,7 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#include <libgnomevfs/gnome-vfs.h>
 
 #include "hd-desktop.h"
 
@@ -73,6 +74,8 @@
 
   gtk_init (&argc, &argv);
 
+  gnome_vfs_init ();
+  
   desktop = hd_desktop_new ();
 
   hd_desktop_run (HD_DESKTOP (desktop));


More information about the maemo-commits mailing list