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

made signals work better, drawers hide when their parent hides

Wed Mar 04 23:28:44 1998  George Lebl  <jirka@5z.com>

        * main.c, panel-widget.c: made signals work better, drawers
          hide when their parent hides
parent de511fc6
Wed Mar 04 23:28:44 1998 George Lebl <jirka@5z.com>
* main.c, panel-widget.c: made signals work better, drawers
hide when their parent hides
Wed Mar 04 01:09:53 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch],main.c,panel.[ch]: few cleanups, made
......
Wed Mar 04 23:28:44 1998 George Lebl <jirka@5z.com>
* main.c, panel-widget.c: made signals work better, drawers
hide when their parent hides
Wed Mar 04 01:09:53 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch],main.c,panel.[ch]: few cleanups, made
......
......@@ -5,7 +5,8 @@ test:
#SUBDIRS = menu mailcheck clock launcher batmon netwatch logout \
# @PROGRAMS_PANEL_CDPLAYER@
SUBDIRS = @PROGRAMS_PANEL_CDPLAYER@ batmon mailcheck netwatch
#FIXME: without libapplet in a separate dir, cdplayer won't compile
#SUBDIRS = @PROGRAMS_PANEL_CDPLAYER@ batmon mailcheck netwatch
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
......
......@@ -95,7 +95,7 @@ load_applet(char *id, char *params, int pos, int panel)
register_toy(drawer->button,drawer->drawer,drawer,DRAWER_ID,
params, pos, panel,
APPLET_HAS_PROPERTIES,APPLET_MENU);
APPLET_HAS_PROPERTIES,APPLET_DRAWER);
}
}
......@@ -163,6 +163,8 @@ orient_change_foreach(gpointer data, gpointer user_data)
AppletInfo *info = gtk_object_get_user_data(GTK_OBJECT(data));
PanelWidget *panel = user_data;
if(!info) return;
if(info->type == APPLET_EXTERN) {
/*FIXME: call corba*/
} else if(info->type == APPLET_MENU) {
......@@ -233,6 +235,60 @@ panel_orient_change(GtkWidget *widget,
(gpointer)widget);
}
static void
state_restore_foreach(gpointer data, gpointer user_data)
{
AppletInfo *info = gtk_object_get_user_data(GTK_OBJECT(data));
PanelWidget *panel = user_data;
if(!info) return;
if(info->type == APPLET_DRAWER) {
if(PANEL_WIDGET(info->assoc)->state == PANEL_SHOWN) {
panel_widget_restore_state(PANEL_WIDGET(info->assoc));
panel_widget_foreach(PANEL_WIDGET(info->assoc),
state_restore_foreach,
(gpointer)info->assoc);
}
}
}
static void
state_hide_foreach(gpointer data, gpointer user_data)
{
AppletInfo *info = gtk_object_get_user_data(GTK_OBJECT(data));
PanelWidget *panel = user_data;
if(!info) return;
if(info->type == APPLET_DRAWER) {
if(PANEL_WIDGET(info->assoc)->state == PANEL_SHOWN) {
gtk_widget_hide(info->assoc);
panel_widget_foreach(PANEL_WIDGET(info->assoc),
state_restore_foreach,
(gpointer)info->assoc);
}
}
}
static int
panel_state_change(GtkWidget *widget,
PanelState state,
gpointer data)
{
puts("PANEL_STATE_CHANGE");
if(state==PANEL_SHOWN) {
puts("PANEL_SHOW");
panel_widget_foreach(PANEL_WIDGET(widget),state_restore_foreach,
(gpointer)widget);
} else {
puts("PANEL_HIDE");
panel_widget_foreach(PANEL_WIDGET(widget),state_hide_foreach,
(gpointer)widget);
}
}
static int
panel_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
......@@ -314,6 +370,10 @@ init_user_panels(void)
"orient_change",
GTK_SIGNAL_FUNC(panel_orient_change),
NULL);
gtk_signal_connect(GTK_OBJECT(panel),
"state_change",
GTK_SIGNAL_FUNC(panel_state_change),
NULL);
gtk_signal_connect(GTK_OBJECT(panel),
"button_press_event",
GTK_SIGNAL_FUNC(panel_button_press),
......
......@@ -13,6 +13,15 @@ static GdkCursor *fleur_cursor;
GDK_POINTER_MOTION_MASK | \
GDK_POINTER_MOTION_HINT_MASK)
typedef void (*PanelWidgetOrientSignal) (GtkObject * object,
PanelOrientation orient,
PanelSnapped snapped,
gpointer data);
typedef void (*PanelWidgetStateSignal) (GtkObject * object,
PanelState state,
gpointer data);
guint
panel_widget_get_type ()
{
......@@ -44,6 +53,35 @@ enum {
static gint panel_widget_signals[LAST_SIGNAL] = {0,0,0};
static void
gtk_panel_widget_marshal_signal_state (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
PanelWidgetStateSignal rfunc;
rfunc = (PanelWidgetStateSignal) func;
(*rfunc) (object, GTK_VALUE_ENUM (args[0]),
func_data);
}
static void
gtk_panel_widget_marshal_signal_orient (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
PanelWidgetOrientSignal rfunc;
rfunc = (PanelWidgetOrientSignal) func;
(*rfunc) (object, GTK_VALUE_ENUM (args[0]),
GTK_VALUE_ENUM (args[1]),
func_data);
}
static void
panel_widget_class_init (PanelWidgetClass *class)
{
......@@ -53,32 +91,32 @@ panel_widget_class_init (PanelWidgetClass *class)
panel_widget_signals[ORIENT_CHANGE_SIGNAL] =
gtk_signal_new("orient_change",
GTK_RUN_FIRST,
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(PanelWidgetClass,
orient_change),
gtk_signal_default_marshaller,
gtk_panel_widget_marshal_signal_orient,
GTK_TYPE_NONE,
2,
GTK_TYPE_ENUM,
GTK_TYPE_ENUM);
panel_widget_signals[STATE_CHANGE_SIGNAL] =
gtk_signal_new("state_change",
GTK_RUN_FIRST,
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(PanelWidgetClass,
state_change),
gtk_signal_default_marshaller,
gtk_panel_widget_marshal_signal_state,
GTK_TYPE_NONE,
1,
GTK_TYPE_ENUM);
panel_widget_signals[RESTORE_STATE_SIGNAL] =
gtk_signal_new("restore_state",
GTK_RUN_FIRST,
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(PanelWidgetClass,
restore_state),
gtk_signal_default_marshaller,
gtk_panel_widget_marshal_signal_state,
GTK_TYPE_NONE,
1,
GTK_TYPE_ENUM);
......
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