From 323baedeb83c11c4640b77f4ce96b192eeb3c3f7 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 18 Dec 2004 22:16:40 +0000 Subject: Don't show multiple toolbar editors for the same window. Part of bug 2004-12-18 Christian Persch * src/window-commands.c: (toolbar_editor_destroy_cb), (window_cmd_edit_toolbar): Don't show multiple toolbar editors for the same window. Part of bug #111114. --- ChangeLog | 8 ++++++++ src/window-commands.c | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6efd46b8e..d20c473fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-12-18 Christian Persch + + * src/window-commands.c: (toolbar_editor_destroy_cb), + (window_cmd_edit_toolbar): + + Don't show multiple toolbar editors for the same window. + Part of bug #111114. + 2004-12-18 Christian Persch * embed/mozilla/ContentHandler.cpp: diff --git a/src/window-commands.c b/src/window-commands.c index 171e16263..83665c9ec 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -59,6 +59,7 @@ #include #include +#define TOOLBAR_EDITOR_KEY "EphyToolbarEditor" enum { RESPONSE_ADD_TOOLBAR @@ -794,6 +795,8 @@ toolbar_editor_destroy_cb (GtkWidget *tbe, (ephy_window_get_toolbar (window)), FALSE); egg_editable_toolbar_set_edit_mode (EGG_EDITABLE_TOOLBAR (ephy_window_get_bookmarksbar (window)), FALSE); + + g_object_set_data (G_OBJECT (window), TOOLBAR_EDITOR_KEY, NULL); } static void @@ -819,14 +822,19 @@ void window_cmd_edit_toolbar (GtkAction *action, EphyWindow *window) { - GtkWidget *editor; + GtkWidget *editor, *dialog, *toolbar; EggToolbarsModel *model; - GtkWidget *t; - GtkWidget *dialog; + + dialog = GTK_WIDGET (g_object_get_data (G_OBJECT (window), TOOLBAR_EDITOR_KEY)); + if (dialog != NULL) + { + gtk_window_present (GTK_WINDOW (dialog)); + return; + } model = EGG_TOOLBARS_MODEL (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); - t = ephy_window_get_toolbar (window); + toolbar = ephy_window_get_toolbar (window); dialog = gtk_dialog_new (); gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); @@ -863,9 +871,11 @@ window_cmd_edit_toolbar (GtkAction *action, EPHY_STATE_WINDOW_SAVE_SIZE); gtk_widget_show (dialog); - egg_editable_toolbar_set_edit_mode (EGG_EDITABLE_TOOLBAR (t), TRUE); + egg_editable_toolbar_set_edit_mode (EGG_EDITABLE_TOOLBAR (toolbar), TRUE); egg_editable_toolbar_set_edit_mode (EGG_EDITABLE_TOOLBAR (ephy_window_get_bookmarksbar (window)), TRUE); + + g_object_set_data (G_OBJECT (window), TOOLBAR_EDITOR_KEY, dialog); } void -- cgit v1.2.3