Commit 61ebc57d authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

switched to using panel-widget. it kind of works, and should work with the

Thu Feb 05 23:45:06 1998  George Lebl  <jirka@5z.com>

        * panel.[ch],main.c,applet_cmds.h,panel_cmds.h,ALL APPLETS:
          switched to using panel-widget. it kind of works, and should
          work with the newest gtk from cvs. session saving does not
          work yet!
parent ceceb91f
Thu Feb 05 23:45:06 1998 George Lebl <jirka@5z.com>
* panel.[ch],main.c,applet_cmds.h,panel_cmds.h,ALL APPLETS:
switched to using panel-widget. it kind of works, and should
work with the newest gtk from cvs. session saving does not
work yet!
1998-02-03 Raja R Harinath <harinath@cs.umn.edu>
* cdplayer/Makefile.am (EXTRA_DIST): But still distribute
......
Thu Feb 05 23:45:06 1998 George Lebl <jirka@5z.com>
* panel.[ch],main.c,applet_cmds.h,panel_cmds.h,ALL APPLETS:
switched to using panel-widget. it kind of works, and should
work with the newest gtk from cvs. session saving does not
work yet!
1998-02-03 Raja R Harinath <harinath@cs.umn.edu>
* cdplayer/Makefile.am (EXTRA_DIST): But still distribute
......
......@@ -19,6 +19,8 @@ panel_SOURCES = \
main.c \
panel.c \
panel.h \
panel-widget.c \
panel-widget.h \
panel_config.c \
panel_config.h
......
......@@ -2,6 +2,7 @@
#define APPLET_CMDS_H
#include "panel_cmds.h"
#include "panel-widget.h"
#include "panel.h"
BEGIN_GNOME_DECLS
......@@ -21,8 +22,8 @@ typedef enum {
typedef struct {
AppletCommandType cmd;
Panel *panel;
GtkWidget *applet;
PanelWidget *panel;
GtkWidget *applet;
union {
/* Init module parameters */
......@@ -33,13 +34,13 @@ typedef struct {
/* Create instance parameters */
struct {
char *params;
int pos;
int pos;
} create_instance;
/* Orientation change notify parameters */
struct {
PanelPos pos;
PanelOrient orient;
PanelSnapped snapped;
PanelOrientation orient;
} orientation_change_notify;
} params;
} AppletCommand;
......
......@@ -11,6 +11,7 @@
#include "applet_files.h"
#include "panel_cmds.h"
#include "applet_cmds.h"
#include "panel-widget.h"
#include "panel.h"
......@@ -49,8 +50,6 @@ load_default_applets(void)
/* XXX: the IDs for these applets are hardcoded here. */
/* Here we use NULL to request querying of default applet parameters */
/* as position we give unknown or 0 to load from left or
PANEL_TABLE_SIZE-1 to load from right */
load_applet("Menu", NULL, PANEL_UNKNOWN_APPLET_POSITION);
load_applet("Clock", NULL, PANEL_UNKNOWN_APPLET_POSITION);
load_applet("Mail check", NULL, PANEL_UNKNOWN_APPLET_POSITION);
......@@ -151,7 +150,7 @@ main(int argc, char **argv)
init_user_drawers();
init_user_applets();
gtk_widget_show(the_panel->panel->window);
gtk_widget_show(GTK_WIDGET(the_panel));
gtk_main();
return 0;
......
......@@ -15,6 +15,7 @@
#include <string.h>
#include "gnome.h"
#include "../panel_cmds.h"
#include "../panel-widget.h"
#include "../applet_cmds.h"
#include "../panel.h"
......@@ -40,7 +41,7 @@ typedef struct {
static char *gnome_folder;
static gint panel_pos=PANEL_POS_BOTTOM;
static PanelSnapped panel_snapped=PANEL_BOTTOM;
static PanelCmdFunc panel_cmd_func;
......@@ -311,20 +312,21 @@ menu_position (GtkMenu *menu, gint *x, gint *y, gpointer data)
gdk_window_get_origin (widget->window, &wx, &wy);
switch(panel_pos) {
case PANEL_POS_TOP:
switch(panel_snapped) {
case PANEL_TOP:
*x = wx;
*y = wy + widget->allocation.height;
break;
case PANEL_POS_BOTTOM:
case PANEL_FREE:
case PANEL_BOTTOM:
*x = wx;
*y = wy - GTK_WIDGET (menu)->allocation.height;
break;
case PANEL_POS_LEFT:
case PANEL_LEFT:
*x = wx + widget->allocation.width;
*y = wy;
break;
case PANEL_POS_RIGHT:
case PANEL_RIGHT:
*x = wx - GTK_WIDGET (menu)->allocation.width;
*y = wy;
break;
......@@ -579,17 +581,18 @@ create_panel_menu (GtkWidget *window, char *menudir, int main_menu,
char *pixmap_name;
if (main_menu)
switch(panel_pos) {
case PANEL_POS_TOP:
switch(panel_snapped) {
case PANEL_TOP:
pixmap_name = gnome_unconditional_pixmap_file ("gnome-menu-down.xpm");
break;
case PANEL_POS_BOTTOM:
case PANEL_FREE:
case PANEL_BOTTOM:
pixmap_name = gnome_unconditional_pixmap_file ("gnome-menu-up.xpm");
break;
case PANEL_POS_LEFT:
case PANEL_LEFT:
pixmap_name = gnome_unconditional_pixmap_file ("gnome-menu-right.xpm");
break;
case PANEL_POS_RIGHT:
case PANEL_RIGHT:
pixmap_name = gnome_unconditional_pixmap_file ("gnome-menu-left.xpm");
break;
}
......@@ -648,9 +651,8 @@ set_show_small_icons(gpointer data, gpointer user_data)
gtk_widget_hide(w);
}
static void
create_instance (Panel *panel, char *params, int pos)
create_instance (PanelWidget *panel, char *params, int pos)
{
char *menu_base = gnome_unconditional_datadir_file ("apps");
char *this_menu;
......@@ -693,7 +695,7 @@ create_instance (Panel *panel, char *params, int pos)
menu = g_new(Menu,1);
menu->small_icons = NULL;
menu->button = create_menu_widget (panel->window, params, this_menu,
menu->button = create_menu_widget (GTK_WIDGET(panel), params, this_menu,
&(menu->small_icons));
menu->path = g_strdup(params);
menu->show_small_icons = show_small_icons;
......@@ -713,33 +715,34 @@ create_instance (Panel *panel, char *params, int pos)
}
static void
set_orientation(GtkWidget *applet, Panel *panel, PanelPos pos)
set_orientation(GtkWidget *applet, PanelWidget *panel, PanelSnapped snapped)
{
GtkWidget *pixmap;
char *pixmap_name;
Menu *menu;
panel_pos = pos; /*FIXME: this should probably be in the structure*/
panel_snapped = snapped; /*FIXME: this should probably be in the structure*/
menu = gtk_object_get_user_data(GTK_OBJECT(applet));
if(!menu || !menu->path)
return;
if (strcmp (menu->path, ".") == 0)
switch (panel_pos) {
case PANEL_POS_TOP:
switch (panel_snapped) {
case PANEL_TOP:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-down.xpm");
break;
case PANEL_POS_BOTTOM:
case PANEL_FREE:
case PANEL_BOTTOM:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-up.xpm");
break;
case PANEL_POS_LEFT:
case PANEL_LEFT:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-right.xpm");
break;
case PANEL_POS_RIGHT:
case PANEL_RIGHT:
pixmap_name = gnome_unconditional_pixmap_file(
"gnome-menu-left.xpm");
break;
......@@ -753,7 +756,7 @@ set_orientation(GtkWidget *applet, Panel *panel, PanelPos pos)
gtk_widget_destroy(pixmap);
/*make the pixmap*/
pixmap = gnome_create_pixmap_widget (panel->window,applet,pixmap_name);
pixmap = gnome_create_pixmap_widget (GTK_WIDGET(panel),applet,pixmap_name);
gtk_container_add (GTK_CONTAINER(applet), pixmap);
gtk_widget_show (pixmap);
......@@ -905,7 +908,7 @@ applet_cmd_func(AppletCommand *cmd)
case APPLET_CMD_ORIENTATION_CHANGE_NOTIFY:
set_orientation(cmd->applet,cmd->panel,
cmd->params.orientation_change_notify.pos);
cmd->params.orientation_change_notify.snapped);
break;
case APPLET_CMD_PROPERTIES:
......
......@@ -8,6 +8,7 @@
#include "gnome.h"
#include "panel.h"
#include "panel-widget.h"
#include "config.h"
/* Used for all the packing and padding options */
......@@ -16,8 +17,15 @@
/* used to temporarily store config values until the 'Apply'
* button is pressed. */
PanelMain config_panel;
Panel config_panel_gen;
struct {
PanelOrientation orient;
PanelSnapped snapped;
PanelMode mode;
PanelState state;
gint step_size;
gint minimized_size;
gint minimize_delay;
} panel_config_struct;
GtkWidget *config_window;
......@@ -36,11 +44,11 @@ config_destroy(GtkWidget *widget, gpointer data)
}
static void
set_position (GtkWidget *widget, gpointer data)
set_snapped (GtkWidget *widget, gpointer data)
{
PanelPos position = (PanelPos) data;
PanelSnapped snapped = (PanelSnapped) data;
config_panel.panel->pos = position;
panel_config_struct.snapped = snapped;
}
static void
......@@ -48,7 +56,7 @@ set_mode (GtkWidget *widget, gpointer data)
{
PanelMode mode = (PanelMode) data;
config_panel.mode = mode;
panel_config_struct.mode = mode;
}
static void
......@@ -63,7 +71,15 @@ set_toggle_button_value (GtkWidget *widget, gpointer data)
static void
config_apply (GtkWidget *widget, gpointer data)
{
panel_reconfigure(&config_panel);
PanelWidget *panel = data;
panel_widget_change_params(panel,
panel_config_struct.orient,
panel_config_struct.snapped,
panel_config_struct.mode,
panel_config_struct.state,
panel_config_struct.step_size,
panel_config_struct.minimized_size,
panel_config_struct.minimize_delay);
}
/* FIXME: I think these should probly go in a notebook.. I have to
......@@ -98,9 +114,9 @@ position_notebook_page(void)
/* Top Position */
button = gtk_radio_button_new_with_label (NULL, _("Top"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (set_position),
(gpointer)PANEL_POS_TOP);
if (config_panel.panel->pos == PANEL_POS_TOP) {
GTK_SIGNAL_FUNC (set_snapped),
(gpointer)PANEL_TOP);
if (panel_config_struct.snapped == PANEL_TOP) {
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
}
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, CONFIG_PADDING_SIZE);
......@@ -111,9 +127,9 @@ position_notebook_page(void)
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
_("Bottom"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (set_position),
(gpointer)PANEL_POS_BOTTOM);
if (config_panel.panel->pos == PANEL_POS_BOTTOM) {
GTK_SIGNAL_FUNC (set_snapped),
(gpointer)PANEL_BOTTOM);
if (panel_config_struct.snapped == PANEL_BOTTOM) {
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
}
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, CONFIG_PADDING_SIZE);
......@@ -124,9 +140,9 @@ position_notebook_page(void)
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
_("Left"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (set_position),
(gpointer)PANEL_POS_LEFT);
if (config_panel.panel->pos == PANEL_POS_LEFT) {
GTK_SIGNAL_FUNC (set_snapped),
(gpointer)PANEL_LEFT);
if (panel_config_struct.snapped == PANEL_LEFT) {
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
}
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, CONFIG_PADDING_SIZE);
......@@ -137,9 +153,9 @@ position_notebook_page(void)
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
_("Right"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (set_position),
(gpointer)PANEL_POS_RIGHT);
if (config_panel.panel->pos == PANEL_POS_RIGHT) {
GTK_SIGNAL_FUNC (set_snapped),
(gpointer)PANEL_RIGHT);
if (panel_config_struct.snapped == PANEL_RIGHT) {
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
}
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, CONFIG_PADDING_SIZE);
......@@ -161,8 +177,8 @@ position_notebook_page(void)
button = gtk_radio_button_new_with_label (NULL, _("Explicitly Hide"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (set_mode),
(gpointer)PANEL_STAYS_PUT);
if (config_panel.mode == PANEL_STAYS_PUT) {
(gpointer)PANEL_EXPLICIT_HIDE);
if (panel_config_struct.mode == PANEL_EXPLICIT_HIDE) {
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
}
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, CONFIG_PADDING_SIZE);
......@@ -174,8 +190,8 @@ position_notebook_page(void)
_("Auto Hide"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (set_mode),
(gpointer)PANEL_GETS_HIDDEN);
if (config_panel.mode == PANEL_GETS_HIDDEN) {
(gpointer)PANEL_AUTO_HIDE);
if (panel_config_struct.mode == PANEL_AUTO_HIDE) {
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
}
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, CONFIG_PADDING_SIZE);
......@@ -188,21 +204,21 @@ static void
step_size_scale_update (GtkAdjustment *adjustment, gpointer data)
{
double scale_val = adjustment->value;
config_panel.panel->step_size = (gint) scale_val;
panel_config_struct.step_size = (gint) scale_val;
}
static void
delay_scale_update (GtkAdjustment *adjustment, gpointer data)
{
double scale_val = adjustment->value;
config_panel.minimize_delay = (gint) scale_val;
panel_config_struct.minimize_delay = (gint) scale_val;
}
static void
minimized_size_scale_update (GtkAdjustment *adjustment, gpointer data)
{
double scale_val = adjustment->value;
config_panel.minimized_size = (gint) scale_val;
panel_config_struct.minimized_size = (gint) scale_val;
}
......@@ -237,7 +253,7 @@ animation_notebook_page(void)
gtk_widget_show (box);
/* Animation step_size scale */
step_size_scale_data = gtk_adjustment_new ((double) config_panel.panel->step_size,
step_size_scale_data = gtk_adjustment_new ((double) panel_config_struct.step_size,
3.0, 100.0, 1.0, 1.0, 0.0);
scale = gtk_hscale_new (GTK_ADJUSTMENT (step_size_scale_data));
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
......@@ -263,7 +279,7 @@ animation_notebook_page(void)
gtk_widget_show (box);
/* minimize_delay scale */
delay_scale_data = gtk_adjustment_new ((double) config_panel.minimize_delay,
delay_scale_data = gtk_adjustment_new ((double) panel_config_struct.minimize_delay,
30.0, 1000.0, 1.0, 1.0, 0.0);
scale = gtk_hscale_new (GTK_ADJUSTMENT (delay_scale_data));
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
......@@ -289,7 +305,7 @@ animation_notebook_page(void)
gtk_widget_show (box);
/* minimized_size scale */
minimized_size_scale_data = gtk_adjustment_new ((double) config_panel.minimized_size,
minimized_size_scale_data = gtk_adjustment_new ((double) panel_config_struct.minimized_size,
1.0, 10.0, 1.0, 1.0, 0.0);
scale = gtk_hscale_new (GTK_ADJUSTMENT (minimized_size_scale_data));
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
......@@ -332,12 +348,13 @@ misc_notebook_page(void)
/* Tooltips enable */
button = gtk_check_button_new_with_label (_("Tooltips enabled"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
/*FIXME: tooltips!*/
/*gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (set_toggle_button_value),
&(config_panel.tooltips_enabled));
if (config_panel.tooltips_enabled) {
&(panel_config_struct.tooltips_enabled));
if (panel_config_struct.tooltips_enabled) {
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
}
}*/
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, CONFIG_PADDING_SIZE);
gtk_widget_show (button);
......@@ -346,7 +363,7 @@ misc_notebook_page(void)
void
panel_config(void)
panel_config(PanelWidget *panel)
{
GtkWidget *box1;
GtkWidget *box2;
......@@ -358,18 +375,21 @@ panel_config(void)
/* return if the window is already up. */
if (config_window)
return;
/*FIXME: I should be able to get windows up for other panels I
guess*/
/* so far, these are the only ones that can be set */
config_panel.panel = &config_panel_gen;
config_panel.mode = the_panel->mode;
config_panel.panel->pos = the_panel->panel->pos;
panel_config_struct.orient = panel->orient;
panel_config_struct.snapped = panel->snapped;
panel_config_struct.mode = panel->mode;
panel_config_struct.state = panel->state;
config_panel.panel->step_size = the_panel->panel->step_size;
config_panel.delay = the_panel->delay;
config_panel.minimize_delay = the_panel->minimize_delay;
config_panel.minimized_size = the_panel->minimized_size;
panel_config_struct.step_size = panel->step_size;
panel_config_struct.minimize_delay = panel->minimize_delay;
panel_config_struct.minimized_size = panel->minimized_size;
config_panel.tooltips_enabled = the_panel->tooltips_enabled;
/*panel_config_struct.tooltips_enabled = panel->tooltips_enabled;
FIXME: TOOLTIPS*/
/* main window */
......@@ -433,7 +453,7 @@ panel_config(void)
button = gtk_button_new_with_label(_("Apply"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (config_apply),
NULL);
panel);
gtk_box_pack_start(GTK_BOX (box2), button, TRUE, TRUE,
CONFIG_PADDING_SIZE);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
......
#ifndef PANEL_CONFIG_H
#define PANEL_CONFIG_H
void panel_config(void);
#include "panel-widget.h"
void panel_config(PanelWidget *panel);
#endif /* PANEL_CONFIG_H */
......@@ -38,9 +38,6 @@ panel_widget_get_type ()
static void
panel_widget_class_init (PanelWidgetClass *class)
{
GtkWidgetClass *widget_class;
widget_class = (GtkWidgetClass*) class;
}
static void
......@@ -56,6 +53,78 @@ panel_widget_init (PanelWidget *panel_widget)
panel_widget->currently_dragged_applet = NULL;
}
static void
panel_widget_set_size(PanelWidget *panel, gint length)
{
gint buttonswidth;
switch(panel->snapped) {
case PANEL_FREE:
if(length == 0 && panel->orient == PANEL_HORIZONTAL)
length = GTK_WIDGET(panel)->allocation.width;
else if(length == 0 && panel->orient == PANEL_VERTICAL)
length = GTK_WIDGET(panel)->allocation.height;
if(panel->orient == PANEL_HORIZONTAL)
gtk_widget_set_usize(GTK_WIDGET(panel),
length, panel->thick);
else
gtk_widget_set_usize(GTK_WIDGET(panel),
panel->thick, length);
panel->size = length/PANEL_CELL_SIZE;
break;
case PANEL_TOP:
case PANEL_BOTTOM:
buttonswidth = panel->hidebutton_w->allocation.width +
panel->hidebutton_e->allocation.width;
panel->orient = PANEL_HORIZONTAL;
gtk_widget_set_usize(GTK_WIDGET(panel),
gdk_screen_width(),
panel->thick);
panel->size = (gdk_screen_width()-buttonswidth) /
PANEL_CELL_SIZE;
break;
case PANEL_LEFT:
case PANEL_RIGHT:
buttonswidth = panel->hidebutton_n->allocation.height +
panel->hidebutton_s->allocation.height;
panel->orient = PANEL_VERTICAL;
gtk_widget_set_usize(GTK_WIDGET(panel),
panel->thick,
gdk_screen_height());
panel->size = (gdk_screen_height()-buttonswidth) /
PANEL_CELL_SIZE;
break;
}
switch(panel->snapped) {
case PANEL_TOP:
gtk_widget_set_uposition(GTK_WIDGET(panel),
0,
0);
break;
case PANEL_BOTTOM:
gtk_widget_set_uposition(GTK_WIDGET(panel),
0,
gdk_screen_height() -
panel->thick);
break;
case PANEL_LEFT:
gtk_widget_set_uposition(GTK_WIDGET(panel),
0,
0);
break;
case PANEL_RIGHT:
gtk_widget_set_uposition(GTK_WIDGET(panel),
gdk_screen_width() -
panel->thick,
0);
break;
default: break; /*to get rid of a warning*/
}
}
static void
panel_widget_shrink_wrap(PanelWidget *panel,
gint width,
......@@ -78,6 +147,48 @@ panel_widget_shrink_wrap(PanelWidget *panel,
}
}
static gint
panel_widget_push_right(PanelWidget *panel,gint pos)
{
gint i;
gint freepos;
for(i=0;pos+i<panel->size && panel->applets[pos+i].applet;i++)
;
if(pos+i >= panel->size)
return FALSE;
freepos=i;
for(;i>0;i--) {
panel->applets[pos+i].applet=
panel->applets[pos+i-1].applet;
panel->applets[pos+i].drawer =
panel->applets[pos+i-1].drawer;
panel->applets[pos+i].cells =
panel->applets[pos+i-1].cells;
}
for(i=0;i<freepos;i+=panel->applets[pos+i].cells) {
if(panel->orient == PANEL_HORIZONTAL)
gtk_fixed_move(GTK_FIXED(panel->fixed),
panel->applets[pos+i].applet,
panel->applets[pos+i].applet->
allocation.x-PANEL_CELL_SIZE,
panel->applets[pos+i].applet->
allocation.y);
else
gtk_fixed_move(GTK_FIXED(panel->fixed),
panel->applets[pos+i].applet,
panel->applets[pos+i].applet->
allocation.x,
panel->applets[pos+i].applet->
allocation.y-PANEL_CELL_SIZE);
}
return TRUE;
}
static gint
panel_widget_seize_space(PanelWidget *panel,
gint width,
......@@ -103,18 +214,19 @@ panel_widget_seize_space(PanelWidget *panel,
allocated++;
for(i=1;(pos-i >= 0) &&
(allocated < width) &&
(panel->applets[pos-i].applet == applet ||
panel->applets[pos-i].applet == NULL);i++)
(panel->applets[pos-i].applet == NULL);i++)
allocated++;
pos = pos-i+1;
if(allocated < width) {
/*FIXME: push apart other applets if neccessary!*/
while(allocated < width &&
panel_widget_push_right(panel,pos+allocated))
allocated++;
}
for(i=0;i<allocated;i++) {
panel->applets[pos+i].applet = applet;
panel->applets[pos+i].applet = drawer;
panel->applets[pos+i].drawer = drawer;
panel->applets[pos+i].cells = allocated;
}
return pos;
......@@ -126,7 +238,6 @@ panel_widget_adjust_applet(PanelWidget *panel, GtkWidget *applet)
gint width, height;
gint x,y;
gint oldx,oldy;
gint panel_thick;
gint pos;
width = applet->allocation.width;
......@@ -135,16 +246,10 @@ panel_widget_adjust_applet(PanelWidget *panel, GtkWidget *applet)
oldy = applet->allocation.y;
pos = panel_widget_get_pos(panel,applet);
if(panel->orient==PANEL_HORIZONTAL) {
panel_thick = GTK_WIDGET(panel)->allocation.height;
if(panel_thick<PANEL_CELL_SIZE)
panel_thick = PANEL_CELL_SIZE;
if(height > panel_thick) {
/*FIXME: schedhule window resize, this has to
be done after all applets has been added,
so probably this would be done by an idle
function which then adjusts the vertical
position of applets*/
if(height > panel->thick) {
panel->thick = height;
panel_widget_set_size(panel,
GTK_WIDGET(panel)->allocation.width);
}
/*if smaller then it's allocation, we are OK*/
......@@ -153,37 +258,31 @@ panel_widget_adjust_applet(PanelWidget *panel, GtkWidget *applet)
x = (PANEL_CELL_SIZE*pos) +
((PANEL_CELL_SIZE*panel->applets[pos].cells)/2) -
(width/2);
y = (panel_thick/2) - (height/2);
y = (panel->thick/2) - (height/2);
} else {
pos = panel_widget_seize_space(panel,width,pos);
x = (PANEL_CELL_SIZE*pos) +
((PANEL_CELL_SIZE*panel->applets[pos].cells)/2) -
(width/2);
y = (panel_thick/2) - (height/2);
y = (panel->thick/2) - (height/2);
}
} else { /* panel->orient==PANEL_VERTICAL */
panel_thick = GTK_WIDGET(panel)->allocation.width;
if(panel_thick<PANEL_CELL_SIZE)
panel_thick = PANEL_CELL_SIZE;
if(width > panel_thick) {
/*FIXME: schedhule window resize, this has to
be done after all applets has been added,
so probably this would be done by an idle
function which then adjusts the vertical
position of applets*/
if(width > panel->thick) {
panel->thick = width;
panel_widget_set_size(panel,
GTK_WIDGET(panel)->allocation.height);
}
/*if smaller then it's allocation, we are OK*/
if(height<=(PANEL_CELL_SIZE*panel->applets[pos].cells)) {
panel_widget_shrink_wrap(panel,width,pos);
x = (panel_thick/2) - (width/2);
x = (panel->thick/2) - (width/2);
y = (PANEL_CELL_SIZE*pos) +
((PANEL_CELL_SIZE*panel->applets[pos].cells)/2) -
(height/2);
} else {
pos = panel_widget_seize_space(panel,width,pos);
x = (panel_thick/2) - (width/2);
x = (panel->thick/2) - (width/2);
y = (PANEL_CELL_SIZE*pos) +
((PANEL_CELL_SIZE*panel->applets[pos].cells)/2) -
(height/2);
......@@ -193,6 +292,7 @@ panel_widget_adjust_applet(PanelWidget *panel, GtkWidget *applet)
gtk_fixed_move(GTK_FIXED(panel->fixed),applet,x,y);
}