[Xfce4-commits] <xfce4-panel:devel> * Fix compiler warnings in clock. * Handle xfconf_init error if it fails.
Nick Schermer
nick at xfce.org
Tue Aug 11 20:26:30 CEST 2009
Updating branch refs/heads/devel
to a72af8586ae2a8718f03e37059d1e2ec2261fb92 (commit)
from 5c5d8e037d10218ecc807f6508d46e0a63aecbe7 (commit)
commit a72af8586ae2a8718f03e37059d1e2ec2261fb92
Author: Nick Schermer <nick at xfce.org>
Date: Fri Dec 26 15:57:29 2008 +0100
* Fix compiler warnings in clock.
* Handle xfconf_init error if it fails.
panel/main.c | 24 ++++++++++++++----------
plugins/clock/clock-lcd.c | 32 ++++++++++++++++----------------
2 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/panel/main.c b/panel/main.c
index 25f7cd0..b84093d 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -149,19 +149,17 @@ main (gint argc, gchar **argv)
if (G_LIKELY (error))
{
/* print error */
- g_print ("%s: %s.\n", G_LOG_DOMAIN, error->message);
+ g_print ("%s: %s.\n", PACKAGE_NAME, error->message);
g_print (_("Type '%s --help' for usage."), G_LOG_DOMAIN);
g_print ("\n");
/* cleanup */
g_error_free (error);
- }
- else
- {
- g_error ("Unable to open display.");
- }
-
- return EXIT_FAILURE;
+ }
+ else
+ {
+ g_error ("Unable to open display.");
+ }
/* leave */
return EXIT_FAILURE;
@@ -230,8 +228,14 @@ main (gint argc, gchar **argv)
}
/* initialize xfconf */
- /* TODO */
- xfconf_init (NULL);
+ if (!xfconf_init (&error))
+ {
+ /* print error and exit */
+ g_error ("Failed to connect to xfconf daemon: %s.", error->message);
+ g_error_free (error);
+
+ return EXIT_FAILURE;
+ }
/* create dbus service */
dbus_service = panel_dbus_service_get ();
diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c
index f7c5cfb..29f44bf 100644
--- a/plugins/clock/clock-lcd.c
+++ b/plugins/clock/clock-lcd.c
@@ -454,8 +454,6 @@ xfce_clock_lcd_draw_digit (cairo_t *cr,
gdouble x, y;
gdouble rel_x, rel_y;
- panel_return_val_if_fail (number <= 11, offset_x);
-
/* ##1##
* 6 2
* ##7##
@@ -464,20 +462,20 @@ xfce_clock_lcd_draw_digit (cairo_t *cr,
*/
/* coordicates to draw for each segment */
- gdouble segments_x[][6] = { { 0.02, 0.48, 0.38, 0.12, -1.0, 0.00 }, /* 1x */
- { 0.40, 0.505, 0.505, 0.40, -1.0, 0.00 }, /* 2x */
- { 0.40, 0.505, 0.505, 0.40, -1.0, 0.00 }, /* 3x */
- { 0.12, 0.38, 0.48, 0.02, -1.0, 0.00 }, /* 4x */
- { 0.00, 0.105, 0.105, 0.00, -1.0, 0.00 }, /* 5x */
- { 0.00, 0.105, 0.105, 0.00, -1.0, 0.00 }, /* 6x */
- { 0.00, 0.10, 0.40, 0.50, 0.40, 0.10 } }; /* 7x */
- gdouble segments_y[][6] = { { 0.00, 0.00, 0.105, 0.105, -1.0, 0.00 }, /* 1y */
- { 0.12, 0.02, 0.48, 0.43, -1.0, 0.00 }, /* 2y */
- { 0.57, 0.52, 0.98, 0.88, -1.0, 0.00 }, /* 3y */
- { 0.90, 0.90, 1.00, 1.00, -1.0, 0.00 }, /* 4y */
- { 0.52, 0.57, 0.88, 0.98, -1.0, 0.00 }, /* 5y */
- { 0.02, 0.12, 0.43, 0.48, -1.0, 0.00 }, /* 6y */
- { 0.50, 0.445, 0.445, 0.50, 0.55, 0.55 } }; /* 7y */
+ gdouble segments_x[][6] = { { 0.02, 0.48, 0.38, 0.12, -1.0, 0.00 }, /* 1x */
+ { 0.40, 0.505, 0.505, 0.40, -1.0, 0.00 }, /* 2x */
+ { 0.40, 0.505, 0.505, 0.40, -1.0, 0.00 }, /* 3x */
+ { 0.12, 0.38, 0.48, 0.02, -1.0, 0.00 }, /* 4x */
+ { 0.00, 0.105, 0.105, 0.00, -1.0, 0.00 }, /* 5x */
+ { 0.00, 0.105, 0.105, 0.00, -1.0, 0.00 }, /* 6x */
+ { 0.00, 0.10, 0.40, 0.50, 0.40, 0.10 } }; /* 7x */
+ gdouble segments_y[][6] = { { 0.00, 0.00, 0.105, 0.105, -1.0, 0.00 }, /* 1y */
+ { 0.12, 0.02, 0.48, 0.43, -1.0, 0.00 }, /* 2y */
+ { 0.57, 0.52, 0.98, 0.88, -1.0, 0.00 }, /* 3y */
+ { 0.90, 0.90, 1.00, 1.00, -1.0, 0.00 }, /* 4y */
+ { 0.52, 0.57, 0.88, 0.98, -1.0, 0.00 }, /* 5y */
+ { 0.02, 0.12, 0.43, 0.48, -1.0, 0.00 }, /* 6y */
+ { 0.50, 0.445, 0.445, 0.50, 0.55, 0.55 } }; /* 7y */
/* segment to draw for each number: 0, 1, ..., 9, A, P */
gint numbers[][8] = { { 0, 1, 2, 3, 4, 5, -1 },
@@ -493,6 +491,8 @@ xfce_clock_lcd_draw_digit (cairo_t *cr,
{ 4, 5, 0, 1, 2, 6, -1 },
{ 4, 5, 0, 1, 6, -1 } };
+ panel_return_val_if_fail (number <= 11, offset_x);
+
for (i = 0; i < 9; i++)
{
/* get the segment we're going to draw */
More information about the Xfce4-commits
mailing list