r1350 - trunk/src/target/OM-2007/applications/openmoko-appmanager/src

caowai_song at sita.openmoko.org caowai_song at sita.openmoko.org
Wed Mar 14 02:40:50 CET 2007


Author: caowai_song
Date: 2007-03-14 02:40:41 +0100 (Wed, 14 Mar 2007)
New Revision: 1350

Modified:
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-window.c
Log:
Because the windows-manager will sure that the application will only
run once, remove the unuseful code in the application manager.


Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-window.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-window.c	2007-03-14 01:32:02 UTC (rev 1349)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-window.c	2007-03-14 01:40:41 UTC (rev 1350)
@@ -17,13 +17,6 @@
  *
  *  @author Chaowei Song (songcw at fic-sh.com.cn)
  */
-
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-
 #include <libmokoui/moko-application.h>
 #include <libmokoui/moko-paned-window.h>
 #include <libmokoui/moko-tool-box.h>
@@ -41,82 +34,6 @@
 #include "package-list.h"
 #include "select-menu.h"
 
-static GtkWidget* mainwindow = NULL;
-
-static void 
-handle_sigusr1 (int value)
-{
-  if (mainwindow == NULL)
-    {
-      return;
-    }
-  gtk_window_present (GTK_WINDOW (mainwindow));
-  signal (SIGUSR1, handle_sigusr1);
-}
-
-static pid_t 
-testlock (char *fname)
-{
-  int fd;
-  struct flock fl;
-
-  fd = open (fname, O_WRONLY, S_IWUSR);
-  if (fd < 0)
-    {
-      if (errno == ENOENT)
-        {
-          return 0;
-        }
-      else
-        {
-          perror ("Test lock open file");
-          return -1;
-        }
-    }
-
-  fl.l_type = F_WRLCK;
-  fl.l_whence = SEEK_SET;
-  fl.l_start = 0;
-  fl.l_len = 0;
-
-  if (fcntl (fd, F_GETLK, &fl) < 0)
-    {
-      close (fd);
-      return -1;
-    }
-  close (fd);
-
-  if (fl.l_type == F_UNLCK)
-    return 0;
-
-  return fl.l_pid;
-}
-
-static void 
-setlock (char *fname)
-{
-  int fd;
-  struct flock fl;
-
-  fd = open (fname, O_WRONLY|O_CREAT, S_IWUSR);
-  if (fd < 0)
-    {
-      perror ("Set lock open file");
-      return ;
-    }
-
-  fl.l_type = F_WRLCK;
-  fl.l_whence = SEEK_SET;
-  fl.l_start = 0;
-  fl.l_len = 0;
-
-  if (fcntl (fd, F_SETLK, &fl) < 0)
-    {
-      perror ("Lock file");
-      close (fd);
-    }
-}
-
 /**
  * @brief The start function.
  */
@@ -133,7 +50,6 @@
   GtkWidget       *detail;
 
   gint            ret;
-  pid_t           lockapp;
 
   g_debug ("appplication manager start up");
 
@@ -143,13 +59,6 @@
     {
       /* Add init code. */
     }
-  lockapp = testlock ("/tmp/appmgr.lock");
-  if (lockapp > 0)
-    {
-      kill (lockapp, SIGUSR1);
-      return 0;
-    }
-  setlock ("/tmp/appmgr.lock");
 
   appdata = application_manager_data_new ();
   if (appdata == NULL)
@@ -165,9 +74,6 @@
                     G_CALLBACK (gtk_main_quit), NULL);
   application_manager_data_set_main_window (appdata, window);
 
-  /* Save the main window */
-  mainwindow = GTK_WIDGET(window);
-
   appmenu = application_menu_new (appdata);
   moko_paned_window_set_application_menu (window, appmenu);
 
@@ -204,8 +110,6 @@
 
   package_list_add_section_to_filter_menu (appdata);
 
-  signal (SIGUSR1, handle_sigusr1);
-
   gtk_widget_show_all (GTK_WIDGET (window));
   g_debug ("application manager enter main loop");
   gtk_main ();





More information about the commitlog mailing list