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

cleanups, plus we no longer refer to panels by their count as that is not

Sun Jul 12 02:07:52 1998  George Lebl  <jirka@5z.com>

        * main.[ch],panel.[ch],menu.c: cleanups, plus we no longer
          refer to panels by their count as that is not clean any more
          (although this is done during startup and depends on the fact
          that all paneltypes init all their PanelWidgets in their _new
          functions which might not be the case in the future, so this
          will also need cleaning) ... plus now adding something to a panel
          adds it to the one on which the menu resides instead of the
          first one loaded
parent 0c73bb3d
Sun Jul 12 02:07:52 1998 George Lebl <jirka@5z.com>
* main.[ch],panel.[ch],menu.c: cleanups, plus we no longer
refer to panels by their count as that is not clean any more
(although this is done during startup and depends on the fact
that all paneltypes init all their PanelWidgets in their _new
functions which might not be the case in the future, so this
will also need cleaning) ... plus now adding something to a panel
adds it to the one on which the menu resides instead of the
first one loaded
Sat Jul 11 04:01:38 1998 George Lebl <jirka@5z.com>
* main.c,mulapp.c,panel.c: general cleanup, I thought that
......
Sun Jul 12 02:07:52 1998 George Lebl <jirka@5z.com>
* main.[ch],panel.[ch],menu.c: cleanups, plus we no longer
refer to panels by their count as that is not clean any more
(although this is done during startup and depends on the fact
that all paneltypes init all their PanelWidgets in their _new
functions which might not be the case in the future, so this
will also need cleaning) ... plus now adding something to a panel
adds it to the one on which the menu resides instead of the
first one loaded
Sat Jul 11 04:01:38 1998 George Lebl <jirka@5z.com>
* main.c,mulapp.c,panel.c: general cleanup, I thought that
......
......@@ -82,7 +82,7 @@ struct _LoadApplet {
char *pixmap;
char *tooltip;
int pos;
int panel;
PanelWidget *panel;
char *cfgpath;
};
......@@ -270,7 +270,7 @@ get_def_panel_widget(GtkWidget *panel)
static void
queue_load_applet(char *id_str, char *path, char *params,
char *pixmap, char *tooltip,
int pos, int panel, char *cfgpath)
int pos, PanelWidget *panel, char *cfgpath)
{
LoadApplet *l;
l = g_new(LoadApplet,1);
......@@ -446,7 +446,7 @@ drawer_realize_cb(GtkWidget *button, Drawer *drawer)
void
load_applet(char *id_str, char *path, char *params,
char *pixmap, char *tooltip,
int pos, int panel, char *cfgpath)
int pos, PanelWidget *panel, char *cfgpath)
{
if(strcmp(id_str,EXTERN_ID) == 0) {
char *fullpath;
......@@ -522,15 +522,12 @@ load_applet(char *id_str, char *path, char *params,
}
} else if(strcmp(id_str,DRAWER_ID) == 0) {
Drawer *drawer;
PanelWidget *parent;
PanelWidget *dr_panel;
parent = PANEL_WIDGET(g_list_nth(panels,panel)->data);
if(!params) {
drawer = create_empty_drawer_applet(
tooltip,pixmap,
get_applet_orient(parent));
get_applet_orient(panel));
if(drawer) panel_setup(drawer->drawer);
} else {
int i;
......@@ -541,7 +538,7 @@ load_applet(char *id_str, char *path, char *params,
drawer=create_drawer_applet(dr_pd->panel,
tooltip,pixmap,
get_applet_orient(parent));
get_applet_orient(panel));
}
if(!drawer)
......@@ -560,14 +557,14 @@ load_applet(char *id_str, char *path, char *params,
dr_panel);
if(DRAWER_WIDGET(drawer->drawer)->state == DRAWER_SHOWN) {
GtkWidget *wparent;
GtkWidget *wpanel;
/*pop up, if popped down*/
wparent = gtk_object_get_data(GTK_OBJECT(parent),
wpanel = gtk_object_get_data(GTK_OBJECT(panel),
PANEL_PARENT);
if(IS_SNAPPED_WIDGET(wparent)) {
if(IS_SNAPPED_WIDGET(wpanel)) {
/*drawer is open so we track it*/
SNAPPED_WIDGET(wparent)->drawers_open++;
snapped_widget_pop_up(SNAPPED_WIDGET(wparent));
SNAPPED_WIDGET(wpanel)->drawers_open++;
snapped_widget_pop_up(SNAPPED_WIDGET(wpanel));
}
}
......@@ -668,7 +665,8 @@ init_user_applets(void)
char *applet_pixmap;
char *applet_tooltip;
char *applet_path;
int pos=0,panel;
int pos=0,panel_num;
PanelWidget *panel;
g_snprintf(buf,256,"%sApplet_%d/config/", old_panel_cfg_path, num);
gnome_config_push_prefix(buf);
......@@ -682,7 +680,17 @@ init_user_applets(void)
g_snprintf(buf,256,"position=%d",
PANEL_UNKNOWN_APPLET_POSITION);
pos = gnome_config_get_int(buf);
panel = gnome_config_get_int("panel=0");
panel_num = gnome_config_get_int("panel=0");
{
GList *list = g_list_nth(panels,panel_num);
if(!list) {
g_warning("Can't find panel, "
"putting applet on the first one");
panel = panels->data;
} else
panel = list->data;
}
/*if we are to right stick this, make the number large,
INT_MAX/2 should allways be large enough */
......@@ -1970,7 +1978,7 @@ main(int argc, char **argv)
load_queued_applets();
/*add forbidden lists to ALL panels*/
g_list_foreach(panels,panel_widget_add_forbidden,NULL);
g_list_foreach(panels,(GFunc)panel_widget_add_forbidden,NULL);
/*this will make the drawers be hidden for closed panels etc ...*/
send_state_change();
......
......@@ -28,7 +28,7 @@ PanelWidget * get_def_panel_widget(GtkWidget *panel);
void load_applet(char *id, char *path, char *params,
char *pixmap, char *tooltip,
int pos, int panel, char *cfgpath);
int pos, PanelWidget *panel, char *cfgpath);
void orientation_change(int applet_id, PanelWidget *panel);
void back_change(int applet_id, PanelWidget *panel);
......
......@@ -45,6 +45,11 @@ struct _FileInfo {
time_t ctime;
};
/*???? this might be ugly, but I guess we can safely assume that we can only have
one menu open and that nothing weird will happen to the panel that opened that
menu whilethe user is looking over the choices*/
static PanelWidget *current_panel = NULL;
/*the most important dialog in the whole application*/
void
about_cb (GtkWidget *widget, gpointer data)
......@@ -153,8 +158,8 @@ free_string (GtkWidget *widget, void *data)
static int
add_to_panel (char *applet, char *path, char *arg)
{
load_applet(applet,path,arg,NULL,NULL,
PANEL_UNKNOWN_APPLET_POSITION,0,NULL);
load_applet(applet,path,arg,NULL,NULL,PANEL_UNKNOWN_APPLET_POSITION,
current_panel,NULL);
return TRUE;
}
......@@ -883,7 +888,8 @@ menu_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
Menu *menu = data;
if(event->button==1) {
GtkWidget *panel = get_panel_parent(menu->button->parent);
GtkWidget *wpanel = get_panel_parent(menu->button->parent);
GList *finfo = gtk_object_get_data(GTK_OBJECT(menu->menu),
"finfo");
......@@ -922,10 +928,14 @@ menu_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
/*so that the panel doesn't pop down until we're done with
the menu */
if(IS_SNAPPED_WIDGET(panel)) {
SNAPPED_WIDGET(panel)->autohide_inhibit = TRUE;
snapped_widget_queue_pop_down(SNAPPED_WIDGET(panel));
if(IS_SNAPPED_WIDGET(wpanel)) {
SNAPPED_WIDGET(wpanel)->autohide_inhibit = TRUE;
snapped_widget_queue_pop_down(SNAPPED_WIDGET(wpanel));
}
/*this HAS to be set everytime we popup the menu*/
current_panel = gtk_object_get_data(menu->button->parent,
PANEL_APPLET_PARENT_KEY);
gtk_menu_popup(GTK_MENU(menu->menu), 0,0, menu_position,
data, event->button, event->time);
......
......@@ -895,7 +895,7 @@ show_applet_menu(int applet_id, GdkEventButton *event)
snapped_widget_queue_pop_down(SNAPPED_WIDGET(panel));
}
gtk_menu_popup(GTK_MENU(info->menu), NULL, NULL, applet_menu_position,
ITOP(applet_id), 0/*3*/, event->time);
ITOP(applet_id), event->button, event->time);
}
......@@ -1088,7 +1088,7 @@ applet_request_id (const char *path, const char *param,
}
}
*winid = reserve_applet_spot (EXTERN_ID, path, param, 0, 0,
*winid = reserve_applet_spot (EXTERN_ID, path, param, panels->data, 0,
NULL, APPLET_EXTERN_RESERVED);
if(*winid == 0) {
*globcfgpath = NULL;
......@@ -1146,7 +1146,7 @@ applet_register (const char * ior, int applet_id)
only*/
guint32
reserve_applet_spot (const char *id_str, const char *path, const char *param,
int panel, int pos, char *cfgpath,
PanelWidget *panel, int pos, char *cfgpath,
AppletType type)
{
GtkWidget *socket;
......@@ -1173,10 +1173,9 @@ static void
panel_add_main_menu(GtkWidget *w, gpointer data)
{
PanelWidget *panel = get_def_panel_widget(data);
int panel_num = g_list_index(panels,panel);
load_applet(MENU_ID,NULL,NULL,NULL,NULL,PANEL_UNKNOWN_APPLET_POSITION,
panel_num!=-1?panel_num:0,NULL);
panel,NULL);
}
GtkWidget *
......@@ -1274,26 +1273,16 @@ register_toy(GtkWidget *applet,
char *path,
char *params,
int pos,
int panel,
PanelWidget *panel,
char *cfgpath,
AppletType type)
{
GtkWidget *eventbox;
AppletInfo info;
PanelWidget *panelw;
GList *list;
g_return_val_if_fail(applet != NULL, FALSE);
g_return_val_if_fail(id_str != NULL, FALSE);
list = g_list_nth(panels,panel);
g_return_val_if_fail(list != NULL, FALSE);
panelw = PANEL_WIDGET(list->data);
g_return_val_if_fail(panelw != NULL, FALSE);
/* We wrap the applet in a GtkEventBox so that we can capture
events over it */
eventbox = gtk_event_box_new();
......@@ -1340,8 +1329,11 @@ register_toy(GtkWidget *applet,
if(pos==PANEL_UNKNOWN_APPLET_POSITION)
pos = 0;
while(panel_widget_add(panelw, eventbox, pos)==-1) {
list = g_list_next(list);
if(panel_widget_add(panel, eventbox, pos)==-1) {
GList *list;
for(list = panels; list != NULL; list = g_list_next(list))
if(panel_widget_add(panel, eventbox, pos)!=-1)
break;
if(!list) {
gtk_widget_unref(eventbox);
if(info.cfg)
......@@ -1354,7 +1346,7 @@ register_toy(GtkWidget *applet,
g_warning("Can't find an empty spot");
return FALSE;
}
panelw = PANEL_WIDGET(list->data);
panel = PANEL_WIDGET(list->data);
}
gtk_signal_connect(GTK_OBJECT(eventbox),
......@@ -1382,7 +1374,7 @@ register_toy(GtkWidget *applet,
gtk_widget_dnd_drag_set (GTK_WIDGET(eventbox), TRUE,
applet_drag_types, 1);*/
orientation_change(applet_count-1,panelw);
orientation_change(applet_count-1,panel);
return TRUE;
}
......@@ -99,7 +99,7 @@ int register_toy(GtkWidget *applet,
char *path,
char *params,
int pos,
int panel,
PanelWidget *panel,
char *cfgpath,
AppletType type);
......@@ -118,7 +118,7 @@ int applet_request_id (const char *path, const char *param,
void applet_register (const char * ior, int applet_id);
guint32 reserve_applet_spot (const char *id_str, const char *path,
const char *param,
int panel, int pos, char *cfgpath,
PanelWidget *panel, int pos, char *cfgpath,
AppletType type);
void applet_abort_id(int applet_id);
int applet_get_panel(int applet_id);
......
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