Re: [gpm] (more) useful popups



On Wed, 2007-03-21 at 01:26 +0000, Richard Hughes wrote:
> 
> 2007-03-21  Richard Hughes  <richard hughsie com>
> 
> 	* src/gpm-cell-array.c: (gpm_cell_array_get_time_until_action):
> 	* src/gpm-cell-array.h:
> 	Print the time remaining on the critical warning. Lots of new strings.
> 
> Can you checkout trunk and tell me what you think?
> 
> Thanks,
> 
> Richard.
> 
> 

Hi,

I  checked out trunk and it looks good. I was doing some modifications,
but they would only make sense, i guess, if ACTION_SUSPEND and the sorts
where defined as integers or code shortening. I checked the rest of the
code (sorry, i haven't pocked much around with g-p-m source before), and
that is the default coding style. So take the attached patch as a
suggestion or something.

We can discuss more on this if you want.

I'm not sure if you use any docgen tool, but the patch also fixes the
header of the new function. Just misc stuff.

Anyway, looks good, great job.

Thanks,

Alfredo.
Index: gpm-cell-array.c
===================================================================
--- gpm-cell-array.c	(revision 2075)
+++ gpm-cell-array.c	(working copy)
@@ -159,7 +159,7 @@
 }
 
 /**
- * gpm_cell_perhaps_recall_cb:
+ * gpm_cell_array_get_time_until_action:
  */
 guint
 gpm_cell_array_get_time_until_action (GpmCellArray *cell_array)
Index: gpm-manager.c
===================================================================
--- gpm-manager.c	(revision 2075)
+++ gpm-manager.c	(working copy)
@@ -1107,20 +1107,12 @@
 						     "Plug in your AC adapter to avoid losing data."),
 						   remaining, unit->percentage);
 
-		} else if (strcmp (action, ACTION_SUSPEND) == 0) {
-			message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%d%%). "
-						     "This computer will suspend in %s if the AC is not connected."),
-						   remaining, unit->percentage, critical_time_text);
-
-		} else if (strcmp (action, ACTION_HIBERNATE) == 0) {
-			message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%d%%). "
-						     "This computer will hibernate in %s if the AC is not connected."),
-						   remaining, unit->percentage, critical_time_text);
-
-		} else if (strcmp (action, ACTION_SHUTDOWN) == 0) {
-			message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%d%%). "
-						     "This computer will shutdown in %s if the AC is not connected."),
-						   remaining, unit->percentage, critical_time_text);
+		} else if ( (strcmp (action, ACTION_SUSPEND) == 0) ||
+			    (strcmp (action, ACTION_HIBERNATE) == 0) ||
+			    (strcmp (action, ACTION_SHUTDOWN) == 0) ) 
+				message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%d%%). "
+						     "This computer will %s in %s if the AC is not connected."),
+						   remaining, unit->percentage, action, critical_time_text);
 		}
 
 		g_free (action);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]