]> git.sur5r.net Git - openldap/commitdiff
U-MICH backward-compatibility fixes for gtk-tool and other minor fixes and cleanups
authorPredrag "Pele" Balorda <pele@openldap.org>
Fri, 12 Feb 1999 23:45:35 +0000 (23:45 +0000)
committerPredrag "Pele" Balorda <pele@openldap.org>
Fri, 12 Feb 1999 23:45:35 +0000 (23:45 +0000)
contrib/gtk-tool/ChangeLog
contrib/gtk-tool/Gtk_LdapServer.cc
contrib/gtk-tool/Gtk_LdapServer.h
contrib/gtk-tool/Gtk_LdapTree.cc
contrib/gtk-tool/Gtk_LdapTreeItem.cc
contrib/gtk-tool/Gtk_LdapTreeItem.h
contrib/gtk-tool/Makefile
contrib/gtk-tool/My_Window.cc
contrib/gtk-tool/My_Window.h
contrib/gtk-tool/TODO
contrib/gtk-tool/main.cc

index 29dcb2ec005eaf1eb548f87acc1e4a1d23c4e549..d8960e7b99d8ddbc109932e104aaf9508030c157 100644 (file)
@@ -1,5 +1,16 @@
 ChangeLog for gtk-tool
 
+12/01/1999 - Pele
+       * Added some defines for U-MICH compatibility
+       * Updated to the latest Gtk-- API (in Gtk-- CVS tree)
+       * Minor fixes due to the new and cleaner Gtk-- API
+       * A new server can be added by entering a hostname into the
+       "url" field at the top and clicking on "Query Server" button
+       (note that one server still has to be supplied on the command line -
+       I'll try and fix this tomorrow...to do with ldap_get_opt)
+       * Somewhat "smarter" Makefile - can someone please look into integrating
+       gtk-tool into the openldap autoconf stuff?
+
 09/12/1998 - Pele
        * Display of all ldap options in their proper widgets (sliders for 
        timeout, radio buttons for booleans etc.) when server selected
index ff7c1fc362d1e0437ed9e046800391c0a1ca26a7..ec209e4e2532319c8e96192ae484c70196adb021 100644 (file)
@@ -32,8 +32,8 @@ void Gtk_LdapServer::setType(int t) {
        Gtk_Pixmap *xpm_icon;
        Gtk_Label *label;
        char *c = NULL;
-       if (this->getchild() != NULL) {
-               xpm_label = new Gtk_HBox(GTK_HBOX(this->getchild()->gtkobj()));
+       if (this->get_child() != NULL) {
+               xpm_label = new Gtk_HBox(GTK_HBOX(this->get_child()->gtkobj()));
                xpm_label->remove_c(xpm_label->children()->nth_data(0));
                xpm_label->remove_c(xpm_label->children()->nth_data(0));
        }
@@ -47,7 +47,7 @@ void Gtk_LdapServer::setType(int t) {
        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->getchild() == NULL) this->add(xpm_label);
+       if (this->get_child() == NULL) this->add(xpm_label);
        label->show();
        xpm_label->show();
        xpm_icon->show();
@@ -55,22 +55,21 @@ void Gtk_LdapServer::setType(int t) {
 
 int Gtk_LdapServer::showDetails() {
        debug("Gtk_LdapServer::showDetails()\n");
+       if (this->notebook == NULL) this->getOptions();
        if (this->notebook != NULL) {
-//             debug("Have notebook here");
-               if (par->viewport->getchild() != NULL) {
-//                     debug(" and viewport has children");
-                       par->viewport->remove_c(par->viewport->getchild()->gtkobj());
-//                     debug(" which have been removed");
+               debug("Have a notebook here");
+               if (par->viewport2->get_child() != NULL) {
+                       debug(" and viewport has children");
+                       par->viewport2->remove(par->viewport2->get_child());
+                       debug(" which have been removed");
                }
-//             else debug(" and viewport without children");
-               par->viewport->add(this->notebook);
+               else debug(" and viewport without children");
+               par->viewport2->add(this->notebook);
                this->notebook->show();
-               par->viewport->show();
+               par->viewport2->show();
                return 0;
        }
-       if (this->getOptions() != 0) return 1;
-       this->showDetails();
-//     debug("done\n");
+       debug("done\n");
        return 0;
 }
 
@@ -115,6 +114,7 @@ int Gtk_LdapServer::getConfig() {
        return entriesCount;
 }
 
+#ifndef LDAP_GET_OPT /* a temporary fix for usability with (old) U-MICH api */
 char* Gtk_LdapServer::getOptDescription(int option) {
        debug("Gtk_LdapServer::getOptDescription(%i) ", option);
        char *c;
@@ -172,10 +172,20 @@ int Gtk_LdapServer::getOptType(int option) {
        debug("%i\n", type);
        return type;
 }
+#endif /* LDAP_GET_OPT */
 
 int Gtk_LdapServer::getOptions() {
        debug("Gtk_LdapServer::getOptions()\n");
        if (this->notebook != NULL) return 0;
+#ifdef LDAP_GET_OPT /* a temporary fix for usability with (old) U-MICH api */
+       Gtk_Label *label;
+       label = new Gtk_Label("This tool has been compiled with (old) U-MICH API (no LDAP_GET_OPT)\nCompile with the latest -devel (from OpenLDAP cvs tree)\nto get some nice options here");
+       this->notebook = new Gtk_Frame("LDAP Options");
+       this->notebook->add(*label);
+       label->show();
+       this->notebook->show();
+       return 0;
+#else
        LDAPAPIInfo api;
        Gtk_HBox *hbox, *mini_hbox;
        Gtk_VBox *vbox, *mini_vbox;
@@ -216,7 +226,7 @@ int Gtk_LdapServer::getOptions() {
        for (int i=0; i<10; i++) {
        //      debug("%i\n", i);
                hbox = new Gtk_HBox(TRUE, 2);
-               hbox->border_width(2);
+               hbox->set_border_width(2);
                description = this->getOptDescription(things[i]);
                label = new Gtk_Label(description);
                label->set_justify(GTK_JUSTIFY_LEFT);
@@ -246,10 +256,10 @@ int Gtk_LdapServer::getOptions() {
                                ldap_get_option(this->ld, things[i], &i_value);
                                radio1 = new Gtk_RadioButton(static_cast<GSList*>(0), "Enabled");
                                radio2 = new Gtk_RadioButton(*radio1, "Disabled");
-                               if (i_value == 1) radio1->set_state(true);
-                               else radio2->set_state(true);
+                               if (i_value == 1) radio1->set_active(true);
+                               else radio2->set_active(true);
                                mini_hbox = new Gtk_HBox(FALSE, 2);
-                               mini_hbox->border_width(2);
+                               mini_hbox->set_border_width(2);
                                mini_hbox->pack_start(*radio1);
                                radio1->show();
                                mini_hbox->pack_end(*radio2);
@@ -298,11 +308,12 @@ int Gtk_LdapServer::getOptions() {
                table->attach_defaults(*hbox, 0, 1, i, i+1);
                hbox->show();
        }
-       table->border_width(2);
+       table->set_border_width(2);
        this->notebook = new Gtk_Frame("LDAP Options");
        this->notebook->add(*table);
        table->show();
        return 0;
+#endif /* LDAP_GET_OPT */
 }
 
 Gtk_Tree* Gtk_LdapServer::getSubtree() {
@@ -336,37 +347,47 @@ Gtk_Tree* Gtk_LdapServer::getSubtree() {
        //      tree->show();
        }
 //     this->set_subtree(*tree);
-       debug("getTree() done\n");
+       debug("getSubtree() done\n");
        return tree;
 }
-
+/*
 void Gtk_LdapServer::show_impl() {
        debug("%s showed\n", this->hostname);
-       Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
-       sig->show(GTK_WIDGET(gtkobj()));
+       BaseClassType *sig=static_cast<BaseClassType *>(get_parent_class());
+       if (!sig->show) return;
+       sig->show(gtkobj());
+//     Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
+//     sig->show(GTK_WIDGET(gtkobj()));
 }
-
+*/
 void Gtk_LdapServer::select_impl() {
        debug("%s selected\n", this->hostname);
-       Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
-       if (!sig->select) return;
+//     Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
+//     if (!sig->select) return;
        this->showDetails();
-       sig->select(GTK_ITEM(gtkobj()));
+//     sig->select(GTK_ITEM(gtkobj()));
+       Gtk_TreeItem::select_impl();
 }
 
 void Gtk_LdapServer::collapse_impl() {
        debug("%s collapsed\n", this->hostname);
-       Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
-       if (!sig->collapse) return;
-       sig->collapse(GTK_TREE_ITEM(gtkobj()));
+//     Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
+//     if (!sig->collapse) return;
+//     sig->collapse(GTK_TREE_ITEM(gtkobj()));
 //     gtk_widget_hide(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
+       Gtk_TreeItem::collapse_impl();
 }
 
 void Gtk_LdapServer::expand_impl() {
        debug("%s expanded\n", this->hostname);
-       Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
-       if (!sig->expand) return;
-       sig->expand(GTK_TREE_ITEM(gtkobj()));
+       Gtk_TreeItem::expand_impl();
+//     BaseClassType *sig=static_cast<BaseClassType *>(get_parent_class());
+//     if (!sig->expand)
+//             { return; }
+//     sig->expand(gtkobj());
+//     Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
+//     if (!sig->expand) return;
+//     sig->expand(GTK_TREE_ITEM(gtkobj()));
 //     Gtk_Tree *t;
 //     t = new Gtk_Tree(GTK_TREE(GTK_TREE_ITEM(this->gtkobj())->subtree));
 //     bool vis = t->visible();
index 3f265b98f6b3252952df081c2d8f261aedb4bbe7..4a448a9f39e98537ba87b0d197f13ce0b10d5daf 100644 (file)
@@ -38,11 +38,13 @@ public:
        void setType(int t);
        int getConfig();
        Gtk_Tree* getSubtree();
+#ifndef LDAP_GET_OPT
        char* getOptDescription(int option);
        int getOptType(int option);
+#endif
        int getOptions();
        int showDetails();
-       void show_impl();
+//     void show_impl();
        void select_impl();
        void collapse_impl();
        void expand_impl();
index 18aab887d424abfecc5b625f06e1170824634863..a4d93a293d6c7b2c4a58f97e40c72e0901e32b5d 100644 (file)
@@ -7,14 +7,15 @@ void Gtk_LdapTree::show_impl() {
        Gtk_LdapTree::iterator i;
        debug("iterator\n");
        for (i=this->begin(); i!=this->end();i++) {
-               item = (Gtk_LdapTreeItem *)GTK_TREE_ITEM((*i));
+       //      item = (Gtk_LdapTreeItem *)GTK_TREE_ITEM((*i));
+               item = (Gtk_LdapTreeItem *)(*i);
                debug("#%s#\n", item->dn);
-               if (item->gtkobj()->subtree == NULL) {
+               if (item->get_subtree() == NULL) {
+                       debug("ding!\n");
                        tree = item->getSubtree(item->ld, 1);
                        if (tree != NULL) item->set_subtree(*tree);
                }
        }
        debug("done\n");
-       Gtk_c_signals_Tree *sig=(Gtk_c_signals_Tree *)internal_getsignalbase(); 
-       sig->show(GTK_WIDGET(gtkobj()));
+       Gtk_Tree::show_impl();
 }
index a6e1d247f5b3ca61de0fc9e27760238e4b62e3c8..473c4cf3b05ce2d74d8643f09750a70798131c7e 100644 (file)
@@ -1,5 +1,4 @@
 #include "Gtk_LdapTreeItem.h"
-#include <gtk--/base.h>
 
 Gtk_LdapTreeItem::Gtk_LdapTreeItem() : Gtk_TreeItem() {
        this->objectClass = NULL;
@@ -83,8 +82,8 @@ void Gtk_LdapTreeItem::setType(int t) {
        debug("Gtk_LdapTreeItem::setType(%s)\n", this->objectClass);
        Gtk_Pixmap *xpm_icon;
        Gtk_Label *label;
-       if (this->getchild() != NULL) {
-               xpm_label = new Gtk_HBox(GTK_HBOX(this->getchild()->gtkobj()));
+       if (this->get_child() != NULL) {
+               xpm_label = new Gtk_HBox(GTK_HBOX(this->get_child()->gtkobj()));
                xpm_label->remove_c(xpm_label->children()->nth_data(0));
                xpm_label->remove_c(xpm_label->children()->nth_data(0));
        }
@@ -103,7 +102,7 @@ void Gtk_LdapTreeItem::setType(int t) {
        label = new Gtk_Label(this->rdn);
        xpm_label->pack_start(*xpm_icon, false, false, 1);
        xpm_label->pack_start(*label, false, false, 1);
-       if (this->getchild() == NULL) this->add(xpm_label);
+       if (this->get_child() == NULL) this->add(xpm_label);
        label->show();
        xpm_label->show();
        xpm_icon->show();
@@ -111,17 +110,21 @@ void Gtk_LdapTreeItem::setType(int t) {
 
 int Gtk_LdapTreeItem::showDetails() {
        debug("Gtk_LdapTreeItem::showDetails()\n");
+       if (this->notebook == NULL) this->getDetails();
        if (this->notebook != NULL) {
-               if (par->viewport->getchild() != NULL) {
-                       par->viewport->remove_c(par->viewport->getchild()->gtkobj());
+               debug("Have a notebook here");
+               if (par->viewport2->get_child() != NULL) {
+                       debug(" and the viewport has children");
+                       par->viewport2->remove(par->viewport2->get_child());
+                       debug(" which have been removed");
                }
-               par->viewport->add(this->notebook);
+               else debug(" and viewport has no children");
+               par->viewport2->add(*this->notebook);
                this->notebook->show();
-               par->viewport->show();
+               par->viewport2->show();
                return 0;
        }
-       else this->getDetails();
-       this->showDetails();
+       else debug("No notebook and no details");
        return 0;
 }
 
@@ -131,16 +134,17 @@ int Gtk_LdapTreeItem::getDetails() {
        BerElement *ber;
        LDAPMessage *entry;
        char *attribute, **values;
+       char attrib[32];
        Gtk_CList *table;
        Gtk_Label *label;
        GList *child_list;
-       Gtk_Notebook *g;
+//     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);
        if (entriesCount == 0) return 0;
-       notebook = new Gtk_Notebook();
-       notebook->set_tab_pos(GTK_POS_LEFT);
+       this->notebook = new Gtk_Notebook();
+       this->notebook->set_tab_pos(GTK_POS_LEFT);
        const gchar *titles[] = { "values" };
        
        for (entry = ldap_first_entry(ld, result_identifier); entry != NULL; entry = ldap_next_entry(ld, result_identifier)) {
@@ -159,10 +163,11 @@ int Gtk_LdapTreeItem::getDetails() {
                                table->append(t);
                        }
                        ldap_value_free(values);
-                       label = new Gtk_Label(attribute);
+                       sprintf(attrib, "%s", attribute);
+                       label = new Gtk_Label(attrib);
                        label->set_alignment(0, 0);
                        label->set_justify(GTK_JUSTIFY_LEFT);
-                       notebook->append_page(*table, *label);
+                       this->notebook->append_page(*table, *label);
                        table->show();
                        label->show();
                }
@@ -171,28 +176,22 @@ int Gtk_LdapTreeItem::getDetails() {
        debug("done\n");
        return 0;
 }
-
+/*
 void Gtk_LdapTreeItem::show_impl() {
        debug("%s showed\n", this->dn);
-       Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
-       sig->show(GTK_WIDGET(gtkobj()));
+//     Gtk_c_signals_Base *sig=(Gtk_c_signals_Base *)internal_getsignalbase();
+//     sig->show(GTK_WIDGET(gtkobj()));
 }
-
+*/
 void Gtk_LdapTreeItem::select_impl() {
        debug("%s selected\n", this->dn);
-//     gtk_item_select(GTK_ITEM(GTK_TREE_ITEM(this->gtkobj())));
-       Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
-       if (!sig->select) return;
-       sig->select(GTK_ITEM(gtkobj()));
        this->showDetails();
+       Gtk_TreeItem::select_impl();
 }
 
 void Gtk_LdapTreeItem::collapse_impl() {
        debug("%s collapsed\n", this->dn);
-       Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
-       if (!sig->collapse) return;
-       sig->collapse(GTK_TREE_ITEM(gtkobj()));
-//     gtk_widget_hide(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
+       Gtk_TreeItem::collapse_impl();
 }
 
 void Gtk_LdapTreeItem::expand_impl() {
@@ -200,18 +199,5 @@ void Gtk_LdapTreeItem::expand_impl() {
        Gtk_LdapTreeItem *item;
        G_List<GtkWidget> *list;
        Gtk_Tree *tree;
-       Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
-       if (!sig->expand) return;
-       sig->expand(GTK_TREE_ITEM(gtkobj()));
-//     Gtk_Tree *t;
-//     t = new Gtk_Tree(GTK_TREE(GTK_TREE_ITEM(this->gtkobj())->subtree));
-//     bool vis = t->visible();
-//     if (vis == false) {
-//             gtk_widget_show(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
-//             cout << this->dn << " expanded" << endl;
-//     }
-//     else {
-//             gtk_widget_hide(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
-//             cout << this->dn << " collapsed" << endl;
-//     }
+       Gtk_TreeItem::expand_impl();
 }
index ad5cbe279fd8a79486d742d632cfb1d7fc4a28e1..fe0a12bdab0bd59544b0e6293344d75e94967999 100644 (file)
@@ -38,7 +38,7 @@ public:
        void setType(int t);
        int getDetails();
        int showDetails();
-       void show_impl();
+//     void show_impl();
        void select_impl();
        void collapse_impl();
        void expand_impl();
index bb2d1179a35a3766e35b78c826c6892b2218f249..befe581a4fcf2e65f6af812c13dd9ed1f3fbfd1f 100644 (file)
@@ -1,30 +1,30 @@
 HOME_LOCATION=$(shell pwd)
-CC=    gcc
 CPLUS= g++
-OPTS=-g -DDEBUG
+OPTS=-g #-DDEBUG
 INCLUDES=`gtkmm-config --cflags` -I.
 LDFLAGS=`gtkmm-config --libs` -L/usr/lib -L/usr/X11/lib -L/usr/local/gnome/lib -L/usr/local/ldap/lib -lldap -llber -L/usr/local/kerberos/lib -lkrb5 -lkrb4
 LIBS=-lXext -lgtkmm -lX11 -lXt -lXxf86dga
 
 .EXPORT_ALL_VARIABLES:
 
-SOURCES=       My_Window.cc Gtk_LdapTree.cc Gtk_LdapTreeItem.cc Gtk_LdapServer.cc utils.cc main.cc
-OBJECTS=       My_Window.o Gtk_LdapTree.o Gtk_LdapTreeItem.o Gtk_LdapServer.o utils.o main.o
+SOURCES=My_Window.cc Gtk_LdapTree.cc Gtk_LdapTreeItem.cc Gtk_LdapServer.cc utils.cc main.o
+OBJECTS=My_Window.o Gtk_LdapTree.o Gtk_LdapTreeItem.o Gtk_LdapServer.o utils.o main.o
 
 ################################################################################
 
-all:   $(OBJECTS) $(SOURCES)
+all: main
+main:  $(OBJECTS)
        $(CPLUS) $(OBJECTS) -o main $(LDFLAGS)
        exec
 
+main.o: main.cc
+       $(CPLUS) -c $(OPTS) $(INCLUDES) $<
+
 exec:  all
        chmod a+x main
        ls -al main
 
-%.o: %.c
-       $(CC) -c $(OPTS) $(INCLUDES) $<
-
-%.o: %.cc
+%.o: %.cc %.h
        $(CPLUS) -c $(OPTS) $(INCLUDES) $<
 
 clean: 
index 7cac6e8bc73c72e4dc02624d00be493a46821fd8..a6ad13dc5d1061e42dda42c496dd2a3bc8d8950d 100644 (file)
@@ -10,18 +10,20 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
 
        pane = new Gtk_HPaned();
        this->scroller = new Gtk_ScrolledWindow();
+       this->viewport = new Gtk_Viewport();
        this->scroller->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-//     this->scroller->set_usize(this->height(), 400);
+       this->scroller->add(*this->viewport);
        pane->add1(*this->scroller);
        this->scroller->show();
+       this->viewport->show();
 
-//     this->scroller2 = new My_Scroller();
        this->scroller2 = new Gtk_ScrolledWindow();
-       this->viewport = new Gtk_Viewport();
+       this->viewport2 = new Gtk_Viewport();
        this->scroller2->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-       this->scroller2->add(*this->viewport);
+       this->scroller2->add(*this->viewport2);
        pane->add2(*this->scroller2);   
        this->scroller2->show();
+       this->viewport2->show();
 
        top_hbox = new Gtk_HBox();
        menu = new Gtk_Menu();
@@ -29,7 +31,7 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
        menu->append(*menuitem);
        this->menubar = new Gtk_MenuBar();
        file_menu = new Gtk_MenuItem("File");
-       file_menu->set_submenu(menu);
+       file_menu->set_submenu(*menu);
        this->menubar->append(*file_menu);
        menuitem->show();
        menu->show();
@@ -39,8 +41,8 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
        this->urlfield = new Gtk_Entry();
        top_hbox->pack_start(*this->urlfield, TRUE, TRUE, 1);
        this->urlfield->show();
-       this->display_button = new Gtk_Button("Display");
-       connect_to_method(this->display_button->clicked, this, &do_display);
+       this->display_button = new Gtk_Button("Query Server");
+       connect_to_method(this->display_button->clicked, this, &getHost);
        top_hbox->pack_end(*this->display_button, FALSE, FALSE, 1);
        this->display_button->show();
 
@@ -91,6 +93,40 @@ void My_Window::do_display() {
        cout << this->urlfield->get_text() << endl;
 }
 
+void My_Window::getHost() {
+       debug("My_Window::getHost()\n");
+       Gtk_Tree *tree, *subtree;
+       Gtk_LdapServer *treeitem;
+       char *host, *prt;
+       int port;
+
+//     viewport = (Gtk_Viewport *) GTK_VIEWPORT(this->scroller->children()->nth_data(1));
+//     viewport = (Gtk_Viewport *)this->scroller->children()->nth_data(1);
+       if (this->viewport->get_child()!=NULL) {
+               tree = (Gtk_Tree *)(this->viewport->get_child());
+       }
+       else {
+               tree = new Gtk_Tree();
+       }
+       string thing;
+       thing = this->urlfield->get_text();
+       gchar **c;
+       c = g_strsplit(thing.c_str(), ":", 2);
+       host = c[0];
+       prt = c[1]; //strtok(NULL, "\0");
+       if (prt != NULL) port = atoi(prt);
+       else port = LDAP_PORT;
+       treeitem = new Gtk_LdapServer(this, host, port);
+       subtree = treeitem->getSubtree();
+       tree->append(*treeitem);
+       treeitem->set_subtree(*subtree);
+       treeitem->show();
+       this->viewport->add(tree);
+       tree->show();
+       this->viewport->show();
+       this->scroller->show();
+}
+
 gint My_Window::delete_event_impl(GdkEventAny*) {
        Gtk_Main::instance()->quit();
        return 0;
index 05f028bfbaf54a563bfe21be6d102bde3edb3a3a..f0dcc467c03c1b137253c87796588c298a250fbf 100644 (file)
@@ -2,12 +2,13 @@
 #define MY_WINDOW_H
 #include "cpluscommon.h"
 #include "gtk.h"
+#include "Gtk_LdapServer.h"
+#include "Gtk_LdapTreeItem.h"
 
 class My_Window : public Gtk_Window {
 public:
        Gtk_ScrolledWindow *scroller, *scroller2;
-       Gtk_Viewport *viewport;
-//     My_Scroller *scroller2;
+       Gtk_Viewport *viewport, *viewport2;
        Gtk_Entry *urlfield;
        Gtk_Button *display_button;
        Gtk_Paned *pane;
@@ -18,6 +19,7 @@ public:
        ~My_Window();
        int debug(const char *c,...);
        void do_display();
+       void getHost();
        gint delete_event_impl(GdkEventAny *);
 };
 #endif
index 31012c325e802c988f3121d58a97e3f7d3b1288c..70d7d31350e273a47aff8a5d670d00f7667b0766 100644 (file)
@@ -1,5 +1,10 @@
 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
index aff5f345e71636b082da063e025521b7ef5929e5..d1de3c15b8e07ed43d15335cb4d479f4a2079f49 100644 (file)
@@ -40,40 +40,47 @@ int main(int argc, char **argv) {
                debug("%s\n", hosts->nth_data(f));
        }
        if (hosts->length() == 0) {
+#ifdef LDAP_GET_OPT
+               printf("Supply me with a host please (hint: use -s\n");
+               exit(0);
+#else
                ldap_get_option(NULL, LDAP_OPT_HOST_NAME, host);
                hosts = hosts->append(host);
+#endif /* LDAP_GET_OPT */
        }       
        if (port == 0) port = LDAP_PORT;
 
        Gtk_Main m(&argc, &argv);
 
        window = new My_Window(GTK_WINDOW_TOPLEVEL);
+
+//     viewport = new Gtk_Viewport();
+       if (hosts!=NULL) {
+               tree = new Gtk_Tree();
+               for (int f=0; f<hosts->length(); f++) {
+                       host = strtok(hosts->nth_data(f), ":");
+                       prt = strtok(NULL, "\0");
+                       if (prt != NULL) port = atoi(prt);
+                       else port = LDAP_PORT;
+                       treeitem = new Gtk_LdapServer(window, host, port);
+                       subtree = treeitem->getSubtree();
+                       tree->append(*treeitem);
+                       treeitem->set_subtree(*subtree);
+                       treeitem->show();
+               }
+               window->viewport->add(tree);
+               tree->show();
+       }
+
+//     window->scroller->add(viewport);
+       window->viewport->show();
+       window->scroller->show();
+
        window->set_title("gtk-tool");
        window->activate();
        window->set_usize(600, 500);
        window->show();
 
-       tree = new Gtk_Tree();
-       for (int f=0; f<hosts->length(); f++) {
-               host = strtok(hosts->nth_data(f), ":");
-               prt = strtok(NULL, "\0");
-               if (prt != NULL) port = atoi(prt);
-               else port = LDAP_PORT;
-               treeitem = new Gtk_LdapServer(window, host, port);
-               subtree = treeitem->getSubtree();
-               tree->append(*treeitem);
-               treeitem->set_subtree(*subtree);
-               treeitem->show();
-       }
-       viewport = new Gtk_Viewport();
-       viewport->add(tree);
-       window->scroller->add(viewport);
-       tree->show();
-       viewport->show();
-       window->scroller->show();
-//     treeitem->showDetails();
-//     treeitem->select();
-
        m.run();
        return 0;
 }