From 9a61eb330ae70c247171629a7b402ce3ab4d3c00 Mon Sep 17 00:00:00 2001 From: Ramiro Estrugo Date: Sun, 1 Apr 2001 01:01:00 +0000 Subject: Restore the "dance." It was needed after all to deal with situations when * src/nautilus-sidebar.c: (toggle_sidebar_panel): Restore the "dance." It was needed after all to deal with situations when the display become out of whack with the number of running sidebar panels, for example when a panel crashes. Added a comment to this effect as well. --- ChangeLog | 8 ++++++++ src/nautilus-information-panel.c | 15 +++++++++++++-- src/nautilus-sidebar.c | 15 +++++++++++++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index af8a7efa7..ebc578ed1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-03-31 Ramiro Estrugo + + * src/nautilus-sidebar.c: (toggle_sidebar_panel): + Restore the "dance." It was needed after all to deal with + situations when the display become out of whack with the number of + running sidebar panels, for example when a panel crashes. + Added a comment to this effect as well. + 2001-03-31 Ramiro Estrugo * libnautilus-extensions/nautilus-preferences-item.c: diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index f5f61d5d7..159301b46 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -392,6 +392,7 @@ toggle_sidebar_panel (GtkWidget *widget, { NautilusSidebar *sidebar; const char *preference_key; + gboolean already_on; g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (widget)); g_return_if_fail (NAUTILUS_IS_SIDEBAR (gtk_object_get_user_data (GTK_OBJECT (widget)))); @@ -402,8 +403,18 @@ toggle_sidebar_panel (GtkWidget *widget, sidebar = NAUTILUS_SIDEBAR (gtk_object_get_user_data (GTK_OBJECT (widget))); nautilus_sidebar_hide_active_panel_if_matches (sidebar, sidebar_iid); - - nautilus_preferences_set_boolean (preference_key, GTK_CHECK_MENU_ITEM (widget)->active); + + already_on = any_panel_matches_iid (sidebar, sidebar_iid); + + /* This little dance gets the preferences code to send a + * notification even though it thinks there's "no change". + * + * This is needed to deal with situations when the display + * become out of whack with the number of running sidebar + * panels, for example when a panel crashes. + */ + nautilus_preferences_set_boolean (preference_key, already_on); + nautilus_preferences_set_boolean (preference_key, !already_on); } typedef struct diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index f5f61d5d7..159301b46 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -392,6 +392,7 @@ toggle_sidebar_panel (GtkWidget *widget, { NautilusSidebar *sidebar; const char *preference_key; + gboolean already_on; g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (widget)); g_return_if_fail (NAUTILUS_IS_SIDEBAR (gtk_object_get_user_data (GTK_OBJECT (widget)))); @@ -402,8 +403,18 @@ toggle_sidebar_panel (GtkWidget *widget, sidebar = NAUTILUS_SIDEBAR (gtk_object_get_user_data (GTK_OBJECT (widget))); nautilus_sidebar_hide_active_panel_if_matches (sidebar, sidebar_iid); - - nautilus_preferences_set_boolean (preference_key, GTK_CHECK_MENU_ITEM (widget)->active); + + already_on = any_panel_matches_iid (sidebar, sidebar_iid); + + /* This little dance gets the preferences code to send a + * notification even though it thinks there's "no change". + * + * This is needed to deal with situations when the display + * become out of whack with the number of running sidebar + * panels, for example when a panel crashes. + */ + nautilus_preferences_set_boolean (preference_key, already_on); + nautilus_preferences_set_boolean (preference_key, !already_on); } typedef struct -- cgit v1.2.1