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

more swallow applet work

Sat Apr 04 23:31:05 1998  George Lebl  <jirka@5z.com>

        * swallow.c: more swallow applet work

        * main.c: laoding of swallow applets in place
parent d3f05282
Sat Apr 04 23:31:05 1998 George Lebl <jirka@5z.com>
* swallow.c: more swallow applet work
* main.c: laoding of swallow applets in place
Sat Apr 04 19:17:01 1998 George Lebl <jirka@5z.com>
* swallow.[ch]: beginnings of a swallow applet.
......
Sat Apr 04 23:31:05 1998 George Lebl <jirka@5z.com>
* swallow.c: more swallow applet work
* main.c: laoding of swallow applets in place
Sat Apr 04 19:17:01 1998 George Lebl <jirka@5z.com>
* swallow.[ch]: beginnings of a swallow applet.
......
......@@ -59,6 +59,8 @@ panel_SOURCES = \
main.c \
menu.c \
menu.h \
swallow.c \
swallow.h \
mico-glue.cc \
mico-glue.h \
mico-parse.cc \
......
......@@ -13,6 +13,7 @@
#include "panel_config_global.h"
#include "menu.h"
#include "drawer.h"
#include "swallow.h"
#include "mico-glue.h"
#include "mico-parse.h"
#include "panel-util.h"
......@@ -127,6 +128,13 @@ load_applet(char *id, char *params, int pos, int panel, char *cfgpath)
register_toy(drawer->button,drawer->drawer,drawer,DRAWER_ID,
params, pos, panel, NULL, APPLET_DRAWER);
} else if(strcmp(id,SWALLOW_ID) == 0) {
Swallow *swallow;
swallow = create_swallow_applet(params, SWALLOW_HORIZONTAL);
register_toy(swallow->table,NULL,swallow,MENU_ID,params,pos,
panel,NULL,APPLET_SWALLOW);
}
}
......@@ -269,6 +277,13 @@ orientation_change(AppletInfo *info, PanelWidget *panel)
panel_widget_foreach(PANEL_WIDGET(info->assoc),
orient_change_foreach,
(gpointer)info->assoc);
} else if(info->type == APPLET_SWALLOW) {
Swallow *swallow = info->data;
if(panel->orient == PANEL_VERTICAL)
set_swallow_applet_orient(swallow,SWALLOW_VERTICAL);
else
set_swallow_applet_orient(swallow,SWALLOW_HORIZONTAL);
}
}
......
......@@ -400,6 +400,13 @@ create_panel_submenu (GtkWidget *app_menu)
(GtkSignalFunc) add_applet_to_panel_data,
DRAWER_ID);
menuitem = gtk_menu_item_new ();
setup_menuitem (menuitem, 0, _("Add swallowed app"));
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
(GtkSignalFunc) add_applet_to_panel_data,
SWALLOW_ID);
add_menu_separator(menu);
menuitem = gtk_menu_item_new ();
......
......@@ -21,37 +21,72 @@ Swallow *
create_swallow_applet(char *arguments, SwallowOrient orient)
{
Swallow *swallow;
GtkWidget *w;
swallow = g_new(Swallow,1);
swallow->table = gtk_table_new(2,2,FALSE);
gtk_widget_show(swallow->table);
swallow->handle_n = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_SHADOW_OUT);
swallow->handle_n = gtk_vbox_new(FALSE,0);
gtk_table_attach(GTK_TABLE(swallow->table),swallow->handle_n,
1,2,0,1,
GTK_FILL|GTK_EXPAND|GTK_SHRINK,
GTK_FILL|GTK_EXPAND|GTK_SHRINK,
0,0);
swallow->handle_e = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_SHADOW_OUT);
gtk_table_attach(GTK_TABLE(swallow->table),swallow->handle_e,
w = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w),GTK_SHADOW_OUT);
gtk_box_pack_start(GTK_BOX(swallow->handle_n),w,TRUE,TRUE,0);
gtk_widget_show(w);
w = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w),GTK_SHADOW_OUT);
gtk_box_pack_start(GTK_BOX(swallow->handle_n),w,TRUE,TRUE,0);
gtk_widget_show(w);
w = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w),GTK_SHADOW_OUT);
gtk_box_pack_start(GTK_BOX(swallow->handle_n),w,TRUE,TRUE,0);
gtk_widget_show(w);
swallow->handle_w = gtk_hbox_new(FALSE,0);
gtk_table_attach(GTK_TABLE(swallow->table),swallow->handle_w,
0,1,1,2,
GTK_FILL|GTK_EXPAND|GTK_SHRINK,
GTK_FILL|GTK_EXPAND|GTK_SHRINK,
0,0);
w = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w),GTK_SHADOW_OUT);
gtk_box_pack_start(GTK_BOX(swallow->handle_w),w,TRUE,TRUE,0);
gtk_widget_show(w);
w = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w),GTK_SHADOW_OUT);
gtk_box_pack_start(GTK_BOX(swallow->handle_w),w,TRUE,TRUE,0);
gtk_widget_show(w);
w = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w),GTK_SHADOW_OUT);
gtk_box_pack_start(GTK_BOX(swallow->handle_w),w,TRUE,TRUE,0);
gtk_widget_show(w);
swallow->socket=gtk_socket_new();
gtk_table_attach(GTK_TABLE(swallow->table),swallow->socket,
1,2,1,2,
GTK_FILL|GTK_EXPAND|GTK_SHRINK,
GTK_FILL|GTK_EXPAND|GTK_SHRINK,
0,0);
gtk_widget_show(swallow->socket);
/*FIXME: add the right window or wait for it or something here*/
gtk_widget_set_usize(swallow->socket,48,48);
/*{
long wid;
puts("window ID to get:");
scanf("%lX",&wid);
gtk_socket_steal(GTK_SOCKET(swallow->socket),wid);
}*/
gtk_object_set_user_data(GTK_OBJECT(swallow->socket),swallow);
set_swallow_applet_orient(swallow, orient);
......@@ -64,9 +99,9 @@ set_swallow_applet_orient(Swallow *swallow, SwallowOrient orient)
{
if(orient==SWALLOW_VERTICAL) {
gtk_widget_show(swallow->handle_n);
gtk_widget_hide(swallow->handle_e);
gtk_widget_hide(swallow->handle_w);
} else {
gtk_widget_hide(swallow->handle_n);
gtk_widget_show(swallow->handle_e);
gtk_widget_show(swallow->handle_w);
}
}
......@@ -11,13 +11,13 @@ typedef enum {
typedef struct {
GtkWidget *table;
GtkWidget *handle_n;
GtkWidget *handle_e;
GtkWidget *handle_w;
GtkWidget *socket;
gchar *title;
guint32 wid;
} Swallow;
Menu * create_swallow_applet(char *arguments, SwallowOrient orient);
Swallow * create_swallow_applet(char *arguments, SwallowOrient orient);
void set_swallow_applet_orient(Swallow *swallow, SwallowOrient orient);
......
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