diff options
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 8 | ||||
-rw-r--r-- | addressbook/gui/widgets/test-reflow.c | 19 |
2 files changed, 24 insertions, 3 deletions
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index bef929b36c..f656d98b40 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -141,9 +141,11 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) switch (arg_id){ case ARG_WIDTH: - e_minicard->width = GTK_VALUE_DOUBLE (*arg); - _update_card(e_minicard); - gnome_canvas_item_request_update (item); + if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { + e_minicard->width = GTK_VALUE_DOUBLE (*arg); + _update_card(e_minicard); + gnome_canvas_item_request_update (item); + } break; case ARG_HAS_FOCUS: if (e_minicard->fields) diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c index f03232c72d..067e520754 100644 --- a/addressbook/gui/widgets/test-reflow.c +++ b/addressbook/gui/widgets/test-reflow.c @@ -26,6 +26,7 @@ /* This is a horrible thing to do, but it is just a test. */ GnomeCanvasItem *reflow; GnomeCanvasItem *rect; +GtkAllocation last_alloc; static void destroy_callback(GtkWidget *app, gpointer data) { @@ -35,6 +36,7 @@ static void destroy_callback(GtkWidget *app, gpointer data) static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) { double width; + last_alloc = *allocation; gnome_canvas_item_set( reflow, "height", (double) allocation->height, NULL ); @@ -49,6 +51,20 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi NULL ); } +static void resize(GnomeCanvasItem *item, gpointer data) +{ + double width; + gtk_object_get(GTK_OBJECT(reflow), + "width", &width, + NULL); + width = MAX(width, last_alloc.width); + gnome_canvas_set_scroll_region(item->canvas , 0, 0, width, last_alloc.height ); + gnome_canvas_item_set( rect, + "x2", (double) width, + "y2", (double) last_alloc.height, + NULL ); +} + static void about_callback( GtkWidget *widget, gpointer data ) { @@ -98,6 +114,9 @@ int main( int argc, char *argv[] ) "y", (double) 0, "height", (double) 100, NULL ); + gtk_signal_connect( GTK_OBJECT( reflow ), "resize", + GTK_SIGNAL_FUNC( resize ), + ( gpointer ) app); for ( i = 0; i < 200; i++ ) { GnomeCanvasItem *item; |