(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.

svn path=/trunk/; revision=22989
This commit is contained in:
Ettore Perazzoli
2003-10-22 17:24:38 +00:00
parent 3dbe4a3ce1
commit ec0f879ca6
3 changed files with 43 additions and 6 deletions

View File

@ -1,3 +1,13 @@
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.

View File

@ -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);

View File

@ -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));
}