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

move applet menuitem fixed

Sun Feb 08 14:52:40 1998  George Lebl  <jirka@5z.com>

        * panel-widget.[ch], panel.c: move applet menuitem fixed
parent b915c1ee
Sun Feb 08 14:52:40 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch], panel.c: move applet menuitem fixed
Sun Feb 08 12:19:55 1998 George Lebl <jirka@5z.com>
* main.c, panel.c, panel.h, panel-widget.c: fixed applet menu
......
Sun Feb 08 14:52:40 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch], panel.c: move applet menuitem fixed
Sun Feb 08 12:19:55 1998 George Lebl <jirka@5z.com>
* main.c, panel.c, panel.h, panel-widget.c: fixed applet menu
......
......@@ -867,18 +867,18 @@ panel_widget_add_with_drawer (PanelWidget *panel, GtkWidget *button, gint pos)
return -1;
}
static void
panel_widget_applet_drag_start(PanelWidget *panel, GtkWidget *applet, int warp)
void
panel_widget_applet_drag_start(PanelWidget *panel, GtkWidget *applet)
{
panel->currently_dragged_applet = applet;
panel->currently_dragged_applet_pos =
panel_widget_get_pos(panel,applet);
if (warp)
/*if (warp)
gdk_pointer_warp(NULL, applet->window,
0, 0, 0, 0,
applet->allocation.width / 2,
applet->allocation.height / 2);
applet->allocation.height / 2);*/
gtk_grab_add(applet);
gdk_pointer_grab(applet->window,
......@@ -915,8 +915,7 @@ panel_widget_applet_event(GtkWidget *widget, GdkEvent *event, gpointer data)
if(bevent->button == 2) {
/* Start drag */
panel_widget_applet_drag_start(
panel, widget, FALSE);
panel_widget_applet_drag_start(panel, widget);
return TRUE;
}
......
......@@ -123,6 +123,9 @@ GList* panel_widget_get_applets (PanelWidget *panel);
void panel_widget_foreach (PanelWidget *panel,
GFunc func,
gpointer user_data);
/*initiate drag*/
void panel_widget_applet_drag_start (PanelWidget *panel,
GtkWidget *applet);
/*changing parameters*/
void panel_widget_change_params (PanelWidget *panel,
......
......@@ -389,16 +389,31 @@ create_applet(char *id, char *params, int pos, int panel)
g_free(params);
}
/*FIXME: move can't work from here!*/
static PanelWidget *
find_applet_panel(GtkWidget *applet)
{
GList *list;
for(list=panels;list!=NULL;list=g_list_next(list))
if(panel_widget_get_pos(PANEL_WIDGET(list->data),applet)!=-1)
break;
if(!list)
return NULL;
return PANEL_WIDGET(list->data);
}
static void
move_applet_callback(GtkWidget *widget, gpointer data)
{
/*
GtkWidget *applet;
PanelWidget *panel;
applet = gtk_object_get_user_data(GTK_OBJECT(applet_menu));
applet_drag_start(applet, TRUE);
*/
if(!(panel = find_applet_panel(applet)))
return;
panel_widget_applet_drag_start(panel,applet);
}
......@@ -409,7 +424,7 @@ remove_applet_callback(GtkWidget *widget, gpointer data)
AppletCommand cmd;
gchar *id;
gint pos;
GList *list;
PanelWidget *panel;
applet = gtk_object_get_user_data(GTK_OBJECT(applet_menu));
......@@ -425,12 +440,10 @@ remove_applet_callback(GtkWidget *widget, gpointer data)
}
applets=g_list_remove(applets,applet);
for(list=panels;list!=NULL;list=g_list_next(list))
if(panel_widget_get_pos(PANEL_WIDGET(list->data),applet)!=-1)
break;
if(!list)
if(!(panel = find_applet_panel(applet)))
return;
panel_widget_remove(PANEL_WIDGET(list->data),applet);
panel_widget_remove(panel,applet);
gtk_widget_destroy(applet);
}
......@@ -463,14 +476,14 @@ create_applet_menu(void)
gtk_widget_show(menuitem);
applet_menu_remove_item = menuitem;
/*
menuitem = gtk_menu_item_new_with_label(_("Move applet"));
gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
(GtkSignalFunc) move_applet_callback,
NULL);
gtk_menu_append(GTK_MENU(applet_menu), menuitem);
gtk_widget_show(menuitem);
*/
menuitem = gtk_menu_item_new();
gtk_menu_append(GTK_MENU(applet_menu), menuitem);
......
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