[gnumeric] GUI: Improve handling of too-narrow windows.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Improve handling of too-narrow windows.
- Date: Tue, 23 Mar 2010 17:59:58 +0000 (UTC)
commit 0824ce39837f42fca3d8281647a760b7afa7504f
Author: Morten Welinder <terra gnome org>
Date: Tue Mar 23 13:59:36 2010 -0400
GUI: Improve handling of too-narrow windows.
ChangeLog | 5 +++++
NEWS | 1 +
src/wbc-gtk-impl.h | 1 +
src/wbc-gtk.c | 22 +++++++++++++++++++---
4 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c24bd77..104bdf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-03-23 Morten Welinder <terra gnome org>
+ * src/wbc-gtk.c (cb_paned_size_allocate): Improve handling of
+ too-narrow windows.
+ (cb_status_size_allocate): New function to trigger repartition
+ after window resize.
+
* src/wbc-gtk-actions.c (permanent_actions): Move FileNew,
FileOpen, and a few more actions here.
diff --git a/NEWS b/NEWS
index 78bbe1b..21133da 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Morten:
* Improve object sizing tooltip positioning a bit.
* Fix filter critical. [#611073]
* Make more menu entries available when an object is selected.
+ * Improve partitioning of status area.
--------------------------------------------------------------------------
Gnumeric 1.10.1
diff --git a/src/wbc-gtk-impl.h b/src/wbc-gtk-impl.h
index d2a8353..c745a60 100644
--- a/src/wbc-gtk-impl.h
+++ b/src/wbc-gtk-impl.h
@@ -106,6 +106,7 @@ struct _WBCGtk {
/**********************************************/
GtkWidget *status_area;
+ int status_area_width;
GtkUIManager *ui;
GtkActionGroup *permanent_actions, *actions, *font_actions;
struct {
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index de2a7b9..b7c8cf0 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -934,7 +934,7 @@ cb_paned_size_allocate (GtkHPaned *hpaned,
GtkWidget *widget = (GtkWidget *)paned;
GtkRequisition child1_requisition;
gint handle_size;
- gint p1, p2, h1, h2, w1, w2, w;
+ gint p1, p2, h1, h2, w1, w2, w, desired;
gint border_width = GTK_CONTAINER (paned)->border_width;
gboolean position_set;
GtkWidget *child1 = paned->child1;
@@ -969,8 +969,9 @@ cb_paned_size_allocate (GtkHPaned *hpaned,
gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
w = widget->allocation.width - handle_size - 2 * border_width;
- p1 = MIN (w / 3, child1->requisition.width);
- p2 = w - p1;
+ desired = MAX (0, w / 3);
+ p1 = MIN (desired, child1->requisition.width);
+ p2 = MAX (0, w - p1);
if (p1 < child1->requisition.width) {
/*
@@ -1027,6 +1028,18 @@ cb_bnotebook_button_press (GtkWidget *widget, GdkEventButton *event)
}
static void
+cb_status_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ WBCGtk *wbcg)
+{
+ GTK_WIDGET_GET_CLASS(widget)->size_allocate (widget, allocation);
+ if (allocation->width != wbcg->status_area_width) {
+ signal_paned_repartition (wbcg->tabs_paned);
+ wbcg->status_area_width = allocation->width;
+ }
+}
+
+static void
wbc_gtk_create_notebook_area (WBCGtk *wbcg)
{
wbcg->notebook_area = gtk_vbox_new (FALSE, 0);
@@ -4392,6 +4405,9 @@ wbc_gtk_create_status_area (WBCGtk *wbcg)
NULL);
wbcg->status_area = gtk_hbox_new (FALSE, 2);
+ g_signal_connect (G_OBJECT (wbcg->status_area),
+ "size-allocate", G_CALLBACK (cb_status_size_allocate),
+ wbcg);
gtk_box_pack_start (GTK_BOX (wbcg->status_area),
GTK_WIDGET (wbcg->tabs_paned),
TRUE, TRUE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]