From 0c5baf1a098125fad2c5f241110928f8803eef70 Mon Sep 17 00:00:00 2001 From: "Predrag \"Pele\" Balorda" Date: Mon, 3 Jan 2000 12:23:15 +0000 Subject: [PATCH] Modifications to gtk-tool (follow aliases, options, bugfixes) --- contrib/gtk-tool/COPYRIGHT | 2 +- contrib/gtk-tool/ChangeLog | 9 +++ contrib/gtk-tool/Gtk_LdapServer.cc | 82 ++++++++++++++++++---------- contrib/gtk-tool/Gtk_LdapServer.h | 1 + contrib/gtk-tool/Gtk_LdapTree.cc | 5 +- contrib/gtk-tool/Gtk_LdapTreeItem.cc | 35 ++++++++++-- contrib/gtk-tool/Gtk_LdapTreeItem.h | 3 + contrib/gtk-tool/INSTALL | 10 ++-- contrib/gtk-tool/My_Window.cc | 29 ++++++---- contrib/gtk-tool/My_Window.h | 2 +- contrib/gtk-tool/README | 5 +- contrib/gtk-tool/TODO | 7 +-- contrib/gtk-tool/main.cc | 23 +++++--- 13 files changed, 143 insertions(+), 70 deletions(-) diff --git a/contrib/gtk-tool/COPYRIGHT b/contrib/gtk-tool/COPYRIGHT index cf1515dd54..755a0ddd37 100644 --- a/contrib/gtk-tool/COPYRIGHT +++ b/contrib/gtk-tool/COPYRIGHT @@ -1,4 +1,4 @@ -Copyright 1998 Predrag Balorda, London, UK +Copyright 1998,1999,2000 Predrag Balorda, London, UK All rights reserved. Redistribution and use in source and binary forms are permitted only diff --git a/contrib/gtk-tool/ChangeLog b/contrib/gtk-tool/ChangeLog index dd2a78f794..9eec313150 100644 --- a/contrib/gtk-tool/ChangeLog +++ b/contrib/gtk-tool/ChangeLog @@ -1,4 +1,13 @@ ChangeLog for gtk-tool +03/01/2000 - Pele + * Fixed localtime() bug in Linux ?;) + +03/01/19100 - Pele + * Auto-select the first server if any supplied as arguments + * A visual bug in the former (deselect a bit messy) + * Follow aliases (not tested with leaf nodes though) + * "Show Debug Info" in "Options" menu + 28/12/1999 - Pele * Updated Gtk-- API from 1.0 to 1.1 * Added -d switch (for debugging info) diff --git a/contrib/gtk-tool/Gtk_LdapServer.cc b/contrib/gtk-tool/Gtk_LdapServer.cc index 9b685db884..fe51dbc1f2 100644 --- a/contrib/gtk-tool/Gtk_LdapServer.cc +++ b/contrib/gtk-tool/Gtk_LdapServer.cc @@ -32,31 +32,18 @@ void Gtk_LdapServer::setType(int t) { Gtk_Pixmap *xpm_icon; Gtk_Label *label; char *c = NULL; - if (this->get_child() != NULL) { - this->remove(); - /* - //xpm_label = new Gtk_HBox(GTK_HBOX(this->get_child()->gtkobj())); - xpm_label = new Gtk_HBox(this->get_child()); - xpm_label->remove_c(xpm_label->children()->nth_data(0)); - xpm_label->remove_c(xpm_label->children()->nth_data(0)); - */ - } + if (this->get_child() != NULL) this->remove(); xpm_label = new Gtk_HBox(); debug(this->hostname); if (strcasecmp(this->hostname,"localhost") == 0) - //xpm_icon=new Gtk_Pixmap(*xpm_label, local_server); xpm_icon=new Gtk_Pixmap(local_server); - else //xpm_icon=new Gtk_Pixmap(*xpm_label, remote_server); - xpm_icon=new Gtk_Pixmap(remote_server); + else xpm_icon=new Gtk_Pixmap(remote_server); // sprintf(c, "%s:%i", this->hostname, this->port); // printf("%s\n", c); label = new Gtk_Label(this->hostname); xpm_label->pack_start(*xpm_icon, false, false, 1); xpm_label->pack_start(*label, false, false, 1); if (this->get_child() == NULL) this->add(*xpm_label); - //label->show(); - //xpm_label->show(); - //xpm_icon->show(); this->show_all(); } @@ -67,20 +54,59 @@ int Gtk_LdapServer::showDetails() { debug("Have a notebook here"); if (par->viewport2->get_child() != NULL) { debug(" and viewport has children"); - par->viewport2->remove(); //par->viewport2->get_child()); + par->viewport2->remove(); debug(" which have been removed\n"); } else debug(" and viewport without children\n"); par->viewport2->add(*this->notebook); - //this->notebook->show(); - //par->viewport2->show(); - //return 0; } this->show_all(); debug("done\n"); return 0; } +int Gtk_LdapServer::getMonitor() { + debug("Gtk_LdapServer::getMonitor()\n"); + int error, entriesCount; + LDAPMessage *entry, *result_identifier; + BerElement *ber; + char *attribute, **t; + + if ((this->ld = ldap_open(this->hostname, this->port)) == NULL) { + perror("connection"); + } + + error = ldap_search_s(this->ld, "cn=monitor", LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &result_identifier); + entriesCount = ldap_count_entries(this->ld, result_identifier); + if (entriesCount == 0) { + return 0; + } + + debug("%i tree(s)\n", entriesCount); + for (entry = ldap_first_entry(this->ld, result_identifier); entry != NULL; entry = ldap_next_entry(this->ld, result_identifier)) { + for (attribute = ldap_first_attribute(this->ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(this->ld, entry, ber)) { + debug("Attrib: %s\n", attribute); + if (strcasecmp(attribute, "database") == 0) { + debug("have database here\n"); + this->databases = NULL; + t = ldap_get_values(this->ld, entry, attribute); + for (int i=0; idatabases = g_list_append(this->databases, strdup(t[i])); + } + ldap_value_free(t); + debug("databases loaded\n"); + GList *t; + for (int i=0;i>g_list_length(this->databases);i++) { + t = g_list_nth(this->databases, i); + debug("database(%i) %s\n", i, (char*) t->data); + } + } + } + debug("entry done\n"); + } + return entriesCount; +} + int Gtk_LdapServer::getConfig() { debug("Gtk_LdapServer::getConfig()\n"); int error, entriesCount; @@ -98,31 +124,30 @@ int Gtk_LdapServer::getConfig() { return 0; } - debug("%i entry\n", entriesCount); +// debug("%i tree(s)\n", entriesCount); for (entry = ldap_first_entry(this->ld, result_identifier); entry != NULL; entry = ldap_next_entry(this->ld, result_identifier)) { for (attribute = ldap_first_attribute(this->ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(this->ld, entry, ber)) { debug("Attrib: %s\n", attribute); if (strcasecmp(attribute, "database") == 0) { debug("have database here\n"); - //this->databases = new GList; this->databases = NULL; t = ldap_get_values(this->ld, entry, attribute); for (int i=0; idatabases = g_list_append(this->databases, strdup(t[i])); - //this->databases->push_back(*strdup(t[i])); } + this->databases = g_list_append(this->databases, "ldbm : cn=config"); + this->databases = g_list_append(this->databases, "ldbm : cn=monitor"); ldap_value_free(t); debug("databases loaded\n"); GList *t; - for (int i=0;i>g_list_length(this->databases);i++) { + for (int i=0;idatabases);i++) { t = g_list_nth(this->databases, i); -// debug("database(%i) %s\n", i, ((gchar*) t->data)); + debug("database(%i) %s\n", i, (char*) t->data); } } } debug("entry done\n"); } -// debug("got %i entries\n", entriesCount); return entriesCount; } @@ -208,7 +233,7 @@ int Gtk_LdapServer::getOptions() { Gtk_HScale *scale; Gtk_Adjustment *adjustment; char *description = NULL, *s_value = NULL; - int i_value; +// int i_value; string label_string; int things[10] = { @@ -236,6 +261,7 @@ int Gtk_LdapServer::getOptions() { table = new Gtk_Table(10, 1, TRUE); for (int i=0; i<10; i++) { + int i_value; // debug("%i\n", i); hbox = new Gtk_HBox(TRUE, 2); hbox->set_border_width(2); @@ -283,7 +309,7 @@ int Gtk_LdapServer::getOptions() { case 3: ldap_get_option(this->ld, things[i], &i_value); debug("i_value: %s\n", i_value); - adjustment = new Gtk_Adjustment(i_value, 1.0, 20.0, 1.0, 1.0, 0.0); + adjustment = new Gtk_Adjustment(i_value, 0.0, 20.0, 1.0, 1.0, 0.0); scale = new Gtk_HScale(*adjustment); scale->set_update_policy(GTK_UPDATE_CONTINUOUS); scale->set_value_pos(GTK_POS_TOP); @@ -358,7 +384,7 @@ Gtk_Tree* Gtk_LdapServer::getSubtree() { subtree = treeitem->getSubtree(this->ld, 1); debug("inserting %s into %s\n", treeitem->rdn, this->hostname); tree->append(*treeitem); - treeitem->set_subtree(*subtree); + if (subtree != NULL) treeitem->set_subtree(*subtree); treeitem->show(); // tree->show(); } diff --git a/contrib/gtk-tool/Gtk_LdapServer.h b/contrib/gtk-tool/Gtk_LdapServer.h index e234feb8d5..21466a0b6c 100644 --- a/contrib/gtk-tool/Gtk_LdapServer.h +++ b/contrib/gtk-tool/Gtk_LdapServer.h @@ -36,6 +36,7 @@ public: Gtk_LdapServer(GtkTreeItem *t); ~Gtk_LdapServer(); void setType(int t); + int getMonitor(); int getConfig(); Gtk_Tree* getSubtree(); #ifndef LDAP_GET_OPT diff --git a/contrib/gtk-tool/Gtk_LdapTree.cc b/contrib/gtk-tool/Gtk_LdapTree.cc index 58e596ac41..e5b25c7932 100644 --- a/contrib/gtk-tool/Gtk_LdapTree.cc +++ b/contrib/gtk-tool/Gtk_LdapTree.cc @@ -5,9 +5,10 @@ void Gtk_LdapTree::show_impl() { Gtk_LdapTree *tree; Gtk_LdapTreeItem *item = NULL; Gtk_LdapTree::ItemList &items = this->tree(); - Gtk_LdapTree::ItemList::iterator i = items.begin(); + Gtk_LdapTree::ItemList::iterator i; // = items.begin(); debug("iterator\n"); - for (i=items.begin(); i!=items.end();i++) { + for (i=items.begin(); i!=items.end();++i) { +// while (i!=items.end()) { item = (Gtk_LdapTreeItem *)(*i); debug("new item\n"); debug("#%s#\n", item->dn); diff --git a/contrib/gtk-tool/Gtk_LdapTreeItem.cc b/contrib/gtk-tool/Gtk_LdapTreeItem.cc index ead239f1a7..7add7b0954 100644 --- a/contrib/gtk-tool/Gtk_LdapTreeItem.cc +++ b/contrib/gtk-tool/Gtk_LdapTreeItem.cc @@ -29,6 +29,7 @@ Gtk_LdapTree* Gtk_LdapTreeItem::getSubtree(LDAP *ld, int counter) { if (counter <= 0) return NULL; if (this->gtkobj()->subtree != NULL) { //return (Gtk_LdapTree *)GTK_TREE(this->gtkobj()->subtree); + debug("This item has a subtree\n"); return (Gtk_LdapTree *)this->get_subtree(); //gtkobj()->subtree); } counter--; @@ -40,7 +41,11 @@ Gtk_LdapTree* Gtk_LdapTreeItem::getSubtree(LDAP *ld, int counter) { int entriesCount = 0, error; this->ld = ld; - error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_ONELEVEL, "objectclass=*", NULL, 0, &r_i); + if (this->dn == "cn=config" || this->dn == "cn=monitor") error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &r_i); + else { + if (strcasecmp(this->objectClass,"alias") == 0) error = ldap_search_s(this->ld, this->getAttribute("aliasedobjectname"), LDAP_SCOPE_ONELEVEL, "objectclass=*", NULL, 0, &r_i); + else error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_ONELEVEL, "objectclass=*", NULL, 0, &r_i); + } // printf("%s\n", ldap_err2string(error)); entriesCount = ldap_count_entries(this->ld, r_i); debug("%i results\n", entriesCount); @@ -51,9 +56,9 @@ Gtk_LdapTree* Gtk_LdapTreeItem::getSubtree(LDAP *ld, int counter) { tree->set_view_lines(false); entry = ldap_first_entry(this->ld, r_i); // float i = 1; - // float percent = 100/entriesCount; - // cout << "percent is " << percent << endl; - // this->par->progress.update(0); + gfloat percent = 100/entriesCount; + cout << "percent is " << percent << endl; + // this->par->progress.set_percentage(percent/100); // this->par->progress.show(); while (entry != NULL) { subtreeitem = new Gtk_LdapTreeItem(ldap_get_dn(this->ld, entry), this->par, this->ld); @@ -114,6 +119,8 @@ void Gtk_LdapTreeItem::setType(int t) { else if (strcasecmp(this->objectClass,"rfc822mailgroup") == 0) //xpm_icon=new Gtk_Pixmap(*xpm_label, rfc822mailgroup_node); xpm_icon=new Gtk_Pixmap(rfc822mailgroup_node); + else if (strcasecmp(this->objectClass,"LDAPsubentry") == 0) + xpm_icon=new Gtk_Pixmap(monitor); else //xpm_icon=new Gtk_Pixmap(*xpm_label, general_node); xpm_icon=new Gtk_Pixmap(general_node); label = new Gtk_Label(this->rdn); @@ -150,6 +157,25 @@ int Gtk_LdapTreeItem::showDetails() { return 0; } +char* Gtk_LdapTreeItem::getAttribute(char *c) { + int entriesCount, error; + BerElement *ber; + LDAPMessage *entry; + char *attribute, **values; + error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &this->result_identifier); + entriesCount = ldap_count_entries(this->ld, this->result_identifier); + if (entriesCount == 0) return 0; + for (entry = ldap_first_entry(ld, result_identifier); entry != NULL; entry = ldap_next_entry(ld, result_identifier)) { + for (attribute = ldap_first_attribute(ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(ld, entry, ber)) { + values = ldap_get_values(ld, entry, attribute); + if (strcasecmp(attribute, "aliasedobjectname") == 0) { + this->aliasedObjectName = strdup(values[0]); + } + } + } + return this->aliasedObjectName; +} + int Gtk_LdapTreeItem::getDetails() { debug("Gtk_LdapTreeItem::getDetails()\n"); int error, entriesCount; @@ -160,7 +186,6 @@ int Gtk_LdapTreeItem::getDetails() { Gtk_CList *table; Gtk_Label *label; GList *child_list; -// Gtk_Notebook *g; Gtk_Viewport *viewport; error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &this->result_identifier); entriesCount = ldap_count_entries(this->ld, this->result_identifier); diff --git a/contrib/gtk-tool/Gtk_LdapTreeItem.h b/contrib/gtk-tool/Gtk_LdapTreeItem.h index fe0a12bdab..a5775c542c 100644 --- a/contrib/gtk-tool/Gtk_LdapTreeItem.h +++ b/contrib/gtk-tool/Gtk_LdapTreeItem.h @@ -12,6 +12,7 @@ #include "icons/alias_node.h" #include "icons/rfc822mailgroup_node.h" #include "icons/general_node.h" +#include "icons/monitor.h" #define ROOT_NODE 1 #define BRANCH_NODE 2 @@ -25,6 +26,7 @@ public: char *dn; char *rdn; char *objectClass; + char *aliasedObjectName; LDAP *ld; LDAPMessage *result_identifier; My_Window *par; @@ -34,6 +36,7 @@ public: Gtk_LdapTreeItem(char *c, My_Window *w, LDAP *ld); Gtk_LdapTreeItem(GtkTreeItem *t); ~Gtk_LdapTreeItem(); + gchar* getAttribute(char *c); Gtk_LdapTree* getSubtree(LDAP *ld, int i); void setType(int t); int getDetails(); diff --git a/contrib/gtk-tool/INSTALL b/contrib/gtk-tool/INSTALL index 81cb982c83..84a5c594e8 100644 --- a/contrib/gtk-tool/INSTALL +++ b/contrib/gtk-tool/INSTALL @@ -1,13 +1,13 @@ Please read this carefully To copile gtk-tool, although OpenLDAP in itself is a very out-of-the-box -straightforward piece of code to compile gtk-tool isn't. You will require the -latest Gtk+/Gtk-- CVS trees on your machine - as of 11 February 1999 so your -last weeks' checkout is more than likely allready useless - not my problem, they -promise API freezes and then don't stick to it...what can I say...a hint for -the gtk people - Java 1.1 +straightforward piece of code to compile gtk-tool isn't. You will require following: + + Gtk+1.2.x + Gtk--1.1.x So, latest gtk stuff and if you successfully compiled and installed all that it should be easy. If you didn't I really hope you can take some comfort in that I have provided you with some snapshots of what the thing actually looks like. I hope in the near future I would be able to provide you with a static binary..next week perhaps..I don't know, I'm looking for a job right now so no promises... +(I'm no longer looking for a job but the situation with spare time seems even worse - I wish I could do this full-time guys, I really do...) Pele pele@openldap.org diff --git a/contrib/gtk-tool/My_Window.cc b/contrib/gtk-tool/My_Window.cc index 174d388960..ee21e94243 100644 --- a/contrib/gtk-tool/My_Window.cc +++ b/contrib/gtk-tool/My_Window.cc @@ -35,22 +35,22 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) { menuitem->activate.connect(slot(this,&My_Window::addServer)); //connect_to_method(menuitem->activate, this, &addServer); sub_menu->append(*menuitem); - menuitem->show(); +// menuitem->show(); new_menu = new Gtk_MenuItem("New..."); new_menu->set_submenu(*sub_menu); - sub_menu->show(); +// sub_menu->show(); menu->append(*new_menu); - new_menu->show(); +// new_menu->show(); menuitem = new Gtk_MenuItem("Quit"); menuitem->activate.connect(Gtk_Main::quit.slot()); menu->append(*menuitem); - menuitem->show(); +// menuitem->show(); this->menubar = new Gtk_MenuBar(); file_menu = new Gtk_MenuItem("File (?)"); file_menu->set_submenu(*menu); this->menubar->append(*file_menu); - menu->show(); +// menu->show(); menu = new Gtk_Menu(); check_menuitem = new Gtk_CheckMenuItem("Show Debug Info"); @@ -61,29 +61,32 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) { options_menu = new Gtk_MenuItem("Options"); options_menu->set_submenu(*menu); this->menubar->append(*options_menu); - menu->show(); +// menu->show(); - file_menu->show(); - options_menu->show(); +// file_menu->show(); +// options_menu->show(); // top_hbox->pack_start(*this->menubar, TRUE, TRUE, 1); - this->menubar->show(); +// this->menubar->show(); this->urlfield = new Gtk_Entry(); top_hbox->pack_start(*this->urlfield, TRUE, TRUE, 1); - this->urlfield->show(); +// this->urlfield->show(); this->display_button = new Gtk_Button("Query Server"); this->display_button->clicked.connect(slot(this, &My_Window::getHost)); //connect_to_method(this->display_button->clicked, this, &getHost); top_hbox->pack_end(*this->display_button, FALSE, FALSE, 1); - this->display_button->show(); +// this->display_button->show(); this->status = new Gtk_Statusbar(); +// this->progress = new Gtk_ProgressBar(); +// this->status->add(*progress); +// this->progress->show(); bottom_hbox = new Gtk_VBox(); bottom_hbox->pack_start(*pane, TRUE, TRUE, 1); bottom_hbox->pack_end(*status, FALSE, TRUE, 1); pane->show(); - status->show(); +// status->show(); main_hbox = new Gtk_VBox(); main_hbox->pack_start(*this->menubar, FALSE, FALSE, 1); @@ -94,6 +97,7 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) { this->add(*main_hbox); this->destroy.connect(Gtk_Main::quit.slot()); main_hbox->show(); +// this->show_all(); } My_Window::~My_Window() { @@ -157,6 +161,7 @@ void My_Window::getHost() { tree->show(); this->viewport->show(); this->scroller->show(); + treeitem->select(); } void My_Window::setDebug() { diff --git a/contrib/gtk-tool/My_Window.h b/contrib/gtk-tool/My_Window.h index c56c6690b3..f68c480473 100644 --- a/contrib/gtk-tool/My_Window.h +++ b/contrib/gtk-tool/My_Window.h @@ -16,7 +16,7 @@ public: Gtk_InputDialog *dialog; Gtk_Paned *pane; Gtk_MenuBar *menubar; -// Gtk_ProgressBar progress; +// Gtk_ProgressBar *progress; Gtk_Statusbar *status; My_Window(GtkWindowType t); ~My_Window(); diff --git a/contrib/gtk-tool/README b/contrib/gtk-tool/README index 51e1977871..e2579e5af0 100644 --- a/contrib/gtk-tool/README +++ b/contrib/gtk-tool/README @@ -1,6 +1,6 @@ -README for gtk-tool v0.6a +README for gtk-tool v0.7a -This package has been tested and run with the latest Gtk+/Gtk-- +This package has been tested and run with the latest Gtk+1.2/Gtk--1.1 OpenLDAP 2.0-devel. It should also compile (i.e. it is backward-compatible) with the U-MICH (old) API but it has not been tested (read compiled) - however the siplicity of the "problem" and a few ifdefs lead me to believe everything should be allright with gtk-tool now. This thing doesn't run as it should, please @@ -26,6 +26,7 @@ i.e.: etc... It does not accept -b switch as it no longer needs it to aquire databases. +There's also a -d switch (try it with -d 1) for all the debug info. But please feel free to add whatever else you consider neccessary to understanding how this thing works. Enjoy, and I hope this can be useful to you in some miniscule way. diff --git a/contrib/gtk-tool/TODO b/contrib/gtk-tool/TODO index 70d7d31350..d316745daa 100644 --- a/contrib/gtk-tool/TODO +++ b/contrib/gtk-tool/TODO @@ -2,20 +2,17 @@ LOADS!!! Please someone test this with old U-MICH API - hopefully all is as it should be. -Odd behaviour with tabbed panes - labels misteriously dissapear after you -select a node for the second time 'round. Anyone any ideas on this? - Priorities: Now that we have cn=config we can start using ldap_get_option propperly and be able to run/stop server from the gtk-tool. Other things like new entries would now come in handy. Implement searches - port to autoconf (anyone? it should be easy) + Integrate with OpenLDAP build - autoconf stuff (anyone?) Optional: comments in the source code port it to NT so we can use it with the NT port of OpenLDAP - (is there a NT port of Gtk+?) + (they say that there is an NT port of Gtk+?) Pele pele@openldap.org diff --git a/contrib/gtk-tool/main.cc b/contrib/gtk-tool/main.cc index f2db2bfc3c..8b66c2da8a 100644 --- a/contrib/gtk-tool/main.cc +++ b/contrib/gtk-tool/main.cc @@ -11,7 +11,7 @@ int debug_level = 0; int main(int argc, char **argv) { My_Window *window; Gtk_LdapItem *treeresult; - Gtk_Tree *tree, *subtree; + Gtk_Tree *tree = NULL, *subtree = NULL; Gtk_Tree *machine, *machinetree; Gtk_LdapServer *server; Gtk_Viewport *viewport; @@ -36,7 +36,7 @@ int main(int argc, char **argv) { port = atoi(optarg); break; case 'h': default: - fprintf(stderr, "Usage: %s ([-s server[:port]])*\n", argv[0]); + fprintf(stderr, "Usage: %s [-d level] [-s server[:port]]*\n", argv[0]); exit(-1); } fprintf(stderr,"b"); @@ -54,7 +54,6 @@ int main(int argc, char **argv) { fprintf(stderr,"Why isn't your LDAP_OPT_HOST_NAME defined?\n"); #endif fprintf(stderr,"Supply me with a host please (hint: use -s)\n"); - // exit(1); } } else { for (int f=0; fshow(); } window->viewport->add(*tree); - tree->show(); +// tree->show(); } -// window->scroller->add(viewport); - window->viewport->show(); - window->scroller->show(); +// window->viewport->show(); +// window->scroller->show(); + + //Select first server + if (tree != NULL) { + Gtk_LdapTree::ItemList &items = tree->tree(); + Gtk_LdapTree::ItemList::iterator i = items.begin(); + server = (Gtk_LdapServer *)(* i); + server->select_impl(); + } window->set_title("gtk-tool"); window->activate(); window->set_usize(600, 500); - window->show(); + window->show_all(); m.run(); return 0; -- 2.39.5