Commit 0482896e authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

fixed a few warnings

Sat Aug 08 01:29:31 1998  George Lebl  <jirka@5z.com>

        * panel.c: fixed a few warnings

        * main.c: reordered some startup items

        * panel_config_global.[ch],panel-widget.[ch],session.c: support
          applet padding, the minimum distance between applets


whoops forgot to commit this yesterday
-George
parent 63759ffb
Sat Aug 08 01:29:31 1998 George Lebl <jirka@5z.com>
* panel.c: fixed a few warnings
* main.c: reordered some startup items
* panel_config_global.[ch],panel-widget.[ch],session.c: support
applet padding, the minimum distance between applets
Mon Aug 03 03:04:44 1998 George Lebl <jirka@5z.com>
* *.(c|cc): fixed memory leaks concerning remove_link
......
Sat Aug 08 01:29:31 1998 George Lebl <jirka@5z.com>
* panel.c: fixed a few warnings
* main.c: reordered some startup items
* panel_config_global.[ch],panel-widget.[ch],session.c: support
applet padding, the minimum distance between applets
Mon Aug 03 03:04:44 1998 George Lebl <jirka@5z.com>
* *.(c|cc): fixed memory leaks concerning remove_link
......
......@@ -214,15 +214,15 @@ main(int argc, char **argv)
applets = g_array_new(FALSE);
applet_count = 0;
init_user_panels();
panel_tooltips = gtk_tooltips_new();
init_user_applets();
/*set the globals*/
load_up_globals();
init_user_panels();
init_user_applets();
/*add forbidden lists to ALL panels*/
g_list_foreach(panels,(GFunc)panel_widget_add_forbidden,NULL);
......
......@@ -15,6 +15,7 @@ struct _GlobalConfig {
int prompt_for_logout;
PanelMovementType movement_type;
int disable_animations;
int applet_padding;
};
......
......@@ -48,6 +48,7 @@ int pw_minimized_size = 6;
int pw_minimize_delay = 300;
int pw_disable_animations = FALSE;
PanelMovementType pw_movement_type = PANEL_SWITCH_MOVE;
int pw_applet_padding = 3;
static char *image_drop_types[] = {"url:ALL", "application/x-color"};
......@@ -583,8 +584,8 @@ panel_widget_switch_move(PanelWidget *panel, AppletData *ad, int moveby)
if(finalpos >= panel->size)
finalpos = panel->size-1;
else if(finalpos < 0)
finalpos = 0;
else if(finalpos < pw_applet_padding)
finalpos = pw_applet_padding;
while((ad->pos+ad->cells-1)<finalpos) {
pos = panel_widget_get_right_switch_pos(panel,list);
......@@ -648,6 +649,11 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
GList *list;
requisition->height = 0;
requisition->width = 0;
if(panel->orient == PANEL_HORIZONTAL)
requisition->width = pw_applet_padding;
else
requisition->height = pw_applet_padding;
for(list = panel->applet_list; list!=NULL; list = g_list_next(list)) {
AppletData *ad = list->data;
gtk_widget_size_request (ad->applet, &ad->applet->requisition);
......@@ -659,7 +665,8 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
}
if(panel->packed)
requisition->width +=
ad->applet->requisition.width;
ad->applet->requisition.width +
pw_applet_padding;
} else {
if(requisition->width <
ad->applet->requisition.width) {
......@@ -668,7 +675,8 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
}
if(panel->packed)
requisition->height +=
ad->applet->requisition.height;
ad->applet->requisition.height +
pw_applet_padding;
}
}
if(!panel->packed) {
......@@ -680,7 +688,6 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
}
}
/*FIXME: do rightsticking*/
static void
panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
......@@ -707,7 +714,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
panel_widget_right_stick(panel,old_size);
if(panel->packed) {
i = 0;
i = pw_applet_padding;
for(list = panel->applet_list;
list!=NULL;
list = g_list_next(list)) {
......@@ -719,11 +726,13 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
send_move = g_list_prepend(send_move,ad);
}
if(panel->orient == PANEL_HORIZONTAL) {
ad->cells = ad->applet->requisition.width;
ad->cells = ad->applet->requisition.width +
pw_applet_padding;
challoc.x = ad->pos;
challoc.y = (allocation->height - ad->applet->requisition.height) / 2;
} else {
ad->cells = ad->applet->requisition.height;
ad->cells = ad->applet->requisition.height +
pw_applet_padding;
challoc.x = (allocation->width - ad->applet->requisition.width) / 2;
challoc.y = ad->pos;
}
......@@ -740,17 +749,19 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
AppletData *ad = list->data;
if(panel->orient == PANEL_HORIZONTAL)
ad->cells = ad->applet->requisition.width;
ad->cells = ad->applet->requisition.width +
pw_applet_padding;
else
ad->cells = ad->applet->requisition.height;
ad->cells = ad->applet->requisition.height +
pw_applet_padding;
if(ad->pos+ad->cells > i) {
ad->pos = i - ad->cells;
send_move = g_list_prepend(send_move,ad);
}
i = ad->pos;
}
if(i<0) {
i = 0;
if(i<pw_applet_padding) {
i = pw_applet_padding;
for(list = panel->applet_list;
list!=NULL;
list = g_list_next(list)) {
......@@ -1364,8 +1375,8 @@ panel_widget_get_free_spot(PanelWidget *panel, AppletData *ad)
list = panel->applet_list;
start = place-(ad->cells/2);
if(start<0)
start = 0;
if(start<pw_applet_padding)
start = pw_applet_padding;
for(e=0,i=start;i<panel->size;i++) {
GtkWidget *applet;
list = walk_up_to(i,list);
......@@ -1683,7 +1694,7 @@ panel_widget_find_empty_pos(PanelWidget *panel, int pos)
}
}
for(i=pos;i>=0;i--) {
for(i=pos;i>=pw_applet_padding;i--) {
list = walk_up_to(i,list);
if(!is_in_applet(i,list->data)) {
left = i;
......@@ -1954,7 +1965,8 @@ panel_widget_change_global(int explicit_step,
int minimized_size,
int minimize_delay,
PanelMovementType move_type,
int disable_animations)
int disable_animations,
int applet_padding)
{
if(explicit_step>0)
pw_explicit_step=explicit_step;
......@@ -1968,4 +1980,12 @@ panel_widget_change_global(int explicit_step,
pw_minimize_delay=minimize_delay;
pw_movement_type = move_type;
pw_disable_animations = disable_animations;
/*change padding on all panels NOW*/
if(pw_applet_padding != applet_padding) {
GList *li;
pw_applet_padding = applet_padding;
for(li=panels;li!=NULL;li=g_list_next(li))
gtk_widget_queue_resize(li->data);
}
}
......@@ -168,7 +168,8 @@ void panel_widget_change_global (int explicit_step,
int minimized_size,
int minimize_delay,
PanelMovementType move_type,
int disable_animations);
int disable_animations,
int applet_padding);
/*get the number of applets*/
int panel_widget_get_applet_count (PanelWidget *panel);
......
......@@ -214,7 +214,7 @@ panel_realize(GtkWidget *widget, gpointer data)
}
/*we call this recursively*/
static void orient_change_foreach(gpointer data, gpointer user_data);
static void orient_change_foreach(GtkWidget *w, gpointer data);
void
orientation_change(int applet_id, PanelWidget *panel)
......@@ -249,10 +249,11 @@ orientation_change(int applet_id, PanelWidget *panel)
}
static void
orient_change_foreach(gpointer data, gpointer user_data)
orient_change_foreach(GtkWidget *w, gpointer data)
{
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(data),"applet_id"));
PanelWidget *panel = user_data;
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w),
"applet_id"));
PanelWidget *panel = data;
orientation_change(applet_id,panel);
}
......@@ -319,10 +320,11 @@ back_change(int applet_id,
static void
back_change_foreach(gpointer data, gpointer user_data)
back_change_foreach(GtkWidget *w, gpointer data)
{
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(data),"applet_id"));
PanelWidget *panel = user_data;
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w),
"applet_id"));
PanelWidget *panel = data;
back_change(applet_id,panel);
}
......@@ -339,12 +341,13 @@ panel_back_change(GtkWidget *widget,
update_config_back(PANEL_WIDGET(widget));
}
static void state_hide_foreach(gpointer data, gpointer user_data);
static void state_hide_foreach(GtkWidget *w, gpointer data);
static void
state_restore_foreach(gpointer data, gpointer user_data)
state_restore_foreach(GtkWidget *w, gpointer data)
{
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(data),"applet_id"));
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w),
"applet_id"));
AppletInfo *info = get_applet_info(applet_id);
if(info->type == APPLET_DRAWER) {
......@@ -365,9 +368,10 @@ state_restore_foreach(gpointer data, gpointer user_data)
}
static void
state_hide_foreach(gpointer data, gpointer user_data)
state_hide_foreach(GtkWidget *w, gpointer data)
{
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(data),"applet_id"));
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w),
"applet_id"));
AppletInfo *info = get_applet_info(applet_id);
if(info->type == APPLET_DRAWER) {
......@@ -472,7 +476,8 @@ panel_applet_added_idle(gpointer data)
static void
panel_applet_added(GtkWidget *widget, GtkWidget *applet, gpointer data)
{
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(applet),"applet_id"));
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(applet),
"applet_id"));
AppletInfo *info = get_applet_info(applet_id);
GtkWidget *panelw = gtk_object_get_data(GTK_OBJECT(widget),
PANEL_PARENT);
......@@ -500,11 +505,12 @@ panel_applet_added(GtkWidget *widget, GtkWidget *applet, gpointer data)
}
static void
count_open_drawers(gpointer data, gpointer user_data)
count_open_drawers(GtkWidget *w, gpointer data)
{
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(data),"applet_id"));
int applet_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w),
"applet_id"));
AppletInfo *info = get_applet_info(applet_id);
int *count = user_data;
int *count = data;
if(info->type == APPLET_DRAWER) {
Drawer *drawer = info->data;
if(DRAWER_WIDGET(drawer->drawer)->state == DRAWER_SHOWN)
......
......@@ -310,6 +310,13 @@ misc_notebook_page(void)
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE,
CONFIG_PADDING_SIZE);
/* Minimize Delay scale frame */
frame = make_int_scale_frame(_("Applet Padding"),
&(temp_config.applet_padding),
0.0,10.0);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE,
CONFIG_PADDING_SIZE);
return (vbox);
}
......
......@@ -15,6 +15,7 @@ struct _GlobalConfig {
int prompt_for_logout;
PanelMovementType movement_type;
int disable_animations;
int applet_padding;
};
......
......@@ -33,7 +33,11 @@ GlobalConfig global_config = {
DEFAULT_MINIMIZED_SIZE,
DEFAULT_MINIMIZE_DELAY,
TRUE, /*tooltips*/
TRUE /*show small icons*/
TRUE, /*show small icons*/
TRUE, /*logout question*/
PANEL_SWITCH_MOVE,
FALSE, /*disable anims*/
3 /*applet padding*/
};
char *panel_cfg_path=NULL;
......@@ -73,7 +77,8 @@ apply_global_config(void)
global_config.minimized_size,
global_config.minimize_delay,
global_config.movement_type,
global_config.disable_animations);
global_config.disable_animations,
global_config.applet_padding);
if(global_config.tooltips_enabled)
gtk_tooltips_enable(panel_tooltips);
else
......@@ -422,6 +427,8 @@ do_session_save(GnomeClient *client,
global_config.prompt_for_logout);
gnome_config_set_bool("disable_animations",
global_config.disable_animations);
gnome_config_set_int("applet_padding",
global_config.applet_padding);
}
gnome_config_pop_prefix ();
......@@ -880,6 +887,8 @@ load_up_globals(void)
g_snprintf(buf,256,"movement_type=%d", PANEL_SWITCH_MOVE);
global_config.movement_type=gnome_config_get_int(buf);
global_config.applet_padding=gnome_config_get_int("applet_padding=3");
gnome_config_pop_prefix();
......
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