[Goodies-commits] r3260 - xfce4-smartpm-plugin/trunk/src

Anders F Bjorklund afb at xfce.org
Thu Sep 27 23:38:49 CEST 2007


Author: afb
Date: 2007-09-27 21:38:49 +0000 (Thu, 27 Sep 2007)
New Revision: 3260

Modified:
   xfce4-smartpm-plugin/trunk/src/xfcesmart.c
   xfce4-smartpm-plugin/trunk/src/xfcesmart.h
Log:
making annoying dialog timeout after 5 minutes

Modified: xfce4-smartpm-plugin/trunk/src/xfcesmart.c
===================================================================
--- xfce4-smartpm-plugin/trunk/src/xfcesmart.c	2007-09-27 21:32:47 UTC (rev 3259)
+++ xfce4-smartpm-plugin/trunk/src/xfcesmart.c	2007-09-27 21:38:49 UTC (rev 3260)
@@ -73,6 +73,8 @@
 
 #define TIMEOUT_TIME  1000 /* milliseconds */
 
+#define PROGRESS_TIME 5*60 /* seconds */
+
 #define UNUSED(x)     (void) x
 
 /* prototypes */
@@ -313,6 +315,7 @@
   }
 
   smart->in_progress = TRUE;
+  g_get_current_time(&smart->in_progress_since);
 
   if (terminal)
   {
@@ -591,6 +594,7 @@
   }
 
   smart->in_progress = TRUE;
+  g_get_current_time(&smart->in_progress_since);
 
   if (!g_spawn_async_with_pipes( NULL /*cwd*/, argv, envp,
     G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
@@ -801,6 +805,15 @@
       case 2:  /* middle */
         if (smart->in_progress)
         {
+           GTimeVal now;
+
+           g_get_current_time(&now);
+           if (now.seconds - smart->in_progress.seconds > PROGRESS_TIME)
+           {
+             smart->in_progress = FALSE;
+             smart_check_upgrades(smart);
+           }
+           else
            xfce_message_dialog(NULL, _("Upgrade In Progress"), GTK_STOCK_DIALOG_WARNING,
                                _("An upgrade is already in progress, please wait."), NULL,
                                GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);

Modified: xfce4-smartpm-plugin/trunk/src/xfcesmart.h
===================================================================
--- xfce4-smartpm-plugin/trunk/src/xfcesmart.h	2007-09-27 21:32:47 UTC (rev 3259)
+++ xfce4-smartpm-plugin/trunk/src/xfcesmart.h	2007-09-27 21:38:49 UTC (rev 3260)
@@ -47,6 +47,7 @@
     guint timeout;
   
     gboolean in_progress;
+    GTimeVal in_progress_since;
     gint updates_available;
     gint stdout, stderr;
 




More information about the Goodies-commits mailing list