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

save applet position on move, don't save it when we're removing the

Wed Feb 27 23:58:15 2002  George Lebl <jirka@5z.com>

	* applet.c, panel-applet-frame.[ch], session.c, panel.c: save
	  applet position on move, don't save it when we're removing the
	  applets.  Implement back the clean_remove setting for
	  bonobo_applets in preparation for the 'dead applet' dialog

	* basep-widget.[ch], menu.c, panel.c:  Try to figure out memory
	  issues with removing panels/applets.  The menu applet now removes
	  without a warning, but removing a panel will still corrupt memory
	  somewhere.  While I was at it I converted the Pos objects to
	  GObject rather then GtkObject, which gets rid of some sinking
	  issues.

	* menu-properties.c: remove a dead argument to a function

	* panel-widget.c: minor cleanup
parent 4cc856f8
Wed Feb 27 23:58:15 2002 George Lebl <jirka@5z.com>
* applet.c, panel-applet-frame.[ch], session.c, panel.c: save
applet position on move, don't save it when we're removing the
applets. Implement back the clean_remove setting for
bonobo_applets in preparation for the 'dead applet' dialog
* basep-widget.[ch], menu.c, panel.c: Try to figure out memory
issues with removing panels/applets. The menu applet now removes
without a warning, but removing a panel will still corrupt memory
somewhere. While I was at it I converted the Pos objects to
GObject rather then GtkObject, which gets rid of some sinking
issues.
* menu-properties.c: remove a dead argument to a function
* panel-widget.c: minor cleanup
Wed Feb 27 19:45:40 2002 George Lebl <jirka@5z.com>
* panel-applet-frame.c: fix initial setting of medium size
......
......@@ -164,9 +164,12 @@ applet_idle_remove (gpointer data)
info->remove_idle = 0;
panel_applet_save_position (info, info->gconf_key);
if (info->type == APPLET_BONOBO) {
PanelAppletFrame *frame = info->data;
if (info->type == APPLET_SWALLOW) {
panel_applet_frame_set_clean_remove
(PANEL_APPLET_FRAME (frame), TRUE);
} else if (info->type == APPLET_SWALLOW) {
Swallow *swallow = info->data;
swallow->clean_remove = TRUE;
......
......@@ -750,8 +750,8 @@ basep_pos_get_type (void)
(GInstanceInitFunc) basep_pos_instance_init
};
object_type = g_type_register_static
(GTK_TYPE_OBJECT, "BasePPos", &object_info, 0);
basep_pos_parent_class = g_type_class_ref (GTK_TYPE_OBJECT);
(G_TYPE_OBJECT, "BasePPos", &object_info, 0);
basep_pos_parent_class = g_type_class_ref (G_TYPE_OBJECT);
}
return object_type;
}
......@@ -1252,14 +1252,16 @@ basep_widget_destroy (GtkObject *o)
g_source_remove (basep->leave_notify_timer_tag);
basep->leave_notify_timer_tag = 0;
if (BORDER_IS_WIDGET (basep))
basep_border_queue_recalc (basep->screen);
if (basep->pos != NULL)
g_object_unref (basep->pos);
if (basep->pos != NULL) {
if (BORDER_IS_WIDGET (basep))
basep_border_queue_recalc (basep->screen);
g_object_unref (G_OBJECT (basep->pos));
}
basep->pos = NULL;
if (GTK_OBJECT_CLASS (basep_widget_parent_class)->destroy)
GTK_OBJECT_CLASS (basep_widget_parent_class)->destroy (o);
}
static void
......@@ -1726,7 +1728,6 @@ basep_widget_construct (gchar *panel_id,
basep->state = state;
g_object_ref (basep->pos);
gtk_object_sink (GTK_OBJECT (basep->pos));
basep->pos->basep = basep;
if (state == BASEP_AUTO_HIDDEN &&
......@@ -1919,7 +1920,7 @@ basep_widget_explicit_hide (BasePWidget *basep, BasePState state)
old_state = basep->state;
basep->state = state;
g_signal_emit (GTK_OBJECT(basep),
g_signal_emit (G_OBJECT (basep),
basep_widget_signals[STATE_CHANGE_SIGNAL],
0, old_state);
panels_to_sync = TRUE;
......
......@@ -121,13 +121,13 @@ struct _BasePWidgetClass
/* we mostly want the class for this */
struct _BasePPos {
GtkObject object;
GObject object;
BasePWidget *basep;
};
struct _BasePPosClass {
GtkObjectClass parent_class;
GObjectClass parent_class;
/* virtual functions */
void (*set_hidebuttons) (BasePWidget *basep);
......
......@@ -344,7 +344,7 @@ textbox_changed (GtkWidget *widget, gpointer data)
}
static void
add_menu_type_options(Menu *menu, GtkObject *dialog, GtkTable *table, int row,
add_menu_type_options(Menu *menu, GtkTable *table, int row,
char *title, GtkWidget **widget, GtkWidget **widget_sub,
gboolean on, gboolean sub)
{
......@@ -492,42 +492,42 @@ create_properties_dialog (Menu *menu)
gtk_container_add(GTK_CONTAINER(f), table);
add_menu_type_options(menu,
GTK_OBJECT(dialog), GTK_TABLE(table),0,
GTK_TABLE(table),0,
_("Programs: "),
&menu->dialog_info->system,
&menu->dialog_info->system_sub,
menu->main_menu_flags & MAIN_MENU_SYSTEM,
menu->main_menu_flags & MAIN_MENU_SYSTEM_SUB);
add_menu_type_options(menu,
GTK_OBJECT(dialog), GTK_TABLE(table),2,
GTK_TABLE(table),2,
_("Applets: "),
&menu->dialog_info->applets,
&menu->dialog_info->applets_sub,
menu->main_menu_flags & MAIN_MENU_APPLETS,
menu->main_menu_flags & MAIN_MENU_APPLETS_SUB);
add_menu_type_options(menu,
GTK_OBJECT(dialog), GTK_TABLE(table),3,
GTK_TABLE(table),3,
_("Distribution menu (if found): "),
&menu->dialog_info->distribution,
&menu->dialog_info->distribution_sub,
menu->main_menu_flags & MAIN_MENU_DISTRIBUTION,
menu->main_menu_flags & MAIN_MENU_DISTRIBUTION_SUB);
add_menu_type_options(menu,
GTK_OBJECT(dialog), GTK_TABLE(table),4,
GTK_TABLE(table),4,
_("KDE menu (if found): "),
&menu->dialog_info->kde,
&menu->dialog_info->kde_sub,
menu->main_menu_flags & MAIN_MENU_KDE,
menu->main_menu_flags & MAIN_MENU_KDE_SUB);
add_menu_type_options(menu,
GTK_OBJECT(dialog), GTK_TABLE(table),6,
GTK_TABLE(table),6,
_("Panel menu: "),
&menu->dialog_info->panel,
&menu->dialog_info->panel_sub,
menu->main_menu_flags & MAIN_MENU_PANEL,
menu->main_menu_flags & MAIN_MENU_PANEL_SUB);
add_menu_type_options(menu,
GTK_OBJECT(dialog), GTK_TABLE(table),7,
GTK_TABLE(table),7,
_("Desktop menu: "),
&menu->dialog_info->desktop,
&menu->dialog_info->desktop_sub,
......
......@@ -2645,7 +2645,7 @@ destroy_menu (GtkWidget *widget, gpointer data)
menu->prop_dialog = NULL;
if (prop_dialog != NULL)
g_object_unref (G_OBJECT (prop_dialog));
gtk_widget_destroy (prop_dialog);
menu->button = NULL;
......@@ -4196,16 +4196,16 @@ add_menu_widget (Menu *menu,
gtk_tooltips_set_tip (panel_tooltips, menu->button,
_("Main Menu"), NULL);
}
}
/* sink the menu, none of this floating */
g_object_ref (G_OBJECT (menu->menu));
gtk_object_sink (GTK_OBJECT (menu->menu));
g_signal_connect (G_OBJECT (menu->menu), "deactivate",
G_CALLBACK (menu_deactivate), menu);
g_object_set_data (G_OBJECT (menu->menu), "menu_panel", panel);
panel_signal_connect_object_while_alive(
G_OBJECT (panel),
"destroy", G_CALLBACK(g_object_unref),
G_OBJECT (menu->menu));
}
static void
......
......@@ -47,6 +47,8 @@ struct _PanelAppletFramePrivate {
gchar *iid;
gboolean moving_focus_out;
gboolean clean_remove;
};
static GObjectClass *parent_class;
......@@ -284,6 +286,19 @@ panel_applet_frame_set_info (PanelAppletFrame *frame,
frame->priv->applet_info = info;
}
void
panel_applet_frame_set_clean_remove (PanelAppletFrame *frame,
gboolean clean_remove)
{
frame->priv->clean_remove = clean_remove;
}
gboolean
panel_applet_frame_get_clean_remove (PanelAppletFrame *frame)
{
return frame->priv->clean_remove;
}
static void
panel_applet_frame_finalize (GObject *object)
{
......@@ -388,6 +403,7 @@ panel_applet_frame_instance_init (PanelAppletFrame *frame,
frame->priv->property_bag = CORBA_OBJECT_NIL;
frame->priv->applet_info = NULL;
frame->priv->moving_focus_out = FALSE;
frame->priv->clean_remove = FALSE;
}
GType
......
......@@ -97,6 +97,10 @@ void panel_applet_frame_load_from_gconf (PanelWidget *panel_widget,
gint position,
const char *gconf_key);
void panel_applet_frame_set_clean_remove (PanelAppletFrame *frame,
gboolean clean_remove);
gboolean panel_applet_frame_get_clean_remove (PanelAppletFrame *frame);
G_END_DECLS
#endif /* __PANEL_APPLET_FRAME_H__ */
......@@ -1435,7 +1435,7 @@ panel_widget_set_back_color(PanelWidget *panel, GdkColor *color)
panel_try_to_set_back_color(panel, color);
gtk_widget_queue_draw (GTK_WIDGET (panel));
g_signal_emit(GTK_OBJECT(panel),
g_signal_emit(G_OBJECT(panel),
panel_widget_signals[BACK_CHANGE_SIGNAL],
0,
panel->back_type,
......
......@@ -576,16 +576,17 @@ panel_remove_applets (PanelWidget *panel)
info = g_object_get_data (G_OBJECT (ad->applet),
"applet_info");
panel_applet_save_position (info, info->gconf_key);
if (info->type == APPLET_BONOBO) {
PanelAppletFrame *frame = info->data;
if (info->type == APPLET_SWALLOW) {
panel_applet_frame_set_clean_remove
(PANEL_APPLET_FRAME (frame), TRUE);
} else if (info->type == APPLET_SWALLOW) {
Swallow *swallow = info->data;
swallow->clean_remove = TRUE;
}
}
gnome_config_sync ();
}
static void
......@@ -633,6 +634,8 @@ panel_destroy (GtkWidget *widget, gpointer data)
g_source_remove (pd->deactivate_idle);
pd->deactivate_idle = 0;
g_object_set_data (G_OBJECT (widget), "PanelData", NULL);
panel_list = g_slist_remove (panel_list, pd);
g_free (pd);
}
......@@ -640,7 +643,15 @@ panel_destroy (GtkWidget *widget, gpointer data)
static void
panel_applet_move(PanelWidget *panel, GtkWidget *widget, gpointer data)
{
applets_to_sync = TRUE;
AppletInfo *info;
info = g_object_get_data (G_OBJECT (widget), "applet_info");
g_return_if_fail (info);
/* FIXME: just queue a save, to make things a bit easier on
* the resources */
panel_applet_save_position (info, info->gconf_key);
}
static void
......
......@@ -264,7 +264,12 @@ panel_session_die (GnomeClient *client,
panel_applet_save_position (info, info->gconf_key);
if (info->type == APPLET_SWALLOW) {
if (info->type == APPLET_BONOBO) {
PanelAppletFrame *frame = info->data;
panel_applet_frame_set_clean_remove
(PANEL_APPLET_FRAME (frame), TRUE);
} else if (info->type == APPLET_SWALLOW) {
Swallow *swallow = info->data;
GtkSocket *socket;
......
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