Commit 2d727738 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

fixed some braindamages, switch between, color, pixmap and standard

Thu Jun 04 00:32:50 1998  George Lebl  <jirka@5z.com>

        * panel_config.c: fixed some braindamages, switch between,
          color, pixmap and standard backgrounds, added a color selector

        * panel-widget.[ch]: added a background type variable and support
          the above changes, fix some some braindamages, scale the back
	  pixmap when needed (needs to be optimized but it works for now)

        * main.c,panel.[ch]: support for the above

        * gnome-panel.idl (and all corba files): added a sync corba call
          so that applets can force a save of the session

        * panel_config.c, panel_config_global.c: sync the configuration after
          apply

        * panel.c, main.c: add a timeout to sync every 10 seconds if something
          has changed

originally this was supposed to go in after the freeze, but since it fixes
so many braindamages with the way the backgrounds (they were kind of hacked in
before)

this adresses bugs #50 (kind of) and #166, plus a few others which
aren't on the bug tracker (but which I've had on my todo list:)
parent 784f8509
Thu Jun 04 00:32:50 1998 George Lebl <jirka@5z.com>
* panel_config.c: fixed some braindamages, switch between,
color, pixmap and standard backgrounds, added a color selector
* panel-widget.[ch]: added a background type variable and support
teh above changes, fix some some braindamages
* main.c,panel.[ch]: support for the above
* gnome-panel.idl (and all corba files): added a sync corba call
so that applets can force a save of the session
* panel_config.c, panel_config_global.c: sync the configuration after
apply
* panel.c, main.c: add a timeout to sync every 10 seconds if something
has changed
1998-06-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
* panel-widget.c (panel_try_to_set_back_color): Destroy the pixmap
......
Thu Jun 04 00:32:50 1998 George Lebl <jirka@5z.com>
* panel_config.c: fixed some braindamages, switch between,
color, pixmap and standard backgrounds, added a color selector
* panel-widget.[ch]: added a background type variable and support
teh above changes, fix some some braindamages
* main.c,panel.[ch]: support for the above
* gnome-panel.idl (and all corba files): added a sync corba call
so that applets can force a save of the session
* panel_config.c, panel_config_global.c: sync the configuration after
apply
* panel.c, main.c: add a timeout to sync every 10 seconds if something
has changed
1998-06-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
* panel-widget.c (panel_try_to_set_back_color): Destroy the pixmap
......
......@@ -550,6 +550,16 @@ gnome_panel_applet_cleanup(gint applet_id)
}
char *
gnome_panel_sync_config (void)
{
char *result;
panel_client->sync_config (cookie);
return 0;
}
char *
gnome_panel_quit (void)
{
......
......@@ -25,6 +25,7 @@ char *gnome_panel_applet_remove_from_panel (gint applet_id);
char *gnome_panel_applet_request_glob_cfg (char **globcfgpath);
gint gnome_panel_applet_get_panel_orient (gint applet_id);
char *gnome_panel_quit (void);
char *gnome_panel_sync_config (void);
int gnome_panel_applet_init_corba (void);
int gnome_panel_applet_reinit_corba (void);
void gnome_panel_applet_register_callback (gint applet_id,
......
......@@ -163,6 +163,12 @@ applet_widget_remove_from_panel(AppletWidget *applet)
gnome_panel_applet_remove_from_panel(applet->applet_id);
}
void
applet_widget_sync_config(void)
{
gnome_panel_sync_config();
}
void
applet_widget_register_callback(AppletWidget *applet,
char *name,
......
......@@ -114,10 +114,13 @@ AppletWidget* applet_widget_get_by_id (gint applet_id);
/*get thenumber of applets*/
gint applet_widget_get_applet_count (void);
/*tell the panel to save the session here (just saves no shutdown)*/
void applet_widget_sync_config (void);
/* Get the oprientation the applet should use */
PanelOrientType applet_widget_get_panel_orient (AppletWidget *applet);
/*use this instead of gnome init, if you want multi applet, you also
have to specify a "start new applet" function which will launch a new
applet*/
......
......@@ -173,40 +173,40 @@ create_empty_drawer_applet(PanelOrientType orient)
PANEL_VERTICAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_LEFT, NULL, NULL),
DROP_ZONE_LEFT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
orient);
case ORIENT_DOWN:
return create_drawer_applet(panel_widget_new(0,
PANEL_VERTICAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_RIGHT, NULL, NULL),
DROP_ZONE_RIGHT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
orient);
case ORIENT_LEFT:
return create_drawer_applet(panel_widget_new(0,
PANEL_HORIZONTAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_LEFT, NULL, NULL),
DROP_ZONE_LEFT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
orient);
case ORIENT_RIGHT:
return create_drawer_applet(panel_widget_new(0,
PANEL_HORIZONTAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_RIGHT, NULL, NULL),
DROP_ZONE_RIGHT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
orient);
}
return NULL;
......@@ -224,8 +224,7 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
switch (drawer->orient) {
case ORIENT_DOWN:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-down.png");
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-down.png");
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_VERTICAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......@@ -234,8 +233,7 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
break;
case ORIENT_UP:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-up.png");
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-up.png");
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_VERTICAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......@@ -243,8 +241,7 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
DROP_ZONE_LEFT);
break;
case ORIENT_RIGHT:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-right.png");
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-right.png");
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_HORIZONTAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......@@ -252,8 +249,7 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
DROP_ZONE_RIGHT);
break;
case ORIENT_LEFT:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-left.png");
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-left.png");
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_HORIZONTAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......
......@@ -42,7 +42,8 @@ module GNOME {
void applet_remove_tooltip (in string cookie,
in short applet_id);
short applet_in_drag (in string cookie);
void quit(in string cookie);
void sync_config (in string cookie);
void quit (in string cookie);
};
interface Applet {
......
......@@ -37,6 +37,9 @@
yes I am too lazy to get the events to work*/
static gint panel_dragged = 0;
gint config_sync_timeout = 0;
gint config_changed = FALSE;
GArray *applets;
gint applet_count;
......@@ -356,9 +359,11 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
param = params;
if(!cfgpath || !*cfgpath)
/*FIXME: fix this minor leak*/
cfgpath = g_copy_strings(old_panel_cfg_path,
"Applet_Dummy/",NULL);
else
/*we will free this lateer*/
cfgpath = g_strdup(cfgpath);
/*VERY UGLY compatibility hack for the old launcher applet*/
if(strcmp(path,"#panel.application.launcher")==0) {
......@@ -368,6 +373,7 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
g_free(p);
load_applet(LAUNCHER_ID,NULL,fullpath,pos,panel,
cfgpath);
g_free(cfgpath);
g_free(fullpath);
return;
}
......@@ -386,6 +392,7 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
g_warning("Whoops! for some reason we can't add "
"to the panel");
g_free(fullpath);
g_free(cfgpath);
return;
}
......@@ -394,6 +401,7 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
if(path[0]!='#')
exec_prog(applet_count-1,fullpath,param);
g_free(cfgpath);
g_free(fullpath);
} else if(strcmp(id_str,MENU_ID) == 0) {
Menu *menu;
......@@ -628,6 +636,7 @@ panel_orient_change(GtkWidget *widget,
{
panel_widget_foreach(PANEL_WIDGET(widget),orient_change_foreach,
(gpointer)widget);
config_changed = TRUE;
return TRUE;
}
......@@ -675,6 +684,8 @@ panel_state_change(GtkWidget *widget,
panel_widget_foreach(PANEL_WIDGET(widget),state_hide_foreach,
(gpointer)widget);
config_changed = TRUE;
return TRUE;
}
......@@ -687,6 +698,7 @@ panel_size_allocate(GtkWidget *widget, GtkAllocation *alloc, gpointer data)
if(drawer)
if(panel->state == PANEL_SHOWN)
reposition_drawer(drawer);
config_changed = TRUE;
return FALSE;
}
......@@ -703,6 +715,8 @@ panel_applet_added_idle(gpointer data)
orientation_change(ai->applet_id,ai->panel);
g_free(ai);
config_changed = TRUE;
return FALSE;
}
......@@ -726,6 +740,7 @@ panel_applet_added(GtkWidget *widget, GtkWidget *applet, gpointer data)
static gint
panel_applet_removed(GtkWidget *widget, gpointer data)
{
config_changed = TRUE;
return TRUE;
}
......@@ -818,10 +833,12 @@ panel_move(PanelWidget *panel, double x, double y)
panel->orient,
newloc,
panel->mode,
panel->fit_pixmap_bg,
panel->state,
panel->drawer_drop_zone_pos,
panel->back_pixmap );
panel->back_type,
panel->back_pixmap,
panel->fit_pixmap_bg,
&panel->back_color);
while(gtk_events_pending())
gtk_main_iteration();
}
......@@ -932,6 +949,7 @@ static void
panel_applet_move(GtkWidget *panel,GtkWidget *widget, gpointer data)
{
applet_move_foreach(widget,NULL);
config_changed = TRUE;
}
......@@ -1010,8 +1028,9 @@ init_user_panels(void)
GtkWidget *panel;
PanelState state;
DrawerDropZonePos drop_pos;
char *back_pixmap, *tmp;
GdkColor back_color;
PanelBackType back_type;
char *back_pixmap, *color;
GdkColor back_color = {0,0,0,1};
g_snprintf(buf,256,"%sConfig/panel_count=0",old_panel_cfg_path);
count=gnome_config_get_int(buf);
......@@ -1054,30 +1073,42 @@ init_user_panels(void)
drop_pos=gnome_config_get_int(buf);
back_pixmap = gnome_config_get_string ("backpixmap=");
if (back_pixmap && *back_pixmap == 0)
if (back_pixmap && *back_pixmap == '\0') {
g_free(back_pixmap);
back_pixmap = NULL;
}
tmp = gnome_config_get_string("backcolor");
if(tmp && *tmp) {
g_print("tmp for color = %s\n", tmp);
gdk_color_parse(tmp, &back_color);
back_color.pixel = 1;
} else
back_color.pixel = 0;
g_free(tmp);
color = gnome_config_get_string("backcolor=#ffffff");
if(color && *color)
gdk_color_parse(color, &back_color);
/*minor hack to keep older config file compatibility, if we get 999, we
try to guess this*/
back_type=gnome_config_get_int("back_type=999");
if(back_type == 999) {
if(back_pixmap && *back_pixmap)
back_type = PANEL_BACK_PIXMAP;
else if(strcmp(color,"#ffffff")!=0)
back_type = PANEL_BACK_COLOR;
else
back_type = PANEL_BACK_NONE;
}
gnome_config_pop_prefix ();
panel = panel_widget_new(size,
config.orient,
config.snapped,
config.mode,
config.fit_pixmap_bg,
state,
x,
y,
drop_pos,
back_type,
back_pixmap,
back_color.pixel?&back_color:NULL);
config.fit_pixmap_bg,
&back_color);
g_free(color);
g_free(back_pixmap);
panel_widget_disable_buttons(PANEL_WIDGET(panel));
......@@ -1111,8 +1142,7 @@ discard_session (gchar *id)
static error_t
parse_an_arg (int key, char *arg, struct argp_state *state)
{
if (key == DISCARD_KEY)
{
if (key == DISCARD_KEY) {
discard_session (arg);
just_exit = 1;
return 0;
......@@ -1170,6 +1200,15 @@ sigchld_handler(int type)
}
}
static gint
try_config_sync(gpointer data)
{
if(config_changed)
panel_sync_config();
config_changed = FALSE;
return TRUE;
}
int
main(int argc, char **argv)
......@@ -1270,6 +1309,10 @@ main(int argc, char **argv)
add_forbidden_to_panels();
/*attempt to sync the config every 10 seconds, only if a change was
indicated though*/
config_sync_timeout = gtk_timeout_add(10*1000,try_config_sync,NULL);
/* I use the glue code to avoid making this a C++ file */
panel_corba_gtk_main ("IDL:GNOME/Panel:1.0");
......
......@@ -131,6 +131,10 @@ public:
CHECK_COOKIE_V (FALSE);
return panel_applet_in_drag;
}
void sync_config(const char *ccookie) {
CHECK_COOKIE ();
::panel_sync_config();
}
void quit(const char *ccookie) {
CHECK_COOKIE ();
::panel_quit();
......
......@@ -10,7 +10,6 @@
/* Used for all the packing and padding options */
#define CONFIG_PADDING_SIZE 3
/* used to temporarily store config values until the 'Apply'
* button is pressed. */
PanelConfig panel_config_struct;
......@@ -32,6 +31,7 @@ config_destroy(GtkWidget *widget, gpointer data)
{
config_window = NULL;
panel_config_struct.config_box = 0;
g_free(panel_config_struct.back_pixmap);
}
static gint
......@@ -78,23 +78,20 @@ static void
config_apply (GtkWidget *widget, int page, gpointer data)
{
PanelWidget *panel = data;
char *back_pixmap;
if(panel_config_struct.pixmap_enable)
back_pixmap = GTK_ENTRY (gnome_file_entry_gtk_entry (
GNOME_FILE_ENTRY (file_entry)))->text;
else
back_pixmap = "";
panel_widget_change_params(panel,
panel_config_struct.orient,
panel_config_struct.snapped,
panel_config_struct.mode,
panel_config_struct.fit_pixmap_bg,
panel->state,
panel->drawer_drop_zone_pos,
back_pixmap);
panel_config_struct.back_type,
panel_config_struct.back_pixmap,
panel_config_struct.fit_pixmap_bg,
&panel_config_struct.back_color);
gtk_widget_queue_draw (GTK_WIDGET (panel));
panel_sync_config();
}
GtkWidget *
......@@ -211,75 +208,124 @@ align (GtkWidget *w, float x)
}
static gint
value_changed ()
value_changed (GtkWidget *w, gpointer data)
{
g_free(panel_config_struct.back_pixmap);
panel_config_struct.back_pixmap =
g_strdup(gtk_entry_get_text(GTK_ENTRY(w)));
if (panel_config_struct.config_box)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
return FALSE;
}
static void
set_pixmap_enable (GtkWidget *widget, gpointer data)
set_fit_pixmap_bg (GtkToggleButton *toggle, gpointer data)
{
GtkWidget *w = data;
gint enabled = GTK_TOGGLE_BUTTON(widget)->active;
panel_config_struct.pixmap_enable = enabled;
gtk_widget_set_sensitive(w,enabled);
panel_config_struct.fit_pixmap_bg = toggle->active;
if (panel_config_struct.config_box)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
}
static void
set_fit_pixmap_bg (GtkToggleButton *toggle, gpointer data)
color_changed_cb(GnomeColorSelector *sel, gpointer data)
{
panel_config_struct.fit_pixmap_bg = toggle->active;
gint r,g,b;
gnome_color_selector_get_color_int(sel,&r,&g,&b, 65355);
panel_config_struct.back_color.red = r;
panel_config_struct.back_color.green = g;
panel_config_struct.back_color.blue =b;
if (panel_config_struct.config_box)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
}
static void
color_changed_cb( GnomeColorSelector *widget, gchar **color )
static gint
set_back (GtkWidget *widget, gpointer data)
{
char *tmp;
int r,g,b;
/*FIXME*/
return;
GtkWidget *pix;
GtkWidget *col;
PanelBackType back_type = PTOI(data);
if(!GTK_TOGGLE_BUTTON(widget)->active)
return FALSE;
/* FIXME ugh, mem leak..anyone have a better way of doing this? */
tmp = g_malloc(24);
if( !tmp )
{
g_warning(_("Can't allocate memory for color\n"));
return;
pix = gtk_object_get_data(GTK_OBJECT(widget),"pix");
col = gtk_object_get_data(GTK_OBJECT(widget),"col");
if(back_type == PANEL_BACK_NONE) {
gtk_widget_set_sensitive(pix,FALSE);
gtk_widget_set_sensitive(col,FALSE);
} else if(back_type == PANEL_BACK_COLOR) {
gtk_widget_set_sensitive(pix,FALSE);
gtk_widget_set_sensitive(col,TRUE);
} else {
gtk_widget_set_sensitive(pix,TRUE);
gtk_widget_set_sensitive(col,FALSE);
}
gnome_color_selector_get_color_int(
widget, &r, &g, &b, 255 );
sprintf( tmp, "#%02x%02x%02x", r, g, b );
*color = tmp;
panel_config_struct.back_type = back_type;
if (panel_config_struct.config_box)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
}
static GtkWidget *
pixmap_page (PanelWidget *panel)
background_page (PanelWidget *panel)
{
GtkWidget *box, *f, *t;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *w;
GtkWidget *fit;
GtkWidget *pix;
GtkWidget *col;
GtkWidget *non;
GnomeColorSelector *sel;
vbox = gtk_vbox_new (FALSE, CONFIG_PADDING_SIZE);
gtk_container_border_width(GTK_CONTAINER (vbox), CONFIG_PADDING_SIZE);
/*selector frame*/
f = gtk_frame_new (_("Background"));
gtk_container_border_width(GTK_CONTAINER (f), CONFIG_PADDING_SIZE);
gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, FALSE,
CONFIG_PADDING_SIZE);
box = gtk_hbox_new (0, 0);
gtk_container_border_width(GTK_CONTAINER (box), CONFIG_PADDING_SIZE);
gtk_container_add (GTK_CONTAINER (f), box);
/*standard background*/
non = gtk_radio_button_new_with_label (NULL, _("Standard"));
gtk_box_pack_start (GTK_BOX (box), non, FALSE, FALSE,
CONFIG_PADDING_SIZE);
/* pixmap */
pix = gtk_radio_button_new_with_label (
gtk_radio_button_group (GTK_RADIO_BUTTON (non)),
_("Pixmap"));
gtk_box_pack_start (GTK_BOX (box), pix, FALSE, FALSE,
CONFIG_PADDING_SIZE);
/* color */
col = gtk_radio_button_new_with_label (
gtk_radio_button_group (GTK_RADIO_BUTTON (non)),
_("Color"));
gtk_box_pack_start (GTK_BOX (box), col, FALSE, FALSE,
CONFIG_PADDING_SIZE);
/*image frame*/
f = gtk_frame_new (_("Image file"));
if(panel_config_struct.back_type == PANEL_BACK_PIXMAP) {
gtk_widget_set_sensitive(f,TRUE);
} else {
gtk_widget_set_sensitive(f,FALSE);
}
gtk_object_set_data(GTK_OBJECT(pix),"pix",f);
gtk_object_set_data(GTK_OBJECT(col),"pix",f);
gtk_object_set_data(GTK_OBJECT(non),"pix",f);
gtk_container_border_width(GTK_CONTAINER (f), CONFIG_PADDING_SIZE);
gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, FALSE,
CONFIG_PADDING_SIZE);
......@@ -290,19 +336,6 @@ pixmap_page (PanelWidget *panel)
file_entry = gnome_file_entry_new ("pixmap", _("Browse"));
fit = gtk_check_button_new_with_label (_("Scale image to fit panel"));
w = gtk_check_button_new_with_label (_("Enable Background Image"));
/*always set to true, because in the beginning we don't have
any pixmap so it's not gonna be set by default anyhow*/
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_pixmap_enable),
file_entry);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_pixmap_enable),
fit);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,
CONFIG_PADDING_SIZE);
t = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (file_entry));
gtk_signal_connect (GTK_OBJECT (t), "changed",
......@@ -310,34 +343,67 @@ pixmap_page (PanelWidget *panel)
gtk_box_pack_start (GTK_BOX (box), file_entry, FALSE, FALSE,
CONFIG_PADDING_SIZE);
gtk_entry_set_text (GTK_ENTRY (t), panel->back_pixmap ?
panel->back_pixmap : "");
gtk_entry_set_text (GTK_ENTRY(t),
panel->back_pixmap?panel->back_pixmap:"");
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fit),
w = gtk_check_button_new_with_label (_("Scale image to fit panel"));
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w),
panel->fit_pixmap_bg);
gtk_signal_connect (GTK_OBJECT (fit), "toggled",
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_fit_pixmap_bg),
NULL);
gtk_box_pack_start (GTK_BOX (box), fit, FALSE, FALSE,
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,
CONFIG_PADDING_SIZE);
#if 0
/*color frame*/
box = gtk_hbox_new (0, 0);
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE,
CONFIG_PADDING_SIZE);
f = gtk_frame_new (_("Background color"));
if(panel_config_struct.back_type == PANEL_BACK_COLOR) {
gtk_widget_set_sensitive(f,TRUE);
} else {
gtk_widget_set_sensitive(f,FALSE);
}
gtk_object_set_data(GTK_OBJECT(pix),"col",f);
gtk_object_set_data(GTK_OBJECT(col),"col",f);
gtk_object_set_data(GTK_OBJECT(non),"col",f);
gtk_container_border_width(GTK_CONTAINER (f), CONFIG_PADDING_SIZE);
gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, FALSE,
gtk_box_pack_start (GTK_BOX (box), f, FALSE, FALSE,
CONFIG_PADDING_SIZE);
box = gtk_vbox_new (0, 0);
gtk_container_border_width(GTK_CONTAINER (box), CONFIG_PADDING_SIZE);
gtk_container_add (GTK_CONTAINER (f), box);
w = gnome_color_selector_new((SetColorFunc)color_changed_cb, NULL);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,
CONFIG_PADDING_SIZE);
#endif
sel = gnome_color_selector_new(color_changed_cb, NULL);
gnome_color_selector_set_color_int(sel,
panel_config_struct.back_color.red,
panel_config_struct.back_color.green,
panel_config_struct.back_color.blue,
65355);
gtk_box_pack_start (GTK_BOX (box),
gnome_color_selector_get_button (sel),
FALSE, FALSE, CONFIG_PADDING_SIZE);
gtk_signal_connect (GTK_OBJECT (non), "toggled",
GTK_SIGNAL_FUNC (set_back),
ITOP(PANEL_BACK_NONE));
gtk_signal_connect (GTK_OBJECT (pix), "toggled",
GTK_SIGNAL_FUNC (set_back),
ITOP(PANEL_BACK_PIXMAP));
gtk_signal_connect (GTK_OBJECT (col), "toggled",
GTK_SIGNAL_FUNC (set_back),
ITOP(PANEL_BACK_COLOR));
if(panel_config_struct.back_type == PANEL_BACK_NONE)
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (non), TRUE);
else if(panel_config_struct.back_type == PANEL_BACK_COLOR)
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (col), TRUE);
else
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (pix), TRUE);
return vbox;
}
......@@ -360,8 +426,9 @@ panel_config(PanelWidget *panel)
panel_config_struct.snapped = panel->snapped;
panel_config_struct.mode = panel->mode;
panel_config_struct.fit_pixmap_bg = panel->fit_pixmap_bg;
/*panel_config_struct.pixmap_enable = panel->back_pixmap != NULL;*/
panel_config_struct.pixmap_enable = TRUE;
panel_config_struct.back_pixmap = g_strdup(panel->back_pixmap);
panel_config_struct.back_color = panel->back_color;
panel_config_struct.back_type = panel->back_type;
/* main window */
config_window = gnome_property_box_new ();
......@@ -380,10 +447,10 @@ panel_config(PanelWidget *panel)
}
/* Backing pixmap configuration */
page = pixmap_page (panel);
/* Backing configuration */
page = background_page (panel);
gnome_property_box_append_page (GNOME_PROPERTY_BOX (config_window),
page, gtk_label_new (_("Background image")));
page, gtk_label_new (_("Background")));
gtk_signal_connect (GTK_OBJECT (config_window), "apply",
GTK_SIGNAL_FUNC (config_apply), panel);
......