mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-09 02:52:04 +08:00
updates to gtk-tool, new functionality, uses config cn
This commit is contained in:
parent
d2995f7def
commit
fa96c5bacb
@ -1,5 +1,15 @@
|
||||
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
|
||||
|
@ -9,5 +9,9 @@ class Gtk_LdapItem {
|
||||
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
|
||||
|
@ -2,7 +2,7 @@
|
||||
#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>
|
||||
|
@ -20,7 +20,7 @@ Gtk_LdapTreeItem::~Gtk_LdapTreeItem() {
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -46,7 +46,7 @@ void Gtk_LdapTreeItem::setType(int t) {
|
||||
}
|
||||
|
||||
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());
|
||||
@ -58,10 +58,11 @@ int Gtk_LdapTreeItem::showDetails() {
|
||||
}
|
||||
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;
|
||||
@ -99,7 +100,7 @@ int Gtk_LdapTreeItem::getDetails() {
|
||||
}
|
||||
}
|
||||
this->setType(1);
|
||||
cout << ".";
|
||||
// cout << ".";
|
||||
return 0;
|
||||
}
|
||||
void Gtk_LdapTreeItem::select_impl() {
|
||||
|
@ -8,8 +8,8 @@ LIBS=-lXext -lgtkmm -lX11 -lXt -lXxf86dga
|
||||
|
||||
.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
|
||||
|
||||
################################################################################
|
||||
|
||||
|
@ -4,6 +4,8 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
|
||||
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();
|
||||
@ -21,6 +23,18 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
|
||||
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();
|
||||
@ -30,6 +44,7 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
|
||||
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();
|
||||
@ -54,7 +69,7 @@ void My_Window::expand(Gtk_TreeItem *t) {
|
||||
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;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
Gtk_Entry *urlfield;
|
||||
Gtk_Button *display_button;
|
||||
Gtk_Paned *pane;
|
||||
Gtk_MenuBar *menubar;
|
||||
My_Window(GtkWindowType t);
|
||||
~My_Window();
|
||||
void do_display();
|
||||
|
@ -4,16 +4,15 @@
|
||||
#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;
|
||||
@ -33,30 +32,19 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
Loading…
Reference in New Issue
Block a user