diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-31 01:06:11 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-31 01:06:11 +0800 |
commit | 936611683a969d2a93bde1c41d048881e860edea (patch) | |
tree | 4d30ce4db8310ffc3fd0dfbbd6c92405b0856aa6 | |
parent | 016b2a545c3b3f79132f0b2fb333fbf830203eb5 (diff) | |
download | gsoc2013-evolution-936611683a969d2a93bde1c41d048881e860edea.tar gsoc2013-evolution-936611683a969d2a93bde1c41d048881e860edea.tar.gz gsoc2013-evolution-936611683a969d2a93bde1c41d048881e860edea.tar.bz2 gsoc2013-evolution-936611683a969d2a93bde1c41d048881e860edea.tar.lz gsoc2013-evolution-936611683a969d2a93bde1c41d048881e860edea.tar.xz gsoc2013-evolution-936611683a969d2a93bde1c41d048881e860edea.tar.zst gsoc2013-evolution-936611683a969d2a93bde1c41d048881e860edea.zip |
Added alphabet.glade and alphabet.glade.h.
2000-05-30 Christopher James Lahey <clahey@helixcode.com>
* gui/component/Makefile.am: Added alphabet.glade and
alphabet.glade.h.
* gui/component/addressbook.c, gui/component/alphabet.glade,
gui/component/alphabet.glade.h: Added an alphabet bar.
* gui/minicard/e-minicard-view.c, gui/minicard/e-minicard-view.h,
gui/minicard/e-reflow-sorted.c, gui/minicard/e-reflow-sorted.h:
Added the ability to just to a particular spot in the reflow.
svn path=/trunk/; revision=3283
-rw-r--r-- | addressbook/ChangeLog | 12 | ||||
-rw-r--r-- | addressbook/gui/component/Makefile.am | 5 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 89 | ||||
-rw-r--r-- | addressbook/gui/component/alphabet.glade | 382 | ||||
-rw-r--r-- | addressbook/gui/component/alphabet.glade.h | 34 | ||||
-rw-r--r-- | addressbook/gui/minicard/e-minicard-view.c | 30 | ||||
-rw-r--r-- | addressbook/gui/minicard/e-minicard-view.h | 2 | ||||
-rw-r--r-- | addressbook/gui/minicard/e-reflow-sorted.c | 33 | ||||
-rw-r--r-- | addressbook/gui/minicard/e-reflow-sorted.h | 1 | ||||
-rw-r--r-- | addressbook/gui/widgets/alphabet.glade | 382 | ||||
-rw-r--r-- | addressbook/gui/widgets/alphabet.glade.h | 34 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard-view.c | 30 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard-view.h | 2 | ||||
-rw-r--r-- | widgets/e-reflow/e-reflow-sorted.c | 33 | ||||
-rw-r--r-- | widgets/e-reflow/e-reflow-sorted.h | 1 |
15 files changed, 1057 insertions, 13 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index a793e505c1..4583ad3b0e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,17 @@ 2000-05-30 Christopher James Lahey <clahey@helixcode.com> + * gui/component/Makefile.am: Added alphabet.glade and + alphabet.glade.h. + + * gui/component/addressbook.c, gui/component/alphabet.glade, + gui/component/alphabet.glade.h: Added an alphabet bar. + + * gui/minicard/e-minicard-view.c, gui/minicard/e-minicard-view.h, + gui/minicard/e-reflow-sorted.c, gui/minicard/e-reflow-sorted.h: + Added the ability to just to a particular spot in the reflow. + +2000-05-30 Christopher James Lahey <clahey@helixcode.com> + * printing/Makefile.am: Added BONOBO_GNOME_CFLAGS to CPPFLAGS. 2000-05-30 Christopher James Lahey <clahey@helixcode.com> diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index 0958528daf..370265e019 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -69,12 +69,13 @@ gnorba_DATA = addressbook.gnorba endif gladedir = $(datadir)/evolution/glade -glade_DATA = ldap-server-dialog.glade ldap-server-dialog.glade.h +glade_DATA = ldap-server-dialog.glade ldap-server-dialog.glade.h alphabet.glade EXTRA_DIST = \ $(glade_DATA) \ addressbook.gnorba \ - addressbook.oafinfo + addressbook.oafinfo \ + alphabet.glade.h if ENABLE_PURIFY PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index dab940d088..a128648d76 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -50,7 +50,7 @@ typedef struct { AddressbookViewType view_type; EBook *book; GtkWidget *vbox; - GtkWidget *minicard_vbox; + GtkWidget *minicard_hbox; GtkWidget *canvas; GnomeCanvasItem *view; GnomeCanvasItem *rect; @@ -639,23 +639,84 @@ teardown_minicard_view (AddressbookView *view) gtk_object_destroy(GTK_OBJECT(view->view)); view->view = NULL; } - if (view->minicard_vbox) { - gtk_widget_destroy(view->minicard_vbox); - view->minicard_vbox = NULL; + if (view->minicard_hbox) { + gtk_widget_destroy(view->minicard_hbox); + view->minicard_hbox = NULL; } view->canvas = NULL; } +typedef struct { + AddressbookView *view; + char letter; +} LetterClosure; + +static void +jump_to_letter(GtkWidget *button, LetterClosure *closure) +{ + if (closure->view->view) + e_minicard_view_jump_to_letter(E_MINICARD_VIEW(closure->view->view), closure->letter); +} + +static void +free_closure(GtkWidget *button, LetterClosure *closure) +{ + g_free(closure); +} + +static void +connect_button (AddressbookView *view, GladeXML *gui, char letter) +{ + char *name; + GtkWidget *button; + LetterClosure *closure; + name = g_strdup_printf("button-%c", letter); + button = glade_xml_get_widget(gui, name); + g_free(name); + if (!button) + return; + closure = g_new(LetterClosure, 1); + closure->view = view; + closure->letter = letter; + gtk_signal_connect(GTK_OBJECT(button), "clicked", + GTK_SIGNAL_FUNC(jump_to_letter), closure); + gtk_signal_connect(GTK_OBJECT(button), "destroy", + GTK_SIGNAL_FUNC(free_closure), closure); +} + +static GtkWidget * +create_alphabet (AddressbookView *view) +{ + GtkWidget *widget; + char letter; + GladeXML *gui = glade_xml_new (EVOLUTION_GLADEDIR "/alphabet.glade", NULL); + + widget = glade_xml_get_widget(gui, "scrolledwindow-top"); + if (!widget) { + return NULL; + } + + connect_button(view, gui, '1'); + for (letter = 'a'; letter <= 'z'; letter ++) { + connect_button(view, gui, letter); + } + return widget; +} + static void create_minicard_view (AddressbookView *view, char *initial_query) { GtkWidget *scrollbar; + GtkWidget *vbox; + GtkWidget *alphabet; gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - view->minicard_vbox = gtk_vbox_new(FALSE, 0); + view->minicard_hbox = gtk_hbox_new(FALSE, 0); + + vbox = gtk_vbox_new(FALSE, 0); view->canvas = e_canvas_new(); view->rect = gnome_canvas_item_new( @@ -683,16 +744,26 @@ create_minicard_view (AddressbookView *view, char *initial_query) 0, 0, 100, 100 ); - gtk_box_pack_start(GTK_BOX(view->minicard_vbox), view->canvas, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), view->canvas, TRUE, TRUE, 0); scrollbar = gtk_hscrollbar_new( gtk_layout_get_hadjustment(GTK_LAYOUT(view->canvas))); - gtk_box_pack_start(GTK_BOX(view->minicard_vbox), scrollbar, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(view->minicard_hbox), vbox, TRUE, TRUE, 0); + + alphabet = create_alphabet(view); + if (alphabet) { + gtk_object_ref(GTK_OBJECT(alphabet)); + gtk_widget_unparent(alphabet); + gtk_box_pack_start(GTK_BOX(view->minicard_hbox), alphabet, FALSE, FALSE, 0); + gtk_object_unref(GTK_OBJECT(alphabet)); + } - gtk_box_pack_start(GTK_BOX(view->vbox), view->minicard_vbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(view->vbox), view->minicard_hbox, TRUE, TRUE, 0); - gtk_widget_show_all( GTK_WIDGET(view->minicard_vbox) ); + gtk_widget_show_all( GTK_WIDGET(view->minicard_hbox) ); /* Connect the signals */ gtk_signal_connect( GTK_OBJECT( view->canvas ), "size_allocate", diff --git a/addressbook/gui/component/alphabet.glade b/addressbook/gui/component/alphabet.glade new file mode 100644 index 0000000000..a2c61d4a47 --- /dev/null +++ b/addressbook/gui/component/alphabet.glade @@ -0,0 +1,382 @@ +<?xml version="1.0"?> +<GTK-Interface> + +<project> + <name>alphabet</name> + <program_name>alphabet</program_name> + <directory></directory> + <source_directory>src</source_directory> + <pixmaps_directory>pixmaps</pixmaps_directory> + <language>C</language> + <gnome_support>True</gnome_support> + <gettext_support>True</gettext_support> + <use_widget_names>True</use_widget_names> + <output_main_file>False</output_main_file> + <output_support_files>False</output_support_files> + <output_build_files>False</output_build_files> + <gnome_help_support>True</gnome_help_support> + <output_translatable_strings>True</output_translatable_strings> + <translatable_strings_file>alphabet.glade.h</translatable_strings_file> +</project> + +<widget> + <class>GtkWindow</class> + <name>window2</name> + <visible>False</visible> + <title>window2</title> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_NONE</position> + <modal>False</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>False</auto_shrink> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow-top</name> + <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + + <widget> + <class>GtkViewport</class> + <name>viewport1</name> + <shadow_type>GTK_SHADOW_NONE</shadow_type> + + <widget> + <class>GtkVBox</class> + <name>vbox2</name> + <width>27</width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkButton</class> + <name>button-1</name> + <can_focus>True</can_focus> + <label>123</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-a</name> + <can_focus>True</can_focus> + <label>a</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-b</name> + <can_focus>True</can_focus> + <label>b</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-c</name> + <can_focus>True</can_focus> + <label>c</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-d</name> + <can_focus>True</can_focus> + <label>d</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-e</name> + <can_focus>True</can_focus> + <label>e</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-f</name> + <can_focus>True</can_focus> + <label>f</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-g</name> + <can_focus>True</can_focus> + <label>g</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-h</name> + <can_focus>True</can_focus> + <label>h</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-i</name> + <can_focus>True</can_focus> + <label>i</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-j</name> + <can_focus>True</can_focus> + <label>j</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-k</name> + <can_focus>True</can_focus> + <label>k</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-l</name> + <can_focus>True</can_focus> + <label>l</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-m</name> + <can_focus>True</can_focus> + <label>m</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-n</name> + <can_focus>True</can_focus> + <label>n</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-o</name> + <can_focus>True</can_focus> + <label>o</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-p</name> + <can_focus>True</can_focus> + <label>p</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-q</name> + <can_focus>True</can_focus> + <label>q</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-r</name> + <can_focus>True</can_focus> + <label>r</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-s</name> + <can_focus>True</can_focus> + <label>s</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-t</name> + <can_focus>True</can_focus> + <label>t</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-u</name> + <can_focus>True</can_focus> + <label>u</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-v</name> + <can_focus>True</can_focus> + <label>v</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-w</name> + <can_focus>True</can_focus> + <label>w</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-x</name> + <can_focus>True</can_focus> + <label>x</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-y</name> + <can_focus>True</can_focus> + <label>y</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-z</name> + <can_focus>True</can_focus> + <label>z</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + </widget> + </widget> +</widget> + +</GTK-Interface> diff --git a/addressbook/gui/component/alphabet.glade.h b/addressbook/gui/component/alphabet.glade.h new file mode 100644 index 0000000000..2448eeb4fc --- /dev/null +++ b/addressbook/gui/component/alphabet.glade.h @@ -0,0 +1,34 @@ +/* + * Translatable strings file generated by Glade. + * Add this file to your project's POTFILES.in. + * DO NOT compile it as part of your application. + */ + +gchar *s = N_("window2"); +gchar *s = N_("123"); +gchar *s = N_("a"); +gchar *s = N_("b"); +gchar *s = N_("c"); +gchar *s = N_("d"); +gchar *s = N_("e"); +gchar *s = N_("f"); +gchar *s = N_("g"); +gchar *s = N_("h"); +gchar *s = N_("i"); +gchar *s = N_("j"); +gchar *s = N_("k"); +gchar *s = N_("l"); +gchar *s = N_("m"); +gchar *s = N_("n"); +gchar *s = N_("o"); +gchar *s = N_("p"); +gchar *s = N_("q"); +gchar *s = N_("r"); +gchar *s = N_("s"); +gchar *s = N_("t"); +gchar *s = N_("u"); +gchar *s = N_("v"); +gchar *s = N_("w"); +gchar *s = N_("x"); +gchar *s = N_("y"); +gchar *s = N_("z"); diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c index d3acb1ad54..bc2e22fa32 100644 --- a/addressbook/gui/minicard/e-minicard-view.c +++ b/addressbook/gui/minicard/e-minicard-view.c @@ -107,7 +107,7 @@ e_minicard_view_init (EMinicardView *view) view->canvas_destroy_id = 0; gtk_object_set(GTK_OBJECT(view), - "empty_message", _("There are no items to show in this view\n\n" + "empty_message", _("\n\nThere are no items to show in this view\n\n" "Double-click here to create a new Contact."), NULL); @@ -380,3 +380,31 @@ e_minicard_view_remove_selection(EMinicardView *view, } } } + +static int +compare_to_letter(EMinicard *card, char *letter) +{ + g_return_val_if_fail(card != NULL, 0); + g_return_val_if_fail(E_IS_MINICARD(card), 0); + + if (card->card) { + char *file_as; + gtk_object_get(GTK_OBJECT(card->card), + "file_as", &file_as, + NULL); + if (file_as) + return strncasecmp(file_as, letter, 1); + else + return 0; + } else { + return 0; + } +} + +void e_minicard_view_jump_to_letter (EMinicardView *view, + char letter) +{ + e_reflow_sorted_jump(E_REFLOW_SORTED(view), + (GCompareFunc) compare_to_letter, + &letter); +} diff --git a/addressbook/gui/minicard/e-minicard-view.h b/addressbook/gui/minicard/e-minicard-view.h index 780b0dde33..a166a6ade1 100644 --- a/addressbook/gui/minicard/e-minicard-view.h +++ b/addressbook/gui/minicard/e-minicard-view.h @@ -84,6 +84,8 @@ GtkType e_minicard_view_get_type (void); void e_minicard_view_remove_selection (EMinicardView *view, EBookCallback cb, gpointer closure); +void e_minicard_view_jump_to_letter (EMinicardView *view, + char letter); #ifdef __cplusplus } diff --git a/addressbook/gui/minicard/e-reflow-sorted.c b/addressbook/gui/minicard/e-reflow-sorted.c index 7205785c6c..c899ccb9a7 100644 --- a/addressbook/gui/minicard/e-reflow-sorted.c +++ b/addressbook/gui/minicard/e-reflow-sorted.c @@ -34,6 +34,10 @@ static void e_reflow_sorted_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); static void e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); static void e_reflow_sorted_add_item(EReflow *e_reflow, GnomeCanvasItem *item); +#define E_REFLOW_DIVIDER_WIDTH 2 +#define E_REFLOW_BORDER_WIDTH 7 +#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) + static EReflowClass *parent_class = NULL; /* The arguments we take */ @@ -234,3 +238,32 @@ e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item) } e_reflow_post_add_item(reflow, item); } + +void e_reflow_sorted_jump (EReflowSorted *sorted, + GCompareFunc compare_func, + void *value) +{ + int columns = 0; + EReflow *reflow = E_REFLOW(sorted); + GList *list; + + for (list = reflow->columns; list; list = g_list_next(list)) { + if (compare_func(((GList *)list->data)->data, value) >= 0) { + GList *last = list->prev; + GtkAdjustment *adjustment; + if (last) { + GList *walk; + for (walk = last->data; walk != list->data; walk = g_list_next(walk)) { + if (compare_func(walk->data, value) >= 0) { + columns --; + break; + } + } + } + adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(sorted)->canvas)); + gtk_adjustment_set_value(adjustment, (reflow->column_width + E_REFLOW_FULL_GUTTER) * columns); + return; + } + columns ++; + } +} diff --git a/addressbook/gui/minicard/e-reflow-sorted.h b/addressbook/gui/minicard/e-reflow-sorted.h index d9b4acc747..7adfa2c045 100644 --- a/addressbook/gui/minicard/e-reflow-sorted.h +++ b/addressbook/gui/minicard/e-reflow-sorted.h @@ -81,6 +81,7 @@ void e_reflow_sorted_replace_item (EReflowSorted *sorted, GnomeCanvasI void e_reflow_sorted_reorder_item (EReflowSorted *e_reflow_sorted, const gchar *id); GnomeCanvasItem *e_reflow_sorted_get_item (EReflowSorted *e_reflow_sorted, const gchar *id); GtkType e_reflow_sorted_get_type (void); +void e_reflow_sorted_jump (EReflowSorted *sorted, GCompareFunc compare_func, void *value); #ifdef __cplusplus } diff --git a/addressbook/gui/widgets/alphabet.glade b/addressbook/gui/widgets/alphabet.glade new file mode 100644 index 0000000000..a2c61d4a47 --- /dev/null +++ b/addressbook/gui/widgets/alphabet.glade @@ -0,0 +1,382 @@ +<?xml version="1.0"?> +<GTK-Interface> + +<project> + <name>alphabet</name> + <program_name>alphabet</program_name> + <directory></directory> + <source_directory>src</source_directory> + <pixmaps_directory>pixmaps</pixmaps_directory> + <language>C</language> + <gnome_support>True</gnome_support> + <gettext_support>True</gettext_support> + <use_widget_names>True</use_widget_names> + <output_main_file>False</output_main_file> + <output_support_files>False</output_support_files> + <output_build_files>False</output_build_files> + <gnome_help_support>True</gnome_help_support> + <output_translatable_strings>True</output_translatable_strings> + <translatable_strings_file>alphabet.glade.h</translatable_strings_file> +</project> + +<widget> + <class>GtkWindow</class> + <name>window2</name> + <visible>False</visible> + <title>window2</title> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_NONE</position> + <modal>False</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>False</auto_shrink> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow-top</name> + <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + + <widget> + <class>GtkViewport</class> + <name>viewport1</name> + <shadow_type>GTK_SHADOW_NONE</shadow_type> + + <widget> + <class>GtkVBox</class> + <name>vbox2</name> + <width>27</width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkButton</class> + <name>button-1</name> + <can_focus>True</can_focus> + <label>123</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-a</name> + <can_focus>True</can_focus> + <label>a</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-b</name> + <can_focus>True</can_focus> + <label>b</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-c</name> + <can_focus>True</can_focus> + <label>c</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-d</name> + <can_focus>True</can_focus> + <label>d</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-e</name> + <can_focus>True</can_focus> + <label>e</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-f</name> + <can_focus>True</can_focus> + <label>f</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-g</name> + <can_focus>True</can_focus> + <label>g</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-h</name> + <can_focus>True</can_focus> + <label>h</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-i</name> + <can_focus>True</can_focus> + <label>i</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-j</name> + <can_focus>True</can_focus> + <label>j</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-k</name> + <can_focus>True</can_focus> + <label>k</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-l</name> + <can_focus>True</can_focus> + <label>l</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-m</name> + <can_focus>True</can_focus> + <label>m</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-n</name> + <can_focus>True</can_focus> + <label>n</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-o</name> + <can_focus>True</can_focus> + <label>o</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-p</name> + <can_focus>True</can_focus> + <label>p</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-q</name> + <can_focus>True</can_focus> + <label>q</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-r</name> + <can_focus>True</can_focus> + <label>r</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-s</name> + <can_focus>True</can_focus> + <label>s</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-t</name> + <can_focus>True</can_focus> + <label>t</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-u</name> + <can_focus>True</can_focus> + <label>u</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-v</name> + <can_focus>True</can_focus> + <label>v</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-w</name> + <can_focus>True</can_focus> + <label>w</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-x</name> + <can_focus>True</can_focus> + <label>x</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-y</name> + <can_focus>True</can_focus> + <label>y</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button-z</name> + <can_focus>True</can_focus> + <label>z</label> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + </widget> + </widget> +</widget> + +</GTK-Interface> diff --git a/addressbook/gui/widgets/alphabet.glade.h b/addressbook/gui/widgets/alphabet.glade.h new file mode 100644 index 0000000000..2448eeb4fc --- /dev/null +++ b/addressbook/gui/widgets/alphabet.glade.h @@ -0,0 +1,34 @@ +/* + * Translatable strings file generated by Glade. + * Add this file to your project's POTFILES.in. + * DO NOT compile it as part of your application. + */ + +gchar *s = N_("window2"); +gchar *s = N_("123"); +gchar *s = N_("a"); +gchar *s = N_("b"); +gchar *s = N_("c"); +gchar *s = N_("d"); +gchar *s = N_("e"); +gchar *s = N_("f"); +gchar *s = N_("g"); +gchar *s = N_("h"); +gchar *s = N_("i"); +gchar *s = N_("j"); +gchar *s = N_("k"); +gchar *s = N_("l"); +gchar *s = N_("m"); +gchar *s = N_("n"); +gchar *s = N_("o"); +gchar *s = N_("p"); +gchar *s = N_("q"); +gchar *s = N_("r"); +gchar *s = N_("s"); +gchar *s = N_("t"); +gchar *s = N_("u"); +gchar *s = N_("v"); +gchar *s = N_("w"); +gchar *s = N_("x"); +gchar *s = N_("y"); +gchar *s = N_("z"); diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index d3acb1ad54..bc2e22fa32 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -107,7 +107,7 @@ e_minicard_view_init (EMinicardView *view) view->canvas_destroy_id = 0; gtk_object_set(GTK_OBJECT(view), - "empty_message", _("There are no items to show in this view\n\n" + "empty_message", _("\n\nThere are no items to show in this view\n\n" "Double-click here to create a new Contact."), NULL); @@ -380,3 +380,31 @@ e_minicard_view_remove_selection(EMinicardView *view, } } } + +static int +compare_to_letter(EMinicard *card, char *letter) +{ + g_return_val_if_fail(card != NULL, 0); + g_return_val_if_fail(E_IS_MINICARD(card), 0); + + if (card->card) { + char *file_as; + gtk_object_get(GTK_OBJECT(card->card), + "file_as", &file_as, + NULL); + if (file_as) + return strncasecmp(file_as, letter, 1); + else + return 0; + } else { + return 0; + } +} + +void e_minicard_view_jump_to_letter (EMinicardView *view, + char letter) +{ + e_reflow_sorted_jump(E_REFLOW_SORTED(view), + (GCompareFunc) compare_to_letter, + &letter); +} diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h index 780b0dde33..a166a6ade1 100644 --- a/addressbook/gui/widgets/e-minicard-view.h +++ b/addressbook/gui/widgets/e-minicard-view.h @@ -84,6 +84,8 @@ GtkType e_minicard_view_get_type (void); void e_minicard_view_remove_selection (EMinicardView *view, EBookCallback cb, gpointer closure); +void e_minicard_view_jump_to_letter (EMinicardView *view, + char letter); #ifdef __cplusplus } diff --git a/widgets/e-reflow/e-reflow-sorted.c b/widgets/e-reflow/e-reflow-sorted.c index 7205785c6c..c899ccb9a7 100644 --- a/widgets/e-reflow/e-reflow-sorted.c +++ b/widgets/e-reflow/e-reflow-sorted.c @@ -34,6 +34,10 @@ static void e_reflow_sorted_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); static void e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); static void e_reflow_sorted_add_item(EReflow *e_reflow, GnomeCanvasItem *item); +#define E_REFLOW_DIVIDER_WIDTH 2 +#define E_REFLOW_BORDER_WIDTH 7 +#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) + static EReflowClass *parent_class = NULL; /* The arguments we take */ @@ -234,3 +238,32 @@ e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item) } e_reflow_post_add_item(reflow, item); } + +void e_reflow_sorted_jump (EReflowSorted *sorted, + GCompareFunc compare_func, + void *value) +{ + int columns = 0; + EReflow *reflow = E_REFLOW(sorted); + GList *list; + + for (list = reflow->columns; list; list = g_list_next(list)) { + if (compare_func(((GList *)list->data)->data, value) >= 0) { + GList *last = list->prev; + GtkAdjustment *adjustment; + if (last) { + GList *walk; + for (walk = last->data; walk != list->data; walk = g_list_next(walk)) { + if (compare_func(walk->data, value) >= 0) { + columns --; + break; + } + } + } + adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(sorted)->canvas)); + gtk_adjustment_set_value(adjustment, (reflow->column_width + E_REFLOW_FULL_GUTTER) * columns); + return; + } + columns ++; + } +} diff --git a/widgets/e-reflow/e-reflow-sorted.h b/widgets/e-reflow/e-reflow-sorted.h index d9b4acc747..7adfa2c045 100644 --- a/widgets/e-reflow/e-reflow-sorted.h +++ b/widgets/e-reflow/e-reflow-sorted.h @@ -81,6 +81,7 @@ void e_reflow_sorted_replace_item (EReflowSorted *sorted, GnomeCanvasI void e_reflow_sorted_reorder_item (EReflowSorted *e_reflow_sorted, const gchar *id); GnomeCanvasItem *e_reflow_sorted_get_item (EReflowSorted *e_reflow_sorted, const gchar *id); GtkType e_reflow_sorted_get_type (void); +void e_reflow_sorted_jump (EReflowSorted *sorted, GCompareFunc compare_func, void *value); #ifdef __cplusplus } |