aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog10
-rw-r--r--shell/e-shell-window.c4
-rw-r--r--shell/e-sidebar.c35
3 files changed, 43 insertions, 6 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 375b7133ee..6ae50e37fd 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,15 @@
2003-10-22 Ettore Perazzoli <ettore@ximian.com>
+ * e-sidebar.c (PADDING): Increase to 6 pixels.
+ (button_toggled_callback): Add a cast.
+ (e_sidebar_set_selection_widget): Handle the NULL widget case
+ properly.
+ (impl_remove): New, implementation for GtkContainer::remove.
+ (do_layout): Add padding between the selection_widget and the
+ button box.
+
+2003-10-22 Ettore Perazzoli <ettore@ximian.com>
+
* e-shell-window.c (struct _ComponentView): New member button_id.
(struct _EShellWindowPrivate): New member sidebar.
(component_new_new): Get a button_id arg.
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 9cf807e858..7769577a40 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -285,7 +285,7 @@ setup_widgets (EShellWindow *window)
priv->sidebar = e_sidebar_new ();
g_signal_connect (priv->sidebar, "button_selected",
G_CALLBACK (sidebar_button_selected_callback), window);
- gtk_paned_pack1 (GTK_PANED (paned), priv->sidebar, TRUE, FALSE);
+ gtk_paned_pack1 (GTK_PANED (paned), priv->sidebar, FALSE, FALSE);
priv->sidebar_notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->sidebar_notebook), FALSE);
@@ -293,7 +293,7 @@ setup_widgets (EShellWindow *window)
priv->view_notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->view_notebook), FALSE);
- gtk_paned_pack2 (GTK_PANED (paned), priv->view_notebook, FALSE, TRUE);
+ gtk_paned_pack2 (GTK_PANED (paned), priv->view_notebook, TRUE, TRUE);
gtk_paned_set_position (GTK_PANED (paned), 200);
diff --git a/shell/e-sidebar.c b/shell/e-sidebar.c
index 1f6df8c451..ce0a29325f 100644
--- a/shell/e-sidebar.c
+++ b/shell/e-sidebar.c
@@ -59,7 +59,7 @@ enum {
static unsigned int signals[NUM_SIGNALS] = { 0 };
-#define PADDING 3
+#define PADDING 6
/* Callbacks. */
@@ -79,7 +79,7 @@ button_toggled_callback (GtkToggleButton *toggle_button,
for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
Button *button = p->data;
- if (button->button_widget != toggle_button) {
+ if (button->button_widget != GTK_WIDGET (toggle_button)) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), FALSE);
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), TRUE);
@@ -201,7 +201,7 @@ do_layout (ESidebar *sidebar)
child_allocation.x = allocation->x + PADDING;
child_allocation.y = allocation->y + PADDING;
child_allocation.width = allocation->width - PADDING * 2;
- child_allocation.height = y - allocation->y;
+ child_allocation.height = y - allocation->y - PADDING;
gtk_widget_size_allocate (sidebar->priv->selection_widget, & child_allocation);
}
@@ -234,6 +234,30 @@ impl_forall (GtkContainer *container,
}
}
+static void
+impl_remove (GtkContainer *container,
+ GtkWidget *widget)
+{
+ ESidebar *sidebar = E_SIDEBAR (container);
+ GSList *p;
+
+ if (widget == sidebar->priv->selection_widget) {
+ e_sidebar_set_selection_widget (sidebar, NULL);
+ return;
+ }
+
+ for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
+ GtkWidget *button_widget = ((Button *) p->data)->button_widget;
+
+ if (button_widget == widget) {
+ gtk_widget_unparent (button_widget);
+ sidebar->priv->buttons = g_slist_remove_link (sidebar->priv->buttons, p);
+ gtk_widget_queue_resize (GTK_WIDGET (sidebar));
+ break;
+ }
+ }
+}
+
/* GtkWidget methods. */
@@ -309,6 +333,7 @@ class_init (ESidebarClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
container_class->forall = impl_forall;
+ container_class->remove = impl_remove;
widget_class->size_request = impl_size_request;
widget_class->size_allocate = impl_size_allocate;
@@ -358,7 +383,9 @@ e_sidebar_set_selection_widget (ESidebar *sidebar, GtkWidget *widget)
gtk_widget_unparent (sidebar->priv->selection_widget);
sidebar->priv->selection_widget = widget;
- gtk_widget_set_parent (widget, GTK_WIDGET (sidebar));
+
+ if (widget != NULL)
+ gtk_widget_set_parent (widget, GTK_WIDGET (sidebar));
gtk_widget_queue_resize (GTK_WIDGET (sidebar));
}