diff options
author | Anders Carlsson <andersca@src.gnome.org> | 2000-07-09 19:54:25 +0800 |
---|---|---|
committer | Anders Carlsson <andersca@src.gnome.org> | 2000-07-09 19:54:25 +0800 |
commit | af3c0ca93922eccab25da7e4b3ef6bf109c2ce80 (patch) | |
tree | c696f940f93e64382d64d0b77f267f92eaf6c421 /addressbook/gui/minicard | |
parent | abd6ce3b53f239441f5a655a362d057e16622b62 (diff) | |
download | gsoc2013-evolution-af3c0ca93922eccab25da7e4b3ef6bf109c2ce80.tar.gz gsoc2013-evolution-af3c0ca93922eccab25da7e4b3ef6bf109c2ce80.tar.zst gsoc2013-evolution-af3c0ca93922eccab25da7e4b3ef6bf109c2ce80.zip |
Several contacts list bugfixes.
svn path=/trunk/; revision=4008
Diffstat (limited to 'addressbook/gui/minicard')
-rw-r--r-- | addressbook/gui/minicard/Makefile.am | 1 | ||||
-rw-r--r-- | addressbook/gui/minicard/e-reflow.c | 23 | ||||
-rw-r--r-- | addressbook/gui/minicard/test-reflow.c | 21 |
3 files changed, 30 insertions, 15 deletions
diff --git a/addressbook/gui/minicard/Makefile.am b/addressbook/gui/minicard/Makefile.am index 0eb7946ac5..a20edc1c08 100644 --- a/addressbook/gui/minicard/Makefile.am +++ b/addressbook/gui/minicard/Makefile.am @@ -5,6 +5,7 @@ INCLUDES = \ -I$(top_builddir)/addressbook/backend \ -I$(top_srcdir)/addressbook/contact-editor \ -I$(top_srcdir)/widgets/e-text \ + -I$(top_srcdir)/widgets/misc \ $(BONOBO_GNOME_CFLAGS) noinst_LIBRARIES = \ diff --git a/addressbook/gui/minicard/e-reflow.c b/addressbook/gui/minicard/e-reflow.c index ba7bf36c4d..0e9c8b92b1 100644 --- a/addressbook/gui/minicard/e-reflow.c +++ b/addressbook/gui/minicard/e-reflow.c @@ -329,11 +329,14 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) case 1: { GdkEventButton *button = (GdkEventButton *) event; - double n_x; + double n_x, max_x; n_x = button->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { + + max_x = E_REFLOW_BORDER_WIDTH; + max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count; + if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) { e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x); e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; e_reflow->temp_column_width = e_reflow->column_width; @@ -412,11 +415,16 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) return TRUE; } else { GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x; + double n_x, max_x; + n_x = motion->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { + + max_x = E_REFLOW_BORDER_WIDTH; + max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count; + + if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) { if ( e_reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); e_reflow->default_cursor_shown = FALSE; @@ -432,11 +440,14 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) case GDK_ENTER_NOTIFY: if (!e_reflow->column_drag) { GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; + double n_x, max_x; n_x = crossing->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { + + max_x = E_REFLOW_BORDER_WIDTH; + max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count; + if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) { if ( e_reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); e_reflow->default_cursor_shown = FALSE; diff --git a/addressbook/gui/minicard/test-reflow.c b/addressbook/gui/minicard/test-reflow.c index dacaeb055c..8013c428d5 100644 --- a/addressbook/gui/minicard/test-reflow.c +++ b/addressbook/gui/minicard/test-reflow.c @@ -51,6 +51,7 @@ #include <e-util/e-canvas.h> #include "e-reflow.h" #include "e-minicard.h" +#include "e-scroll-frame.h" /* This is a horrible thing to do, but it is just a test. */ GnomeCanvasItem *reflow; @@ -76,7 +77,7 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi "width", &width, NULL); width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height ); + gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1); gnome_canvas_item_set( rect, "x2", (double) width, "y2", (double) allocation->height, @@ -90,7 +91,7 @@ static void resize(GnomeCanvas *canvas, gpointer data) "width", &width, NULL); width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width, last_alloc.height ); + gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1); gnome_canvas_item_set( rect, "x2", (double) width, "y2", (double) last_alloc.height, @@ -122,7 +123,7 @@ int main( int argc, char *argv[] ) GtkWidget *app; GtkWidget *canvas; GtkWidget *vbox; - GtkWidget *scrollbar; + GtkWidget *scrollframe; int i; /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); @@ -164,13 +165,15 @@ int main( int argc, char *argv[] ) 0, 0, 100, 100 ); - gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas))); - - gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); + scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)), + gtk_layout_get_vadjustment(GTK_LAYOUT(canvas))); + e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_NEVER); + + gtk_container_add (GTK_CONTAINER (scrollframe), canvas); - gnome_app_set_contents( GNOME_APP( app ), vbox ); + gnome_app_set_contents( GNOME_APP( app ), scrollframe ); /* Connect the signals */ gtk_signal_connect( GTK_OBJECT( app ), "destroy", |