diff options
Diffstat (limited to 'addressbook/gui/component')
-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 |
4 files changed, 499 insertions, 11 deletions
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"); |