gnome-power-manager r2799 - in trunk: . applets/brightness applets/inhibit src



Author: kmaraas
Date: Mon May 19 14:24:45 2008
New Revision: 2799
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2799&view=rev

Log:
2008-05-19  Kjartan Maraas  <kmaraas gnome org>

	* applets/brightness/brightness-applet.c:
	(gpm_applet_update_tooltip):
	* applets/inhibit/inhibit-applet.c: (gpm_applet_update_tooltip):
	* src/gpm-common.c: (gpm_get_timestring):
	* src/gpm-control.c: (gpm_control_convert_hal_error):
	* src/gpm-inhibit.c: (gpm_inhibit_get_message):
	* src/gpm-manager.c: (gpm_manager_is_inhibit_valid),
	(gpm_engine_charge_critical_cb), (gpm_engine_charge_action_cb):
	* src/gpm-notify.c: (gpm_notify_inhibit_lid):
	* src/gpm-statistics-core.c: (gpm_statistics_populate_graph_types):
	Fix a bunch of build warnings with glib trunk.

Modified:
   trunk/ChangeLog
   trunk/applets/brightness/brightness-applet.c
   trunk/applets/inhibit/inhibit-applet.c
   trunk/src/gpm-common.c
   trunk/src/gpm-control.c
   trunk/src/gpm-inhibit.c
   trunk/src/gpm-manager.c
   trunk/src/gpm-notify.c
   trunk/src/gpm-statistics-core.c

Modified: trunk/applets/brightness/brightness-applet.c
==============================================================================
--- trunk/applets/brightness/brightness-applet.c	(original)
+++ trunk/applets/brightness/brightness-applet.c	Mon May 19 14:24:45 2008
@@ -349,19 +349,20 @@
 static void
 gpm_applet_update_tooltip (GpmBrightnessApplet *applet)
 {
-	static gchar buf[101];
+	gchar *buf = NULL;
 	if (applet->popped == FALSE) {
 		if (applet->proxy == NULL) {
-			snprintf (buf, 100, _("Cannot connect to gnome-power-manager"));
+			buf = g_strdup (_("Cannot connect to gnome-power-manager"));
 		} else if (applet->call_worked == FALSE) {
-			snprintf (buf, 100, _("Cannot get laptop panel brightness"));
+			buf = g_strdup (_("Cannot get laptop panel brightness"));
 		} else {
-			snprintf (buf, 100, _("LCD brightness : %d%%"), applet->level);
+			buf = g_strdup_printf (_("LCD brightness : %d%%"), applet->level);
 		}
 		gtk_widget_set_tooltip_text (GTK_WIDGET(applet), buf);
 	} else {
 		gtk_widget_set_tooltip_text (GTK_WIDGET(applet), NULL);
 	}
+	g_free (buf);
 }
 
 /**

Modified: trunk/applets/inhibit/inhibit-applet.c
==============================================================================
--- trunk/applets/inhibit/inhibit-applet.c	(original)
+++ trunk/applets/inhibit/inhibit-applet.c	Mon May 19 14:24:45 2008
@@ -344,14 +344,14 @@
 static void
 gpm_applet_update_tooltip (GpmInhibitApplet *applet)
 {
-	static gchar buf[101];
+	const gchar *buf;
 	if (applet->proxy == NULL) {
-		snprintf (buf, 100, _("Cannot connect to gnome-power-manager"));
+		buf = g_strdup (_("Cannot connect to gnome-power-manager"));
 	} else {
 		if (applet->cookie > 0) {
-			snprintf (buf, 100, _("Automatic sleep inhibited"));
+			buf = g_strdup (_("Automatic sleep inhibited"));
 		} else {
-			snprintf (buf, 100, _("Automatic sleep enabled"));
+			buf = g_strdup (_("Automatic sleep enabled"));
 		}
 	}
 	gtk_widget_set_tooltip_text (GTK_WIDGET(applet), buf);

Modified: trunk/src/gpm-common.c
==============================================================================
--- trunk/src/gpm-common.c	(original)
+++ trunk/src/gpm-common.c	Mon May 19 14:24:45 2008
@@ -237,7 +237,7 @@
 	minutes = (int) ( ( time_secs / 60.0 ) + 0.5 );
 
 	if (minutes == 0) {
-		timestring = g_strdup_printf (_("Unknown time"));
+		timestring = g_strdup (_("Unknown time"));
 		return timestring;
 	}
 

Modified: trunk/src/gpm-control.c
==============================================================================
--- trunk/src/gpm-control.c	(original)
+++ trunk/src/gpm-control.c	Mon May 19 14:24:45 2008
@@ -276,10 +276,10 @@
 	if (code == 9) {
 		/* DBUS security prevents sending */
 		g_set_error (error, GPM_CONTROL_ERROR, GPM_CONTROL_ERROR_GENERAL,
-			     _("The message was not sent due to DBUS security rules"));
+			     "%s", _("The message was not sent due to DBUS security rules"));
 	} else {
 		g_set_error (error, GPM_CONTROL_ERROR, GPM_CONTROL_ERROR_GENERAL,
-			     _("General failure: %s"), message);
+			     "%s:%s", _("General failure"), message);
 	}
 	g_free (message);
 }

Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c	(original)
+++ trunk/src/gpm-inhibit.c	Mon May 19 14:24:45 2008
@@ -404,22 +404,22 @@
 
 	} else {
 		if (strcmp (action, "suspend") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the suspend from taking place."));
+			g_string_append (message, _("Multiple applications have stopped the suspend from taking place."));
 
 		} else if (strcmp (action, "hibernate") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the hibernate from taking place."));
+			g_string_append (message, _("Multiple applications have stopped the hibernate from taking place."));
 
 		} else if (strcmp (action, "policy action") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the policy action from taking place."));
+			g_string_append (message, _("Multiple applications have stopped the policy action from taking place."));
 
 		} else if (strcmp (action, "reboot") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the reboot from taking place.")); 
+			g_string_append (message, _("Multiple applications have stopped the reboot from taking place.")); 
 
 		} else if (strcmp (action, "shutdown") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the shutdown from taking place."));
+			g_string_append (message, _("Multiple applications have stopped the shutdown from taking place."));
 
 		} else if (strcmp (action, "timeout action") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the suspend from taking place."));
+			g_string_append (message, _("Multiple applications have stopped the suspend from taking place."));
 		}
 		
 		for (a=0; a<g_slist_length (inhibit->priv->list); a++) {

Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c	(original)
+++ trunk/src/gpm-manager.c	Mon May 19 14:24:45 2008
@@ -180,22 +180,22 @@
 
 		/*Compose message for each possible action*/
 		if (strcmp (action, "suspend") == 0) {
-				title = g_strdup_printf (_("Request to suspend")); 
+				title = g_strdup (_("Request to suspend")); 
 
 		} else if (strcmp (action, "hibernate") == 0) {
-				title = g_strdup_printf (_("Request to hibernate")); 
+				title = g_strdup (_("Request to hibernate")); 
 
 		} else if (strcmp (action, "policy action") == 0) {
-				title = g_strdup_printf (_("Request to do policy action")); 
+				title = g_strdup (_("Request to do policy action")); 
 
 		} else if (strcmp (action, "reboot") == 0) {
-				title = g_strdup_printf (_("Request to reboot")); 
+				title = g_strdup (_("Request to reboot")); 
 
 		} else if (strcmp (action, "shutdown") == 0) {
-				title = g_strdup_printf (_("Request to shutdown")); 
+				title = g_strdup (_("Request to shutdown")); 
 
 		} else if (strcmp (action, "timeout action") == 0) {
-				title = g_strdup_printf (_("Request to do timeout action"));
+				title = g_strdup (_("Request to do timeout action"));
 		}
 		
 		gpm_inhibit_get_message (manager->priv->inhibit, message, action);
@@ -1467,7 +1467,7 @@
 
 		/* use different text for different actions */
 		if (strcmp (action, ACTION_NOTHING) == 0) {
-			action_text = g_strdup_printf (_("Plug in your AC adapter to avoid losing data."));
+			action_text = g_strdup (_("Plug in your AC adapter to avoid losing data."));
 
 		} else if (strcmp (action, ACTION_SUSPEND) == 0) {
 			action_text = g_strdup_printf (_("This computer will suspend in %s if the AC is not connected."), time_text);
@@ -1579,17 +1579,17 @@
 
 		/* use different text for different actions */
 		if (strcmp (action, ACTION_NOTHING) == 0) {
-			message = _("The UPS is below the critical level and "
-				    "this computer will <b>power-off</b> when the "
-				    "UPS becomes completely empty.");
+			message = g_strdup (_("The UPS is below the critical level and "
+				              "this computer will <b>power-off</b> when the "
+				              "UPS becomes completely empty."));
 
 		} else if (strcmp (action, ACTION_HIBERNATE) == 0) {
-			message = _("The UPS is below the critical level and "
-				    "this computer is about to hibernate.");
+			message = g_strdup (_("The UPS is below the critical level and "
+				              "this computer is about to hibernate."));
 
 		} else if (strcmp (action, ACTION_SHUTDOWN) == 0) {
-			message = _("The UPS is below the critical level and "
-				    "this computer is about to shutdown.");
+			message = g_strdup (_("The UPS is below the critical level and "
+				              "this computer is about to shutdown."));
 		}
 
 		g_free (action);

Modified: trunk/src/gpm-notify.c
==============================================================================
--- trunk/src/gpm-notify.c	(original)
+++ trunk/src/gpm-notify.c	Mon May 19 14:24:45 2008
@@ -455,10 +455,10 @@
 	}
 
 	title = _("Sleep warning");
-	msg = g_strdup_printf (_("Your laptop will not sleep if you shut the "
-				 "lid as a running program has prevented this.\n"
-				 "Some laptops can overheat if they do not sleep "
-				 "when the lid is closed."));
+	msg = g_strdup (_("Your laptop will not sleep if you shut the "
+			  "lid as a running program has prevented this.\n"
+			  "Some laptops can overheat if they do not sleep "
+			  "when the lid is closed."));
 
 	gpm_notify_create (notify, title, msg, GPM_NOTIFY_TIMEOUT_LONG,
 			   GPM_STOCK_INHIBIT,

Modified: trunk/src/gpm-statistics-core.c
==============================================================================
--- trunk/src/gpm-statistics-core.c	(original)
+++ trunk/src/gpm-statistics-core.c	Mon May 19 14:24:45 2008
@@ -700,7 +700,7 @@
 	GList *l;
 	gchar *type;
 	gchar *saved;
-	gchar *type_localized;
+	const gchar *type_localized;
 	gboolean ret;
 	guint count, pos;
 



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