From 661cc2d0ef7f97a064543032b088d5092c36b4cb Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 7 Jul 2000 16:14:27 +0000 Subject: Since ELDAPServer->port is a char *, allocate a string with the number 389 2000-07-07 Christopher James Lahey * gui/component/addressbook.c (new_server_cb): Since ELDAPServer->port is a char *, allocate a string with the number 389 contained. * gui/component/addressbook.c: Make the select names test test the new code instead of the old way of getting to an ESelectNames dialog. * gui/component/select-names/e-select-names-manager.c: Coded storing the model for each section, creating an entry and returning it, and for activating the dialog. Wrote a bit of the get_cards code, but not all of it. * gui/component/select-names/e-select-names-model.c, gui/component/select-names/e-select-names-model.h: Coded all of the code needed to make ESelectNamesTextModel work (it doesn't yet, but all the code should be there.) Removed E_SELECT_NAMES_MODEL_DATA_TYPE_SEPARATION_MATERIAL. * gui/component/select-names/e-select-names-table-model.c, gui/component/select-names/e-select-names-text-model.c: Changed these to compensate for removal of E_SELECT_NAMES_MODEL_DATA_TYPE_SEPARATION_MATERIAL. * gui/component/select-names/e-select-names-table-model.h, gui/component/select-names/e-select-names-text-model.h: Fixed some silly typos. * gui/component/select-names/e-select-names.c, gui/component/select-names/e-select-names.h: Added a parameter to add_section that lets you specify the source ESelectNamesModel. svn path=/trunk/; revision=3948 --- addressbook/gui/component/addressbook.c | 42 +++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'addressbook/gui/component/addressbook.c') diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index f248e1e4bd..134365f6e8 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -27,6 +27,7 @@ #include #include +#include #include "e-contact-editor.h" #include "e-contact-save-as.h" #include "e-ldap-server-dialog.h" @@ -194,10 +195,10 @@ new_server_cb (BonoboUIHandler *uih, void *user_data, const char *path) /* fill in the defaults */ server->name = g_strdup(""); server->host = g_strdup(""); - server->port = 389; + server->port = g_strdup_printf("%d", 389); server->description = g_strdup(""); server->rootdn = g_strdup(""); - server->uri = g_strdup_printf ("ldap://%s:%d/%s", server->host, server->port, server->rootdn); + server->uri = g_strdup_printf ("ldap://%s:%s/%s", server->host, server->port, server->rootdn); e_ldap_server_editor_show (server); if (view->view) @@ -407,15 +408,42 @@ print_cb (BonoboUIHandler *uih, void *user_data, const char *path) } } +static void +open_dialog(GtkWidget *button, ESelectNamesManager *manager) +{ + char *id = gtk_object_get_data(GTK_OBJECT(button), "id"); + e_select_names_manager_activate_dialog(manager, id); +} + static void test_select_names_cb (BonoboUIHandler *uih, void *user_data, const char *path) { - ESelectNames *names = E_SELECT_NAMES(e_select_names_new()); + ESelectNamesManager *manager = e_select_names_manager_new(); + GtkWidget *window; + GtkWidget *table; + int row = 0; + char *sections[] = {"to", "from", "cc"}; + char *titles[] = {N_("To"), N_("From"), N_("Cc")}; + + for (row = 0; row < 3; row ++) + e_select_names_manager_add_section(manager, sections[row], _(titles[row])); + + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + table = gtk_table_new(3, 2, FALSE); - e_select_names_add_section(names, _("To"), "to"); - e_select_names_add_section(names, _("From"), "from"); - e_select_names_add_section(names, _("Cc"), "cc"); - gtk_widget_show(GTK_WIDGET(names)); + for (row = 0; row < 3; row ++) { + GtkWidget *button = gtk_button_new_with_label(_(titles[row])); + GtkWidget *entry = e_select_names_manager_create_entry(manager, sections[row]); + + gtk_object_set_data(GTK_OBJECT(button), "id", g_strdup(sections[row])); + gtk_signal_connect(GTK_OBJECT(button), "clicked", + GTK_SIGNAL_FUNC(open_dialog), manager); + gtk_table_attach(GTK_TABLE(table), button, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); + } + gtk_container_add(GTK_CONTAINER(window), table); + gtk_widget_show_all(window); } static GnomeUIInfo gnome_toolbar [] = { -- cgit v1.2.3