[emerillon] Fix display bugs if the currently visible sidebar page gets removed
- From: Łukasz Jernaś <ljernas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [emerillon] Fix display bugs if the currently visible sidebar page gets removed
- Date: Tue, 4 May 2010 10:08:33 +0000 (UTC)
commit 09caedeee1620957c1965e4b0227e2a229f94af4
Author: Simon Wenner <simon wenner ch>
Date: Sun May 2 14:40:48 2010 +0200
Fix display bugs if the currently visible sidebar page gets removed
emerillon/sidebar.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/emerillon/sidebar.c b/emerillon/sidebar.c
index f3de819..e487c34 100644
--- a/emerillon/sidebar.c
+++ b/emerillon/sidebar.c
@@ -553,6 +553,7 @@ emerillon_sidebar_remove_page (EmerillonSidebar *sidebar,
GtkTreeIter iter;
GtkWidget *widget, *menu_item;
gboolean valid;
+ gboolean visible;
gint index;
g_return_if_fail (EMERILLON_IS_SIDEBAR (sidebar));
@@ -579,6 +580,9 @@ emerillon_sidebar_remove_page (EmerillonSidebar *sidebar,
if (valid)
{
+ visible = (index == gtk_notebook_get_current_page (
+ GTK_NOTEBOOK (sidebar->priv->notebook)));
+
gtk_notebook_remove_page (GTK_NOTEBOOK (sidebar->priv->notebook),
index);
@@ -587,7 +591,20 @@ emerillon_sidebar_remove_page (EmerillonSidebar *sidebar,
gtk_list_store_remove (GTK_LIST_STORE (sidebar->priv->page_model),
&iter);
- g_signal_emit (G_OBJECT (sidebar),
+ /* If we removed the visible tab, we select the first page or remove
+ * the text in the dropdown menu if no page is left */
+ if (visible)
+ {
+ if (!emerillon_sidebar_is_empty(sidebar))
+ {
+ valid = gtk_tree_model_get_iter_first (sidebar->priv->page_model, &iter);
+ emerillon_sidebar_select_page (sidebar, &iter);
+ }
+ else
+ gtk_label_set_text (GTK_LABEL (sidebar->priv->label), "");
+ }
+
+ g_signal_emit (G_OBJECT (sidebar),
signals[SIGNAL_PAGE_REMOVED], 0, main_widget);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]