Updating branch refs/heads/master
         to 517c071847fe153c665f436743d2708205843e71 (commit)
       from 01bbdb7fe220e044711f27c2c05b217dfba918f6 (commit)

commit 517c071847fe153c665f436743d2708205843e71
Author: Florian Rivoal <[email protected]>
Date:   Fri Dec 31 15:29:34 2010 +0900

    Make the warning messages non modal
    
    This way, even if the user doesn't answer them, the plugin can still
    carry on its job.
    
    Fixes bug #3008

 panel-plugin/battery.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/battery.c b/panel-plugin/battery.c
index eeb34e2..e5e1d12 100644
--- a/panel-plugin/battery.c
+++ b/panel-plugin/battery.c
@@ -571,15 +571,16 @@ battmon.c:241: for each function it appears in.)
     }
 
     /* alarms */
-    /* FIXME: should put in a timeout to terminate the alarm boxes after one
-     * minute because if they are left open, they block the event loop for
-     * the panel, and that means the critical action will not be performed! */
     if (!acline && charge <= battmon->options.low_percentage){
         if(!battmon->critical && charge <= 
battmon->options.critical_percentage) {
                battmon->critical = TRUE;
+              GtkWidget *dialog;
             if(battmon->options.action_on_critical == BM_MESSAGE){
 do_critical_warn:
-                xfce_warn(_("WARNING: Your battery has reached critical 
status. You should plug in or shutdown your computer now to avoid possible data 
loss."));
+                dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, 
GTK_BUTTONS_CLOSE,
+                _("WARNING: Your battery has reached critical status. You 
should plug in or shutdown your computer now to avoid possible data loss."));
+                g_signal_connect_swapped (dialog, "response", G_CALLBACK 
(gtk_widget_destroy), dialog);
+               gtk_widget_show_all (dialog);
                 return TRUE;
             }
             if(battmon->options.action_on_critical == BM_COMMAND ||
@@ -591,9 +592,13 @@ do_critical_warn:
             }
         } else if (!battmon->low){
                 battmon->low = TRUE;
+              GtkWidget *dialog;
             if(battmon->options.action_on_low == BM_MESSAGE){
 do_low_warn:
-                xfce_warn(_("WARNING: Your battery is running low. You should 
consider plugging in or shutting down your computer soon to avoid possible data 
loss."));
+                dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, 
GTK_BUTTONS_CLOSE,
+                _("WARNING: Your battery is running low. You should consider 
plugging in or shutting down your computer soon to avoid possible data loss."));
+                g_signal_connect_swapped (dialog, "response", G_CALLBACK 
(gtk_widget_destroy), dialog);
+               gtk_widget_show_all (dialog);
                 return TRUE;
             }
             if(battmon->options.action_on_low == BM_COMMAND ||
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to