gqclient-commit Mailing List for GQ LDAP client (Page 8)
Status: Beta
Brought to you by:
sur5r
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
(14) |
Jul
(38) |
Aug
(5) |
Sep
(29) |
Oct
(30) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(30) |
Oct
(217) |
Nov
(24) |
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(53) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sta...@us...> - 2003-10-13 07:25:10
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv14958 Modified Files: dt_text.c dt_text.h Log Message: * Implemented proper line-sizing, the previous algorithm was completly broken, as it did not have any connection to what actually happened on screen. Index: dt_text.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_text.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dt_text.c 12 Oct 2003 16:52:57 -0000 1.13 --- dt_text.c 13 Oct 2003 07:25:00 -0000 1.14 *************** *** 147,225 **** } - static void dt_text_set_data(struct formfill *form, GByteArray *data, - GtkWidget *widget) - { - GtkWidget *text = gtk_bin_get_child(GTK_BIN(widget)); - GtkTextBuffer *b = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); - if (data) { - GtkTextIter start; - int y, height, x; - - gtk_text_buffer_set_text(b, (gchar*) data->data, data->len); - gtk_text_buffer_get_iter_at_offset(b, - &start, 0); - - gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(text), - &start, - &y, - &height); - - gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(text), - GTK_TEXT_WINDOW_WIDGET, - 0, height, - &x, &height); - height += gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(text)); - /* go through great lenghts to calculate the line height */ - { - - /* - Pango is expecting the size on "points divided by PANGO_SCALE". And for pango - the resolution for converting from points (a 1/72 inch) to pixels is the - fontconfig dpi (usually 96 these days, I guess). - - So, to convert from your pixels to points at fontconfig dpi you should do: - - pango_size = font_size_pix * PANGO_SCALE * 72 / fontconfig_dpi; - - If your fontconfig dpi is 75, the last 72 / fontconfig_dpi will be almost 1, - so you were getting an almost right resolt with this resolution. With a dpi - of 91, the factor is 0.79. And so on. - - I think that there is a GtkSetting or something to get the fontconfig dpi, but - I'm not sure. You can also get it using directly the fontconfig API. - - - */ - - /* - font_size_pix = pango_size * fontconfig_dpi / 72 / PANGO_SCALE ! */ ! ! double d = 1.0; ! int w, h; ! PangoContext *ctx = ! gtk_widget_get_pango_context(GTK_WIDGET(text)); ! GdkScreen *screen = gdk_screen_get_default(); ! int scr_h = gdk_screen_get_height(screen); ! int scr_hmm = gdk_screen_get_height_mm(screen); ! PangoLayout *lay = pango_layout_new(ctx); ! d = (scr_h / ((double) scr_hmm / 25.4)) / (72.0 * PANGO_SCALE); ! pango_layout_set_text(lay, "X", 1); ! pango_layout_get_size(lay, &w, &h); ! height = (int) ((double) h * d); ! g_object_unref(lay); ! } ! gtk_widget_set_size_request(GTK_WIDGET(text), 100, 5 * height); ! } } --- 147,192 ---- } ! static void realize_text(GtkWidget *text, gpointer user_data) ! { ! /* go through great lenghts to calculate the line height */ ! ! int height; ! PangoContext *ctx = gtk_widget_get_pango_context(GTK_WIDGET(text)); ! PangoLayout *lay = pango_layout_new(ctx); ! PangoRectangle rect; ! pango_layout_set_single_paragraph_mode(lay, FALSE); ! ! pango_layout_set_text(lay, "X\nX", 3); /* two lines */ ! pango_layout_get_pixel_extents(lay, &rect, NULL); ! height = rect.height; ! pango_layout_set_text(lay, "X", 1); /* one line */ ! pango_layout_get_pixel_extents(lay, &rect, NULL); ! height -= rect.height; /* difference is height of one line ... */ ! ! g_object_unref(lay); ! ! gtk_widget_set_size_request(GTK_WIDGET(text), 100, ! DEFAULT_LINES * height); ! } ! static void dt_text_set_data(struct formfill *form, GByteArray *data, ! GtkWidget *widget) ! { ! GtkWidget *text = gtk_bin_get_child(GTK_BIN(widget)); ! GtkTextBuffer *b = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); ! if (data) { ! gtk_text_buffer_set_text(b, (gchar*) data->data, data->len); ! gtk_signal_connect(GTK_OBJECT(text), "realize", ! (GtkSignalFunc) realize_text, NULL); ! } } Index: dt_text.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_text.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dt_text.h 30 Sep 2003 17:20:25 -0000 1.6 --- dt_text.h 13 Oct 2003 07:25:01 -0000 1.7 *************** *** 42,44 **** --- 42,46 ---- gpointer funcdata); + #define DEFAULT_LINES 5 + #endif |
From: <sta...@us...> - 2003-10-12 16:53:02
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv10115 Modified Files: dt_text.c Log Message: * Fixed several bug: could not delete attribute values with the multi-line text display-type * Fixed core dump upon empty attribute value for this display type * Try to size the text widget properly Index: dt_text.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_text.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dt_text.c 12 Oct 2003 06:14:18 -0000 1.12 --- dt_text.c 12 Oct 2003 16:52:57 -0000 1.13 *************** *** 95,101 **** #if GTK_MAJOR >= 2 GtkWidget *scrolled; ! inputbox = gtk_text_view_new(); gtk_widget_show(inputbox); scrolled = gtk_scrolled_window_new(NULL, NULL); --- 95,102 ---- #if GTK_MAJOR >= 2 GtkWidget *scrolled; ! inputbox = gtk_text_view_new(); gtk_widget_show(inputbox); + scrolled = gtk_scrolled_window_new(NULL, NULL); *************** *** 137,142 **** if (!c) return NULL; ! a = g_byte_array_new(); ! g_byte_array_append(a, c, strlen(c)); g_free(c); --- 138,145 ---- if (!c) return NULL; ! if (strlen(c) != 0) { ! a = g_byte_array_new(); ! g_byte_array_append(a, c, strlen(c)); ! } g_free(c); *************** *** 149,153 **** GtkWidget *text = gtk_bin_get_child(GTK_BIN(widget)); GtkTextBuffer *b = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); ! gtk_text_buffer_set_text(b, (gchar*) data->data, data->len); } --- 152,225 ---- GtkWidget *text = gtk_bin_get_child(GTK_BIN(widget)); GtkTextBuffer *b = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); ! ! if (data) { ! GtkTextIter start; ! int y, height, x; ! ! ! gtk_text_buffer_set_text(b, (gchar*) data->data, data->len); ! gtk_text_buffer_get_iter_at_offset(b, ! &start, 0); ! ! gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(text), ! &start, ! &y, ! &height); ! ! gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(text), ! GTK_TEXT_WINDOW_WIDGET, ! 0, height, ! &x, &height); ! height += gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(text)); ! ! /* go through great lenghts to calculate the line height */ ! { ! ! /* ! Pango is expecting the size on "points divided by PANGO_SCALE". And for pango ! the resolution for converting from points (a 1/72 inch) to pixels is the ! fontconfig dpi (usually 96 these days, I guess). ! ! So, to convert from your pixels to points at fontconfig dpi you should do: ! ! pango_size = font_size_pix * PANGO_SCALE * 72 / fontconfig_dpi; ! ! If your fontconfig dpi is 75, the last 72 / fontconfig_dpi will be almost 1, ! so you were getting an almost right resolt with this resolution. With a dpi ! of 91, the factor is 0.79. And so on. ! ! I think that there is a GtkSetting or something to get the fontconfig dpi, but ! I'm not sure. You can also get it using directly the fontconfig API. ! ! ! */ ! ! /* ! ! font_size_pix = pango_size * fontconfig_dpi / 72 / PANGO_SCALE ! ! */ ! ! ! double d = 1.0; ! int w, h; ! PangoContext *ctx = ! gtk_widget_get_pango_context(GTK_WIDGET(text)); ! GdkScreen *screen = gdk_screen_get_default(); ! int scr_h = gdk_screen_get_height(screen); ! int scr_hmm = gdk_screen_get_height_mm(screen); ! PangoLayout *lay = pango_layout_new(ctx); ! ! d = (scr_h / ((double) scr_hmm / 25.4)) / (72.0 * PANGO_SCALE); ! ! pango_layout_set_text(lay, "X", 1); ! pango_layout_get_size(lay, &w, &h); ! ! height = (int) ((double) h * d); ! g_object_unref(lay); ! } ! ! gtk_widget_set_size_request(GTK_WIDGET(text), 100, 5 * height); ! } } |
From: <sta...@us...> - 2003-10-12 11:10:47
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv18710 Modified Files: browse.c browse.h configfile.c util.c Log Message: * Initial LDAP referral support in Browse Mode!!!!! Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** browse.c 12 Oct 2003 06:22:56 -0000 1.79 --- browse.c 12 Oct 2003 11:10:40 -0000 1.80 *************** *** 65,68 **** --- 65,72 ---- struct tab *tab); + static GtkCTreeNode *ref_browse_single_add(const char *uri, + GtkCTree *ctree, + GtkCTreeNode *node); + /* A GtkDestroyNotify callback to be used as a destroy function for browse_entry objects attached to gtk objects */ *************** *** 70,75 **** { if (!entry) return; ! if (entry->destroy) { ! entry->destroy(entry); } else { free(entry); --- 74,80 ---- { if (!entry) return; ! assert(entry->base_methods); ! if (entry->base_methods->destroy) { ! entry->base_methods->destroy(entry); } else { free(entry); *************** *** 177,183 **** --- 182,191 ---- char message[MAX_DN_LEN + 21]; char *dummy[] = { "dummy", NULL }; + char *ref[] = { "ref", NULL }; char *c, **refs; int context = error_new_context(_("Expand entry")); + assert(IS_DN_ENTRY(entry)); + if (!entry->seen) { server = server_from_node(ctree, node); *************** *** 213,216 **** --- 221,264 ---- #endif + + /* check if this is a referral object */ + if (server->show_ref) { + msg = ldap_search(ld, entry->dn, LDAP_SCOPE_BASE, + "objectclass=referral", ref, 0); + + if(msg == -1) { + statusbar_msg("%s", ldap_err2string(msg)); + close_connection(server, FALSE); + gtk_clist_thaw(GTK_CLIST(ctree)); + + error_flush(context); + return; + } + + while((rc = ldap_result(ld, msg, 0, + NULL, &res)) == LDAP_RES_SEARCH_ENTRY) { + for(e = ldap_first_entry(ld, res) ; e != NULL ; + e = ldap_next_entry(ld, e)) { + char **vals = ldap_get_values(ld, e, "ref"); + int i; + + if (vals == NULL) continue; + + for(i = 0; vals[i]; i++) { + entry->is_ref = TRUE; /* now we know for sure */ + ref_browse_single_add(vals[i], ctree, node); + } + } + ldap_msgfree(res); + } + if (entry->is_ref) { + entry->seen = TRUE; + statusbar_msg(_("Showing referrals")); + gtk_clist_thaw(GTK_CLIST(ctree)); + close_connection(server, FALSE); + return; + } + } + msg = ldap_search(ld, entry->dn, LDAP_SCOPE_ONELEVEL, "objectclass=*", dummy, 1); *************** *** 352,355 **** --- 400,405 ---- int hidden = 0; + assert(IS_DN_ENTRY(entry)); + if (ctreenode == NULL) return; *************** *** 431,435 **** refresh_subtree(ctree, node); ! entry->base_methods.select((browse_entry *) entry, ctree, node, tab); } --- 481,485 ---- refresh_subtree(ctree, node); ! entry->base_methods->select((browse_entry *) entry, ctree, node, tab); } *************** *** 438,447 **** char* dn_browse_entry_get_name(dn_browse_entry *entry, gboolean long_form) { ! char **exploded_dn = gq_ldap_explode_dn(entry->dn, FALSE); char *g; #if GTK_MAJOR >= 2 g = g_strdup(exploded_dn[0]); #else ! char *l = decoded_string(exploded_dn[0]); /* impedance match -> malloc to g_malloc */ --- 488,505 ---- char* dn_browse_entry_get_name(dn_browse_entry *entry, gboolean long_form) { ! char **exploded_dn; char *g; + #if GTK_MAJOR < 2 + char *l; + #endif + + assert(IS_DN_ENTRY(entry)); + + exploded_dn = gq_ldap_explode_dn(entry->dn, FALSE); + #if GTK_MAJOR >= 2 g = g_strdup(exploded_dn[0]); #else ! l = decoded_string(exploded_dn[0]); /* impedance match -> malloc to g_malloc */ *************** *** 454,457 **** --- 512,523 ---- } + static struct browse_entry_vtab dn_vtab = { + (browse_entry_destructor) destroy_dn_browse_entry, /* destroy */ + (browse_entry_expand) dn_browse_entry_expand, /* expand */ + (browse_entry_select) browse_edit_from_entry, /* select */ + (browse_entry_refresh) dn_browse_entry_refresh, /* refresh */ + (browse_entry_get_name) dn_browse_entry_get_name, /* get_name */ + }; + /* *************** *** 461,468 **** { dn_browse_entry *e; ! e = g_malloc(sizeof(dn_browse_entry)); ! memset(e, 0, sizeof(dn_browse_entry)); ! e->base_methods.rtti_info = &dn_browse_entry_rtti; if (dn != NULL) e->dn = g_strdup(dn); --- 527,534 ---- { dn_browse_entry *e; ! e = g_malloc0(sizeof(dn_browse_entry)); ! e->type = DN_BROWSE_ENTRY; ! e->base_methods = &dn_vtab; if (dn != NULL) e->dn = g_strdup(dn); *************** *** 470,484 **** e->leaf = FALSE; - e->base_methods.destroy = - (browse_entry_destructor) destroy_dn_browse_entry; - e->base_methods.expand = - (browse_entry_expand) dn_browse_entry_expand; - e->base_methods.select = - (browse_entry_select) browse_edit_from_entry; - e->base_methods.refresh = - (browse_entry_refresh) dn_browse_entry_refresh; - e->base_methods.get_name = - (browse_entry_get_name) dn_browse_entry_get_name; - return (browse_entry *) e; } --- 536,539 ---- *************** *** 528,531 **** --- 583,589 ---- { GList *suffixes = NULL, *next; + + assert(IS_SERVER_ENTRY(entry)); + if (!entry->once_expanded) { /* printf("expanding %s\n", entry->server->name); */ *************** *** 567,571 **** int row = 0; char buf[128]; ! LDAP *ld = open_connection(entry->server); server_name = entry->server->name; /* dn_by_node(node); */ --- 625,633 ---- int row = 0; char buf[128]; ! LDAP *ld; ! ! assert(IS_SERVER_ENTRY(entry)); ! ! ld = open_connection(entry->server); server_name = entry->server->name; /* dn_by_node(node); */ *************** *** 894,897 **** --- 956,961 ---- struct tab *tab) { + assert(IS_SERVER_ENTRY(entry)); + entry->once_expanded = 0; *************** *** 915,939 **** gboolean long_form) { return g_strdup(entry->server->name); } browse_entry *new_server_browse_entry(struct ldapserver *server) { server_browse_entry *e; ! e = g_malloc(sizeof(server_browse_entry)); ! memset(e, 0, sizeof(server_browse_entry)); ! e->base_methods.rtti_info = &server_browse_entry_rtti; ! ! e->base_methods.expand = ! (browse_entry_expand) server_browse_entry_expand; ! e->base_methods.select = ! (browse_entry_select) server_browse_entry_selected; ! e->base_methods.refresh = ! (browse_entry_refresh) server_browse_entry_refresh; ! e->base_methods.get_name = ! (browse_entry_get_name) server_browse_entry_get_name; e->server = server; --- 979,1003 ---- gboolean long_form) { + assert(IS_SERVER_ENTRY(entry)); return g_strdup(entry->server->name); } + static struct browse_entry_vtab server_vtab = { + (browse_entry_destructor) NULL, /* destroy */ + (browse_entry_expand) server_browse_entry_expand, /* expand */ + (browse_entry_select) server_browse_entry_selected, /* select */ + (browse_entry_refresh) server_browse_entry_refresh, /* refresh */ + (browse_entry_get_name) server_browse_entry_get_name, /* get_name */ + }; + browse_entry *new_server_browse_entry(struct ldapserver *server) { server_browse_entry *e; ! e = g_malloc0(sizeof(server_browse_entry)); ! e->type = SERVER_BROWSE_ENTRY; ! e->base_methods = &server_vtab; e->server = server; *************** *** 944,947 **** --- 1008,1268 ---- + /**************************************************************************/ + + + static GtkCTreeNode *ref_browse_single_add(const char *uri, + GtkCTree *ctree, + GtkCTreeNode *node) + { + const char *labels[] = { NULL, NULL }; + char *dummy[] = { "dummy", NULL }; + ref_browse_entry *new_entry; + GtkCTreeNode *new_item, *added = NULL; + + new_entry = (ref_browse_entry *) new_ref_browse_entry(uri); + + labels[0] = uri; + + added = gtk_ctree_insert_node(ctree, + node, NULL, + (char**) labels, /* bug in the GTK2 API: should be const */ + 0, + NULL, NULL, NULL, NULL, + FALSE, FALSE); + + gtk_ctree_node_set_row_data_full(ctree, + added, + new_entry, + (GtkDestroyNotify) destroy_browse_entry); + + /* add dummy node */ + new_item = gtk_ctree_insert_node(ctree, + added, NULL, + dummy, + 0, + NULL, NULL, NULL, NULL, + TRUE, FALSE); + + return added; + } + + static void free_ref_browse_entry(ref_browse_entry *entry) + { + if (!entry) return; + assert(IS_REF_ENTRY(entry)); + + g_free_if(entry->uri); + if (entry->server) { + free_ldapserver(entry->server); + entry->server = NULL; + } + + g_free(entry); + } + + /* + * a ref browse entry was selected in the tree widget. + * + * put up some info. + */ + static void ref_browse_entry_selected(ref_browse_entry *entry, + GtkCTree *ctree, + GtkCTreeNode *node, + struct tab *tab) + { + GtkWidget *pane2_scrwin, *pane2_vbox, *label, *e; + GtkWidget *table; + int row = 0; + + assert(IS_REF_ENTRY(entry)); + + g_string_assign(BROWSETAB(tab)->cur_dn, entry->uri); + BROWSETAB(tab)->cur_server = NULL; + + pane2_scrwin = BROWSETAB(tab)->pane2_scrwin; + pane2_vbox = BROWSETAB(tab)->pane2_vbox; + + /* gtk_widget_destroy(pane2_vbox); */ + /* remove the viewport of the scrolled window. This should + _really_ destroy the widgets below it. The pane2_scrwin + is a GtkBin Object and thus has only one child, use this + to obtain the viewport */ + + gtk_container_remove(GTK_CONTAINER(pane2_scrwin), + GTK_BIN(pane2_scrwin)->child); + + pane2_vbox = gtk_vbox_new(FALSE, 2); + BROWSETAB(tab)->pane2_vbox = pane2_vbox; + + gtk_widget_show(pane2_vbox); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pane2_scrwin), + pane2_vbox); + + table = gtk_table_new(5, 2, FALSE); + gtk_container_border_width(GTK_CONTAINER(table), 5); + gtk_widget_show(table); + gtk_box_pack_start(GTK_BOX(pane2_vbox), table, FALSE, FALSE, 5); + + /* URI */ + label = gtk_label_new(_("Referral URI")); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), + label, + 0, 1, row, row+1, + GTK_SHRINK, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + 0, 0); + + e = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(e), entry->uri); + gtk_widget_set_sensitive(e, FALSE); + gtk_widget_show(e); + gtk_table_attach(GTK_TABLE(table), + e, + 1, 2, row, row+1, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + 0, 0); + row++; + } + + static void ref_browse_entry_expand(ref_browse_entry *entry, + GtkCTree *ctree, + GtkCTreeNode *node, + struct tab *tab) + { + if (!entry->expanded) { + LDAPURLDesc *desc = NULL; + + while (GTK_CTREE_ROW(node)->children) { + gtk_ctree_remove_node(ctree, GTK_CTREE_ROW(node)->children); + } + + if (ldap_url_parse(entry->uri, &desc) == 0) { + const char *labels[] = { desc->lud_dn, NULL }; + char *dummy[] = { "dummy", NULL }; + GtkCTreeNode *new_item, *added = NULL; + browse_entry *new_entry; + GString *new_uri = + g_string_sized_new(strlen(entry->uri)); + g_string_sprintf(new_uri, "%s://%s:%d/", + desc->lud_scheme, + desc->lud_host, + desc->lud_port); + + entry->server = new_ldapserver(); + g_free_and_dup(entry->server->ldaphost, new_uri->str); + g_free_and_dup(entry->server->basedn, desc->lud_dn); + entry->expanded = TRUE; + + gtk_clist_freeze(GTK_CLIST(ctree)); + + new_entry = new_dn_browse_entry(desc->lud_dn); + + added = gtk_ctree_insert_node(ctree, + node, NULL, + (char**) labels, /* bug in the GTK2 API: should be const */ + 0, + NULL, NULL, NULL, NULL, + FALSE, FALSE); + + gtk_ctree_node_set_row_data_full(ctree, + added, + new_entry, + (GtkDestroyNotify) destroy_browse_entry); + + /* add dummy node */ + new_item = gtk_ctree_insert_node(ctree, + added, NULL, + dummy, + 0, + NULL, NULL, NULL, NULL, + TRUE, FALSE); + + gtk_clist_thaw(GTK_CLIST(ctree)); + + ldap_free_urldesc(desc); + } + } + } + + char* ref_browse_entry_get_name(ref_browse_entry *entry, gboolean long_form) + { + char *g; + #if GTK_MAJOR < 2 + char *l; + #endif + + assert(IS_REF_ENTRY(entry)); + + #if GTK_MAJOR >= 2 + g = g_strdup(entry->uri); + #else + l = decoded_string(entry->uri); + /* impedance match -> malloc to g_malloc */ + g = g_strdup(l); + free(l); + #endif + + return g; + } + + static void ref_browse_entry_refresh(ref_browse_entry *entry, + GtkCTree *ctree, + GtkCTreeNode *node, + struct tab *tab) + { + assert(IS_REF_ENTRY(entry)); + + entry->expanded = 0; + + gtk_clist_freeze(GTK_CLIST(ctree)); + + ref_browse_entry_selected(entry, ctree, node, tab); + + /* toggle expansion twice to fire the expand callback and to + return to the current expansion state */ + gtk_ctree_toggle_expansion(ctree, node); + gtk_ctree_toggle_expansion(ctree, node); + + /* server_browse_entry_expand(entry, ctree, node, tab); */ + + gtk_clist_thaw(GTK_CLIST(ctree)); + + } + + static struct browse_entry_vtab ref_vtab = { + (browse_entry_destructor) free_ref_browse_entry, /* destroy */ + (browse_entry_expand) ref_browse_entry_expand, /* expand */ + (browse_entry_select) ref_browse_entry_selected, /* select */ + (browse_entry_refresh) ref_browse_entry_refresh, /* refresh */ + (browse_entry_get_name) ref_browse_entry_get_name, /* get_name */ + }; + + + browse_entry *new_ref_browse_entry(const char *uri) + { + ref_browse_entry *e; + e = g_malloc0(sizeof(ref_browse_entry)); + + e->type = REF_BROWSE_ENTRY; + e->base_methods = &ref_vtab; + + /* e->server = server; */ + + e->uri = g_strdup(uri); + + return (browse_entry *) e; + } + + + + + + + + + + /* * adds a single server to the root node *************** *** 1024,1029 **** if (!entry) return; ! if (entry->expand) { ! entry->expand(entry, ctree, ctree_node, tab); } } --- 1345,1351 ---- if (!entry) return; ! assert(entry->base_methods); ! if (entry->base_methods->expand) { ! entry->base_methods->expand(entry, ctree, ctree_node, tab); } } *************** *** 1061,1066 **** if (entry) { ! if (entry->select) { ! entry->select(entry, ctree, node, tab); } BROWSETAB(tab)->tree_row_selected = node; --- 1383,1389 ---- if (entry) { ! assert(entry->base_methods); ! if (entry->base_methods->select) { ! entry->base_methods->select(entry, ctree, node, tab); } BROWSETAB(tab)->tree_row_selected = node; *************** *** 1083,1088 **** if (!entry) return; ! if (entry->refresh) { ! entry->refresh(entry, ctree, node, tab); } --- 1406,1412 ---- if (!entry) return; ! assert(entry->base_methods); ! if (entry->base_methods->refresh) { ! entry->base_methods->refresh(entry, ctree, node, tab); } *************** *** 1310,1313 **** --- 1634,1640 ---- return ((server_browse_entry*) entry)->server; } + if (IS_REF_ENTRY(entry)) { + return ((ref_browse_entry*) entry)->server; + } } return NULL; *************** *** 1994,1998 **** p_entry = (browse_entry *) gtk_ctree_node_get_row_data(ctree, parent); if (p_entry) { ! p_entry->refresh(p_entry, ctree, parent, tab); } } --- 2321,2328 ---- p_entry = (browse_entry *) gtk_ctree_node_get_row_data(ctree, parent); if (p_entry) { ! assert(p_entry->base_methods); ! if (p_entry->base_methods->refresh) ! p_entry->base_methods->refresh(p_entry, ctree, ! parent, tab); } } *************** *** 2048,2052 **** /* The get_name method already does UTF-8 decoding */ ! name = entry->base_methods.get_name((browse_entry *) entry, FALSE); BROWSETAB(tab)->tree_row_popped_up = ctree_node; --- 2378,2382 ---- /* The get_name method already does UTF-8 decoding */ ! name = entry->base_methods->get_name((browse_entry *) entry, FALSE); BROWSETAB(tab)->tree_row_popped_up = ctree_node; Index: browse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** browse.h 11 Oct 2003 22:37:47 -0000 1.29 --- browse.h 12 Oct 2003 11:10:41 -0000 1.30 *************** *** 49,57 **** }; - typedef struct _browse_entry browse_entry; struct ldapserver *server_from_node(GtkCTree *ctreeroot, GtkCTreeNode *node); /** Define an OO style object hierarchy for the payload data for CTree --- 49,64 ---- }; struct ldapserver *server_from_node(GtkCTree *ctreeroot, GtkCTreeNode *node); + struct browse_entry_vtab; + + /* the basic browse entry layout */ + typedef struct { + /* common */ + int type; + struct browse_entry_vtab *base_methods; + } browse_entry; /** Define an OO style object hierarchy for the payload data for CTree *************** *** 76,85 **** gboolean long_form); - /* The basic object layout */ - struct _browse_entry { - /** runtime type identification information - every type must - define a private integer variable this information points to */ - int *rtti_info; /* destructor */ browse_entry_destructor destroy; --- 83,91 ---- gboolean long_form); + #define IS_ENTRY(o,t) ((o) && (((browse_entry *)(o))->type == t)) + + /* The basic methods */ + struct browse_entry_vtab { /* destructor */ browse_entry_destructor destroy; *************** *** 98,139 **** }; /* * A browse_entry describing a singe DN (eg. a single LDAP object) */ ! typedef struct { ! struct _browse_entry base_methods; char *dn; gboolean seen; gboolean leaf; gboolean uncache; - } dn_browse_entry; - - extern int dn_browse_entry_rtti; - - #define IS_DN_ENTRY(entry) (((entry) != NULL) && (((struct _browse_entry *)(entry))->rtti_info == &dn_browse_entry_rtti)) - /* * A browse_entry object describing a LDAP server */ typedef struct { ! struct _browse_entry base_methods; struct ldapserver *server; int once_expanded; } server_browse_entry; ! /* RTTI info variable */ ! extern int server_browse_entry_rtti; ! #define IS_SERVER_ENTRY(entry) (((entry) != NULL) && (((struct _browse_entry *)(entry))->rtti_info == &server_browse_entry_rtti)) ! browse_entry *new_dn_browse_entry(const char *dn); ! browse_entry *new_server_browse_entry(struct ldapserver *server); /* get the server object for the current entry */ --- 104,169 ---- }; + /**************************************************************************/ /* * A browse_entry describing a singe DN (eg. a single LDAP object) */ ! #define DN_BROWSE_ENTRY 1 typedef struct { ! /* common */ ! int type; ! struct browse_entry_vtab *base_methods; ! /* specific */ char *dn; gboolean seen; gboolean leaf; gboolean uncache; + gboolean is_ref; /* set if this entry is a referral and children + of it should thus become ref_browse_entry + objects */ + } dn_browse_entry; + #define IS_DN_ENTRY(entry) IS_ENTRY((entry), DN_BROWSE_ENTRY) + browse_entry *new_dn_browse_entry(const char *dn); + /**************************************************************************/ /* * A browse_entry object describing a LDAP server */ + #define SERVER_BROWSE_ENTRY 2 typedef struct { ! /* common */ ! int type; ! struct browse_entry_vtab *base_methods; ! /* specific */ struct ldapserver *server; int once_expanded; } server_browse_entry; ! #define IS_SERVER_ENTRY(entry) IS_ENTRY((entry), SERVER_BROWSE_ENTRY) ! browse_entry *new_server_browse_entry(struct ldapserver *server); + /**************************************************************************/ + /* + * A browse_entry object describing a dynamic LDAP server (referral) + */ + #define REF_BROWSE_ENTRY 3 + typedef struct { + /* common */ + int type; + struct browse_entry_vtab *base_methods; + /* specific */ + char *uri; + struct ldapserver *server; + gboolean expanded; + } ref_browse_entry; ! #define IS_REF_ENTRY(entry) IS_ENTRY((entry), REF_BROWSE_ENTRY) ! ! browse_entry *new_ref_browse_entry(const char *uri); + /**************************************************************************/ /* get the server object for the current entry */ Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** configfile.c 12 Oct 2003 05:30:41 -0000 1.41 --- configfile.c 12 Oct 2003 11:10:41 -0000 1.42 *************** *** 114,117 **** --- 114,121 ---- void free_ldapserver(struct ldapserver *server) { + if (server->connection) { + close_connection(server, 1); + } + g_free_if(server->name); g_free_if(server->ldaphost); Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** util.c 12 Oct 2003 06:22:57 -0000 1.70 --- util.c 12 Oct 2003 11:10:41 -0000 1.71 *************** *** 34,37 **** --- 34,38 ---- #include <string.h> #include <pwd.h> + #include <errno.h> #include <config.h> *************** *** 106,109 **** --- 107,116 ---- ld = NULL; } + + if(!ld) { + error_push(open_context, + _("Failed to initialize LDAP structure: %s."), + ldap_err2string(rc)); + } #else ld = NULL; *************** *** 113,123 **** } else { ld = ldap_init(server->ldaphost, server->ldapport); } ! ! if(!ld) { ! error_push(open_context, ! _("Failed to initialize LDAP structure.")); ! } ! else { server->server_down = 0; server->version = LDAP_VERSION2; --- 120,131 ---- } else { ld = ldap_init(server->ldaphost, server->ldapport); + if(!ld) { + error_push(open_context, + _("Failed to initialize LDAP structure: %s."), + strerror(errno)); + } } ! ! if (ld) { server->server_down = 0; server->version = LDAP_VERSION2; |
From: <sta...@us...> - 2003-10-12 06:23:02
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv10596 Modified Files: browse.c input.c mainwin.c prefs.c util.c Log Message: * Asure it compiles/works with gtk1 * Removed some left-over debug prints Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** browse.c 11 Oct 2003 22:37:47 -0000 1.78 --- browse.c 12 Oct 2003 06:22:56 -0000 1.79 *************** *** 1175,1181 **** --- 1175,1183 ---- BROWSETAB(tab)->cur_server->name); + #if GTK_MAJOR >= 2 if (BROWSETAB(tab)->mainpane) state_value_set_int(state_name, "gutter-pos", gtk_paned_get_position(GTK_PANED(BROWSETAB(tab)->mainpane))); + #endif } Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** input.c 12 Oct 2003 05:48:20 -0000 1.67 --- input.c 12 Oct 2003 06:22:57 -0000 1.68 *************** *** 663,667 **** #if GTK_MAJOR < 2 not_in_schema = gtk_style_copy(gtk_widget_get_default_style()); ! not_in_schema->fg[GTK_STATE_NORMAL] = cotcol; must_in_schema = gtk_style_copy(gtk_widget_get_default_style()); --- 663,667 ---- #if GTK_MAJOR < 2 not_in_schema = gtk_style_copy(gtk_widget_get_default_style()); ! not_in_schema->fg[GTK_STATE_NORMAL] = notcol; must_in_schema = gtk_style_copy(gtk_widget_get_default_style()); Index: mainwin.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** mainwin.c 11 Oct 2003 21:47:51 -0000 1.43 --- mainwin.c 12 Oct 2003 06:22:57 -0000 1.44 *************** *** 238,246 **** int i; - printf("REMOVED TAB 1\n"); - tab = gtk_object_get_data(GTK_OBJECT(content), "tab"); if (tab) { - printf("REMOVED TAB 2\n"); thismode = tab->type; g_hash_table_insert(win->lastofmode, (gpointer) thismode, NULL); --- 238,243 ---- *************** *** 386,390 **** gtk_container_add(GTK_CONTAINER(menuFile), Close); gtk_signal_connect_object(GTK_OBJECT(Close), "activate", ! GTK_SIGNAL_FUNC(close_current_tab), win); gtk_widget_add_accelerator(Close, "activate", accel_group, 'W', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); --- 383,388 ---- gtk_container_add(GTK_CONTAINER(menuFile), Close); gtk_signal_connect_object(GTK_OBJECT(Close), "activate", ! GTK_SIGNAL_FUNC(close_current_tab), ! (gpointer) win); gtk_widget_add_accelerator(Close, "activate", accel_group, 'W', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** prefs.c 11 Oct 2003 21:47:51 -0000 1.40 --- prefs.c 12 Oct 2003 06:22:57 -0000 1.41 *************** *** 1012,1016 **** gtk_signal_connect_object(GTK_OBJECT(cancelbutton), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), ! editwindow); gtk_signal_connect(GTK_OBJECT(editwindow), "key_press_event", GTK_SIGNAL_FUNC(destroy_edit_server_window_on_esc), --- 1012,1016 ---- gtk_signal_connect_object(GTK_OBJECT(cancelbutton), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), ! (gpointer) editwindow); gtk_signal_connect(GTK_OBJECT(editwindow), "key_press_event", GTK_SIGNAL_FUNC(destroy_edit_server_window_on_esc), Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** util.c 11 Oct 2003 20:45:42 -0000 1.69 --- util.c 12 Oct 2003 06:22:57 -0000 1.70 *************** *** 1755,1764 **** { int s = -1; int n = string->allocated_len; ! va_list ap; assert(string); ! printf("gq_g_string_sprintf...\n"); /* while (s > string->len || s < 0) { */ for (;;) { --- 1755,1767 ---- { int s = -1; + #if GTK_MAJOR >= 2 int n = string->allocated_len; ! #else ! int n = 0; ! #endif va_list ap; assert(string); ! /* printf("gq_g_string_sprintf...\n"); */ /* while (s > string->len || s < 0) { */ for (;;) { *************** *** 1776,1790 **** } ! printf("resizing %d to %d...\n", s, n); #if GTK_MAJOR >= 2 g_string_set_size(string, n + 1); #else ! /* Uarghhh, what an ugly hack */ ! char *tmp = g_malloc(n + 1); ! memset(tmp, 'x', n); ! tmp[n] = 0; ! g_string_assign(string, tmp); ! g_free(tmp); #endif va_end(ap); --- 1779,1795 ---- } ! /* printf("resizing %d to %d...\n", s, n); */ #if GTK_MAJOR >= 2 g_string_set_size(string, n + 1); #else ! { ! /* Uarghhh, what an ugly hack */ ! char *tmp = g_malloc(n + 1); ! memset(tmp, 'x', n); ! tmp[n] = 0; ! g_string_assign(string, tmp); ! g_free(tmp); ! } #endif va_end(ap); |
From: <sta...@us...> - 2003-10-12 06:14:22
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv9595 Modified Files: dt_binary.c dt_cert.c dt_clist.c dt_crl.c dt_entry.c dt_generic_binary.c dt_jpeg.c dt_oc.c dt_password.c dt_text.c dt_time.c search.c syntax.c syntax.h Log Message: * Rudimentary display type support for search results Index: dt_binary.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_binary.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dt_binary.c 12 Oct 2003 05:48:20 -0000 1.14 --- dt_binary.c 12 Oct 2003 06:14:18 -0000 1.15 *************** *** 68,72 **** static dt_binary_handler dt_binary_handler_vtab = { { ! "Binary", TRUE, dt_binary_get_widget, /* reused from dt_generic_binary */ dt_binary_get_data, --- 68,74 ---- static dt_binary_handler dt_binary_handler_vtab = { { ! "Binary", ! TRUE, ! FALSE, dt_binary_get_widget, /* reused from dt_generic_binary */ dt_binary_get_data, Index: dt_cert.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_cert.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dt_cert.c 29 Sep 2003 19:24:16 -0000 1.8 --- dt_cert.c 12 Oct 2003 06:14:18 -0000 1.9 *************** *** 72,76 **** { { ! "Certificate", TRUE, dt_clist_get_widget, dt_clist_get_data, --- 72,79 ---- { { ! "Certificate", ! TRUE, ! FALSE, ! dt_clist_get_widget, dt_clist_get_data, Index: dt_clist.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_clist.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dt_clist.c 9 Oct 2003 05:15:06 -0000 1.5 --- dt_clist.c 12 Oct 2003 06:14:18 -0000 1.6 *************** *** 60,64 **** { { ! "Column List", FALSE, dt_clist_get_widget, dt_clist_get_data, --- 60,67 ---- { { ! "Column List", ! FALSE, ! FALSE, ! dt_clist_get_widget, dt_clist_get_data, Index: dt_crl.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_crl.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dt_crl.c 29 Sep 2003 19:24:16 -0000 1.5 --- dt_crl.c 12 Oct 2003 06:14:18 -0000 1.6 *************** *** 71,75 **** { { ! "Certificate Revocation List", TRUE, dt_clist_get_widget, dt_clist_get_data, --- 71,78 ---- { { ! "Certificate Revocation List", ! TRUE, ! FALSE, ! dt_clist_get_widget, dt_clist_get_data, Index: dt_entry.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_entry.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dt_entry.c 2 Oct 2003 16:16:25 -0000 1.10 --- dt_entry.c 12 Oct 2003 06:14:18 -0000 1.11 *************** *** 55,59 **** static dt_entry_handler dt_entry_handler_vtab = { { ! "Entry", TRUE, dt_entry_get_widget, dt_entry_get_data, --- 55,62 ---- static dt_entry_handler dt_entry_handler_vtab = { { ! "Entry", ! TRUE, ! TRUE, ! dt_entry_get_widget, dt_entry_get_data, Index: dt_generic_binary.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_generic_binary.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dt_generic_binary.c 2 Oct 2003 16:16:25 -0000 1.10 --- dt_generic_binary.c 12 Oct 2003 06:14:18 -0000 1.11 *************** *** 68,71 **** --- 68,72 ---- { "Generic Binary", FALSE, + FALSE, dt_generic_binary_get_widget, NULL, Index: dt_jpeg.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_jpeg.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dt_jpeg.c 30 Sep 2003 17:20:25 -0000 1.10 --- dt_jpeg.c 12 Oct 2003 06:14:18 -0000 1.11 *************** *** 58,62 **** static dt_jpeg_handler dt_jpeg_handler_vtab = { { /* dt_handler */ ! "JPEG", TRUE, dt_generic_binary_get_widget, /* reused from dt_generic_binary */ dt_jpeg_get_data, --- 58,65 ---- static dt_jpeg_handler dt_jpeg_handler_vtab = { { /* dt_handler */ ! "JPEG", ! TRUE, ! FALSE, /* might become TRUE in years to come */ ! dt_generic_binary_get_widget, /* reused from dt_generic_binary */ dt_jpeg_get_data, Index: dt_oc.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_oc.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dt_oc.c 8 Oct 2003 22:01:07 -0000 1.17 --- dt_oc.c 12 Oct 2003 06:14:18 -0000 1.18 *************** *** 60,64 **** static dt_oc_handler dt_oc_handler_vtab = { { ! "Objectclass", FALSE, dt_oc_get_widget, dt_oc_get_data, --- 60,66 ---- static dt_oc_handler dt_oc_handler_vtab = { { ! "Objectclass", ! FALSE, ! TRUE, dt_oc_get_widget, dt_oc_get_data, Index: dt_password.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_password.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dt_password.c 11 Oct 2003 07:07:40 -0000 1.16 --- dt_password.c 12 Oct 2003 06:14:18 -0000 1.17 *************** *** 95,99 **** static dt_password_handler dt_password_handler_vtab = { { ! "Password", TRUE, dt_password_get_widget, dt_password_get_data, --- 95,102 ---- static dt_password_handler dt_password_handler_vtab = { { ! "Password", ! TRUE, ! TRUE, ! dt_password_get_widget, dt_password_get_data, Index: dt_text.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_text.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dt_text.c 2 Oct 2003 16:16:26 -0000 1.11 --- dt_text.c 12 Oct 2003 06:14:18 -0000 1.12 *************** *** 59,63 **** static dt_text_handler dt_text_handler_vtab = { { ! "Multi-line Text", TRUE, dt_text_get_widget, #if GTK_MAJOR >= 2 --- 59,66 ---- static dt_text_handler dt_text_handler_vtab = { { ! "Multi-line Text", ! TRUE, ! TRUE, ! dt_text_get_widget, #if GTK_MAJOR >= 2 Index: dt_time.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_time.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dt_time.c 11 Oct 2003 21:26:31 -0000 1.9 --- dt_time.c 12 Oct 2003 06:14:18 -0000 1.10 *************** *** 62,66 **** static dt_time_handler dt_time_handler_vtab = { ! "Generalized Time", TRUE, dt_time_get_widget, dt_time_get_data, --- 62,69 ---- static dt_time_handler dt_time_handler_vtab = { ! "Generalized Time", ! TRUE, ! TRUE, ! dt_time_get_widget, dt_time_get_data, Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** search.c 11 Oct 2003 22:37:09 -0000 1.46 --- search.c 12 Oct 2003 06:14:18 -0000 1.47 *************** *** 47,50 **** --- 47,51 ---- #include "browse.h" #include "state.h" + #include "syntax.h" #include "utf8-compat.h" *************** *** 638,646 **** for(attr = ldap_first_attribute(ld, e, &berptr); attr != NULL; attr = ldap_next_attribute(ld, e, berptr)) { ! /* ! struct syntax_handler *handler = ! get_syntax_handler_of_attr(server, attr, NULL); ! */ ! /* This should now work for ;binary as well */ --- 639,647 ---- for(attr = ldap_first_attribute(ld, e, &berptr); attr != NULL; attr = ldap_next_attribute(ld, e, berptr)) { ! ! if (!show_in_search(server, attr)) { ! ldap_memfree(attr); ! continue; ! } /* This should now work for ;binary as well */ Index: syntax.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/syntax.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** syntax.c 28 Sep 2003 23:10:49 -0000 1.16 --- syntax.c 12 Oct 2003 06:14:18 -0000 1.17 *************** *** 571,574 **** --- 571,588 ---- } + int show_in_search(struct ldapserver *server, const char *attrname) + { + display_type_handler *dh; + struct syntax_handler *sh = + get_syntax_handler_of_attr(server, attrname, NULL); + + if (!sh) return FALSE; + + dh = get_dt_handler(sh->displaytype); + if (!dh) return FALSE; + + return dh->show_in_search_result; + } + GByteArray *identity(const char *val, int len) { Index: syntax.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/syntax.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** syntax.h 28 Sep 2003 23:10:49 -0000 1.8 --- syntax.h 12 Oct 2003 06:14:18 -0000 1.9 *************** *** 46,49 **** --- 46,51 ---- char *name; gboolean selectable; + gboolean show_in_search_result; + GtkWidget* (*get_widget)(struct formfill *form, GByteArray *data, *************** *** 71,74 **** --- 73,78 ---- display_type_handler *get_dt_handler(int type); int get_dt_from_handler(display_type_handler *h); + + int show_in_search(struct ldapserver *server, const char *attrname); void init_syntaxes(void); |
From: <sta...@us...> - 2003-10-12 05:51:45
|
Update of /cvsroot/gqclient/gq In directory sc8-pr-cvs1:/tmp/cvs-serv7133 Modified Files: TODO Log Message: * Being optimistic and moving some items to the "done" section Index: TODO =================================================================== RCS file: /cvsroot/gqclient/gq/TODO,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** TODO 11 Oct 2003 08:55:31 -0000 1.37 --- TODO 12 Oct 2003 05:51:41 -0000 1.38 *************** *** 14,20 **** 1.0 it will be marked as BROKEN in the GUI - * [1.0] schemabrowse mode: items require a double-click to be selected, not - a single click as usual - * update schemabrowse tree on serverlist update (browsetree already done) --- 14,17 ---- *************** *** 47,50 **** --- 44,51 ---- sizelimits??? + * Take care to properly deal with schema information in case of a lost + connection with a server. + + * [1.x] Entry widget: fonts are not used on startup ------------------ *************** *** 59,64 **** ----- ! * use scrolled area in error_flush: ldifadd.c may generate 1000s of errors ------------ --- 60,70 ---- ----- ! * use scrolled area in error_flush: ldifadd.c may generate 1000s of ! errors This is not as simple as it seems. Just using a scrolled ! window won't work, as the autosizing of the dialog will not work ! properly then. + * make the add attribute button insensitive if the shown object is not + an extensibleObject ------------ *************** *** 66,75 **** ------------ ! * [1.0] Get rid of Hashtables as central data structures. This is to ! get in some type safety. [Mostly done by Bert for tabs, done by ! Peter for mainwin and preferences] ! Use a run-type typing system to catch improper use of data structures ! * Make the tabs (Search/Browse/Schema) object oriented. * [1.0] Referral support --- 72,79 ---- ------------ ! * [1.x] Enhance the rudimentary run-type typing system to catch ! improper use of data structures ! * Make the tabs (Search/Browse/Schema) object oriented. Partly done. * [1.0] Referral support *************** *** 108,113 **** * [1.0] Improve LDAP error reporting ! * [1.0] work towards gtk2 - mostly done, need the XML parser change ! (see below) for encoding reasons. * [1.x] never do ldap_add when moving trees. (Use triangulation like --- 112,116 ---- * [1.0] Improve LDAP error reporting ! * [1.x] improve gtk2 support * [1.x] never do ldap_add when moving trees. (Use triangulation like *************** *** 137,140 **** --- 140,154 ---- FIXED BUGS / IMPLEMENTED ENHANCEMENTS ------------------------------------- + + * [1.0] work towards gtk2 - mostly done, need the XML parser change + (see below) for encoding reasons. + + * [1.0] Get rid of Hashtables as central data structures. This is to + get in some type safety. [Mostly done by Bert for tabs, done by + Peter for mainwin and preferences] + Use a run-type typing system to catch improper use of data structures + + * [1.0] schemabrowse mode: items require a double-click to be selected, not + a single click as usual * [1.0] schemabrowse mode: context menu on server, refresh option segfaults |
From: <sta...@us...> - 2003-10-12 05:48:24
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv6861 Modified Files: dt_binary.c input.c Log Message: * Fixed color/style handling in gtk2 Index: dt_binary.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_binary.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dt_binary.c 8 Oct 2003 22:58:46 -0000 1.13 --- dt_binary.c 12 Oct 2003 05:48:20 -0000 1.14 *************** *** 84,88 **** --- 84,92 ---- }; + #if GTK_MAJOR < 2 static GtkStyle *fixed_style = NULL; + #else + static PangoFontDescription *fixed_font = NULL; + #endif display_type_handler *dt_binary_get_handler() { *************** *** 321,333 **** gtk_widget_show(widget); gtk_text_set_editable(GTK_TEXT(widget), TRUE); ! if (!fixed_style) { ! fixed_style = gtk_style_new(); #if GTK_MAJOR >= 2 ! gtk_style_set_font(fixed_style, gdk_font_load("fixed")); #else fixed_style->font = gdk_font_load("fixed"); - #endif } gtk_widget_set_style(widget, fixed_style); } if (newtype & DT_BINARY_ENTRY) { --- 325,341 ---- gtk_widget_show(widget); gtk_text_set_editable(GTK_TEXT(widget), TRUE); ! #if GTK_MAJOR >= 2 ! if (!fixed_font) { ! fixed_font = pango_font_description_from_string("fixed"); ! } ! gtk_widget_modify_font(widget, fixed_font); #else + if (!fixed_style) { + fixed_style = gtk_style_new(); fixed_style->font = gdk_font_load("fixed"); } gtk_widget_set_style(widget, fixed_style); + #endif } if (newtype & DT_BINARY_ENTRY) { Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** input.c 11 Oct 2003 21:35:29 -0000 1.66 --- input.c 12 Oct 2003 05:48:20 -0000 1.67 *************** *** 636,645 **** { GList *values, *formlist, *widgetList; ! GdkColor red = { 0, 0xffff, 0x0000, 0x0000 }; GdkColor mustcol = { 0, 0x5c00, 0x3800, 0xffff }; GdkColor delcol = { 0, 0xd600, 0xa000, 0x0000 }; GdkColor extensible_col = { 0, 0xffff, 0x0000, 0xffff }; GtkStyle *not_in_schema, *must_in_schema, *del_schema, *extensible_attr; GtkWidget *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; --- 636,647 ---- { GList *values, *formlist, *widgetList; ! GdkColor notcol = { 0, 0xffff, 0x0000, 0x0000 }; GdkColor mustcol = { 0, 0x5c00, 0x3800, 0xffff }; GdkColor delcol = { 0, 0xd600, 0xa000, 0x0000 }; GdkColor extensible_col = { 0, 0xffff, 0x0000, 0xffff }; + #if GTK_MAJOR < 2 GtkStyle *not_in_schema, *must_in_schema, *del_schema, *extensible_attr; + #endif GtkWidget *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; *************** *** 653,671 **** GByteArray *gb; ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &red, FALSE, TRUE); not_in_schema = gtk_style_copy(gtk_widget_get_default_style()); ! not_in_schema->fg[GTK_STATE_NORMAL] = red; - gdk_colormap_alloc_color(gdk_colormap_get_system(), &mustcol, FALSE, TRUE); must_in_schema = gtk_style_copy(gtk_widget_get_default_style()); must_in_schema->fg[GTK_STATE_NORMAL] = mustcol; - gdk_colormap_alloc_color(gdk_colormap_get_system(), &delcol, FALSE, TRUE); del_schema = gtk_style_copy(gtk_widget_get_default_style()); del_schema->fg[GTK_STATE_NORMAL] = delcol; - extensible_attr = gtk_style_copy(gtk_widget_get_default_style()); extensible_attr->fg[GTK_STATE_NORMAL] = extensible_col; /* mind form->num_inputfields and len(GList * values) may not --- 655,677 ---- GByteArray *gb; ! gdk_colormap_alloc_color(gdk_colormap_get_system(), ¬col, FALSE, TRUE); ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &mustcol, FALSE,TRUE); ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &delcol, FALSE, TRUE); ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &extensible_col, ! FALSE, TRUE); ! ! #if GTK_MAJOR < 2 not_in_schema = gtk_style_copy(gtk_widget_get_default_style()); ! not_in_schema->fg[GTK_STATE_NORMAL] = cotcol; must_in_schema = gtk_style_copy(gtk_widget_get_default_style()); must_in_schema->fg[GTK_STATE_NORMAL] = mustcol; del_schema = gtk_style_copy(gtk_widget_get_default_style()); del_schema->fg[GTK_STATE_NORMAL] = delcol; extensible_attr = gtk_style_copy(gtk_widget_get_default_style()); extensible_attr->fg[GTK_STATE_NORMAL] = extensible_col; + #endif /* mind form->num_inputfields and len(GList * values) may not *************** *** 678,682 **** --- 684,693 ---- GtkWidget *label = gtk_label_new("dn"); gtk_misc_set_alignment(GTK_MISC(label), LABEL_JUSTIFICATION, .5); + + #if GTK_MAJOR >= 2 + gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &mustcol); + #else gtk_widget_set_style(label, must_in_schema); + #endif gtk_widget_show(label); gtk_table_attach(GTK_TABLE(iform->table), label, 0, 1, 0, 1, *************** *** 758,769 **** gtk_widget_restore_default_style(ff->label); ! if(ff->flags & FLAG_NOT_IN_SCHEMA) gtk_widget_set_style(ff->label, not_in_schema); ! if(ff->flags & FLAG_MUST_IN_SCHEMA) gtk_widget_set_style(ff->label, must_in_schema); ! if(ff->flags & FLAG_DEL_ME) gtk_widget_set_style(ff->label, del_schema); ! if(ff->flags & FLAG_EXTENSIBLE_OBJECT_ATTR) gtk_widget_set_style(ff->label, extensible_attr); currcnt = ff->widgetList ? g_list_length(ff->widgetList) : 0; --- 769,800 ---- gtk_widget_restore_default_style(ff->label); ! #if GTK_MAJOR >= 2 ! if(ff->flags & FLAG_NOT_IN_SCHEMA) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, ¬col); ! } ! if(ff->flags & FLAG_MUST_IN_SCHEMA) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, &mustcol); ! } ! if(ff->flags & FLAG_DEL_ME) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, &delcol); ! } ! if(ff->flags & FLAG_EXTENSIBLE_OBJECT_ATTR) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, ! &extensible_col); ! } ! #else ! if(ff->flags & FLAG_NOT_IN_SCHEMA) { gtk_widget_set_style(ff->label, not_in_schema); ! } ! if(ff->flags & FLAG_MUST_IN_SCHEMA) { gtk_widget_set_style(ff->label, must_in_schema); ! } ! if(ff->flags & FLAG_DEL_ME) { gtk_widget_set_style(ff->label, del_schema); ! } ! if(ff->flags & FLAG_EXTENSIBLE_OBJECT_ATTR) { gtk_widget_set_style(ff->label, extensible_attr); + } + #endif currcnt = ff->widgetList ? g_list_length(ff->widgetList) : 0; *************** *** 844,851 **** } g_free(decode_buf); ! gtk_style_unref(not_in_schema); gtk_style_unref(must_in_schema); gtk_style_unref(del_schema); /* restore the hide-status from a previous LDAP object... */ --- 875,884 ---- } g_free(decode_buf); ! #if GTK_MAJOR < 2 gtk_style_unref(not_in_schema); gtk_style_unref(must_in_schema); gtk_style_unref(del_schema); + gtk_style_unref(extensible_attr); + #endif /* restore the hide-status from a previous LDAP object... */ |
From: <sta...@us...> - 2003-10-12 05:30:46
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5162 Modified Files: configfile.c configfile.h state.c Log Message: * Made XML writing attribute aware Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** configfile.c 11 Oct 2003 22:38:51 -0000 1.40 --- configfile.c 12 Oct 2003 05:30:41 -0000 1.41 *************** *** 263,300 **** } ! void config_write_bool(struct writeconfig *wc, int value, const char *entity) { ! char outstr[128]; ! assert(strlen(entity) < 40); ! snprintf(outstr, sizeof(outstr), ! "<%s>%s</%s>\n", entity, value ? "True" : "False", entity); ! config_write(wc, outstr); } ! void config_write_int(struct writeconfig *wc, int value, const char *entity) { ! char outstr[128]; ! assert(strlen(entity) < 40); ! snprintf(outstr, sizeof(outstr), ! "<%s>%d</%s>\n", entity, value, entity); ! config_write(wc, outstr); } ! void config_write_string(struct writeconfig *wc, const char *value, const char *entity) { ! GString *outstr; gunichar c; ! outstr = g_string_sized_new(1024); ! g_string_sprintf(outstr, "<%s>", entity); ! for(c = g_utf8_get_char(value); c; value = g_utf8_next_char(value), c = g_utf8_get_char(value)) { switch(c) { case '<': --- 263,348 ---- } + static void append_single_attr(const char *key, const char *val, + GString *str) + { + g_string_sprintfa(str, " %s='%s'", key, val); + } ! static void start_tag(GString *str, const char *entity, GHashTable *attr) { ! g_string_sprintfa(str, "<%s", entity); ! if (attr) { ! g_hash_table_foreach(attr, (GHFunc) append_single_attr, str); ! } ! g_string_sprintfa(str, ">"); ! } ! static void end_tag(GString *str, const char *entity) ! { ! g_string_sprintfa(str, "</%s>\n", entity); ! } + void config_write_start_tag(struct writeconfig *wc, + const char *entity, GHashTable *attr) + { + GString *outstr = g_string_sized_new(128); + + start_tag(outstr, entity, attr); + g_string_append(outstr, "\n"); + + config_write(wc, outstr->str); + g_string_free(outstr, TRUE); } + void config_write_end_tag(struct writeconfig *wc, const char *entity) + { + GString *outstr = g_string_sized_new(128); ! end_tag(outstr, entity); ! ! config_write(wc, outstr->str); ! g_string_free(outstr, TRUE); ! } ! ! ! void config_write_bool(struct writeconfig *wc, int value, const char *entity, ! GHashTable *attr) { ! GString *outstr = g_string_sized_new(128); ! start_tag(outstr, entity, attr); ! g_string_sprintfa(outstr, "%s", value ? "True" : "False"); ! end_tag(outstr, entity); + config_write(wc, outstr->str); + g_string_free(outstr, TRUE); } ! void config_write_int(struct writeconfig *wc, int value, const char *entity, ! GHashTable *attr) { ! GString *outstr = g_string_sized_new(128); ! ! start_tag(outstr, entity, attr); ! g_string_sprintfa(outstr, "%d", value); ! end_tag(outstr, entity); ! ! config_write(wc, outstr->str); ! g_string_free(outstr, TRUE); ! } ! ! ! void config_write_string(struct writeconfig *wc, ! const char *value, ! const char *entity, GHashTable *attr) ! { ! GString *outstr = g_string_sized_new(1024); gunichar c; ! start_tag(outstr, entity, attr); ! for(c = g_utf8_get_char(value); c ; ! value = g_utf8_next_char(value), c = g_utf8_get_char(value)) { switch(c) { case '<': *************** *** 318,324 **** } ! g_string_append(outstr, "</"); ! g_string_append(outstr, entity); ! g_string_append(outstr, ">\n"); config_write(wc, outstr->str); --- 366,370 ---- } ! end_tag(outstr, entity); config_write(wc, outstr->str); *************** *** 328,335 **** void config_write_string_ne(struct writeconfig *wc, ! const char *value, const char *entity) { ! if(value && strlen(value)) ! config_write_string(wc, value, entity); } --- 374,383 ---- void config_write_string_ne(struct writeconfig *wc, ! const char *value, ! const char *entity, GHashTable *attr) { ! if(value && strlen(value)) { ! config_write_string(wc, value, entity, attr); ! } } *************** *** 341,346 **** wc->indent++; ! config_write_string(wc, key, "dt-attribute"); ! config_write_int(wc, *value, "dt-default"); wc->indent--; --- 389,394 ---- wc->indent++; ! config_write_string(wc, key, "dt-attribute", NULL); ! config_write_int(wc, *value, "dt-default", NULL); wc->indent--; *************** *** 411,440 **** if (cfg->config_version > 0) { ! config_write_int(wc, cfg->config_version, "config-version"); ! config_write_int(wc, cfg->config_version, "asked-config-version"); ! config_write_int(wc, cfg->config_version, "last-asked"); } ! config_write_bool(wc, cfg->confirm_mod, "confirm-mod"); ! config_write_string(wc, detokenize(token_searchargument, cfg->search_argument), ! "search-argument"); ! config_write_bool(wc, cfg->showdn, "show-dn"); ! config_write_bool(wc, cfg->showoc, "show-oc"); ! config_write_bool(wc, cfg->show_rdn_only, "show-rdn-only"); ! config_write_bool(wc, cfg->sort_search, "sort-search-mode"); ! config_write_bool(wc, cfg->sort_browse, "sort-browse-mode"); config_write_bool(wc, cfg->restore_window_sizes, ! "restore-window-sizes"); config_write_bool(wc, cfg->restore_window_positions, ! "restore-window-positions"); config_write_bool(wc, cfg->restore_search_history, ! "restore-search-history"); config_write_bool(wc, cfg->restore_tabs, ! "restore-tabs"); ! config_write_string(wc, detokenize(token_ldifformat, cfg->ldifformat), "ldif-format"); if(strlen(cfg->schemaserver)) ! config_write_string(wc, cfg->schemaserver, "schema-server"); config_write(wc, "\n"); --- 459,491 ---- if (cfg->config_version > 0) { ! config_write_int(wc, cfg->config_version, "config-version", NULL); ! config_write_int(wc, cfg->config_version, "asked-config-version", ! NULL); ! config_write_int(wc, cfg->config_version, "last-asked", NULL); } ! config_write_bool(wc, cfg->confirm_mod, "confirm-mod", NULL); ! config_write_string(wc, detokenize(token_searchargument, ! cfg->search_argument), ! "search-argument", NULL); ! config_write_bool(wc, cfg->showdn, "show-dn", NULL); ! config_write_bool(wc, cfg->showoc, "show-oc", NULL); ! config_write_bool(wc, cfg->show_rdn_only, "show-rdn-only", NULL); ! config_write_bool(wc, cfg->sort_search, "sort-search-mode", NULL); ! config_write_bool(wc, cfg->sort_browse, "sort-browse-mode", NULL); config_write_bool(wc, cfg->restore_window_sizes, ! "restore-window-sizes", NULL); config_write_bool(wc, cfg->restore_window_positions, ! "restore-window-positions", NULL); config_write_bool(wc, cfg->restore_search_history, ! "restore-search-history", NULL); config_write_bool(wc, cfg->restore_tabs, ! "restore-tabs", NULL); ! config_write_string(wc, detokenize(token_ldifformat, cfg->ldifformat), ! "ldif-format", NULL); if(strlen(cfg->schemaserver)) ! config_write_string(wc, cfg->schemaserver, "schema-server", NULL); config_write(wc, "\n"); *************** *** 448,465 **** wc->indent++; ! config_write_string(wc, server->name, "name"); ! config_write_string(wc, server->ldaphost, "ldaphost"); ! config_write_int(wc, server->ldapport, "ldapport"); ! config_write_string_ne(wc, server->basedn, "basedn"); ! config_write_string_ne(wc, server->binddn, "binddn"); if (cfg->config_version == 0) { ! config_write_string_ne(wc, server->bindpw, "bindpw"); } else { GString *pw = g_string_sized_new(32); b64_encode(pw, server->bindpw, strlen(server->bindpw)); ! config_write_string_ne(wc, pw->str, "bindpw"); ! config_write_string_ne(wc, "Base64", "pw-encoding"); g_string_free(pw, TRUE); --- 499,516 ---- wc->indent++; ! config_write_string(wc, server->name, "name", NULL); ! config_write_string(wc, server->ldaphost, "ldaphost", NULL); ! config_write_int(wc, server->ldapport, "ldapport", NULL); ! config_write_string_ne(wc, server->basedn, "basedn", NULL); ! config_write_string_ne(wc, server->binddn, "binddn", NULL); if (cfg->config_version == 0) { ! config_write_string_ne(wc, server->bindpw, "bindpw", NULL); } else { GString *pw = g_string_sized_new(32); b64_encode(pw, server->bindpw, strlen(server->bindpw)); ! config_write_string_ne(wc, pw->str, "bindpw", NULL); ! config_write_string_ne(wc, "Base64", "pw-encoding", NULL); g_string_free(pw, TRUE); *************** *** 467,486 **** if(server->bindtype != DEFAULT_BINDTYPE) ! config_write_string_ne(wc, detokenize(token_bindtype, server->bindtype), "bindtype"); ! config_write_string_ne(wc, server->searchattr, "search-attribute"); if(server->maxentries != DEFAULT_MAXENTRIES) ! config_write_int(wc, server->maxentries, "maxentries"); if(server->cacheconn != DEFAULT_CACHECONN) ! config_write_bool(wc, server->cacheconn, "cache-connection"); if(server->enabletls != DEFAULT_ENABLETLS) ! config_write_bool(wc, server->enabletls, "enable-tls"); if(server->local_cache_timeout != DEFAULT_LOCAL_CACHE_TIMEOUT) ! config_write_int(wc, server->local_cache_timeout, "local-cache-timeout"); if(server->ask_pw != DEFAULT_ASK_PW) ! config_write_bool(wc, server->ask_pw, "ask-pw"); if(server->hide_internal != DEFAULT_HIDE_INTERNAL) ! config_write_bool(wc, server->hide_internal, "hide-internal"); if(server->show_ref != DEFAULT_SHOW_REF) ! config_write_bool(wc, server->show_ref, "show-ref"); wc->indent--; --- 518,541 ---- if(server->bindtype != DEFAULT_BINDTYPE) ! config_write_string_ne(wc, detokenize(token_bindtype, server->bindtype), "bindtype", NULL); ! config_write_string_ne(wc, server->searchattr, ! "search-attribute", NULL); if(server->maxentries != DEFAULT_MAXENTRIES) ! config_write_int(wc, server->maxentries, "maxentries", NULL); if(server->cacheconn != DEFAULT_CACHECONN) ! config_write_bool(wc, server->cacheconn, ! "cache-connection", NULL); if(server->enabletls != DEFAULT_ENABLETLS) ! config_write_bool(wc, server->enabletls, "enable-tls", NULL); if(server->local_cache_timeout != DEFAULT_LOCAL_CACHE_TIMEOUT) ! config_write_int(wc, server->local_cache_timeout, ! "local-cache-timeout", NULL); if(server->ask_pw != DEFAULT_ASK_PW) ! config_write_bool(wc, server->ask_pw, "ask-pw", NULL); if(server->hide_internal != DEFAULT_HIDE_INTERNAL) ! config_write_bool(wc, server->hide_internal, ! "hide-internal", NULL); if(server->show_ref != DEFAULT_SHOW_REF) ! config_write_bool(wc, server->show_ref, "show-ref", NULL); wc->indent--; *************** *** 495,502 **** wc->indent++; ! config_write_string(wc, template->name, "name"); oclist = template->objectclasses; while(oclist) { ! config_write_string(wc, (char *) oclist->data, "objectclass"); oclist = g_list_next(oclist); } --- 550,558 ---- wc->indent++; ! config_write_string(wc, template->name, "name", NULL); oclist = template->objectclasses; while(oclist) { ! config_write_string(wc, (char *) oclist->data, ! "objectclass", NULL); oclist = g_list_next(oclist); } *************** *** 515,524 **** wc->indent++; ! config_write_string(wc, filter->name, "name"); ! config_write_string(wc, filter->ldapfilter, "ldapfilter"); if(filter->servername[0]) ! config_write_string(wc, filter->servername, "servername"); if(filter->basedn[0]) ! config_write_string(wc, filter->basedn, "basedn"); wc->indent--; --- 571,580 ---- wc->indent++; ! config_write_string(wc, filter->name, "name", NULL); ! config_write_string(wc, filter->ldapfilter, "ldapfilter", NULL); if(filter->servername[0]) ! config_write_string(wc, filter->servername, "servername", NULL); if(filter->basedn[0]) ! config_write_string(wc, filter->basedn, "basedn", NULL); wc->indent--; Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** configfile.h 11 Oct 2003 21:47:51 -0000 1.28 --- configfile.h 12 Oct 2003 05:30:41 -0000 1.29 *************** *** 129,141 **** void free_writeconfig(struct writeconfig *wc); void config_write(struct writeconfig *wc, const char *string); void config_write_bool(struct writeconfig *wc, ! int value, const char *entity); void config_write_int(struct writeconfig *wc, ! int value, const char *entity); void config_write_string(struct writeconfig *wc, ! const char *value, const char *entity); void config_write_string_ne(struct writeconfig *wc, ! const char *value, const char *entity); --- 129,147 ---- void free_writeconfig(struct writeconfig *wc); + void config_write_start_tag(struct writeconfig *wc, + const char *entity, GHashTable *attr); + void config_write_end_tag(struct writeconfig *wc, const char *entity); + void config_write(struct writeconfig *wc, const char *string); void config_write_bool(struct writeconfig *wc, ! int value, const char *entity, GHashTable *attr); void config_write_int(struct writeconfig *wc, ! int value, const char *entity, GHashTable *attr); void config_write_string(struct writeconfig *wc, ! const char *value, ! const char *entity, GHashTable *attr); void config_write_string_ne(struct writeconfig *wc, ! const char *value, ! const char *entity, GHashTable *attr); Index: state.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/state.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** state.c 11 Oct 2003 22:34:18 -0000 1.4 --- state.c 12 Oct 2003 05:30:41 -0000 1.5 *************** *** 491,521 **** struct writeconfig *wc) { - int len = strlen(value_name) + 80; - char *msg = g_malloc(len); GList *l; ! snprintf(msg, len, "<state-value name='%s' type='%s'>\n", value_name, ! detokenize(token_value_type_names, v->type)); ! config_write(wc, msg); ! ! wc->indent++; switch (v->type) { case SV_int: ! snprintf(msg, len, "%d\n", *(v->val.int_val)); ! config_write(wc, msg); break; case SV_char: ! if (v->val.char_val) { ! config_write(wc, v->val.char_val); ! config_write(wc, "\n"); ! } break; case SV_list: wc->indent++; for ( l = v->val.list_val ; l ; l = g_list_next(l)) { ! config_write_string(wc, l->data, "list-item"); } wc->indent--; break; default: --- 491,519 ---- struct writeconfig *wc) { GList *l; + GHashTable *attr = g_hash_table_new(g_str_hash, g_str_equal); ! g_hash_table_insert(attr, "name", (void *) value_name); ! g_hash_table_insert(attr, "type", ! (void *) detokenize(token_value_type_names, v->type)); switch (v->type) { case SV_int: ! config_write_int(wc, *(v->val.int_val), "state-value", attr); break; case SV_char: ! config_write_string(wc, v->val.char_val, "state-value", attr); break; case SV_list: + config_write_start_tag(wc, "state-value", attr); wc->indent++; + for ( l = v->val.list_val ; l ; l = g_list_next(l)) { ! config_write_string(wc, l->data, "list-item", NULL); } + wc->indent--; + config_write_end_tag(wc, "state-value"); + break; default: *************** *** 523,530 **** } ! g_free(msg); ! ! wc->indent--; ! config_write(wc, "</state-value>\n"); } --- 521,525 ---- } ! g_hash_table_destroy(attr); } *************** *** 533,543 **** struct writeconfig *wc) { ! int len = strlen(state_name) + 80; ! char *msg = g_malloc(len); ! snprintf(msg, len, "<entity name='%s'>\n", state_name); ! config_write(wc, msg); ! g_free(msg); ! wc->indent++; g_hash_table_foreach(e->values, (GHFunc) save_single_value, --- 528,539 ---- struct writeconfig *wc) { ! GHashTable *attr = g_hash_table_new(g_str_hash, g_str_equal); ! ! g_hash_table_insert(attr, "name", (void *) state_name); ! config_write_start_tag(wc, "entity", attr); ! ! g_hash_table_destroy(attr); + wc->indent++; g_hash_table_foreach(e->values, (GHFunc) save_single_value, *************** *** 547,553 **** (GHFunc) save_single_entity, wc); - wc->indent--; ! config_write(wc, "</entity>\n"); } --- 543,549 ---- (GHFunc) save_single_entity, wc); wc->indent--; ! ! config_write_end_tag(wc, "entity"); } *************** *** 605,609 **** #endif ! config_write(wc, "<gq-state>\n"); wc->indent++; --- 601,605 ---- #endif ! config_write_start_tag(wc, "gq-state", NULL); wc->indent++; *************** *** 613,617 **** wc->indent--; ! config_write(wc, "</gq-state>\n"); free_writeconfig(wc); --- 609,613 ---- wc->indent--; ! config_write_end_tag(wc, "gq-state"); free_writeconfig(wc); |
From: <sta...@us...> - 2003-10-11 22:41:44
|
Update of /cvsroot/gqclient/gq/po In directory sc8-pr-cvs1:/tmp/cvs-serv23383 Modified Files: de.po Log Message: * New translations Index: de.po =================================================================== RCS file: /cvsroot/gqclient/gq/po/de.po,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** de.po 10 Oct 2003 08:22:25 -0000 1.21 --- de.po 11 Oct 2003 22:41:40 -0000 1.22 *************** *** 6,11 **** msgstr "" "Project-Id-Version: gq 1.0\n" ! "POT-Creation-Date: 2003-10-10 09:03+0200\n" ! "PO-Revision-Date: 2003-10-10 09:10+0200\n" "Last-Translator: Peter Stamfest <pe...@st...>\n" "Language-Team: LANGUAGE <LL...@li...>\n" --- 6,11 ---- msgstr "" "Project-Id-Version: gq 1.0\n" ! "POT-Creation-Date: 2003-10-11 23:55+0200\n" ! "PO-Revision-Date: 2003-10-11 23:57+0200\n" "Last-Translator: Peter Stamfest <pe...@st...>\n" "Language-Team: LANGUAGE <LL...@li...>\n" *************** *** 240,244 **** msgid "No valid configuration found. Using default (empty) configuration" ! msgstr "" msgid "" --- 240,244 ---- msgid "No valid configuration found. Using default (empty) configuration" ! msgstr "Keine gültige Konfiguration gefunden. Benutze Voreinstellungen." msgid "" *************** *** 937,940 **** --- 937,947 ---- msgstr "" "Soll die Suchhistorie über Programmneustarts hinweg beibehalten werden?" + + #. Restore Tabs + msgid "Restore Ta_bs" + msgstr "Register_karten wiederherstellen" + + msgid "If set then save and restore the state of the main window tabs." + msgstr "Sollen die Registerkarten über Programmneustarts hinweg wiederhergestellt werden." msgid "subschemaSubentry search on root DSE" |
From: <sta...@us...> - 2003-10-11 22:41:21
|
Update of /cvsroot/gqclient/gq In directory sc8-pr-cvs1:/tmp/cvs-serv23362 Modified Files: ChangeLog Log Message: * Recent changes Index: ChangeLog =================================================================== RCS file: /cvsroot/gqclient/gq/ChangeLog,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ChangeLog 10 Oct 2003 07:02:16 -0000 1.44 --- ChangeLog 11 Oct 2003 22:41:17 -0000 1.45 *************** *** 1,2 **** --- 1,16 ---- + 2003-10-11 Peter Stamfest <pe...@st...> + * Fixed several search related bug reported by Bert through TODO + * Made search mode UTF-8 clean and memory management safe wrt to + clist column handling + * Assure that the result columns can be resized in search mode + * Rewrote tab handling in mainwin to be more OO + * Save/Restore of mainwin and tab state + * Save/Restore of search history + * Got rid of many fixed-length buffers + * Work around g_string_sprintf problems + 2003-10-10 Peter Stamfest <pe...@st...> + * Released 1.0alpha2 + * Fixed a configure bug when both libxml 1 and 2 are available + (Reported by Marc Britten <yu...@mo...>) 2003-10-09 Peter Stamfest <pe...@st...> * Fixed the misuse of the tearoff menu items in many popup menus |
From: <sta...@us...> - 2003-10-11 22:41:04
|
Update of /cvsroot/gqclient/gq In directory sc8-pr-cvs1:/tmp/cvs-serv23303 Modified Files: configure.in Log Message: * Work around problems with g_string_sprintf and handling of %1$d-like formats Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** configure.in 11 Oct 2003 20:06:30 -0000 1.51 --- configure.in 11 Oct 2003 22:40:59 -0000 1.52 *************** *** 578,602 **** PRINTF=g_string_sprintf ! AC_CACHE_CHECK([reorderable $PRINTF arguments], gq_cv_${PRINTF}_reordering, ! [ ! AC_TRY_RUN([ ! #include <stdio.h> ! #include <string.h> #include <glib.h> ! int main(int argc, char **argv) { ! char buf[80]; ! GString *str = g_string_new(""); ! $PRINTF(str, "%2\$d %1\$d", 1, 2); ! if (strcmp(str->str, "2 1") == 0) ! return 0; ! return 1; ! } ! ], ! eval "gq_cv_${PRINTF}_reordering=yes", ! eval "gq_cv_${PRINTF}_reordering=no", ! eval "gq_cv_${PRINTF}_reordering=no" ! ) ! ] ! ) --- 578,606 ---- PRINTF=g_string_sprintf ! AC_CACHE_CHECK([reorderable $PRINTF arguments], gq_cv_${PRINTF}_reordering, ! [ ! AC_TRY_RUN([ ! #include <stdio.h> ! #include <string.h> #include <glib.h> ! int main(int argc, char **argv) { ! char buf[80]; ! GString *str = g_string_new(""); ! $PRINTF(str, "%2\$d %1\$d", 1, 2); ! if (strcmp(str->str, "2 1") == 0) ! return 0; ! return 1; ! } ! ], ! eval "gq_cv_${PRINTF}_reordering=yes", ! eval "gq_cv_${PRINTF}_reordering=no", ! eval "gq_cv_${PRINTF}_reordering=no" ! ) ! ] ! ) ! ! if test "$gq_cv_g_string_sprintf_reordering" = "yes" ; then ! AC_DEFINE(HAVE_REORDERABLE_G_STRING_SPRINTF,,[Define if g_string_sprintf allows to reorder its arguments]) ! fi |
From: <sta...@us...> - 2003-10-11 22:38:55
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv22924 Modified Files: configfile.c Log Message: * A forgotten copyright year change Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** configfile.c 11 Oct 2003 21:47:51 -0000 1.39 --- configfile.c 11 Oct 2003 22:38:51 -0000 1.40 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen Copyright (C) 2002-2003 Peter Stamfest --- 1,5 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen Copyright (C) 2002-2003 Peter Stamfest |
From: <sta...@us...> - 2003-10-11 22:37:51
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv22657 Modified Files: browse.c browse.h Log Message: * Now the gutter position of the paned window also gets restored Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** browse.c 11 Oct 2003 21:47:51 -0000 1.77 --- browse.c 11 Oct 2003 22:37:47 -0000 1.78 *************** *** 1174,1177 **** --- 1174,1181 ---- state_value_set_string(state_name, "server", BROWSETAB(tab)->cur_server->name); + + if (BROWSETAB(tab)->mainpane) + state_value_set_int(state_name, "gutter-pos", + gtk_paned_get_position(GTK_PANED(BROWSETAB(tab)->mainpane))); } *************** *** 1182,1185 **** --- 1186,1190 ---- const char *dn = state_value_get_string(state_name, "dn", NULL); const char *s = state_value_get_string(state_name, "server", NULL); + int gutter = state_value_get_int(state_name, "gutter-pos", -1); if (dn && s) { *************** *** 1190,1193 **** --- 1195,1202 ---- } } + + if (gutter > 0) { + gtk_paned_set_position(GTK_PANED(BROWSETAB(tab)->mainpane), gutter); + } } *************** *** 1219,1222 **** --- 1228,1232 ---- gtk_widget_show(mainpane); gtk_box_pack_start(GTK_BOX(browsemode_vbox), mainpane, TRUE, TRUE, 0); + BROWSETAB(tab)->mainpane = mainpane; ctreeroot = gtk_ctree_new(1, 0); Index: browse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** browse.h 11 Oct 2003 21:47:51 -0000 1.28 --- browse.h 11 Oct 2003 22:37:47 -0000 1.29 *************** *** 39,42 **** --- 39,43 ---- GtkWidget *pane2_scrwin; GtkWidget *pane2_vbox; + GtkWidget *mainpane; GtkCTreeNode *tree_row_selected; struct inputform *inputform; |
From: <sta...@us...> - 2003-10-11 22:37:13
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv22347 Modified Files: search.c search.h Log Message: * Added persistency for per-tab search history Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** search.c 11 Oct 2003 21:35:30 -0000 1.45 --- search.c 11 Oct 2003 22:37:09 -0000 1.46 *************** *** 46,49 **** --- 46,50 ---- #include "i18n.h" #include "browse.h" + #include "state.h" #include "utf8-compat.h" *************** *** 57,60 **** --- 58,91 ---- + static void search_save_snapshot(char *state_name, struct tab *tab) + { + GList *hist = SEARCHTAB(tab)->history; + if (hist) { + state_value_set_list(state_name, "history", hist); + } + } + + + static void search_restore_snapshot(char *state_name, struct tab *tab) + { + if (config->restore_search_history) { + const GList *hist = state_value_get_list(state_name, "history"); + if (hist) { + const GList *I; + for (I = hist ; I ; I = g_list_next(I)) { + SEARCHTAB(tab)->history = + g_list_append(SEARCHTAB(tab)->history, + g_strdup(I->data)); + } + gtk_combo_set_popdown_strings(GTK_COMBO(SEARCHTAB(tab)->search_combo), + SEARCHTAB(tab)->history); + + } + } + } + + static struct tab_vtab search_vtab = { search_save_snapshot, + search_restore_snapshot }; + struct tab *new_searchmode() { *************** *** 67,70 **** --- 98,102 ---- struct tab *tab = g_malloc0(sizeof(struct tab)); tab->type = SEARCH_MODE; + tab->vtab = &search_vtab; modeinfo = g_malloc0(sizeof(struct tab_search)); *************** *** 76,85 **** gtk_box_pack_start(GTK_BOX(searchmode_vbox), hbox1, FALSE, FALSE, 3); ! /* FIXME for now, init this to an empty list -- modeinfo->history needs ! to be initialized from the session save facility when it's available */ searchhist = modeinfo->history; /* searchterm combo box */ ! searchcombo = gtk_combo_new(); gtk_combo_disable_activate(GTK_COMBO(searchcombo)); if(searchhist) --- 108,117 ---- gtk_box_pack_start(GTK_BOX(searchmode_vbox), hbox1, FALSE, FALSE, 3); ! /* Initially the list is empty. It might be changed to the data ! read from the persistant storage later on*/ searchhist = modeinfo->history; /* searchterm combo box */ ! SEARCHTAB(tab)->search_combo = searchcombo = gtk_combo_new(); gtk_combo_disable_activate(GTK_COMBO(searchcombo)); if(searchhist) *************** *** 997,1002 **** gtk_widget_destroy(main_clist); } - - /* FIXME save history into permanent session thingie */ list = SEARCHTAB(tab)->history; --- 1029,1032 ---- Index: search.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** search.h 11 Oct 2003 21:35:30 -0000 1.11 --- search.h 11 Oct 2003 22:37:09 -0000 1.12 *************** *** 31,34 **** --- 31,35 ---- #define SEARCHTAB(tab) (assert(tab->type == SEARCH_MODE), (struct tab_search *)tab->modeinfo) struct tab_search { + GtkWidget *search_combo; GtkWidget *serverlist_combo; GtkWidget *searchbase_combo; |
From: <sta...@us...> - 2003-10-11 22:34:22
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv22205 Modified Files: state.c state.h Log Message: * Support for storage of lists of strings Index: state.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/state.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** state.c 11 Oct 2003 20:26:07 -0000 1.3 --- state.c 11 Oct 2003 22:34:18 -0000 1.4 *************** *** 26,29 **** --- 26,31 ---- */ + /* $Id$ */ + #include "config.h" #include <stdlib.h> *************** *** 302,305 **** --- 304,360 ---- g_hash_table_insert(e->values, g_strdup(value_name), val); } + } + + const GList *state_value_get_list(const char *state_name, + const char *value_name) + { + struct state_value *val; + struct state_entity *e = lookup_entity(state_name); + assert(e); + assert(e->values); + + val = g_hash_table_lookup(e->values, value_name); + if (val) { + if (val->type == SV_list) { + return val->val.list_val; + } + } + return NULL; + } + + void state_value_set_list(const char *state_name, + const char *value_name, + const GList *n) + { + struct state_value *val; + struct state_entity *e = lookup_entity(state_name); + const GList *I; + + assert(e); + assert(e->values); + + val = g_hash_table_lookup(e->values, value_name); + if (val) { + if (val->type == SV_list) { + if (val->val.list_val && val->free_list_element) { + g_list_foreach(val->val.list_val, + (GFunc) val->free_list_element, NULL); + } + if (val->val.list_val) { + g_list_free(val->val.list_val); + } + val->val.list_val = NULL; + } + } else { + val = new_state_value(SV_list); + val->val.list_val = NULL; + g_hash_table_insert(e->values, g_strdup(value_name), val); + } + + for (I = n ; I ; I = g_list_next(I)) { + val->val.list_val = g_list_append(val->val.list_val, + g_strdup(I->data)); + } + val->free_list_element = (sv_free_list_func) g_free; } Index: state.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/state.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** state.h 11 Oct 2003 20:26:07 -0000 1.2 --- state.h 11 Oct 2003 22:34:18 -0000 1.3 *************** *** 55,58 **** --- 55,68 ---- const char *c); + + const GList *state_value_get_list(const char *state_name, + const char *value_name); + + /* The list set her MUST be a list of strings - nothing else will work */ + void state_value_set_list(const char *state_name, + const char *value_name, + const GList *n); + + gboolean exists_entity(const char *entity_name) ; |
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv14693 Modified Files: browse.c browse.h common.h configfile.c configfile.h gq-xml.c mainwin.c prefs.c Log Message: * Got rid of fixed length buffers * Support for restoration of tab state: - open tabs - active tab - object currently shown in browse tab * tab state restoration required the introduction of methods for the struct tab through a function table. Every mode tab can then declare save and restore functions to use for persistant state handling - might be useful for search history restoration as well * Cleanups wrt destroy handling - badly broken in prefs (caused segfaulting in a testcast) Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** browse.c 11 Oct 2003 21:35:28 -0000 1.76 --- browse.c 11 Oct 2003 21:47:51 -0000 1.77 *************** *** 51,54 **** --- 51,55 ---- #include "search.h" #include "i18n.h" + #include "state.h" #ifdef BROWSER_DND *************** *** 361,364 **** --- 362,366 ---- ctreeroot = BROWSETAB(tab)->ctreeroot; + BROWSETAB(tab)->cur_server = server; /* delete old struct inputform (if any) */ *************** *** 569,572 **** --- 571,575 ---- server_name = entry->server->name; /* dn_by_node(node); */ g_string_assign(BROWSETAB(tab)->cur_dn, server_name); + BROWSETAB(tab)->cur_server = NULL; pane2_scrwin = BROWSETAB(tab)->pane2_scrwin; *************** *** 1162,1165 **** --- 1165,1200 ---- } + static void browse_save_snapshot(char *state_name, struct tab *tab) + { + if (BROWSETAB(tab)->cur_dn) + state_value_set_string(state_name, "dn", + BROWSETAB(tab)->cur_dn->str); + + if (BROWSETAB(tab)->cur_server) + state_value_set_string(state_name, "server", + BROWSETAB(tab)->cur_server->name); + } + + + static void browse_restore_snapshot(char *state_name, struct tab *tab) + { + GtkCTree *ctree = BROWSETAB(tab)->ctreeroot; + const char *dn = state_value_get_string(state_name, "dn", NULL); + const char *s = state_value_get_string(state_name, "server", NULL); + + if (dn && s) { + struct ldapserver *server = server_by_name(s); + + if (server && !server->ask_pw) { + show_server_dn(ctree, server, dn, TRUE); + } + } + } + + + + static struct tab_vtab browse_vtab = { browse_save_snapshot, + browse_restore_snapshot }; + struct tab *new_browsemode() { *************** *** 1172,1175 **** --- 1207,1211 ---- modeinfo = calloc(sizeof(struct tab_browse), 1); tab->modeinfo = modeinfo; + tab->vtab = &browse_vtab; browsemode_vbox = gtk_vbox_new(FALSE, 0); *************** *** 1237,1241 **** modeinfo->cur_dn = g_string_sized_new(128); ! g_string_assign(modeinfo->cur_dn, "some dummy string"); /* prepare for proper cleanup */ --- 1273,1277 ---- modeinfo->cur_dn = g_string_sized_new(128); ! g_string_assign(modeinfo->cur_dn, ""); /* prepare for proper cleanup */ *************** *** 1524,1528 **** void show_server_dn(GtkCTree *tree, ! struct ldapserver *server, char *dn, gboolean select_node) { --- 1560,1564 ---- void show_server_dn(GtkCTree *tree, ! struct ldapserver *server, const char *dn, gboolean select_node) { *************** *** 1534,1538 **** } ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, char *dn, gboolean select_node) { --- 1570,1574 ---- } ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, const char *dn, gboolean select_node) { Index: browse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** browse.h 11 Oct 2003 21:35:29 -0000 1.27 --- browse.h 11 Oct 2003 21:47:51 -0000 1.28 *************** *** 33,36 **** --- 33,38 ---- struct tab_browse { GString *cur_dn; + struct ldapserver *cur_server; + GtkCTree *ctreeroot; GtkWidget *ctree_refresh; /* XXX try to get rid of this */ *************** *** 157,163 **** void show_server_dn(GtkCTree *tree, ! struct ldapserver *server, char *dn, gboolean select_node); ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, char *dn, gboolean select_node); --- 159,165 ---- void show_server_dn(GtkCTree *tree, ! struct ldapserver *server, const char *dn, gboolean select_node); ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, const char *dn, gboolean select_node); Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** common.h 11 Oct 2003 21:35:29 -0000 1.26 --- common.h 11 Oct 2003 21:47:51 -0000 1.27 *************** *** 68,71 **** --- 68,81 ---- #define SCHEMA_MODE 3 + /* fwd decl */ + struct mainwin_data; + + struct tab; + + struct tab_vtab { + void (*save_snapshot)(char *state_name, struct tab *); + void (*restore_snapshot)(char *state_name, struct tab *); + }; + struct tab { int type; *************** *** 76,79 **** --- 86,91 ---- widget of the tab */ void *modeinfo; + + struct tab_vtab *vtab; }; Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** configfile.c 10 Oct 2003 06:59:24 -0000 1.38 --- configfile.c 11 Oct 2003 21:47:51 -0000 1.39 *************** *** 2,5 **** --- 2,6 ---- GQ -- a GTK-based LDAP client Copyright (C) 1998-2001 Bert Vermeulen + Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 266,269 **** --- 267,271 ---- { char outstr[128]; + assert(strlen(entity) < 40); snprintf(outstr, sizeof(outstr), *************** *** 277,280 **** --- 279,283 ---- { char outstr[128]; + assert(strlen(entity) < 40); snprintf(outstr, sizeof(outstr), *************** *** 428,431 **** --- 431,436 ---- config_write_bool(wc, cfg->restore_search_history, "restore-search-history"); + config_write_bool(wc, cfg->restore_tabs, + "restore-tabs"); config_write_string(wc, detokenize(token_ldifformat, cfg->ldifformat), "ldif-format"); *************** *** 602,605 **** --- 607,611 ---- cfg->restore_window_positions = DEFAULT_RESTORE_POSITIONS; cfg->restore_search_history = DEFAULT_RESTORE_SEARCHES; + cfg->restore_tabs = DEFAULT_RESTORE_TABS; return cfg; *************** *** 669,672 **** --- 675,680 ---- struct ldapserver *server; GList *I; + + assert(cfg); if (cfg->schemaserver) g_free(cfg->schemaserver); Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** configfile.h 10 Oct 2003 06:59:25 -0000 1.27 --- configfile.h 11 Oct 2003 21:47:51 -0000 1.28 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 65,68 **** --- 66,70 ---- #define DEFAULT_RESTORE_POSITIONS 0 #define DEFAULT_RESTORE_SEARCHES 1 + #define DEFAULT_RESTORE_TABS 0 /* The following do not _really_ belong in here right now... */ *************** *** 104,107 **** --- 106,110 ---- int restore_window_positions; int restore_search_history; + int restore_tabs; GHashTable *defaultDT; Index: gq-xml.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq-xml.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gq-xml.c 5 Oct 2003 22:23:28 -0000 1.4 --- gq-xml.c 11 Oct 2003 21:47:51 -0000 1.5 *************** *** 218,221 **** --- 218,230 ---- } + static void restore_tabsE(struct parser_context *ctx, + struct tagstack_entry *e) + { + struct gq_config *c = peek_tag(ctx->stack, 1)->data; + + int b = booleanCDATA(ctx, e); + if (b >= 0) c->restore_tabs = b; + } + static void ldif_formatE(struct parser_context *ctx, struct tagstack_entry *e) *************** *** 638,641 **** --- 647,655 ---- }, { + "restore-tabs", 0, + NULL, restore_tabsE, + { "gq-config", NULL }, + }, + { "ldif-format", 0, NULL, ldif_formatE, *************** *** 997,1001 **** g_free(handler); if (rc != 0) { ! free_config(comm.result); comm.result = NULL; } --- 1011,1017 ---- g_free(handler); if (rc != 0) { ! if (comm.result) { ! free_config(comm.result); ! } comm.result = NULL; } Index: mainwin.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** mainwin.c 11 Oct 2003 21:35:29 -0000 1.42 --- mainwin.c 11 Oct 2003 21:47:51 -0000 1.43 *************** *** 112,119 **** --- 112,174 ---- } + gboolean mainwin_restore_snapshot(struct mainwin_data *win) + { + int i, type; + char tmp[32]; + + if (!config->restore_tabs) return FALSE; + + if (!exists_entity("mainwin.tabs")) return FALSE; + + for (i = 0 ; ; i++) { + snprintf(tmp, sizeof(tmp), "mainwin.tabs.%d", i); + if (!exists_entity(tmp)) break; + type = state_value_get_int(tmp, "type", -1); + if (type > 0) { + struct tab *tab = new_modetab(win, type); + + if (tab->vtab && tab->vtab->restore_snapshot) { + tab->vtab->restore_snapshot(tmp, tab); + } + } + + } + + if (i > 0) { + type = state_value_get_int("mainwin.tabs", "active", -1); + gtk_notebook_set_page(GTK_NOTEBOOK(win->mainbook), type); + return TRUE; + } + return FALSE; + } + + void mainwin_save_snapshot(struct mainwin_data *win) + { + struct tab *tab = NULL; + int i; + char tmp[32]; + + rm_value("mainwin.tabs"); + + if (!config->restore_tabs) return; + + for( i = 0 ; (tab = mainwin_get_tab_nth(win, i)) != NULL ; i++) { + snprintf(tmp, sizeof(tmp), "mainwin.tabs.%d", i); + state_value_set_int(tmp, "type", tab->type); + if (tab->vtab && tab->vtab->save_snapshot) { + tab->vtab->save_snapshot(tmp, tab); + } + } + + state_value_set_int("mainwin.tabs", "active", + gtk_notebook_get_current_page(GTK_NOTEBOOK(win->mainbook))); + } + + /* gtk2 checked (multiple destroy callbacks safety), confidence 0.7: cleanup_all_tabs semantics? */ void gq_exit(GtkWidget *widget, struct mainwin_data *win) { + mainwin_save_snapshot(win); cleanup(win); gtk_main_quit(); *************** *** 448,458 **** GTK_SIGNAL_FUNC(remove_tab), win); ! new_modetab(win, SEARCH_MODE); ! new_modetab(win, BROWSE_MODE | 32768); ! new_modetab(win, SCHEMA_MODE | 32768); gtk_widget_show(win->mainwin); } - struct tab *mainwin_get_tab_nth(struct mainwin_data *win, int n) --- 503,516 ---- GTK_SIGNAL_FUNC(remove_tab), win); ! gtk_widget_realize(win->mainwin); ! ! if (! mainwin_restore_snapshot(win)) { ! new_modetab(win, SEARCH_MODE); ! new_modetab(win, BROWSE_MODE | 32768); ! new_modetab(win, SCHEMA_MODE | 32768); ! } gtk_widget_show(win->mainwin); } struct tab *mainwin_get_tab_nth(struct mainwin_data *win, int n) Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** prefs.c 10 Oct 2003 06:55:03 -0000 1.39 --- prefs.c 11 Oct 2003 21:47:51 -0000 1.40 *************** *** 1,6 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen ! Parts: Copyright (C) 2002 Peter Stamfest and Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 78,81 **** --- 78,82 ---- GtkWidget *restore_window_positions; GtkWidget *restore_search_history; + GtkWidget *restore_tabs; /* template tab */ *************** *** 109,117 **** static void create_serverstab(GtkWidget *target, struct prefs_windata *pw); static void create_templatestab(GtkWidget *target, struct prefs_windata *pw); ! static void create_browse_optionstab(GtkWidget *target, struct prefs_windata *pw); ! static void create_search_optionstab(GtkWidget *target, struct prefs_windata *pw); static void create_ldiftab(GtkWidget *target, struct prefs_windata *pw); ! static void destroy_edit_server_window(GtkWidget *this, struct server_windata *sw); static void create_guitab(GtkWidget *target, struct prefs_windata *); --- 110,121 ---- static void create_serverstab(GtkWidget *target, struct prefs_windata *pw); static void create_templatestab(GtkWidget *target, struct prefs_windata *pw); ! static void create_browse_optionstab(GtkWidget *target, ! struct prefs_windata *pw); ! static void create_search_optionstab(GtkWidget *target, ! struct prefs_windata *pw); static void create_ldiftab(GtkWidget *target, struct prefs_windata *pw); ! static void destroy_edit_server_window(GtkWidget *this, ! struct server_windata *sw); static void create_guitab(GtkWidget *target, struct prefs_windata *); *************** *** 119,124 **** static void template_edit_callback(GtkWidget *widget, struct prefs_windata *); static void template_selected_callback(GtkWidget *clist, gint row, gint column, ! GdkEventButton *event, struct prefs_windata *data); ! static void template_delete_callback(GtkWidget *widget, struct prefs_windata *pw); --- 123,130 ---- static void template_edit_callback(GtkWidget *widget, struct prefs_windata *); static void template_selected_callback(GtkWidget *clist, gint row, gint column, ! GdkEventButton *event, ! struct prefs_windata *data); ! static void template_delete_callback(GtkWidget *widget, ! struct prefs_windata *pw); *************** *** 135,139 **** ! static prefs_callback_data *new_prefs_callback_data(struct server_windata *sw) { prefs_callback_data *d = g_malloc(sizeof(prefs_callback_data)); d->server = NULL; --- 141,146 ---- ! static prefs_callback_data *new_prefs_callback_data(struct server_windata *sw) ! { prefs_callback_data *d = g_malloc(sizeof(prefs_callback_data)); d->server = NULL; *************** *** 317,321 **** server->bindtype = tokenize(token_bindtype, text); ! /* connection info might have changed for this server -- close cached connection */ close_connection(server, TRUE); --- 324,329 ---- server->bindtype = tokenize(token_bindtype, text); ! /* connection info might have changed for this server -- close ! cached connection */ close_connection(server, TRUE); *************** *** 336,340 **** } ! destroy_edit_server_window(NULL, cb_data->sw); } --- 344,348 ---- } ! gtk_widget_destroy(window); } *************** *** 350,358 **** } ! static void destroy_edit_server_window(GtkWidget *this, struct server_windata *sw) { ! gtk_widget_destroy(current_edit_server_window); ! current_edit_server_window = NULL; ! if (sw) g_free(sw); } --- 358,367 ---- } ! static void destroy_edit_server_window(GtkWidget *this, ! struct server_windata *sw) { ! if (this == current_edit_server_window) { ! current_edit_server_window = NULL; ! } if (sw) g_free(sw); } *************** *** 363,367 **** { if(event && event->type == GDK_KEY_PRESS && event->keyval == GDK_Escape) { ! destroy_edit_server_window(NULL, NULL); return(TRUE); } --- 372,376 ---- { if(event && event->type == GDK_KEY_PRESS && event->keyval == GDK_Escape) { ! gtk_widget_destroy(widget); return(TRUE); } *************** *** 370,374 **** return(FALSE); #else ! return(TRUE); /* may be a bug to return TRUE unconditionally in gtk 1.2 */ #endif } --- 379,384 ---- return(FALSE); #else ! return(TRUE); /* may be a bug to return TRUE unconditionally in ! gtk 1.2 */ #endif } *************** *** 394,399 **** int y, z; int i; ! char title[MAX_SERVERNAME_LEN + 8]; ! char tmp[16]; GtkWidget *bindtype; GList *bindtypes = NULL; --- 404,409 ---- int y, z; int i; ! GString *title; ! char tmp[16]; /* fixed buffer: OK - used for printf("%d") only */ GtkWidget *bindtype; GList *bindtypes = NULL; *************** *** 441,449 **** (GtkDestroyNotify) destroy_prefs_callback_data); if(cb_data->edit_new_server) ! snprintf(title, sizeof(title), _("New server")); else ! snprintf(title, sizeof(title), _("Server %s"), server->name); ! gtk_window_set_title(GTK_WINDOW(editwindow), title); gtk_window_set_policy(GTK_WINDOW(editwindow), TRUE, TRUE, FALSE); --- 451,464 ---- (GtkDestroyNotify) destroy_prefs_callback_data); + title = g_string_sized_new(64); + if(cb_data->edit_new_server) ! g_string_sprintf(title, _("New server")); else ! g_string_sprintf(title, _("Server %s"), server->name); ! ! gtk_window_set_title(GTK_WINDOW(editwindow), title->str); ! g_string_free(title, TRUE); ! gtk_window_set_policy(GTK_WINDOW(editwindow), TRUE, TRUE, FALSE); *************** *** 461,465 **** gtk_box_pack_start(GTK_BOX(main_vbox), notebook, TRUE, TRUE, 0); - /* "General" tab */ --- 476,479 ---- *************** *** 758,762 **** gtk_widget_show(bindtype); ! gtk_list_select_item(GTK_LIST(GTK_COMBO(bindtype)->list), server->bindtype); gtk_table_attach(GTK_TABLE(table2), bindtype, 1, 2, y, y + 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); --- 772,777 ---- gtk_widget_show(bindtype); ! gtk_list_select_item(GTK_LIST(GTK_COMBO(bindtype)->list), ! server->bindtype); gtk_table_attach(GTK_TABLE(table2), bindtype, 1, 2, y, y + 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); *************** *** 770,774 **** #if GTK_MAJOR >= 2 ! gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_COMBO(bindtype)->entry); #endif --- 785,790 ---- #if GTK_MAJOR >= 2 ! gtk_label_set_mnemonic_widget(GTK_LABEL(label), ! GTK_COMBO(bindtype)->entry); #endif *************** *** 974,977 **** --- 990,994 ---- gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, TRUE, 10); + #if GTK_MAJOR >= 2 okbutton = gtk_button_new_from_stock(GTK_STOCK_OK); *************** *** 993,1002 **** #endif gtk_widget_show(cancelbutton); ! gtk_signal_connect(GTK_OBJECT(cancelbutton), "clicked", ! GTK_SIGNAL_FUNC(destroy_edit_server_window), ! sw); ! gtk_signal_connect(GTK_OBJECT(editwindow), "delete_event", ! GTK_SIGNAL_FUNC(destroy_edit_server_window), ! sw); gtk_signal_connect(GTK_OBJECT(editwindow), "key_press_event", GTK_SIGNAL_FUNC(destroy_edit_server_window_on_esc), --- 1010,1016 ---- #endif gtk_widget_show(cancelbutton); ! gtk_signal_connect_object(GTK_OBJECT(cancelbutton), "clicked", ! GTK_SIGNAL_FUNC(gtk_widget_destroy), ! editwindow); gtk_signal_connect(GTK_OBJECT(editwindow), "key_press_event", GTK_SIGNAL_FUNC(destroy_edit_server_window_on_esc), *************** *** 1150,1153 **** --- 1164,1170 ---- CONFIG_TOGGLE_BUTTON(config, pw, restore_search_history); + /* restore tabs */ + CONFIG_TOGGLE_BUTTON(config, pw, restore_tabs); + /* LDIF: format */ for(type = 0; type < sizeof(pw->ldif_format)/sizeof(pw->ldif_format[0]); *************** *** 1182,1186 **** GtkWidget *label, *vbox2; GtkWidget *notebook; ! GtkWidget *vbox_search_options, *vbox_browse_options, *vbox_servers, *vbox_templates, *vbox_ldif, *vbox_gui; GtkWidget *hbox_buttons, *okbutton, *cancelbutton; --- 1199,1204 ---- GtkWidget *label, *vbox2; GtkWidget *notebook; ! GtkWidget *vbox_search_options, *vbox_browse_options; ! GtkWidget *vbox_servers, *vbox_templates, *vbox_ldif, *vbox_gui; GtkWidget *hbox_buttons, *okbutton, *cancelbutton; *************** *** 1236,1240 **** GTK_WIDGET_UNSET_FLAGS(GTK_NOTEBOOK(notebook), GTK_CAN_FOCUS); #endif ! gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_search_options, label); /* Browse Options tab */ --- 1254,1259 ---- GTK_WIDGET_UNSET_FLAGS(GTK_NOTEBOOK(notebook), GTK_CAN_FOCUS); #endif ! gtk_notebook_append_page(GTK_NOTEBOOK(notebook), ! vbox_search_options, label); /* Browse Options tab */ *************** *** 1246,1250 **** label = gq_label_new(_("Browse O_ptions")); gtk_widget_show(label); ! gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_browse_options, label); /* Servers tab */ --- 1265,1270 ---- label = gq_label_new(_("Browse O_ptions")); gtk_widget_show(label); ! gtk_notebook_append_page(GTK_NOTEBOOK(notebook), ! vbox_browse_options, label); /* Servers tab */ *************** *** 1346,1350 **** gtk_widget_show(scrwin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrwin), ! GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox2), scrwin, TRUE, TRUE, 0); --- 1366,1371 ---- gtk_widget_show(scrwin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrwin), ! GTK_POLICY_AUTOMATIC, ! GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox2), scrwin, TRUE, TRUE, 0); *************** *** 1460,1464 **** fill_serverlist_combo(combo); if(strlen(config->schemaserver)) ! gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), config->schemaserver); gtk_widget_show(combo); gtk_box_pack_start(GTK_BOX(hbox1), combo, FALSE, FALSE, 0); --- 1481,1486 ---- fill_serverlist_combo(combo); if(strlen(config->schemaserver)) ! gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), ! config->schemaserver); gtk_widget_show(combo); gtk_box_pack_start(GTK_BOX(hbox1), combo, FALSE, FALSE, 0); *************** *** 1473,1477 **** gtk_widget_show(scrwin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrwin), ! GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox2), scrwin, TRUE, TRUE, 0); --- 1495,1500 ---- gtk_widget_show(scrwin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrwin), ! GTK_POLICY_AUTOMATIC, ! GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox2), scrwin, TRUE, TRUE, 0); *************** *** 1485,1493 **** gtk_clist_set_selection_mode(GTK_CLIST(template_clist), GTK_SELECTION_SINGLE); ! gtk_clist_set_shadow_type(GTK_CLIST(template_clist), GTK_SHADOW_ETCHED_IN); gtk_signal_connect(GTK_OBJECT(template_clist), "select_row", GTK_SIGNAL_FUNC(template_selected_callback), pw); gtk_widget_show(template_clist); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrwin), template_clist); fill_clist_templates(template_clist); --- 1508,1518 ---- gtk_clist_set_selection_mode(GTK_CLIST(template_clist), GTK_SELECTION_SINGLE); ! gtk_clist_set_shadow_type(GTK_CLIST(template_clist), ! GTK_SHADOW_ETCHED_IN); gtk_signal_connect(GTK_OBJECT(template_clist), "select_row", GTK_SIGNAL_FUNC(template_selected_callback), pw); gtk_widget_show(template_clist); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrwin), ! template_clist); fill_clist_templates(template_clist); *************** *** 1850,1853 **** --- 1875,1896 ---- _("If set then save and restore the search " "history across program invocations."), + S_("tooltip|") + ); + + /* Restore Tabs */ + button = gq_check_button_new_with_label(_("Restore Ta_bs")); + pw->restore_tabs = button; + + if(config->restore_tabs) + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE); + #ifdef OLD_FOCUS_HANDLING + GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); + #endif + gtk_widget_show(button); + gtk_box_pack_start(GTK_BOX(vbox1), button, FALSE, TRUE, 5); + + gtk_tooltips_set_tip(tips, button, + _("If set then save and restore the state " + "of the main window tabs."), S_("tooltip|") ); |
From: <sta...@us...> - 2003-10-11 21:35:35
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv12879 Modified Files: browse.c browse.h common.h filter.c input.c input.h mainwin.c mainwin.h schemabrowse.c schemabrowse.h search.c search.h Log Message: * Rewrote the mainwin tab handling: No longer have the tablist in struct mainwin_data - replaced by the mainwin notebook itself. * Changed the responsibilities for the struct tab creation: The different mode constructors now create this as well. The destroy signal is used to free all memory alloced for a tab: The struct tab used to be leaked. * Changed modes to adhere to the new handling of tabs * Got rid of fixed length buffers * Moved the inputform new/free functions from browse.c to input.c For the records: The changes to the overall operation of the mainwin wrt tab handling turned out to be not as "beautiful" as expected. There might be more to do in this area. However, the thing is a bit more OO now. Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** browse.c 10 Oct 2003 06:58:59 -0000 1.75 --- browse.c 11 Oct 2003 21:35:28 -0000 1.76 *************** *** 58,61 **** --- 58,63 ---- /* #include "../icons/warning.xpm" */ + static void destroy_browse_mode(GtkWidget *w, struct tab *tab); + static gboolean button_press_on_tree_item(GtkWidget *tree, GdkEventButton *event, *************** *** 369,373 **** } ! iform = calloc(sizeof(struct inputform), 1); BROWSETAB(tab)->inputform = iform; --- 371,375 ---- } ! iform = new_inputform(); BROWSETAB(tab)->inputform = iform; *************** *** 1160,1200 **** } ! ! /* free the entry related struct inputform and data it refers to */ ! /* gtk2 checked (multiple destroy callbacks safety), confidence 0.95 */ ! void inputform_free(struct inputform *iform) ! { ! assert(iform); ! if (iform) { ! if(iform->olddn) { ! g_free(iform->olddn); ! iform->olddn = NULL; ! } ! ! if(iform->dn) { ! g_free(iform->dn); ! iform->dn = NULL; ! } ! ! if(iform->oldlist) { ! free_formlist(iform->oldlist); ! iform->oldlist = NULL; ! } ! ! if(iform->formlist) { ! free_formlist(iform->formlist); ! iform->formlist = NULL; ! } ! ! free(iform); ! } ! } ! ! ! GtkWidget *new_browsemode(struct tab *tab) { GtkWidget *ctreeroot, *browsemode_vbox, *spacer; GtkWidget *mainpane, *pane2_vbox, *pane1_scrwin, *pane2_scrwin; struct tab_browse *modeinfo; modeinfo = calloc(sizeof(struct tab_browse), 1); --- 1162,1172 ---- } ! struct tab *new_browsemode() { GtkWidget *ctreeroot, *browsemode_vbox, *spacer; GtkWidget *mainpane, *pane2_vbox, *pane1_scrwin, *pane2_scrwin; struct tab_browse *modeinfo; + struct tab *tab = g_malloc0(sizeof(struct tab)); + tab->type = BROWSE_MODE; modeinfo = calloc(sizeof(struct tab_browse), 1); *************** *** 1267,1271 **** g_string_assign(modeinfo->cur_dn, "some dummy string"); ! return(browsemode_vbox); } --- 1239,1250 ---- g_string_assign(modeinfo->cur_dn, "some dummy string"); ! /* prepare for proper cleanup */ ! gtk_signal_connect(GTK_OBJECT(browsemode_vbox), "destroy", ! GTK_SIGNAL_FUNC(destroy_browse_mode), ! (gpointer) tab); ! ! tab->content = browsemode_vbox; ! gtk_object_set_data(GTK_OBJECT(tab->content), "tab", tab); ! return tab; } *************** *** 1390,1395 **** ! void cleanup_browse_mode(struct tab *tab) { if(BROWSETAB(tab)->cur_dn) { --- 1369,1375 ---- ! static void destroy_browse_mode(GtkWidget *w, struct tab *tab) { + assert(tab); if(BROWSETAB(tab)->cur_dn) { *************** *** 1403,1406 **** --- 1383,1390 ---- } + g_free(tab->modeinfo); + tab->modeinfo = NULL; + + g_free(tab); } *************** *** 1679,1683 **** if (!IS_DN_ENTRY(entry)) return; ! iform = calloc(sizeof(struct inputform), 1); iform->dn = NULL; iform->server = server; --- 1663,1667 ---- if (!IS_DN_ENTRY(entry)) return; ! iform = new_inputform(); iform->dn = NULL; iform->server = server; *************** *** 1700,1704 **** } else { ! free(iform); } #endif /* HAVE_LDAP_STR2OBJECTCLASS */ --- 1684,1688 ---- } else { ! free_inputform(iform); } #endif /* HAVE_LDAP_STR2OBJECTCLASS */ *************** *** 1721,1725 **** /* GString *bigmessage = NULL; */ int written; - char message[512]; int ctx; --- 1705,1708 ---- *************** *** 1794,1801 **** written = fwrite(out->str, 1, out->len, outfile); if(written != out->len) { ! snprintf(message, sizeof(message), ! _("%1$d of %2$d bytes written"), ! written, out->len); ! error_popup(_("Save failed"), message); ldap_msgfree(res); --- 1777,1784 ---- written = fwrite(out->str, 1, out->len, outfile); if(written != out->len) { ! g_string_sprintf(gmessage, ! _("%1$d of %2$d bytes written"), ! written, out->len); ! error_popup(_("Save failed"), gmessage->str); ldap_msgfree(res); Index: browse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** browse.h 1 Oct 2003 22:31:06 -0000 1.26 --- browse.h 11 Oct 2003 21:35:29 -0000 1.27 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 138,144 **** void cleanup_browse_mode(struct tab *tab); ! GtkWidget *new_browsemode(struct tab *tab); ! ! void inputform_free(struct inputform *iform); void refresh_subtree(GtkCTree *ctree, --- 139,143 ---- void cleanup_browse_mode(struct tab *tab); ! struct tab *new_browsemode(); void refresh_subtree(GtkCTree *ctree, Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** common.h 9 Oct 2003 05:26:20 -0000 1.25 --- common.h 11 Oct 2003 21:35:29 -0000 1.26 *************** *** 70,74 **** --- 70,78 ---- struct tab { int type; + struct mainwin_data *win; /* what window does this tab + belong to */ GtkWidget *focus; + GtkWidget *content; /* what is the "content" + widget of the tab */ void *modeinfo; }; *************** *** 136,139 **** --- 140,149 ---- { if (x) g_free(x); (x) = NULL; } + #ifndef HAVE_REORDERABLE_G_STRING_SPRINTF + # undef g_string_sprintf + # define g_string_sprintf gq_g_string_sprintf + # define g_string_printf gq_g_string_sprintf + void gq_g_string_sprintf(GString *string, const gchar *format, ...); + #endif #endif Index: filter.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/filter.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** filter.c 9 Oct 2003 05:47:26 -0000 1.22 --- filter.c 11 Oct 2003 21:35:29 -0000 1.23 *************** *** 101,111 **** struct ldapserver *server; struct tab *tab; - int tabnum; char *filterstring, *searchstring, *servername, *searchbase, msg[192]; const char *filtername; /* find current tab */ ! tabnum = gtk_notebook_get_current_page(GTK_NOTEBOOK(mainwin.mainbook)); ! tab = g_list_nth_data(mainwin.tablist, tabnum); /* ignore if it's not a search mode tab */ --- 101,109 ---- struct ldapserver *server; struct tab *tab; char *filterstring, *searchstring, *servername, *searchbase, msg[192]; const char *filtername; /* find current tab */ ! tab = mainwin_get_current_tab(mainwin.mainbook); /* ignore if it's not a search mode tab */ *************** *** 229,233 **** gtk_widget_show(filternamebox); gtk_signal_connect_object(GTK_OBJECT(filternamebox), "activate", ! GTK_SIGNAL_FUNC(add_filter), GTK_OBJECT(filternamebox)); gtk_box_pack_start(GTK_BOX(vbox1), filternamebox, TRUE, TRUE, 0); --- 227,232 ---- gtk_widget_show(filternamebox); gtk_signal_connect_object(GTK_OBJECT(filternamebox), "activate", ! GTK_SIGNAL_FUNC(add_filter), ! GTK_OBJECT(filternamebox)); gtk_box_pack_start(GTK_BOX(vbox1), filternamebox, TRUE, TRUE, 0); *************** *** 272,280 **** GtkWidget *focusbox, *server_combo, *searchbase_combo; struct tab *tab; - int tabnum; /* find current tab */ ! tabnum = gtk_notebook_get_current_page(GTK_NOTEBOOK(mainwin.mainbook)); ! tab = g_list_nth_data(mainwin.tablist, tabnum); /* we're in luck if the current tab is a Search tab: just use this one */ --- 271,277 ---- GtkWidget *focusbox, *server_combo, *searchbase_combo; struct tab *tab; /* find current tab */ ! tab = mainwin_get_current_tab(mainwin.mainbook); /* we're in luck if the current tab is a Search tab: just use this one */ Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** input.c 11 Oct 2003 06:40:44 -0000 1.65 --- input.c 11 Oct 2003 21:35:29 -0000 1.66 *************** *** 69,72 **** --- 69,104 ---- + struct inputform *new_inputform() + { + struct inputform *n = g_malloc0(sizeof(struct inputform)); + return n; + } + + /* free the entry related struct inputform and data it refers to */ + /* gtk2 checked (multiple destroy callbacks safety), confidence 0.95 */ + void free_inputform(struct inputform *iform) + { + assert(iform); + if (iform) { + g_free_if(iform->olddn); + g_free_if(iform->dn); + + if(iform->oldlist) { + free_formlist(iform->oldlist); + iform->oldlist = NULL; + } + + if(iform->formlist) { + free_formlist(iform->formlist); + iform->formlist = NULL; + } + + g_free(iform); + } + } + + + + void create_form_window(struct inputform *iform) { *************** *** 894,898 **** gtk_widget_show(vbox); ! iform = calloc(sizeof(struct inputform), 1); iform->parent_window = edit_window; iform->target_vbox = vbox; --- 926,930 ---- gtk_widget_show(vbox); ! iform = new_inputform(); iform->parent_window = edit_window; iform->target_vbox = vbox; *************** *** 928,934 **** GList *formlist; struct inputform *iform; ! char *newdn; ! iform = calloc(sizeof(struct inputform), 1); iform->server = server; --- 960,966 ---- GList *formlist; struct inputform *iform; ! /* char *newdn; */ ! iform = new_inputform(); iform->server = server; *************** *** 945,948 **** --- 977,981 ---- iform->formlist = formlist; + /* FIXME: check if the following is OK */ #if 0 int i; *************** *** 959,975 **** gq_exploded_free(oldrdn); #else ! newdn = g_malloc(strlen(dn) + 1); ! /* strcpy(newdn, ","); */ /* Flawfinder: ignore */ ! strcpy(newdn, dn); /* Flawfinder: ignore */ #endif - - iform->dn = newdn; - create_form_window(iform); create_form_content(iform); build_inputform(iform); ! } ! else { ! free(iform); } --- 992,1006 ---- gq_exploded_free(oldrdn); #else ! g_free_and_dup(iform->dn, dn); #endif create_form_window(iform); create_form_content(iform); build_inputform(iform); ! } else { ! ! /* FIXME: check: does this leak memory from ! formfill_from_entry_objectclass and/or ! formlist_from_entry?? */ ! free_inputform(iform); } *************** *** 1138,1142 **** GtkCTreeNode *node; GList *formlist; - GList *tabs; struct ldapserver *server; struct formfill *ff; --- 1169,1172 ---- *************** *** 1240,1246 **** gq_exploded_free(rdn); ! for (tabs = g_list_first(mainwin.tablist) ; tabs ; ! tabs = g_list_next(tabs)) { ! tab = (struct tab *) tabs->data; if(tab->type == BROWSE_MODE) { ctree = BROWSETAB(tab)->ctreeroot; --- 1270,1277 ---- gq_exploded_free(rdn); ! for( i = 0 ; (tab = mainwin_get_tab_nth(&mainwin, i)) != NULL ; i++) { ! /* for (tabs = g_list_first(mainwin.tablist) ; tabs ; */ ! /* tabs = g_list_next(tabs)) { */ ! /* tab = (struct tab *) tabs->data; */ if(tab->type == BROWSE_MODE) { ctree = BROWSETAB(tab)->ctreeroot; Index: input.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** input.h 10 Oct 2003 06:58:59 -0000 1.15 --- input.h 11 Oct 2003 21:35:29 -0000 1.16 *************** *** 57,60 **** --- 57,67 ---- }; + + struct inputform *new_inputform(); + void free_inputform(struct inputform *iform); + /* old name */ + #define inputform_free free_inputform + + /* Maybe we will align attribute labels differently in the future.. */ #define LABEL_JUSTIFICATION 0.5 Index: mainwin.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** mainwin.c 11 Oct 2003 13:15:24 -0000 1.41 --- mainwin.c 11 Oct 2003 21:35:29 -0000 1.42 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 22,25 **** --- 23,27 ---- */ + /* $Id$ */ #include <string.h> *************** *** 69,76 **** void go_to_page(struct tab *tab) { - gtk_notebook_set_page(GTK_NOTEBOOK(mainwin.mainbook), ! g_list_index(mainwin.tablist, tab)); ! } --- 71,77 ---- void go_to_page(struct tab *tab) { gtk_notebook_set_page(GTK_NOTEBOOK(mainwin.mainbook), ! gtk_notebook_page_num(GTK_NOTEBOOK(mainwin.mainbook), ! tab->content)); } *************** *** 172,175 **** --- 173,210 ---- } + /* Callback function called when a tab gets removed from the + notebook. */ + static void remove_tab(GtkContainer *notebook, + GtkWidget *content, + struct mainwin_data *win) + { + int thismode; + struct tab *tab = NULL; + int i; + + printf("REMOVED TAB 1\n"); + + tab = gtk_object_get_data(GTK_OBJECT(content), "tab"); + if (tab) { + printf("REMOVED TAB 2\n"); + thismode = tab->type; + g_hash_table_insert(win->lastofmode, (gpointer) thismode, NULL); + + /* try to find another tab with the same mode so we can put that + one into lastofmode... */ + for( i = 0 ; (tab = mainwin_get_tab_nth(win, i)) != NULL ; i++) { + if (tab->type == thismode) { + /* found one! */ + enter_last_of_mode(tab); + break; + } + } + } + + if (gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 0) == NULL) { + gtk_widget_destroy(win->mainwin); + } + } + void create_mainwin(struct mainwin_data *win) { *************** *** 407,410 **** --- 442,450 ---- gtk_box_pack_end(GTK_BOX(main_vbox), win->statusbar, FALSE, FALSE, 5); gtk_widget_set_sensitive(win->statusbar, TRUE); + + gtk_signal_connect(GTK_OBJECT(win->mainbook), "switch-page", + GTK_SIGNAL_FUNC(switchpage_refocus), win); + gtk_signal_connect(GTK_OBJECT(win->mainbook), "remove", + GTK_SIGNAL_FUNC(remove_tab), win); new_modetab(win, SEARCH_MODE); *************** *** 412,426 **** new_modetab(win, SCHEMA_MODE | 32768); - gtk_signal_connect(GTK_OBJECT(win->mainbook), "switch-page", - GTK_SIGNAL_FUNC(switchpage_refocus), win); - gtk_widget_show(win->mainwin); } ! void new_modetab(struct mainwin_data *win, int mode) { ! GtkWidget *content, *label, *focusbox; struct tab *tab; int focus; --- 452,479 ---- new_modetab(win, SCHEMA_MODE | 32768); gtk_widget_show(win->mainwin); + } + + struct tab *mainwin_get_tab_nth(struct mainwin_data *win, int n) + { + GtkWidget *content = + gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->mainbook), n); + if (content == NULL) return NULL; + + return gtk_object_get_data(GTK_OBJECT(content), "tab"); } + struct tab *mainwin_get_current_tab(GtkWidget *notebook) + { + int tabnum = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); + GtkWidget *content = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), + tabnum); + return gtk_object_get_data(GTK_OBJECT(content), "tab"); + } ! struct tab *new_modetab(struct mainwin_data *win, int mode) { ! GtkWidget *label, *focusbox; struct tab *tab; int focus; *************** *** 430,461 **** mode &= 32767; - tab = calloc(sizeof(struct tab), 1); - tab->type = mode; - switch(mode) { case SEARCH_MODE: label = gq_label_new(_("_Search")); ! content = new_searchmode(tab); break; case BROWSE_MODE: label = gq_label_new(_("_Browse")); ! content = new_browsemode(tab); break; #ifdef HAVE_LDAP_STR2OBJECTCLASS case SCHEMA_MODE: label = gq_label_new(_("S_chema")); ! content = new_schemamode(tab); break; #endif default: ! free(tab); ! return; } ! enter_last_of_mode(tab); gtk_widget_show(label); ! gtk_notebook_append_page(GTK_NOTEBOOK(win->mainbook), content, label); if(focus) { gtk_notebook_set_page(GTK_NOTEBOOK(win->mainbook), -1); --- 483,517 ---- mode &= 32767; switch(mode) { case SEARCH_MODE: label = gq_label_new(_("_Search")); ! tab = new_searchmode(); break; case BROWSE_MODE: label = gq_label_new(_("_Browse")); ! tab = new_browsemode(); break; #ifdef HAVE_LDAP_STR2OBJECTCLASS case SCHEMA_MODE: label = gq_label_new(_("S_chema")); ! tab = new_schemamode(); break; #endif default: ! return NULL; } ! gtk_object_set_data(GTK_OBJECT(tab->content), "tab", tab); ! ! tab->win = win; ! gtk_widget_show(label); ! gtk_notebook_append_page(GTK_NOTEBOOK(win->mainbook), ! tab->content, ! label); if(focus) { + enter_last_of_mode(tab); + gtk_notebook_set_page(GTK_NOTEBOOK(win->mainbook), -1); *************** *** 464,470 **** gtk_widget_grab_focus(focusbox); } ! ! win->tablist = g_list_append(win->tablist, tab); ! } --- 520,524 ---- gtk_widget_grab_focus(focusbox); } ! return tab; } *************** *** 475,479 **** struct tab *tab; ! tab = g_list_nth_data(win->tablist, pagenum); if(!tab) return; --- 529,533 ---- struct tab *tab; ! tab = mainwin_get_tab_nth(win, pagenum); if(!tab) return; *************** *** 487,491 **** gtk_editable_select_region(GTK_EDITABLE(focusbox), 0, -1); } - } --- 541,544 ---- *************** *** 493,511 **** void cleanup_all_tabs(struct mainwin_data *win) { - GList *tabs; - struct tab *tab; - /* don't waste time refocusing on disappearing tabs */ gtk_signal_disconnect_by_func(GTK_OBJECT(win->mainbook), GTK_SIGNAL_FUNC(switchpage_refocus), win); - - tabs = win->tablist; - while(tabs) { - tab = (struct tab *) tabs->data; - cleanup_tab(tab); - - tabs = tabs->next; - } - } --- 546,552 ---- *************** *** 513,579 **** void close_current_tab(struct mainwin_data *win) { ! GList *tl; ! int tabnum, thismode; ! struct tab *tab; - thismode = -1; tabnum = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->mainbook)); ! tab = g_list_nth_data(win->tablist, tabnum); ! ! if(tab) ! thismode = tab->type; ! ! cleanup_tab(tab); ! free(tab->modeinfo); ! free(tab); ! gtk_notebook_remove_page(GTK_NOTEBOOK(win->mainbook), tabnum); ! win->tablist = g_list_remove(win->tablist, tab); ! if(win->tablist == NULL) ! gtk_widget_destroy(win->mainwin); ! ! g_hash_table_insert(win->lastofmode, (gpointer) thismode, NULL); ! ! /* try to find another tab with the same mode so we can put that ! one into lastofmode... */ ! ! for (tl = win->tablist; tl; tl = tl->next) { ! if( ((struct tab *)(tl->data))->type == thismode) { ! /* found one! */ ! enter_last_of_mode( (struct tab *) tl->data); ! break; ! } ! } ! ! } ! ! ! void cleanup_tab(struct tab *tab) ! { ! switch(tab->type) { ! case SEARCH_MODE: ! cleanup_search_mode(tab); ! break; ! case BROWSE_MODE: ! cleanup_browse_mode(tab); ! break; ! #ifdef HAVE_LDAP_STR2OBJECTCLASS ! case SCHEMA_MODE: ! cleanup_schema_mode(); ! break; ! #endif ! } } - void update_serverlist(struct mainwin_data *win) { - GList *tabs; struct tab *tab; ! tabs = win->tablist; ! while(tabs) { ! tab = (struct tab *) tabs->data; switch(tab->type) { case SEARCH_MODE: --- 554,577 ---- void close_current_tab(struct mainwin_data *win) { ! int tabnum; ! GtkWidget *content; tabnum = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->mainbook)); ! content = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->mainbook), tabnum); ! /* for whatever reason: gtk_notebook_remove_page does not call ! the remove signal on the notebook. I consider this to be a GTK ! bug */ ! /* gtk_notebook_remove_page(GTK_NOTEBOOK(win->mainbook), tabnum); */ + gtk_widget_destroy(content); } void update_serverlist(struct mainwin_data *win) { struct tab *tab; + int i; ! for( i = 0 ; (tab = mainwin_get_tab_nth(win, i)) != NULL ; i++) { switch(tab->type) { case SEARCH_MODE: *************** *** 587,594 **** break; } - - tabs = tabs->next; } - } --- 585,589 ---- *************** *** 627,632 **** license_window = window = gtk_dialog_new(); - /* gtk_object_set_data(GTK_OBJECT(window), "close_func", */ - /* close_license_window); */ gtk_widget_set_usize(window, 540, 400); gtk_window_set_title(GTK_WINDOW(window), _("License")); --- 622,625 ---- *************** *** 732,736 **** GdkPixmap *gq_icon; GdkBitmap *gq_icon_mask; ! char title[32], about_text[512]; if (about_window) { --- 725,729 ---- GdkPixmap *gq_icon; GdkBitmap *gq_icon_mask; ! GString *about_text = NULL; if (about_window) { *************** *** 746,751 **** gtk_widget_realize(GTK_WIDGET(about_window)); /* gtk_container_border_width(GTK_CONTAINER(about_window), 12); */ ! snprintf(title, sizeof(title), _("About GQ")); ! gtk_window_set_title(GTK_WINDOW(about_window), title); gtk_window_set_policy(GTK_WINDOW(about_window), FALSE, FALSE, FALSE); --- 739,744 ---- gtk_widget_realize(GTK_WIDGET(about_window)); /* gtk_container_border_width(GTK_CONTAINER(about_window), 12); */ ! ! gtk_window_set_title(GTK_WINDOW(about_window), _("About GQ")); gtk_window_set_policy(GTK_WINDOW(about_window), FALSE, FALSE, FALSE); *************** *** 765,777 **** gtk_box_pack_start(GTK_BOX(hbox), pixmap, TRUE, TRUE, 10); ! snprintf(about_text, sizeof(about_text), ! "GQ %s\n\n\n%s\n\n" ! "GTK version %d.%d.%d\n" ! "GLib version %d.%d.%d\n", ! VERSION, about_blurb, ! gtk_major_version, gtk_minor_version, gtk_micro_version, ! glib_major_version, glib_minor_version, glib_micro_version); - about_label = gtk_label_new(about_text); gtk_label_set_justify(GTK_LABEL(about_label), GTK_JUSTIFY_LEFT); gtk_widget_show(about_label); --- 758,774 ---- gtk_box_pack_start(GTK_BOX(hbox), pixmap, TRUE, TRUE, 10); ! about_text = g_string_sized_new(512); ! ! g_string_sprintf(about_text, ! "GQ %s\n\n\n%s\n\n" ! "GTK version %d.%d.%d\n" ! "GLib version %d.%d.%d\n", ! VERSION, about_blurb, ! gtk_major_version, gtk_minor_version, gtk_micro_version, ! glib_major_version, glib_minor_version, glib_micro_version); ! ! about_label = gtk_label_new(about_text->str); ! g_string_free(about_text, TRUE); gtk_label_set_justify(GTK_LABEL(about_label), GTK_JUSTIFY_LEFT); gtk_widget_show(about_label); Index: mainwin.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mainwin.h 9 Oct 2003 05:47:26 -0000 1.19 --- mainwin.h 11 Oct 2003 21:35:29 -0000 1.20 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 40,44 **** struct mainwin_data { - GList *tablist; GtkWidget *mainwin; GtkWidget *mainbook; --- 41,44 ---- *************** *** 58,62 **** void gq_exit(GtkWidget *widget, struct mainwin_data *win); void create_mainwin(struct mainwin_data *); ! void new_modetab(struct mainwin_data *, int mode); void switchpage_refocus(GtkNotebook *notebook, GtkNotebookPage *page, int pagenum, struct mainwin_data *win); --- 58,62 ---- void gq_exit(GtkWidget *widget, struct mainwin_data *win); void create_mainwin(struct mainwin_data *); ! struct tab *new_modetab(struct mainwin_data *, int mode); void switchpage_refocus(GtkNotebook *notebook, GtkNotebookPage *page, int pagenum, struct mainwin_data *win); *************** *** 70,73 **** --- 70,77 ---- /* gboolean ctrl_b_hack(GtkWidget *widget, GdkEventKey *event, gpointer obj); */ /* gboolean ctrl_w_hack(GtkWidget *widget, GdkEventKey *event, gpointer obj); */ + + /* return the struct tab for the n'th tab in the gq main window win */ + struct tab *mainwin_get_tab_nth(struct mainwin_data *win, int n); + struct tab *mainwin_get_current_tab(GtkWidget *notebook); Index: schemabrowse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** schemabrowse.c 11 Oct 2003 12:32:11 -0000 1.23 --- schemabrowse.c 11 Oct 2003 21:35:30 -0000 1.24 *************** *** 90,95 **** LDAPSyntax *s); ! GtkWidget *new_schemamode(struct tab *tab) { GtkWidget *schemamode_vbox, *rightpane_vbox, *spacer; --- 90,96 ---- LDAPSyntax *s); + static void destroy_schema_mode(GtkWidget *w, struct tab *tab); ! struct tab *new_schemamode() { GtkWidget *schemamode_vbox, *rightpane_vbox, *spacer; *************** *** 98,101 **** --- 99,105 ---- struct tab_schema *modeinfo; + struct tab *tab = g_malloc0(sizeof(struct tab)); + tab->type = SCHEMA_MODE; + modeinfo = calloc(sizeof(struct tab_schema), 1); tab->modeinfo = modeinfo; *************** *** 144,148 **** gtk_widget_show(schemamode_vbox); ! return(schemamode_vbox); } --- 148,159 ---- gtk_widget_show(schemamode_vbox); ! ! gtk_signal_connect(GTK_OBJECT(schemamode_vbox), "destroy", ! GTK_SIGNAL_FUNC(destroy_schema_mode), ! tab); ! ! tab->content = schemamode_vbox; ! gtk_object_set_data(GTK_OBJECT(tab->content), "tab", tab); ! return tab; } *************** *** 1854,1862 **** #endif /* HAVE_LDAP_STR2OBJECTCLASS */ ! void cleanup_schema_mode(void) { ! /* the whole thing is stateless! */ ! } --- 1865,1877 ---- #endif /* HAVE_LDAP_STR2OBJECTCLASS */ ! static void destroy_schema_mode(GtkWidget *w, struct tab *tab) { + assert(tab); + /* the whole thing is (almost) stateless! */ ! g_free(tab->modeinfo); ! tab->modeinfo = NULL; ! ! g_free(tab); } Index: schemabrowse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** schemabrowse.h 11 Oct 2003 09:17:21 -0000 1.10 --- schemabrowse.h 11 Oct 2003 21:35:30 -0000 1.11 *************** *** 55,59 **** ! GtkWidget *new_schemamode(struct tab *tab); void popup_detail(enum schema_detail_type type, struct ldapserver *server, void *detail); --- 55,59 ---- ! struct tab *new_schemamode(); void popup_detail(enum schema_detail_type type, struct ldapserver *server, void *detail); Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** search.c 11 Oct 2003 06:40:44 -0000 1.44 --- search.c 11 Oct 2003 21:35:30 -0000 1.45 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2002 Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 53,59 **** GdkEventButton *event, struct tab *tab); ! GtkWidget *new_searchmode(struct tab *tab) { GtkWidget *main_clist, *searchmode_vbox, *hbox1, *scrwin; --- 54,61 ---- GdkEventButton *event, struct tab *tab); + static void destroy_search_mode(GtkWidget *w, struct tab *tab); ! struct tab *new_searchmode() { GtkWidget *main_clist, *searchmode_vbox, *hbox1, *scrwin; *************** *** 63,67 **** struct tab_search *modeinfo; ! modeinfo = calloc(sizeof(struct tab_search), 1); tab->modeinfo = modeinfo; --- 65,72 ---- struct tab_search *modeinfo; ! struct tab *tab = g_malloc0(sizeof(struct tab)); ! tab->type = SEARCH_MODE; ! ! modeinfo = g_malloc0(sizeof(struct tab_search)); tab->modeinfo = modeinfo; *************** *** 150,154 **** gtk_widget_show(searchmode_vbox); ! return(searchmode_vbox); } --- 155,165 ---- gtk_widget_show(searchmode_vbox); ! gtk_signal_connect(GTK_OBJECT(searchmode_vbox), "destroy", ! GTK_SIGNAL_FUNC(destroy_search_mode), ! tab); ! ! tab->content = searchmode_vbox; ! gtk_object_set_data(GTK_OBJECT(tab->content), "tab", tab); ! return tab; } *************** *** 968,972 **** ! void cleanup_search_mode(struct tab *tab) { GtkWidget *main_clist; --- 979,983 ---- ! static void destroy_search_mode(GtkWidget *w, struct tab *tab) { GtkWidget *main_clist; *************** *** 974,977 **** --- 985,990 ---- struct resultset *cur_resultset; + assert(tab); + cur_resultset = SEARCHTAB(tab)->cur_resultset; if(cur_resultset) { *************** *** 996,999 **** --- 1009,1016 ---- } + g_free(tab->modeinfo); + tab->modeinfo = NULL; + + g_free(tab); } Index: search.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** search.h 11 Oct 2003 06:40:44 -0000 1.10 --- search.h 11 Oct 2003 21:35:30 -0000 1.11 *************** *** 56,60 **** }; ! GtkWidget *new_searchmode(struct tab *tab); void servername_changed_callback(struct tab *tab); gint searchbase_button_pressed(GtkWidget *widget, GdkEventButton *event, struct tab *tab); --- 56,60 ---- }; ! struct tab *new_searchmode(); void servername_changed_callback(struct tab *tab); gint searchbase_button_pressed(GtkWidget *widget, GdkEventButton *event, struct tab *tab); |
From: <sta...@us...> - 2003-10-11 21:26:35
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv11761 Modified Files: dt_time.c Log Message: * Added a note to fix a fixed-length buffer Index: dt_time.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_time.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dt_time.c 9 Oct 2003 05:15:06 -0000 1.8 --- dt_time.c 11 Oct 2003 21:26:31 -0000 1.9 *************** *** 227,231 **** GtkWidget *hbox2, *button2; GtkAdjustment *adj; ! char titlebuffer[1024]; struct tm tm; --- 227,231 ---- GtkWidget *hbox2, *button2; GtkAdjustment *adj; ! char titlebuffer[1024]; /* FIXME: fixed buffer length */ struct tm tm; |
From: <sta...@us...> - 2003-10-11 20:45:45
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv4755 Modified Files: util.c Log Message: * Removed some more fixed size buffers * Added the gq_g_string_sprintf function used to replace g_string_sprintf as long as it does not support positional parameters of the form %1$s (needed for I18N). (I hope this works correctly.) Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** util.c 11 Oct 2003 20:06:30 -0000 1.68 --- util.c 11 Oct 2003 20:45:42 -0000 1.69 *************** *** 305,309 **** int open_context; int rc; ! char message[256]; /* FIXME */ int newpw = 0; --- 305,309 ---- int open_context; int rc; ! GString *message = NULL; int newpw = 0; *************** *** 330,337 **** server->enteredpw[0] == 0) { char *ret; ! snprintf(message, sizeof(message), ! _("Password for server %s"), server->ldaphost); ! if (query_popup(message, &ret, TRUE /* is_password */)) { if (ret) { g_free_if(server->enteredpw); --- 330,339 ---- server->enteredpw[0] == 0) { char *ret; ! message = g_string_sized_new(128); ! g_string_sprintf(message, ! _("Password for server %s"), server->ldaphost); ! if (query_popup(message->str, &ret, TRUE /* is_password */)) { ! g_string_free(message, TRUE); if (ret) { g_free_if(server->enteredpw); *************** *** 342,345 **** --- 344,348 ---- } } else { + g_string_free(message, TRUE); return NULL; } *************** *** 484,488 **** LDAP *ld; int msg; - char message[MAX_DN_LEN + 128]; gboolean rc = TRUE; --- 487,490 ---- *************** *** 531,537 **** if(msg != LDAP_SUCCESS) { ! snprintf(message, sizeof(message), ! "%s: %s", dn, ldap_err2string(msg)); ! error_popup(_("Error deleting entry"), message); rc = FALSE; } --- 533,541 ---- if(msg != LDAP_SUCCESS) { ! GString *message = g_string_sized_new(128); ! g_string_sprintf(message, ! "%s: %s", dn, ldap_err2string(msg)); ! error_popup(_("Error deleting entry"), message->str); ! g_string_free(message, TRUE); rc = FALSE; } *************** *** 1741,1744 **** --- 1745,1798 ---- return bin_enable_uline(gtk_toggle_button_new_with_label(text)); } + + + #ifndef HAVE_REORDERABLE_G_STRING_SPRINTF + + /* This is a work-around around the fact that g_string_sprintf is + unable to deal with positional parameters */ + + void gq_g_string_sprintf(GString *string, const gchar *format, ...) + { + int s = -1; + int n = string->allocated_len; + + va_list ap; + + assert(string); + printf("gq_g_string_sprintf...\n"); + /* while (s > string->len || s < 0) { */ + for (;;) { + va_start(ap, format); + s = vsnprintf(string->str, n, format, ap); + if (s == -1) { + n = 2 * n; + if (n < 32) n = 32; + } else if (s > n) { + n = s + 1; + } else { + va_end(ap); + string->len = s; /* duck */ + break; + } + + printf("resizing %d to %d...\n", s, n); + + #if GTK_MAJOR >= 2 + g_string_set_size(string, n + 1); + #else + /* Uarghhh, what an ugly hack */ + char *tmp = g_malloc(n + 1); + memset(tmp, 'x', n); + tmp[n] = 0; + g_string_assign(string, tmp); + g_free(tmp); + #endif + va_end(ap); + } + return; + } + + #endif /* HAVE_REORDERABLE_G_STRING_SPRINTF */ + /* |
From: <sta...@us...> - 2003-10-11 20:26:10
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv1010 Modified Files: state.c state.h Log Message: * Support for string values, rudimentary, untested support for lists of strings * Support for hierarchic storage of values (very registry-like, uahhh), using the "." as a path separator * Support to allow for removal of state names * Cosmetic changes (I'm using Java conventions, sometimes) Index: state.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/state.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** state.c 8 Oct 2003 22:51:53 -0000 1.2 --- state.c 11 Oct 2003 20:26:07 -0000 1.3 *************** *** 67,70 **** --- 67,72 ---- }; + typedef void (*sv_free_list_func)(void); + struct state_value { enum state_value_type type; *************** *** 74,78 **** GList *list_val; } val; ! void (*free_list_element)(void *); }; --- 76,80 ---- GList *list_val; } val; ! sv_free_list_func free_list_element; }; *************** *** 131,135 **** } ! static gboolean ghr_free_value(char *key, struct state_value *v, gpointer ud) { g_free_if(key); free_state_value(v); --- 133,138 ---- } ! static gboolean ghr_free_value(char *key, struct state_value *v, gpointer ud) ! { g_free_if(key); free_state_value(v); *************** *** 140,144 **** static gboolean ghr_free_entity(char *key, ! struct state_entity *e, gpointer ud) { g_free_if(key); free_state_entity(e); --- 143,148 ---- static gboolean ghr_free_entity(char *key, ! struct state_entity *e, gpointer ud) ! { g_free_if(key); free_state_entity(e); *************** *** 146,150 **** } ! void free_state_entity(struct state_entity *e) { assert(e); g_hash_table_foreach_remove(e->values, (GHRFunc) ghr_free_value, NULL); --- 150,155 ---- } ! void free_state_entity(struct state_entity *e) ! { assert(e); g_hash_table_foreach_remove(e->values, (GHRFunc) ghr_free_value, NULL); *************** *** 155,178 **** ! struct state_entity *lookup_entity(const char *entity_name) { struct state_entity *e; ! if (!entities) { ! entities = g_hash_table_new(g_str_hash, g_str_equal); } ! e = g_hash_table_lookup(entities, entity_name); if (e) { return e; } ! e = new_state_entity(); ! g_hash_table_insert(entities, g_strdup(entity_name), e); return e; } ! int lookup_state_value_get_int(const char *state_name, ! const char *value_name, ! int def) { struct state_value *val; --- 160,222 ---- ! static struct state_entity *lookup_entity_with_root(GHashTable *root, ! const char *entity_name, ! gboolean create) { struct state_entity *e; + const char *c; ! c = strchr(entity_name, '.'); /* UTF-8 OK: we do not use non-ASCII ! entity names */ ! if (c) { ! /* look for subentities! */ ! char *d = g_strdup(entity_name); ! char *f = d + (c - entity_name); ! *f = 0; ! f++; ! ! e = g_hash_table_lookup(root, d); ! ! if (!e) { ! if (create) { ! e = new_state_entity(); ! g_hash_table_insert(root, g_strdup(d), e); ! } else { ! return NULL; ! } ! } ! ! e = lookup_entity_with_root(e->entities, f, create); ! return e; } ! e = g_hash_table_lookup(root, entity_name); if (e) { return e; } ! if (create) { ! e = new_state_entity(); ! g_hash_table_insert(root, g_strdup(entity_name), e); ! } return e; } ! gboolean exists_entity(const char *entity_name) ! { ! return lookup_entity_with_root(entities, entity_name, FALSE) != NULL; ! } ! ! struct state_entity *lookup_entity(const char *entity_name) ! { ! if (!entities) { ! entities = g_hash_table_new(g_str_hash, g_str_equal); ! } ! ! return lookup_entity_with_root(entities, entity_name, TRUE); ! } ! ! int state_value_get_int(const char *state_name, ! const char *value_name, ! int def) { struct state_value *val; *************** *** 215,218 **** --- 259,347 ---- } + const char *state_value_get_string(const char *state_name, + const char *value_name, + const char *def) + { + struct state_value *val; + struct state_entity *e = lookup_entity(state_name); + assert(e); + assert(e->values); + + val = g_hash_table_lookup(e->values, value_name); + if (val) { + if (val->type == SV_char) { + return val->val.char_val; + } + } else { + if (def) { + val = new_state_value(SV_char); + val->val.char_val = g_strdup(def); + g_hash_table_insert(e->values, g_strdup(value_name), val); + } + } + return def; + } + + void state_value_set_string(const char *state_name, + const char *value_name, + const char *c) + { + struct state_value *val; + struct state_entity *e = lookup_entity(state_name); + assert(e); + assert(e->values); + + val = g_hash_table_lookup(e->values, value_name); + if (val) { + if (val->type == SV_char) { + g_free_and_dup(val->val.char_val, c); + } + } else { + val = new_state_value(SV_char); + g_free_and_dup(val->val.char_val, c); + g_hash_table_insert(e->values, g_strdup(value_name), val); + } + } + + static void rm_entity_with_root(GHashTable *root, + const char *entity_name) + { + struct state_entity *e; + const char *c; + + c = strchr(entity_name, '.'); /* UTF-8 OK: we do not use non-ASCII + entity names */ + if (c) { + /* look for subentities! */ + char *d = g_strdup(entity_name); + char *f = d + (c - entity_name); + *f = 0; + f++; + + e = g_hash_table_lookup(root, d); + + if (!e) { + return; + } + + rm_entity_with_root(e->entities, f); + return; + } + + e = g_hash_table_lookup(root, entity_name); + if (e) { + free_state_entity(e); + g_hash_table_remove(root, entity_name); + } + } + + void rm_value(const char *state_name) + { + if (entities != NULL) { + rm_entity_with_root(entities, state_name); + } + } + + static void width_height_state(GtkWidget *w, GtkAllocation *allocation, *************** *** 228,233 **** GdkWindow *win = w->window; if (win && config->restore_window_positions) { ! int x = lookup_state_value_get_int(name, "x", -1); ! int y = lookup_state_value_get_int(name, "y", -1); if (x >= 0 && y >= 0) gdk_window_move(win, x, y); --- 357,362 ---- GdkWindow *win = w->window; if (win && config->restore_window_positions) { ! int x = state_value_get_int(name, "x", -1); ! int y = state_value_get_int(name, "y", -1); if (x >= 0 && y >= 0) gdk_window_move(win, x, y); *************** *** 258,263 **** if (config->restore_window_sizes) { ! w = lookup_state_value_get_int(name, "width", w); ! h = lookup_state_value_get_int(name, "height", h); } --- 387,392 ---- if (config->restore_window_sizes) { ! w = state_value_get_int(name, "width", w); ! h = state_value_get_int(name, "height", h); } *************** *** 309,312 **** --- 438,443 ---- int len = strlen(value_name) + 80; char *msg = g_malloc(len); + GList *l; + snprintf(msg, len, "<state-value name='%s' type='%s'>\n", value_name, detokenize(token_value_type_names, v->type)); *************** *** 323,330 **** if (v->val.char_val) { config_write(wc, v->val.char_val); } break; case SV_list: ! abort(); break; default: --- 454,466 ---- if (v->val.char_val) { config_write(wc, v->val.char_val); + config_write(wc, "\n"); } break; case SV_list: ! wc->indent++; ! for ( l = v->val.list_val ; l ; l = g_list_next(l)) { ! config_write_string(wc, l->data, "list-item"); ! } ! wc->indent--; break; default: *************** *** 487,491 **** static void entity_entityE(struct parser_context *ctx, ! struct tagstack_entry *e) { struct state_entity *parent = peek_tag(ctx->stack, 1)->data; --- 623,627 ---- static void entity_entityE(struct parser_context *ctx, ! struct tagstack_entry *e) { struct state_entity *parent = peek_tag(ctx->stack, 1)->data; *************** *** 506,531 **** } static void state_valueE(struct parser_context *ctx, ! struct tagstack_entry *e) { struct state_entity *ent = peek_tag(ctx->stack, 1)->data; const char *n = NULL; - enum state_value_type t = 0; int i; for (i = 0 ; e->attrs[i] ; i += 2) { if (strcmp("name", e->attrs[i]) == 0) { n = e->attrs[i+1]; - } else if (strcmp("type", e->attrs[i]) == 0) { - t = tokenize(token_value_type_names, e->attrs[i+1]); } } ! if (n != NULL && t != 0) { ! struct state_value *v = new_state_value(t); char *ep; ! switch (t) { ! case SV_int: *(v->val.int_val) = --- 642,689 ---- } + static void state_valuesS(struct parser_context *ctx, + struct tagstack_entry *e) + { + /* struct state_entity *ent = peek_tag(ctx->stack, 1)->data; */ + int i; + enum state_value_type t = 0; + + for (i = 0 ; e->attrs[i] ; i += 2) { + if (strcmp("type", e->attrs[i]) == 0) { + t = tokenize(token_value_type_names, e->attrs[i+1]); + } + } + + if (t != 0) { + struct state_value *v = new_state_value(t); + e->data = v; + e->free_data = (free_func) free_state_value; + } else { + /** FIXME: report error **/ + } + + + } + static void state_valueE(struct parser_context *ctx, ! struct tagstack_entry *e) { struct state_entity *ent = peek_tag(ctx->stack, 1)->data; const char *n = NULL; int i; + struct state_value *v = (struct state_value *) e->data; for (i = 0 ; e->attrs[i] ; i += 2) { if (strcmp("name", e->attrs[i]) == 0) { n = e->attrs[i+1]; } } ! if (n != NULL && v->type != 0) { char *ep; ! assert(v); ! ! switch (v->type) { case SV_int: *(v->val.int_val) = *************** *** 536,540 **** break; case SV_list: ! abort(); break; default: --- 694,698 ---- break; case SV_list: ! v->free_list_element = (sv_free_list_func) g_free; break; default: *************** *** 544,547 **** --- 702,721 ---- g_hash_table_insert(ent->values, g_strdup(n), v); + + e->data = NULL; + e->free_data = NULL; + } + } + + static void list_itemE(struct parser_context *ctx, + struct tagstack_entry *e) + { + struct state_value *v = peek_tag(ctx->stack, 1)->data; + + if (v->type == SV_list) { + v->val.list_val = g_list_append(v->val.list_val, + g_strdup(e->cdata)); + } else { + /* FIXME: report error */ } } *************** *** 565,570 **** { "state-value", 0, ! NULL, state_valueE, { "entity", NULL }, }, { --- 739,749 ---- { "state-value", 0, ! state_valuesS, state_valueE, { "entity", NULL }, + }, + { + "list-item", 0, + NULL, list_itemE, + { "state-value", NULL }, }, { Index: state.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/state.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** state.h 5 Oct 2003 22:15:31 -0000 1.1 --- state.h 11 Oct 2003 20:26:07 -0000 1.2 *************** *** 34,39 **** --- 34,60 ---- const char *name, int w, int h); + void init_state(); void save_state(); + + /* Never use non-ASCII entity names */ + struct state_entity *lookup_entity(const char *entity_name); + void rm_value(const char *state_name); + int state_value_get_int(const char *state_name, + const char *value_name, + int def); + void state_value_set_int(const char *state_name, + const char *value_name, + int n); + + const char *state_value_get_string(const char *state_name, + const char *value_name, + const char *def); + void state_value_set_string(const char *state_name, + const char *value_name, + const char *c); + + gboolean exists_entity(const char *entity_name) ; + #endif |
From: <bi...@us...> - 2003-10-11 20:06:34
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv30519/src Modified Files: util.c Log Message: if "sasl.h" not found, try to use "sasl/sasl.h". This fixes SF bug #777687 fix potential small bug in autoconf feature reporting Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** util.c 9 Oct 2003 05:47:26 -0000 1.67 --- util.c 11 Oct 2003 20:06:30 -0000 1.68 *************** *** 43,47 **** --- 43,51 ---- #endif #ifdef HAVE_SASL + # ifdef HAVE_SASL_H # include <sasl.h> + # else + # include <sasl/sasl.h> + # endif #endif |
From: <bi...@us...> - 2003-10-11 20:06:34
|
Update of /cvsroot/gqclient/gq In directory sc8-pr-cvs1:/tmp/cvs-serv30519 Modified Files: acinclude.m4 configure.in Log Message: if "sasl.h" not found, try to use "sasl/sasl.h". This fixes SF bug #777687 fix potential small bug in autoconf feature reporting Index: acinclude.m4 =================================================================== RCS file: /cvsroot/gqclient/gq/acinclude.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** acinclude.m4 28 Sep 2003 23:31:03 -0000 1.4 --- acinclude.m4 11 Oct 2003 20:06:30 -0000 1.5 *************** *** 27,31 **** AC_DEFUN(ARG_YESNO, [ ! if test -z "$1"; then echo "no" else --- 27,31 ---- AC_DEFUN(ARG_YESNO, [ ! if test -z "$1" -o "x$1" = "xno"; then echo "no" else Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** configure.in 11 Oct 2003 06:42:59 -0000 1.50 --- configure.in 11 Oct 2003 20:06:30 -0000 1.51 *************** *** 326,330 **** ) ! AC_CHECK_HEADERS([sasl.h], [AC_DEFINE(HAVE_SASL,1,[Define if you have SASL])]) GC_TIMEZONE() --- 326,337 ---- ) ! AC_CHECK_HEADERS([sasl.h], ! [AC_DEFINE(HAVE_SASL,1,[Define if you have SASL])], ! [AC_CHECK_HEADERS([sasl/sasl.h], [AC_DEFINE(HAVE_SASL,1,[Define if you have SASL])])] ! ) ! ! if test "x$ac_cv_header_sasl_h" = "xyes" -o "x$ac_cv_header_sasl_sasl_h" = "xyes"; then ! SASL=1 ! fi GC_TIMEZONE() *************** *** 691,695 **** echo -n "Encrypted passwords............ " ARG_YESNO($ac_cv_lib_crypto_OpenSSL_add_all_digests) echo -n "Gdk-pixbuf support............. " ARG_YESNO($HAVE_PIXBUF) ! echo -n "SASL binds..................... " ARG_YESNO($ac_cv_header_sasl_h) echo -n "Kerberos binds................. " ARG_YESNO($HAVE_KERBEROS) echo -n "Browser Drag and drop.......... " ARG_YESNO($enable_browser_dnd) --- 698,702 ---- echo -n "Encrypted passwords............ " ARG_YESNO($ac_cv_lib_crypto_OpenSSL_add_all_digests) echo -n "Gdk-pixbuf support............. " ARG_YESNO($HAVE_PIXBUF) ! echo -n "SASL binds..................... " ARG_YESNO($SASL) echo -n "Kerberos binds................. " ARG_YESNO($HAVE_KERBEROS) echo -n "Browser Drag and drop.......... " ARG_YESNO($enable_browser_dnd) |
From: <bi...@us...> - 2003-10-11 13:15:28
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv32021/src Modified Files: mainwin.c Log Message: fix segfault when closing tabs Index: mainwin.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** mainwin.c 10 Oct 2003 06:51:34 -0000 1.40 --- mainwin.c 11 Oct 2003 13:15:24 -0000 1.41 *************** *** 296,300 **** gtk_container_add(GTK_CONTAINER(menuFile), Close); gtk_signal_connect_object(GTK_OBJECT(Close), "activate", ! GTK_SIGNAL_FUNC(close_current_tab), NULL); gtk_widget_add_accelerator(Close, "activate", accel_group, 'W', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); --- 296,300 ---- gtk_container_add(GTK_CONTAINER(menuFile), Close); gtk_signal_connect_object(GTK_OBJECT(Close), "activate", ! GTK_SIGNAL_FUNC(close_current_tab), win); gtk_widget_add_accelerator(Close, "activate", accel_group, 'W', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); |
From: <sta...@us...> - 2003-10-11 12:32:16
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv23661 Modified Files: schemabrowse.c Log Message: * Forgot to remove a debug printf Index: schemabrowse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** schemabrowse.c 11 Oct 2003 09:17:21 -0000 1.22 --- schemabrowse.c 11 Oct 2003 12:32:11 -0000 1.23 *************** *** 383,387 **** { GtkWidget *root_menu, *menu, *menu_item; ! printf("HI %d\n", event->button); if(event->type == GDK_BUTTON_PRESS && event->button == 3) { gtk_signal_emit_stop_by_name(GTK_OBJECT(tree_item), "button_press_event"); --- 383,387 ---- { GtkWidget *root_menu, *menu, *menu_item; ! if(event->type == GDK_BUTTON_PRESS && event->button == 3) { gtk_signal_emit_stop_by_name(GTK_OBJECT(tree_item), "button_press_event"); |
From: <sta...@us...> - 2003-10-11 09:17:26
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv23345 Modified Files: schemabrowse.c schemabrowse.h Log Message: * gtk2 related bug: Selecting an item in the tree only worked through a double-click. Hacked to work with a single click like it did before * Cleanups: Removed all unnecessary stuff from the header file (hide purely internal functions + make them static) Index: schemabrowse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** schemabrowse.c 11 Oct 2003 00:18:04 -0000 1.21 --- schemabrowse.c 11 Oct 2003 09:17:21 -0000 1.22 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 50,53 **** --- 51,93 ---- + static void attach_schema_item(GtkWidget *tree, char *type, + void *schemaobject, char *itemname); + static gboolean schema_button_tree(GtkWidget *tree_item, GdkEventButton *event, + GtkWidget *root); + + + static void add_single_schema_server(struct tab *tab, + struct ldapserver *server); + static void add_schema_servers(struct tab *tab); + static void attach_server_schema(GtkWidget *item, struct tab *tab); + static void schema_refresh_server(GtkWidget *widget, GtkWidget *item); + + static void make_detail_notebook(struct tab *tab); + static void popup_detail_callback(GtkWidget *dummy, GtkWidget *widget); + static void make_oc_detail(GtkWidget *target_oc_vbox); + static void fill_oc_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, + struct tab *tab); + static void fill_oc_detail(GtkWidget *target_oc_vbox, + struct ldapserver *server, + LDAPObjectClass *oc); + + static void make_at_detail(GtkWidget *target_at_vbox); + static void fill_at_detail_rightpane(GtkWidget *treeroot, + GtkWidget *tree_item, struct tab *tab); + static void fill_at_detail(GtkWidget *target_vbox, struct ldapserver *server, + LDAPAttributeType *at); + + static void make_mr_detail(GtkWidget *target_mr_vbox); + static void fill_mr_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, + struct tab *tab); + static void fill_mr_detail(GtkWidget *target_vbox, struct ldapserver *server, + LDAPMatchingRule *mr); + + static void make_s_detail(GtkWidget *target_vbox); + static void fill_s_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, + struct tab *tab); + static void fill_s_detail(GtkWidget *target_vbox, struct ldapserver *server, + LDAPSyntax *s); + GtkWidget *new_schemamode(struct tab *tab) *************** *** 108,112 **** ! void add_schema_servers(struct tab *tab) { struct ldapserver *server; --- 148,152 ---- ! static void add_schema_servers(struct tab *tab) { struct ldapserver *server; *************** *** 126,130 **** ! void add_single_schema_server(struct tab *tab, struct ldapserver *server) { GtkWidget *new_item, *new_subtree; --- 166,171 ---- ! static void add_single_schema_server(struct tab *tab, ! struct ldapserver *server) { GtkWidget *new_item, *new_subtree; *************** *** 134,138 **** GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), NULL); gtk_object_set_data(GTK_OBJECT(new_item), "tab", tab); gtk_object_set_data(GTK_OBJECT(new_item), "server", --- 175,183 ---- GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); ! gtk_signal_connect(GTK_OBJECT(new_item), "button_release_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); gtk_object_set_data(GTK_OBJECT(new_item), "tab", tab); gtk_object_set_data(GTK_OBJECT(new_item), "server", *************** *** 151,155 **** ! void attach_server_schema(GtkWidget *item, struct tab *tab) { LDAPObjectClass *oc; --- 196,200 ---- ! static void attach_server_schema(GtkWidget *item, struct tab *tab) { LDAPObjectClass *oc; *************** *** 179,183 **** GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), NULL); gtk_widget_show(new_item); gtk_tree_append(GTK_TREE(server_subtree), new_item); --- 224,232 ---- GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); ! gtk_signal_connect(GTK_OBJECT(new_item), "button_release_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); gtk_widget_show(new_item); gtk_tree_append(GTK_TREE(server_subtree), new_item); *************** *** 188,192 **** gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select_child", GTK_SIGNAL_FUNC(fill_oc_detail_rightpane), tab); --- 237,241 ---- gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select-child", GTK_SIGNAL_FUNC(fill_oc_detail_rightpane), tab); *************** *** 194,202 **** while(tmp) { oc = (LDAPObjectClass *) tmp->data; ! if(oc->oc_names && oc->oc_names[0]) ! for(i = 0; oc->oc_names[i]; i++) attach_schema_item(new_subtree, "oc", oc, oc->oc_names[i]); ! else attach_schema_item(new_subtree, "oc", oc, oc->oc_oid); tmp = tmp->next; } --- 243,253 ---- while(tmp) { oc = (LDAPObjectClass *) tmp->data; ! if(oc->oc_names && oc->oc_names[0]) { ! for(i = 0; oc->oc_names[i]; i++) { attach_schema_item(new_subtree, "oc", oc, oc->oc_names[i]); ! } ! } else { attach_schema_item(new_subtree, "oc", oc, oc->oc_oid); + } tmp = tmp->next; } *************** *** 207,211 **** GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), NULL); gtk_tree_append(GTK_TREE(server_subtree), new_item); gtk_widget_show(new_item); --- 258,266 ---- GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); ! gtk_signal_connect(GTK_OBJECT(new_item), "button_release_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); gtk_tree_append(GTK_TREE(server_subtree), new_item); gtk_widget_show(new_item); *************** *** 216,220 **** gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select_child", GTK_SIGNAL_FUNC(fill_at_detail_rightpane), tab); --- 271,275 ---- gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select-child", GTK_SIGNAL_FUNC(fill_at_detail_rightpane), tab); *************** *** 222,230 **** while(tmp) { at = (LDAPAttributeType *) tmp->data; ! if(at->at_names && at->at_names[0]) ! for(i = 0; at->at_names[i]; i++) attach_schema_item(new_subtree, "at", at, at->at_names[i]); ! else attach_schema_item(new_subtree, "at", at, at->at_oid); tmp = tmp->next; } --- 277,287 ---- while(tmp) { at = (LDAPAttributeType *) tmp->data; ! if(at->at_names && at->at_names[0]) { ! for(i = 0; at->at_names[i]; i++) { attach_schema_item(new_subtree, "at", at, at->at_names[i]); ! } ! } else { attach_schema_item(new_subtree, "at", at, at->at_oid); + } tmp = tmp->next; } *************** *** 235,239 **** GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), NULL); gtk_tree_append(GTK_TREE(server_subtree), new_item); gtk_widget_show(new_item); --- 292,300 ---- GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); ! gtk_signal_connect(GTK_OBJECT(new_item), "button_release_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); gtk_tree_append(GTK_TREE(server_subtree), new_item); gtk_widget_show(new_item); *************** *** 244,248 **** gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select_child", GTK_SIGNAL_FUNC(fill_mr_detail_rightpane), tab); --- 305,309 ---- gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select-child", GTK_SIGNAL_FUNC(fill_mr_detail_rightpane), tab); *************** *** 250,258 **** while(tmp) { mr = (LDAPMatchingRule *) tmp->data; ! if(mr->mr_names && mr->mr_names[0]) ! for(i = 0; mr->mr_names[i]; i++) attach_schema_item(new_subtree, "mr", mr, mr->mr_names[i]); ! else attach_schema_item(new_subtree, "mr", mr, mr->mr_oid); tmp = tmp->next; } --- 311,321 ---- while(tmp) { mr = (LDAPMatchingRule *) tmp->data; ! if(mr->mr_names && mr->mr_names[0]) { ! for(i = 0; mr->mr_names[i]; i++) { attach_schema_item(new_subtree, "mr", mr, mr->mr_names[i]); ! } ! } else { attach_schema_item(new_subtree, "mr", mr, mr->mr_oid); + } tmp = tmp->next; } *************** *** 263,267 **** GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), NULL); gtk_tree_append(GTK_TREE(server_subtree), new_item); gtk_widget_show(new_item); --- 326,334 ---- GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); ! gtk_signal_connect(GTK_OBJECT(new_item), "button_release_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! SCHEMATAB(tab)->treeroot); gtk_tree_append(GTK_TREE(server_subtree), new_item); gtk_widget_show(new_item); *************** *** 272,276 **** gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select_child", GTK_SIGNAL_FUNC(fill_s_detail_rightpane), tab); --- 339,343 ---- gtk_widget_show(new_subtree); gtk_tree_item_set_subtree(GTK_TREE_ITEM(new_item), new_subtree); ! gtk_signal_connect(GTK_OBJECT(new_subtree), "select-child", GTK_SIGNAL_FUNC(fill_s_detail_rightpane), tab); *************** *** 291,295 **** /* more of a macro really, this makes inserting duplicates easier */ ! void attach_schema_item(GtkWidget *tree, char *type, void *schemaobject, char *itemname) { GtkWidget *new_item; --- 358,363 ---- /* more of a macro really, this makes inserting duplicates easier */ ! static void attach_schema_item(GtkWidget *tree, char *type, ! void *schemaobject, char *itemname) { GtkWidget *new_item; *************** *** 298,302 **** GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), NULL); gtk_object_set_data(GTK_OBJECT(new_item), type, schemaobject); gtk_widget_show(new_item); --- 366,374 ---- GTK_WIDGET_UNSET_FLAGS(new_item, GTK_CAN_FOCUS); gtk_signal_connect(GTK_OBJECT(new_item), "button_press_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! tree); ! gtk_signal_connect(GTK_OBJECT(new_item), "button_release_event", ! GTK_SIGNAL_FUNC(schema_button_tree), ! tree); gtk_object_set_data(GTK_OBJECT(new_item), type, schemaobject); gtk_widget_show(new_item); *************** *** 307,314 **** ! gboolean schema_button_tree(GtkWidget *tree_item, GdkEventButton *event) { GtkWidget *root_menu, *menu, *menu_item; ! if(event->type == GDK_BUTTON_PRESS && event->button == 3) { gtk_signal_emit_stop_by_name(GTK_OBJECT(tree_item), "button_press_event"); --- 379,387 ---- ! static gboolean schema_button_tree(GtkWidget *tree_item, GdkEventButton *event, ! GtkWidget *root) { GtkWidget *root_menu, *menu, *menu_item; ! printf("HI %d\n", event->button); if(event->type == GDK_BUTTON_PRESS && event->button == 3) { gtk_signal_emit_stop_by_name(GTK_OBJECT(tree_item), "button_press_event"); *************** *** 319,330 **** gtk_menu_item_set_submenu(GTK_MENU_ITEM(root_menu), menu); ! #if GTK_MAJOR >= 2 ! menu_item = gtk_separator_menu_item_new(); ! #else menu_item = gtk_tearoff_menu_item_new(); - #endif gtk_menu_append(GTK_MENU(menu), menu_item); gtk_widget_set_sensitive(menu_item, FALSE); gtk_widget_show(menu_item); /* Refresh */ --- 392,401 ---- gtk_menu_item_set_submenu(GTK_MENU_ITEM(root_menu), menu); ! #if GTK_MAJOR < 2 menu_item = gtk_tearoff_menu_item_new(); gtk_menu_append(GTK_MENU(menu), menu_item); gtk_widget_set_sensitive(menu_item, FALSE); gtk_widget_show(menu_item); + #endif /* Refresh */ *************** *** 352,359 **** return(TRUE); ! } ! else if(event->type == GDK_BUTTON_PRESS && event->button == 2) { popup_detail_callback(NULL, tree_item); return(TRUE); } --- 423,435 ---- return(TRUE); ! } else if(event->type == GDK_BUTTON_RELEASE && event->button == 2) { popup_detail_callback(NULL, tree_item); return(TRUE); + #if GTK_MAJOR >= 2 + /* hack, hack, hack */ + } else if(event->type == GDK_BUTTON_RELEASE && event->button == 1) { + gtk_tree_select_child(GTK_TREE(root), tree_item); + return(TRUE); + #endif } *************** *** 362,366 **** ! void schema_refresh_server(GtkWidget *widget, GtkWidget *item) { GList *sel; --- 438,442 ---- ! static void schema_refresh_server(GtkWidget *widget, GtkWidget *item) { GList *sel; *************** *** 401,405 **** ! void make_detail_notebook(struct tab *tab) { GtkWidget *rightpane_notebook, *rightpane_vbox; --- 477,481 ---- ! static void make_detail_notebook(struct tab *tab) { GtkWidget *rightpane_notebook, *rightpane_vbox; *************** *** 466,470 **** ! void popup_detail_callback(GtkWidget *dummy, GtkWidget *widget) { LDAPObjectClass *oc; --- 542,546 ---- ! static void popup_detail_callback(GtkWidget *dummy, GtkWidget *widget) { LDAPObjectClass *oc; *************** *** 499,503 **** ! void popup_detail(enum schema_detail_type type, struct ldapserver *server, void *detail) { GtkWidget *window, *vbox; --- 575,580 ---- ! void popup_detail(enum schema_detail_type type, ! struct ldapserver *server, void *detail) { GtkWidget *window, *vbox; *************** *** 540,544 **** ! void make_oc_detail(GtkWidget *target_oc_vbox) { GtkWidget *label, *entry, *combo, *check, *clist; --- 617,621 ---- ! static void make_oc_detail(GtkWidget *target_oc_vbox) { GtkWidget *label, *entry, *combo, *check, *clist; *************** *** 714,718 **** ! void fill_oc_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab) { GtkWidget *rightpane_notebook, *oc_vbox; --- 791,795 ---- ! static void fill_oc_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab) { GtkWidget *rightpane_notebook, *oc_vbox; *************** *** 746,751 **** ! void fill_oc_detail(GtkWidget *target_oc_vbox, struct ldapserver *server, ! LDAPObjectClass *oc) { GList *list; --- 823,829 ---- ! static void fill_oc_detail(GtkWidget *target_oc_vbox, ! struct ldapserver *server, ! LDAPObjectClass *oc) { GList *list; *************** *** 834,838 **** ! void make_at_detail(GtkWidget *target_vbox) { GtkWidget *hbox1, *hbox2, *vbox1, *vbox2, *table1, *table2, *scrwin; --- 912,916 ---- ! static void make_at_detail(GtkWidget *target_vbox) { GtkWidget *hbox1, *hbox2, *vbox1, *vbox2, *table1, *table2, *scrwin; *************** *** 1094,1098 **** ! void fill_at_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab) { GtkWidget *rightpane_notebook, *at_vbox; --- 1172,1177 ---- ! static void fill_at_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, ! struct tab *tab) { GtkWidget *rightpane_notebook, *at_vbox; *************** *** 1126,1131 **** ! void fill_at_detail(GtkWidget *target_vbox, struct ldapserver *server, ! LDAPAttributeType *at) { GList *list; --- 1205,1210 ---- ! static void fill_at_detail(GtkWidget *target_vbox, struct ldapserver *server, ! LDAPAttributeType *at) { GList *list; *************** *** 1239,1243 **** ! void make_mr_detail(GtkWidget *target_vbox) { GtkWidget *hbox1, *vbox1, *table1, *hbox2, *vbox2, *scrwin; --- 1318,1322 ---- ! static void make_mr_detail(GtkWidget *target_vbox) { GtkWidget *hbox1, *vbox1, *table1, *hbox2, *vbox2, *scrwin; *************** *** 1367,1371 **** ! void fill_mr_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab) { GtkWidget *rightpane_notebook, *mr_vbox; --- 1446,1451 ---- ! static void fill_mr_detail_rightpane(GtkWidget *treeroot, ! GtkWidget *tree_item, struct tab *tab) { GtkWidget *rightpane_notebook, *mr_vbox; *************** *** 1399,1404 **** ! void fill_mr_detail(GtkWidget *target_vbox, struct ldapserver *server, ! LDAPMatchingRule *mr) { GList *list; --- 1479,1484 ---- ! static void fill_mr_detail(GtkWidget *target_vbox, struct ldapserver *server, ! LDAPMatchingRule *mr) { GList *list; *************** *** 1458,1462 **** ! void make_s_detail(GtkWidget *target_vbox) { GtkWidget *hbox1, *vbox1, *table1, *scrwin, *paned; --- 1538,1542 ---- ! static void make_s_detail(GtkWidget *target_vbox) { GtkWidget *hbox1, *vbox1, *table1, *scrwin, *paned; *************** *** 1567,1571 **** ! void fill_s_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab) { GtkWidget *rightpane_notebook, *s_vbox; --- 1647,1652 ---- ! static void fill_s_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, ! struct tab *tab) { GtkWidget *rightpane_notebook, *s_vbox; *************** *** 1599,1604 **** ! void fill_s_detail(GtkWidget *target_vbox, struct ldapserver *server, ! LDAPSyntax *s) { GList *list; --- 1680,1685 ---- ! static void fill_s_detail(GtkWidget *target_vbox, struct ldapserver *server, ! LDAPSyntax *s) { GList *list; Index: schemabrowse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** schemabrowse.h 29 Sep 2003 17:33:34 -0000 1.9 --- schemabrowse.h 11 Oct 2003 09:17:21 -0000 1.10 *************** *** 1,5 **** /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2001 Bert Vermeulen This program is released under the Gnu General Public License with --- 1,6 ---- /* GQ -- a GTK-based LDAP client ! Copyright (C) 1998-2003 Bert Vermeulen ! Copyright (C) 2002-2003 Peter Stamfest This program is released under the Gnu General Public License with *************** *** 55,89 **** GtkWidget *new_schemamode(struct tab *tab); - void add_single_schema_server(struct tab *tab, struct ldapserver *server); - void add_schema_servers(struct tab *tab); - void attach_server_schema(GtkWidget *item, struct tab *tab); - void attach_schema_item(GtkWidget *tree, char *type, void *schemaobject, char *itemname); - - gboolean schema_button_tree(GtkWidget *tree_item, GdkEventButton *event); - void schema_refresh_server(GtkWidget *widget, GtkWidget *item); - - void make_detail_notebook(struct tab *tab); - void popup_detail_callback(GtkWidget *dummy, GtkWidget *widget); void popup_detail(enum schema_detail_type type, struct ldapserver *server, void *detail); - - void make_oc_detail(GtkWidget *target_oc_vbox); - void fill_oc_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab); - void fill_oc_detail(GtkWidget *target_oc_vbox, struct ldapserver *server, - LDAPObjectClass *oc); - - void make_at_detail(GtkWidget *target_at_vbox); - void fill_at_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab); - void fill_at_detail(GtkWidget *target_vbox, struct ldapserver *server, - LDAPAttributeType *at); - - void make_mr_detail(GtkWidget *target_mr_vbox); - void fill_mr_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab); - void fill_mr_detail(GtkWidget *target_vbox, struct ldapserver *server, - LDAPMatchingRule *mr); - - void make_s_detail(GtkWidget *target_vbox); - void fill_s_detail_rightpane(GtkWidget *treeroot, GtkWidget *tree_item, struct tab *tab); - void fill_s_detail(GtkWidget *target_vbox, struct ldapserver *server, - LDAPSyntax *s); void select_oc_from_clist(GtkWidget *clist, gint row, gint column, --- 56,60 ---- |