[gnumeric] Fixed notebook scrolling and about box.



commit fe1a8d6c50cf33557521670b8f7253e3345d7a42
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Aug 4 10:18:40 2011 +0200

    Fixed notebook scrolling and about box.

 src/dialogs/ChangeLog       |    6 ++++++
 src/dialogs/cell-comment.ui |    5 +++--
 src/dialogs/dialog-about.c  |   19 ++++++++++---------
 src/widgets/ChangeLog       |    4 ++++
 src/widgets/gnm-notebook.c  |    3 ++-
 5 files changed, 25 insertions(+), 12 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 3c421f8..2e203c8 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-04  Jean Brefort  <jean brefort normalesup org>
+
+	* cell-comment.ui: cleaned Gtk[H,V]Boxes.
+	* dialog-about.c (text_item_renderer), (about_dialog_anim_draw),
+	(dialog_about): reimplement.
+
 2011-08-03 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* cell-comment.ui: fix expansion of author fields
diff --git a/src/dialogs/cell-comment.ui b/src/dialogs/cell-comment.ui
index 8b3743a..217794d 100644
--- a/src/dialogs/cell-comment.ui
+++ b/src/dialogs/cell-comment.ui
@@ -10,12 +10,13 @@
     <property name="default_height">300</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox">
+      <object class="GtkBox" id="dialog-vbox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area1">
+          <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
diff --git a/src/dialogs/dialog-about.c b/src/dialogs/dialog-about.c
index 6eaa271..d9d47c9 100644
--- a/src/dialogs/dialog-about.c
+++ b/src/dialogs/dialog-about.c
@@ -180,6 +180,7 @@ struct AboutRenderer_ {
 		double rate;
 		int count;
 	} expansion;
+	cairo_t *cr;
 };
 
 struct AboutState_ {
@@ -237,7 +238,6 @@ text_item_renderer (AboutRenderer *r, AboutState *state)
 	int age = state->now - r->start_time;
 	double rage = CLAMP (age / (double)r->duration, 0.0, 1.0);
 	GtkWidget *widget = state->anim_area;
-	GdkWindow *window = gtk_widget_get_window (widget);
 	GtkStyleContext *ctxt;
 	const int fade = 500;
 	int x, y, width, height;
@@ -292,12 +292,11 @@ text_item_renderer (AboutRenderer *r, AboutState *state)
 	x -= width / 2;
 	y -= height / 2;
 
-	cr = gdk_cairo_create (window);
+	cr = r->cr;
 	gtk_style_context_get_color (ctxt, GTK_STATE_NORMAL, &color);
 	gdk_cairo_set_source_rgba (cr, &color);
 	cairo_move_to (cr, x / (double)PANGO_SCALE, y / (double)PANGO_SCALE);
 	pango_cairo_show_layout (cr, layout);
-	cairo_destroy (cr);
 
 	return TRUE;
 }
@@ -418,8 +417,8 @@ about_dialog_timer (gpointer state_)
 }
 
 static gboolean
-about_dialog_anim_expose (GtkWidget *widget,
-                          GdkEventExpose *event,
+about_dialog_anim_draw (GtkWidget *widget,
+                          cairo_t *cr,
                           AboutState *state)
 {
 	GList *l;
@@ -428,7 +427,9 @@ about_dialog_anim_expose (GtkWidget *widget,
 	while (l) {
 		GList *next = l->next;
 		AboutRenderer *r = l->data;
-		gboolean keep = r->renderer (r, state);
+		gboolean keep;
+		r->cr = cr;
+		keep = r->renderer (r, state);
 		if (!keep) {
 			free_renderer (r);
 			state->active = g_list_remove_link (state->active, l);
@@ -581,7 +582,7 @@ dialog_about (WBCGtk *wbcg)
 	c = gtk_dialog_get_content_area (GTK_DIALOG (w));
 	children = gtk_container_get_children (GTK_CONTAINER (c));
 
-	if (children && GTK_IS_VBOX (children->data)) {
+	if (children && GTK_IS_BOX (children->data)) {
 		GtkWidget *vbox = children->data;
 		int height;
 		PangoLayout *layout;
@@ -592,8 +593,8 @@ dialog_about (WBCGtk *wbcg)
 		gtk_widget_set_size_request (state->anim_area, -1, 4 * height);
 		g_object_unref (layout);
 
-		g_signal_connect (state->anim_area, "expose-event",
-				  G_CALLBACK (about_dialog_anim_expose),
+		g_signal_connect (state->anim_area, "draw",
+				  G_CALLBACK (about_dialog_anim_draw),
 				  state);
 
 		gtk_box_pack_end (GTK_BOX (vbox), state->anim_area, TRUE, TRUE, 0);
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index ea8b56e..075c82c 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-04  Jean Brefort  <jean brefort normalesup org>
+
+	* gnm-notebook.c (gnm_notebook_init): make it scrollable.
+
 2011-08-02  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* widget-editable-label.c (el_button_press_event): enable most
diff --git a/src/widgets/gnm-notebook.c b/src/widgets/gnm-notebook.c
index 24f6231..bcee6d8 100644
--- a/src/widgets/gnm-notebook.c
+++ b/src/widgets/gnm-notebook.c
@@ -77,8 +77,9 @@ gnm_notebook_class_init (GtkWidgetClass *klass)
 }
 
 static void
-gnm_notebook_init (G_GNUC_UNUSED GnmNotebook *notebook)
+gnm_notebook_init (GnmNotebook *notebook)
 {
+	gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
 }
 
 GSF_CLASS (GnmNotebook, gnm_notebook,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]