Commit fcc25be8 authored by Alexander Larsson's avatar Alexander Larsson

Fix applet background color handling (GdkColor contents are 16 bit).

Made the clock applet respect background settings.
parent 90245feb
2001-12-14 Alex Larsson <alexl@redhat.com>
* gen_util/clock.c:
Handle background color changes.
2001-12-14 Mark McLoughlin <mark@skynet.ie>
* gen_util/clock.c: update for panel-applet
......
2001-12-14 Alex Larsson <alexl@redhat.com>
* gen_util/clock.c:
Handle background color changes.
2001-12-14 Mark McLoughlin <mark@skynet.ie>
* gen_util/clock.c: update for panel-applet
......
......@@ -373,6 +373,29 @@ applet_change_orient (PanelApplet *applet,
(*cd->update_func) (cd, current_time);
}
static void
applet_change_background (PanelApplet *applet,
PanelAppletBackgroundType type,
GdkColor *color,
const gchar *pixmap,
ClockData *cd)
{
if (type == PANEL_NO_BACKGROUND)
{
GtkRcStyle *rc_style = gtk_rc_style_new ();
gtk_widget_modify_style (cd->applet, rc_style);
}
else if (type == PANEL_COLOR_BACKGROUND)
{
gtk_widget_modify_bg (cd->applet,
GTK_STATE_NORMAL,
color);
} else { /* pixmap */
/* FIXME: Handle this when the panel support works again */
}
}
/* this is when the panel size changes */
static void
......@@ -576,6 +599,12 @@ make_clock_applet(void)
G_CALLBACK (applet_change_pixel_size),
cd);
g_signal_connect (G_OBJECT (cd->applet),
"change_background",
G_CALLBACK (applet_change_background),
cd);
#ifdef FIXME
g_signal_connect (G_OBJECT (cd->applet),
"save_session",
......
2001-12-14 Alex Larsson <alexl@redhat.com>
* gen_util/clock.c:
Handle background color changes.
2001-12-14 Mark McLoughlin <mark@skynet.ie>
* gen_util/clock.c: update for panel-applet
......
......@@ -373,6 +373,29 @@ applet_change_orient (PanelApplet *applet,
(*cd->update_func) (cd, current_time);
}
static void
applet_change_background (PanelApplet *applet,
PanelAppletBackgroundType type,
GdkColor *color,
const gchar *pixmap,
ClockData *cd)
{
if (type == PANEL_NO_BACKGROUND)
{
GtkRcStyle *rc_style = gtk_rc_style_new ();
gtk_widget_modify_style (cd->applet, rc_style);
}
else if (type == PANEL_COLOR_BACKGROUND)
{
gtk_widget_modify_bg (cd->applet,
GTK_STATE_NORMAL,
color);
} else { /* pixmap */
/* FIXME: Handle this when the panel support works again */
}
}
/* this is when the panel size changes */
static void
......@@ -576,6 +599,12 @@ make_clock_applet(void)
G_CALLBACK (applet_change_pixel_size),
cd);
g_signal_connect (G_OBJECT (cd->applet),
"change_background",
G_CALLBACK (applet_change_background),
cd);
#ifdef FIXME
g_signal_connect (G_OBJECT (cd->applet),
"save_session",
......
2001-12-14 Alex Larsson <alexl@redhat.com>
* gen_util/clock.c:
Handle background color changes.
2001-12-14 Mark McLoughlin <mark@skynet.ie>
* gen_util/clock.c: update for panel-applet
......
2001-12-14 Alex Larsson <alexl@redhat.com>
* gen_util/clock.c:
Handle background color changes.
2001-12-14 Mark McLoughlin <mark@skynet.ie>
* gen_util/clock.c: update for panel-applet
......
2001-12-14 Alex Larsson <alexl@redhat.com>
* panel-applet-frame.c (panel_applet_frame_change_background_color):
Make colors 4 chars per channel, they are 16bit.
2001-12-14 Mark McLoughlin <mark@skynet.ie>
* panel-applet-frame.c: (panel_applet_frame_get_applet_shell):
......
......@@ -204,7 +204,7 @@ panel_applet_frame_change_background_color (PanelAppletFrame *frame,
{
gchar *bg_str;
bg_str = g_strdup_printf ("color:#%.2x%.2x%.2x", red, green, blue);
bg_str = g_strdup_printf ("color:#%.4x%.4x%.4x", red, green, blue);
bonobo_pbclient_set_string (frame->priv->property_bag,
"panel-applet-background",
......
2001-12-14 Alex Larsson <alexl@redhat.com>
* panel-applet.c (panel_applet_parse_color):
Make colors 4 chars per channel, they are 16bit.
2001-12-14 Mark McLoughlin <mark@skynet.ie>
* panel-applet-shell.c:
......
......@@ -288,7 +288,7 @@ panel_applet_parse_color (const gchar *color_str,
if (color_str [0] != '#')
return FALSE;
if (sscanf (color_str + 1, "%2x%2x%2x", &r, &g, &b) != 3)
if (sscanf (color_str + 1, "%4x%4x%4x", &r, &g, &b) != 3)
return FALSE;
color->red = r;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment