summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-horizontal-splitter.c
diff options
context:
space:
mode:
authorMichael Meeks <michael@ximian.com>2002-03-07 14:02:19 +0000
committerMichael Meeks <michael@src.gnome.org>2002-03-07 14:02:19 +0000
commit6b5798037c6df519b12adb45ff919ea796856034 (patch)
tree80fa3f1edf7c6e5a22f48895b8c3fc3551a2ef8e /libnautilus-private/nautilus-horizontal-splitter.c
parent933e88806a23090131e3e58f67df515faba8e3fd (diff)
downloadnautilus-6b5798037c6df519b12adb45ff919ea796856034.tar.gz
impl. to cope with having a paned with no child2, without doing lots of
2002-03-07 Michael Meeks <michael@ximian.com> * libnautilus-private/nautilus-horizontal-splitter.c (nautilus_horizontal_splitter_size_allocate): impl. to cope with having a paned with no child2, without doing lots of bogus size re-allocation. (nautilus_horizontal_splitter_class_init): upd. (nautilus_horizontal_splitter_pack2): impl, since gtkpaned relies on the re-size to generate an expose to re-render it's splitter grabber thing.a * src/nautilus-sidebar.c (nautilus_sidebar_set_width): impl. moving all sidebar preferences here, (nautilus_sidebar_init): move auto value setup here from class_init to save possible re-enterancy issue. Request the size we want for the sidebar, the pane will under-allocate if neccessary. Set the old_width to the correct size so we don't re-render the paned lots as it swiches about. * src/nautilus-window.c (nautilus_window_constructed): reflow to simplify, call sidebar_set_width. (nautilus_window_set_content_view_widget): use nautilus_..._pack2 instead of gtk_paned to fix rendering. 2002-03-06 Michael Meeks <michael@ximian.com> * components/notes/nautilus-notes.c (make_notes_view): upd. * components/news/nautilus-news.c (rss_read_done_callback): parse the RTF, but don't spew warnings everywhere. (make_news_view): upd. * components/throbber/main.c (cb_create_throbber): impl. (throbber_object_destroyed, throbber_make_object): axe cut & paste. * libnautilus/nautilus-view-standard-main.c (nautilus_view_create_from_get_type_function): widen from NautilusView to BonoboObject, this code has a much wider application. (make_object): ditto. * components/hardware/nautilus-hardware-view.c (nautilus_hardware_view_get_nautilus_view): upd. * components/throbber/nautilus-throbber.c (nautilus_throbber_new): kill. * libnautilus/nautilus-view-standard-main.c (nautilus_view_standard_main_multi): use gdk_get_display. * libnautilus-private/nautilus-bonobo-extensions.c (nautilus_bonobo_activation_register_for_display): impl. * src/nautilus-application.c (nautilus_application_startup): use it. * src/nautilus-window-toolbars.c (location_change_at_idle_callback), (throbber_callback): move from nautilus-window.c (nautilus_window_allow_stop): move this here, prune redundant sets, simplify property bag extraction. * src/nautilus-window.c (nautilus_window_constructed): move throbber location changed code out of here. (nautilus_window_unrealize): no explicit removal from remote property bag neccessary & upd. * libnautilus-private/nautilus-metafile-factory.c (corba_open): reduce complexity.
Diffstat (limited to 'libnautilus-private/nautilus-horizontal-splitter.c')
-rw-r--r--libnautilus-private/nautilus-horizontal-splitter.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-horizontal-splitter.c b/libnautilus-private/nautilus-horizontal-splitter.c
index 682f57fa2..158f2edc3 100644
--- a/libnautilus-private/nautilus-horizontal-splitter.c
+++ b/libnautilus-private/nautilus-horizontal-splitter.c
@@ -225,6 +225,47 @@ nautilus_horizontal_splitter_button_release (GtkWidget *widget, GdkEventButton *
}
static void
+nautilus_horizontal_splitter_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ gint border_width;
+ GtkPaned *paned;
+ GtkAllocation child_allocation;
+ GtkRequisition child_requisition;
+
+ paned = GTK_PANED (widget);
+ border_width = GTK_CONTAINER (paned)->border_width;
+
+ widget->allocation = *allocation;
+
+ if (paned->child2 != NULL && GTK_WIDGET_VISIBLE (paned->child2)) {
+ EEL_CALL_PARENT (GTK_WIDGET_CLASS, size_allocate,
+ (widget, allocation));
+ } else if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1)) {
+
+ if (GTK_WIDGET_REALIZED (widget)) {
+ gdk_window_hide (paned->handle);
+ }
+
+ gtk_widget_get_child_requisition (paned->child1,
+ &child_requisition);
+
+ child_allocation.x = widget->allocation.x + border_width;
+ child_allocation.y = widget->allocation.y + border_width;
+ child_allocation.width = MIN (child_requisition.width,
+ allocation->width - 2 * border_width);
+ child_allocation.height = MIN (child_requisition.height,
+ allocation->height - 2 * border_width);
+
+ gtk_widget_size_allocate (paned->child1, &child_allocation);
+ } else
+ if (GTK_WIDGET_REALIZED (widget)) {
+ gdk_window_hide (paned->handle);
+ }
+
+}
+
+static void
nautilus_horizontal_splitter_class_init (NautilusHorizontalSplitterClass *class)
{
GtkWidgetClass *widget_class;
@@ -233,6 +274,43 @@ nautilus_horizontal_splitter_class_init (NautilusHorizontalSplitterClass *class)
G_OBJECT_CLASS (class)->finalize = nautilus_horizontal_splitter_finalize;
+ widget_class->size_allocate = nautilus_horizontal_splitter_size_allocate;
widget_class->button_press_event = nautilus_horizontal_splitter_button_press;
widget_class->button_release_event = nautilus_horizontal_splitter_button_release;
}
+
+void
+nautilus_horizontal_splitter_pack2 (NautilusHorizontalSplitter *splitter,
+ GtkWidget *child2)
+{
+ gboolean re_expose;
+ GtkPaned *paned;
+
+ g_return_if_fail (GTK_IS_WIDGET (child2));
+ g_return_if_fail (NAUTILUS_IS_HORIZONTAL_SPLITTER (splitter));
+
+ paned = GTK_PANED (splitter);
+
+ re_expose = (paned->child2 == NULL ||
+ !GTK_WIDGET_VISIBLE (paned->child2));
+
+ gtk_paned_pack2 (paned, child2, TRUE, TRUE);
+
+
+ if (re_expose) {
+ /* We have to expose the divider, since the pane relies
+ * on a resize when you add the 2nd item to get it's
+ * rendering right */
+
+ /* this calculates the handle positon correctly */
+ gtk_widget_size_allocate (GTK_WIDGET (splitter),
+ &GTK_WIDGET (splitter)->allocation);
+
+ /* and this renders it */
+ gtk_widget_queue_draw_area (GTK_WIDGET (splitter),
+ paned->handle_pos.x,
+ paned->handle_pos.y,
+ paned->handle_pos.width,
+ paned->handle_pos.height);
+ }
+}