[maemo-commits] [maemo-commits] r11322 - in projects/haf/trunk/maemo-af-desktop: . hildon-home hildon-navigator hildon-status-bar

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Apr 26 14:24:24 EEST 2007
Author: jobi
Date: 2007-04-26 14:24:23 +0300 (Thu, 26 Apr 2007)
New Revision: 11322

Modified:
   projects/haf/trunk/maemo-af-desktop/ChangeLog
   projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.c
   projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.h
   projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c
   projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.h
   projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.c
   projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.h
   projects/haf/trunk/maemo-af-desktop/maemo-af-desktop-main.c
Log:

2007-04-26  Johan Bilien <johan.bilien at nokia.com>

	* maemo-af-desktop-main.c:
	- create a stamp file in /tmp when starting, remove it on
	clean shutdown
	- do not load home applets if the file is already present on startup
	* hildon-navigator/hildon-navigator-panel.c:
	- place the log file in /tmp
	* hildon-status-bar/hildon-status-bar-main.c:
	- place the log file in /tmp
	* hildon-home/home-applet-handler.[ch]:
	- remove old protection mechanism for home applets.
	Fixes: NB#51405



Modified: projects/haf/trunk/maemo-af-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-af-desktop/ChangeLog	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/ChangeLog	2007-04-26 11:24:23 UTC (rev 11322)
@@ -1,14 +1,28 @@
+2007-04-26  Johan Bilien <johan.bilien at nokia.com>
+
+	* maemo-af-desktop-main.c:
+	- create a stamp file in /tmp when starting, remove it on
+	clean shutdown
+	- do not load home applets if the file is already present on startup
+	* hildon-navigator/hildon-navigator-panel.c:
+	- place the log file in /tmp
+	* hildon-status-bar/hildon-status-bar-main.c:
+	- place the log file in /tmp
+	* hildon-home/home-applet-handler.[ch]:
+	- remove old protection mechanism for home applets.
+	Fixes: NB#51405
+
 2007-02-13  Johan Bilien <johan.bilien at nokia.com>
 
 	* configure.ac: 2.9.99.23
-	
+
 2007-02-13  Johan Bilien <johan.bilien at nokia.com>
 
 	* maemo-af-desktop.sh: Changed watchdog policy to restart.
 	Fixes: NB#50401
 
 2007-02-13  Johan Bilien <johan.bilien at nokia.com>
-	
+
 	* configure.ac: 2.9.99.22
 
 2007-02-13  Johan Bilien <johan.bilien at nokia.com>
@@ -20,7 +34,7 @@
 2007-02-08  Johan Bilien <johan.bilien at nokia.com>
 
 	* configure.ac: 2.9.99.21
-	
+
 2007-02-08  Johan Bilien <johan.bilien at nokia.com>
 
 	* hildon-home/home-applet-handler.c: Do not log the deinit
@@ -47,7 +61,7 @@
 	hildon-status-bar/hildon-status-bar-main.c:
 	- reverted iteration of the main loop between the load of
 	each applet
-	
+
 2007-01-30  Johan Bilien <johan.bilien at nokia.com>
 
 	* configure.ac: 2.9.99.19

Modified: projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.c
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.c	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.c	2007-04-26 11:24:23 UTC (rev 11322)
@@ -135,7 +135,6 @@
 {
     /* Get convenience variables */
     GObjectClass *object_class = G_OBJECT_CLASS(applet_class);
-    gchar *log_path;
     
     /* Set the global parent_class here */
     parent_class = g_type_class_peek_parent(applet_class);
@@ -145,17 +144,6 @@
    
     g_type_class_add_private(applet_class,
                              sizeof(struct _HomeAppletHandlerPrivate));
-
-    log_path = g_strdup_printf ("%s%s",
-                                g_get_home_dir (),
-                                HH_LOG_PATH);
-    applet_class->log = hildon_log_new (log_path);
-    g_free (log_path);
-    applet_class->bad_plugins = 
-        hildon_log_get_incomplete_groups (applet_class->log,
-                                          "init_start",
-                                          "init_end",
-                                          NULL);
     
 }
 
@@ -276,8 +264,6 @@
     GtkWidget *applet;
     HomeAppletHandlerPrivate *priv;
     HomeAppletHandler *handler;
-    HildonLog *log;
-    GList     *bad_plugins;
     gint applet_x = APPLET_INVALID_COORDINATE;
     gint applet_y = APPLET_INVALID_COORDINATE;
     gint applet_minwidth = APPLET_NONCHANGABLE_DIMENSION;
@@ -428,23 +414,7 @@
     
     handler = g_object_new (HOME_TYPE_APPLET_HANDLER, NULL);
     priv = HOME_APPLET_HANDLER_GET_PRIVATE(handler);
-    log = HOME_APPLET_HANDLER_GET_CLASS(handler)->log;
-    bad_plugins = HOME_APPLET_HANDLER_GET_CLASS(handler)->bad_plugins;
 
-    if (g_list_find_custom (bad_plugins, desktoppath, (GCompareFunc)strcmp))
-    {
-        g_warning ("Not loading %s as it did not complete initialization on "
-                   "previous startup",
-                   desktoppath);
-
-        /* The plugin was found to crash during initialization last time */
-        g_object_unref (handler);
-        g_free (libraryfile);
-        return NULL;
-    }
-
-    hildon_log_add_group (log, desktoppath);
-        
     librarypath =
             g_strconcat(HOME_APPLET_HANDLER_LIBRARY_DIR, libraryfile, NULL);
     priv->dlhandle = dlopen(librarypath, RTLD_NOW);
@@ -474,9 +444,7 @@
             return NULL;
         }
 
-        hildon_log_add_message (log, "init_start", "1");
         priv->applet_data = priv->initialize(state_data, state_size, &applet);
-        hildon_log_add_message (log, "init_end", "1");
         priv->widget = applet;
 	
         handler->libraryfile = libraryfile;

Modified: projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.h
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.h	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/hildon-home/home-applet-handler.h	2007-04-26 11:24:23 UTC (rev 11322)
@@ -101,9 +101,6 @@
 
 struct _HomeAppletHandlerClass {
     GObjectClass parent_class;
-
-    HildonLog   *log;
-    GList       *bad_plugins;
 };
 
 

Modified: projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c	2007-04-26 11:24:23 UTC (rev 11322)
@@ -125,15 +125,15 @@
 {
   HildonNavigatorPanelPrivate *priv;
   gchar *path;
-  const gchar *home;
+  const gchar *tmp;
   gint i;
   
   g_return_if_fail (panel);
 
   priv = HILDON_NAVIGATOR_PANEL_GET_PRIVATE (panel);
 
-  home = getenv ("HOME");
-  path = g_strdup_printf ("%s%s",home,HILDON_NAVIGATOR_LOG_FILE);
+  tmp = g_get_tmp_dir ();
+  path = g_strdup_printf ("%s%s",tmp,HILDON_NAVIGATOR_LOG_FILE);
   
   priv->log = hildon_log_new (path);
 

Modified: projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.h
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.h	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.h	2007-04-26 11:24:23 UTC (rev 11322)
@@ -28,7 +28,7 @@
 #define LIBTN_MAIL_PLUGIN        "libtn_mail_plugin.so"
 #define LIBTN_BOOKMARK_PLUGIN    "libtn_bookmark_plugin.so"
 
-#define HILDON_NAVIGATOR_LOG_FILE "/.osso/navigator.log"
+#define HILDON_NAVIGATOR_LOG_FILE "/osso-appl-states/maemo_af_desktop/navigator.log"
 
 #include <gtk/gtkbox.h>
 #include "hildon-navigator-item.h"

Modified: projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.c
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.c	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.c	2007-04-26 11:24:23 UTC (rev 11322)
@@ -229,7 +229,7 @@
     g_signal_connect(panel->arrow_button, "toggled", 
 		     G_CALLBACK(arrow_button_toggled_cb), panel);
    
-    log_path = g_strdup_printf("%s%s",(gchar *)getenv("HOME"),HSB_PLUGIN_LOG_FILE);
+    log_path = g_strdup_printf("%s%s",g_get_tmp_dir (),HSB_PLUGIN_LOG_FILE);
     
     panel->log = hildon_log_new (log_path);
 

Modified: projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.h
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.h	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/hildon-status-bar/hildon-status-bar-main.h	2007-04-26 11:24:23 UTC (rev 11322)
@@ -86,7 +86,7 @@
 #define HSB_PLUGIN_CATEGORY_CONDITIONAL "conditional"
 #define HSB_PLUGIN_CATEGORY_TEMPORAL    "temporal"
 
-#define HSB_PLUGIN_LOG_FILE             "/.osso/statusbar.log"
+#define HSB_PLUGIN_LOG_FILE             "/osso-appl-states/maemo_af_desktop/statusbar.log"
 #define HSB_PLUGIN_LOG_KEY_START	"Init"
 #define HSB_PLUGIN_LOG_KEY_END		"End"
 

Modified: projects/haf/trunk/maemo-af-desktop/maemo-af-desktop-main.c
===================================================================
--- projects/haf/trunk/maemo-af-desktop/maemo-af-desktop-main.c	2007-04-26 11:18:11 UTC (rev 11321)
+++ projects/haf/trunk/maemo-af-desktop/maemo-af-desktop-main.c	2007-04-26 11:24:23 UTC (rev 11322)
@@ -90,6 +90,10 @@
 /* Moved from main to globals to reduce the amount
    of used stack -- Karoliina Salminen */
 
+
+#define MAEMO_AF_DESKTOP_STAMP_DIR      "/tmp/osso-appl-states/maemo_af_desktop/"
+#define MAEMO_AF_DESKTOP_STAMP_FILE     MAEMO_AF_DESKTOP_STAMP_DIR"/stamp"
+
 HildonNavigatorWindow *tasknav;
 osso_context_t *osso;
 StatusBar *panel;
@@ -159,16 +163,20 @@
             continue;
         }
 
+        g_debug ("Got signal %i", buf.signal);
+
         switch(buf.signal)
         {
             case SIGINT:
                 /* Exit properly */
                 gtk_main_quit();
+                unlink(MAEMO_AF_DESKTOP_STAMP_FILE);
                 break;
             case SIGTERM:
                 /* Kill all the applications we where handling in TN */
                 hildon_navigator_killall();
             default:
+                unlink(MAEMO_AF_DESKTOP_STAMP_FILE);
                 exit(0);
         }
     }
@@ -194,12 +202,15 @@
 gboolean hildon_home_window_applets_init_wrapper (gpointer data);
 
 static gboolean
-start_status_bar (void)
+start_status_bar (gboolean safe_mode)
 {
     status_bar_main(osso, &panel);
 
-    /* load home applets when status bar is done */
-    g_idle_add (&hildon_home_window_applets_init_wrapper, NULL);
+    if (!safe_mode)
+    {
+        /* load home applets when status bar is done */
+        g_idle_add (&hildon_home_window_applets_init_wrapper, NULL);
+    }
  
     return FALSE;
 }
@@ -213,11 +224,28 @@
     GError *error = NULL;   /* handle errors */
     long fd_flags; 	    /* used to change the pipe into non-blocking mode */
     gchar *gtkrc = NULL;
+    gboolean safe_mode = FALSE;
 
     setlocale (LC_ALL, "");
 
     bindtextdomain (PACKAGE, LOCALEDIR);
     textdomain (PACKAGE);
+
+    if (g_file_test (MAEMO_AF_DESKTOP_STAMP_FILE, G_FILE_TEST_EXISTS))
+    {
+        g_warning ("maemo-af-desktop did not exit properly on the previous "
+                   "session. All home plugins will be disabled.");
+        safe_mode = TRUE;
+    }
+    else
+    {
+        int fd;
+        mkdir (MAEMO_AF_DESKTOP_STAMP_DIR, 0755);
+        fd = creat(MAEMO_AF_DESKTOP_STAMP_FILE, S_IRUSR|S_IWUSR);
+        if (fd >= 0)
+            close (fd);
+    }
+
     
     /* Read the maemo-af-desktop gtkrc file */
     gtkrc = g_build_filename (g_get_home_dir (), 
@@ -266,7 +294,7 @@
 
     gtk_widget_show_all (GTK_WIDGET (tasknav));
 
-    g_idle_add ((GSourceFunc)start_status_bar, NULL);
+    g_idle_add ((GSourceFunc)start_status_bar, GINT_TO_POINTER(safe_mode));
 
     if(pipe(signal_pipe)) 
     {


More information about the maemo-commits mailing list