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

added two new signals.

Wed Apr 01 22:01:23 1998  George Lebl  <jirka@5z.com>

        * panel-widget.c: added two new signals.

        * main.c: made interpanel moving work a bit better.
parent e4a1c5b5
Wed Apr 01 22:01:23 1998 George Lebl <jirka@5z.com>
* panel-widget.c: added two new signals.
* main.c: made interpanel moving work a bit better.
Wed Apr 01 01:01:05 1998 George Lebl <jirka@5z.com>
* applet-lib.cc: small fix to corect for temporaries
......
Wed Apr 01 22:01:23 1998 George Lebl <jirka@5z.com>
* panel-widget.c: added two new signals.
* main.c: made interpanel moving work a bit better.
Wed Apr 01 01:01:05 1998 George Lebl <jirka@5z.com>
* applet-lib.cc: small fix to corect for temporaries
......
......@@ -21,8 +21,6 @@
#include "drawer.h"
#define DRAWER_PANEL "drawer_panel"
extern GlobalConfig global_config;
void
......@@ -137,6 +135,7 @@ create_drawer_applet(GtkWidget * drawer_panel, DrawerOrient orient)
else
gtk_widget_hide(drawer_panel);
gtk_object_set_data(GTK_OBJECT(drawer_panel),DRAWER_PANEL,drawer);
g_free (pixmap_name);
return drawer;
......
......@@ -3,6 +3,8 @@
BEGIN_GNOME_DECLS
#define DRAWER_PANEL "drawer_panel"
typedef enum {
DRAWER_UP,
DRAWER_LEFT,
......
......@@ -37,6 +37,8 @@ GlobalConfig global_config = {
TRUE /*show small icons*/
};
/*needed for drawers*/
static void panel_setup(PanelWidget *panel);
void
load_applet(char *id, char *params, int pos, int panel, char *cfgpath)
......@@ -111,13 +113,14 @@ load_applet(char *id, char *params, int pos, int panel, char *cfgpath)
if(!params) {
drawer = create_empty_drawer_applet(orient);
panel_setup(PANEL_WIDGET(drawer->drawer));
panels = g_list_append(panels,drawer->drawer);
} else {
int i;
sscanf(params,"%d",&i);
drawer = create_drawer_applet(g_list_nth(panels,i)->data,
orient);
drawer=create_drawer_applet(g_list_nth(panels,i)->data,
orient);
}
g_return_if_fail(drawer != NULL);
......@@ -341,12 +344,12 @@ panel_state_change(GtkWidget *widget,
return TRUE;
}
static void
static gint
applet_move_foreach(gpointer data, gpointer user_data)
{
AppletInfo *info = gtk_object_get_user_data(GTK_OBJECT(data));
if(!info) return;
if(!info) return FALSE;
if(info->type == APPLET_DRAWER) {
if(PANEL_WIDGET(info->assoc)->state == PANEL_SHOWN) {
......@@ -357,12 +360,45 @@ applet_move_foreach(gpointer data, gpointer user_data)
NULL);
}
}
return TRUE;
}
static void
static gint
panel_applet_move(GtkWidget *widget, GtkWidget *applet, gpointer data)
{
applet_move_foreach(applet,NULL);
return TRUE;
}
static gint
panel_size_allocate(GtkWidget *widget, GtkAllocation *alloc, gpointer data)
{
Drawer *drawer = gtk_object_get_data(GTK_OBJECT(widget),DRAWER_PANEL);
PanelWidget *panel = PANEL_WIDGET(widget);
if(drawer)
if(panel->state == PANEL_SHOWN)
reposition_drawer(drawer);
return TRUE;
}
static gint
panel_applet_added(GtkWidget *widget, GtkWidget *applet, gpointer data)
{
AppletInfo *info = gtk_object_get_user_data(GTK_OBJECT(applet));
PanelWidget *panel = PANEL_WIDGET(widget);
if(!info) return FALSE;
orientation_change(info,panel);
return TRUE;
}
static gint
panel_applet_removed(GtkWidget *widget, gpointer data)
{
return TRUE;
}
static void
......@@ -443,6 +479,50 @@ panel_destroy(GtkWidget *widget, gpointer data)
gtk_widget_unref(panel_menu);
}
static void
panel_setup(PanelWidget *panel)
{
GtkWidget *panel_menu;
panel_menu = create_panel_root_menu(panel);
gtk_signal_connect(GTK_OBJECT(panel),
"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),
"applet_move",
GTK_SIGNAL_FUNC(panel_applet_move),
NULL);
gtk_signal_connect(GTK_OBJECT(panel),
"size_allocate",
GTK_SIGNAL_FUNC(panel_size_allocate),
NULL);
gtk_signal_connect(GTK_OBJECT(panel),
"applet_added",
GTK_SIGNAL_FUNC(panel_applet_added),
NULL);
gtk_signal_connect(GTK_OBJECT(panel),
"applet_removed",
GTK_SIGNAL_FUNC(panel_applet_removed),
NULL);
gtk_signal_connect(GTK_OBJECT(panel),
"button_press_event",
GTK_SIGNAL_FUNC(panel_button_press),
panel_menu);
gtk_signal_connect(GTK_OBJECT(panel),
"destroy",
GTK_SIGNAL_FUNC(panel_destroy),
panel_menu);
gtk_signal_connect_after(GTK_OBJECT(panel), "realize",
GTK_SIGNAL_FUNC(panel_realize),
NULL);
}
static void
init_user_panels(void)
......@@ -452,7 +532,6 @@ init_user_panels(void)
int size,x,y;
PanelConfig config;
GtkWidget *panel;
GtkWidget *panel_menu;
PanelState state;
DrawerDropZonePos drop_pos;
......@@ -503,31 +582,7 @@ init_user_panels(void)
y,
drop_pos);
panel_menu = create_panel_root_menu(PANEL_WIDGET(panel));
gtk_signal_connect(GTK_OBJECT(panel),
"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),
"applet_move",
GTK_SIGNAL_FUNC(panel_applet_move),
NULL);
gtk_signal_connect(GTK_OBJECT(panel),
"button_press_event",
GTK_SIGNAL_FUNC(panel_button_press),
panel_menu);
gtk_signal_connect(GTK_OBJECT(panel),
"destroy",
GTK_SIGNAL_FUNC(panel_destroy),
panel_menu);
gtk_signal_connect_after(GTK_OBJECT(panel), "realize",
GTK_SIGNAL_FUNC(panel_realize),
NULL);
panel_setup(PANEL_WIDGET(panel));
gtk_widget_show(panel);
......
......@@ -64,6 +64,8 @@ enum {
ORIENT_CHANGE_SIGNAL,
STATE_CHANGE_SIGNAL,
APPLET_MOVE_SIGNAL,
APPLET_ADDED_SIGNAL,
APPLET_REMOVED_SIGNAL,
LAST_SIGNAL
};
......@@ -150,6 +152,25 @@ panel_widget_class_init (PanelWidgetClass *class)
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
panel_widget_signals[APPLET_ADDED_SIGNAL] =
gtk_signal_new("applet_added",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(PanelWidgetClass,
applet_added),
gtk_panel_widget_marshal_signal_applet,
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
panel_widget_signals[APPLET_REMOVED_SIGNAL] =
gtk_signal_new("applet_removed",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(PanelWidgetClass,
applet_removed),
gtk_panel_widget_marshal_signal_applet,
GTK_TYPE_NONE,
0);
gtk_object_class_add_signals(object_class,panel_widget_signals,
LAST_SIGNAL);
......@@ -157,6 +178,8 @@ panel_widget_class_init (PanelWidgetClass *class)
class->orient_change = NULL;
class->state_change = NULL;
class->applet_move = NULL;
class->applet_added = NULL;
class->applet_removed = NULL;
}
static void
......@@ -1501,10 +1524,6 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel)
/*force orient change on the applet,
maybe there should be a applet
based orient signal*/
gtk_signal_emit(GTK_OBJECT(new_panel),
panel_widget_signals[ORIENT_CHANGE_SIGNAL],
new_panel->orient,
new_panel->snapped);
return FALSE;
}
}
......@@ -1784,6 +1803,10 @@ panel_widget_add (PanelWidget *panel, GtkWidget *applet, gint pos)
bind_top_applet_events(applet);
gtk_signal_emit(GTK_OBJECT(panel),
panel_widget_signals[APPLET_ADDED_SIGNAL],
applet);
return pos;
}
......@@ -1815,6 +1838,10 @@ panel_widget_reparent (PanelWidget *old_panel,
PANEL_APPLET_PARENT_KEY,
new_panel);
gtk_signal_emit(GTK_OBJECT(new_panel),
panel_widget_signals[APPLET_ADDED_SIGNAL],
applet);
return pos;
}
......@@ -1891,6 +1918,9 @@ panel_widget_remove (PanelWidget *panel, GtkWidget *applet)
panel->thick = PANEL_MINIMUM_WIDTH;
panel_widget_set_size(panel,panel->size);
gtk_signal_emit(GTK_OBJECT(panel),
panel_widget_signals[APPLET_REMOVED_SIGNAL]);
return i;
}
......
......@@ -113,6 +113,9 @@ struct _PanelWidgetClass
PanelState state);
void (* applet_move) (PanelWidget *panel,
GtkWidget *applet);
void (* applet_added) (PanelWidget *panel,
GtkWidget *applet);
void (* applet_removed) (PanelWidget *panel);
};
guint panel_widget_get_type (void);
......
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