ChangeLog for gtk-tool
+29/11/1998 - Pele
+ * Added Gtk_LdapServer class
+ * Started using cn=config, ldap_get_option (not sure about get_option
+ though, cn=config looks much nicer for the future-proofing)
+ * Can traverse, display and serve two (or possibly/hopefully) more
+ databases on the local machine - remote machines also possible -
+ need to use "-s hostname"
+ * The program needs the "-s" switch! Without it it won't run (temporary
+ "feature")
+
28/11/1998 - Pele
* Fixes, enhancements, started using ldap utility api
* It now traverses the whole tree at startup, not sure if it's smart
public:
Gtk_Tree *tree;
Gtk_LdapTreeItem *treeitem;
+ G_List<gchar> *value_list;
+ char *attribute_name;
+ G_List<Gtk_LdapItem> *attribute_list;
+ char *entry_name;
};
#endif
#define GTK_LDAPSERVER_H
#include "gtk.h"
#include <My_Window.h>
-#include <LdapOpts.h>
+/*#include <LdapOpts.h>*/
#include <Gtk_LdapItem.h>
#include <Gtk_LdapTreeItem.h>
#include <lber.h>
}
void Gtk_LdapTreeItem::setType(int t) {
- cout << "Gtk_LdapTreeItem::setType(" << t << ")" << endl;
+// cout << "Gtk_LdapTreeItem::setType(" << t << ")" << endl;
Gtk_Pixmap *xpm_icon;
Gtk_Label *label;
if (this->getchild() != NULL) {
}
int Gtk_LdapTreeItem::showDetails() {
- cout << "Gtk_LdapTreeItem::showDetails()" << endl;
+// cout << "Gtk_LdapTreeItem::showDetails()" << endl;
if (this->notebook != NULL) {
if (par->viewport->getchild() != NULL) {
par->viewport->remove_c(par->viewport->getchild()->gtkobj());
}
else this->getDetails();
this->showDetails();
+ return 0;
}
int Gtk_LdapTreeItem::getDetails() {
- cout << "Gtk_LdapTreeItem::getDetails()" << endl;
+// cout << "Gtk_LdapTreeItem::getDetails()" << endl;
int error, entriesCount;
BerElement *ber;
LDAPMessage *entry;
}
}
this->setType(1);
- cout << ".";
+// cout << ".";
return 0;
}
void Gtk_LdapTreeItem::select_impl() {
.EXPORT_ALL_VARIABLES:
-SOURCES= My_Window.cc Gtk_LdapTreeItem.cc main.cc
-OBJECTS= My_Window.o Gtk_LdapTreeItem.o main.o
+SOURCES= My_Window.cc Gtk_LdapTreeItem.cc Gtk_LdapServer.cc main.cc
+OBJECTS= My_Window.o Gtk_LdapTreeItem.o Gtk_LdapServer.o main.o
################################################################################
cout << "My_Window(t)" << endl;
Gtk_VBox *main_hbox;
Gtk_HBox *top_hbox;
+ Gtk_Menu *menu;
+ Gtk_MenuItem *file_menu, *menuitem;
pane = new Gtk_HPaned();
this->scroller = new Gtk_ScrolledWindow();
this->scroller2->show();
top_hbox = new Gtk_HBox();
+ menu = new Gtk_Menu();
+ menuitem = new Gtk_MenuItem("Quit");
+ menu->append(*menuitem);
+ this->menubar = new Gtk_MenuBar();
+ file_menu = new Gtk_MenuItem("File");
+ file_menu->set_submenu(menu);
+ this->menubar->append(*file_menu);
+ menuitem->show();
+ menu->show();
+ file_menu->show();
+// top_hbox->pack_start(*this->menubar, TRUE, TRUE, 1);
+ this->menubar->show();
this->urlfield = new Gtk_Entry();
top_hbox->pack_start(*this->urlfield, TRUE, TRUE, 1);
this->urlfield->show();
this->display_button->show();
main_hbox = new Gtk_VBox();
+ main_hbox->pack_start(*this->menubar, FALSE, FALSE, 1);
main_hbox->pack_start(*top_hbox, FALSE, TRUE, 1);
main_hbox->pack_end(*pane, TRUE, TRUE, 1);
top_hbox->show();
g_print("%s selected\n", name);
}
-gint My_Window::delete_event_impl(GdkEventAny *) {
+gint My_Window::delete_event_impl(GdkEventAny*) {
Gtk_Main::instance()->quit();
return 0;
}
Gtk_Entry *urlfield;
Gtk_Button *display_button;
Gtk_Paned *pane;
+ Gtk_MenuBar *menubar;
My_Window(GtkWindowType t);
~My_Window();
void do_display();
#include <ldap.h>
#include <My_Window.h>
#include <Gtk_LdapItem.h>
-#include <Gtk_LdapTreeItem.h>
+#include <Gtk_LdapServer.h>
int main(int argc, char **argv) {
My_Window *window;
Gtk_LdapItem *treeresult;
Gtk_Tree *tree, *subtree;
- Gtk_LdapTreeItem *treeitem;
+ Gtk_Tree *machine, *machinetree;
+ Gtk_LdapServer *treeitem;
Gtk_Viewport *viewport;
- LDAPMessage **thing;
- LDAP *ld;
char *host = NULL;
char *base_dn = NULL;
int c, port = 0;
}
}
-// if (base_dn == NULL) base_dn = ldap_get_option(NULL, LDAP_OPT_BASE);
- if (base_dn == NULL) base_dn = "o=University of Michigan, c=US";
+// if (base_dn == NULL) base_dn = "o=University of Michigan, c=US";
if (host == NULL) ldap_get_option(NULL, LDAP_OPT_HOST_NAME, host);
//host = "localhost";
+ cout << host << endl;
if (port == 0) port = LDAP_PORT;
Gtk_Main m(&argc, &argv);
window = new My_Window(GTK_WINDOW_TOPLEVEL);
- if ((ld = ldap_open(host, port)) == NULL) {
- perror("connection");
- }
-
tree = new Gtk_Tree();
- treeresult = window->make_tree(window, ld, base_dn);
- treeitem = new Gtk_LdapTreeItem(*treeresult->treeitem);
-// treeresult->treeitem->setType(ROOT_NODE);
+ treeitem = new Gtk_LdapServer(window, host, port);
tree->append(*treeitem);
- if (treeresult->tree != NULL) {
- subtree = new Gtk_Tree(*treeresult->tree);
- // cout << "Inserting " << base_dn << " into root" << endl;
- treeitem->set_subtree(*subtree);
- }
treeitem->show();
viewport = new Gtk_Viewport();
viewport->add(tree);