sync with sylpheed 0.6.3 release
[claws.git] / src / editldap_basedn.c
index 7b12ec9f470a031bb8e65ed59555accf3409affc..a2aa21c34b95035b78c4b5ec0b7de04acf4c4b86 100644 (file)
@@ -98,8 +98,9 @@ static void edit_ldap_bdn_cancel( GtkWidget *widget, gboolean *cancelled ) {
 
 static void edit_ldap_bdn_list_select( GtkCList *clist, gint row, gint column, GdkEvent *event, gpointer data ) {
        gchar *text = NULL;
+
        if( gtk_clist_get_text( clist, row, 0, &text ) ) {
-               if( text != NULL ) {
+               if( text ) {
                        gtk_entry_set_text(GTK_ENTRY(ldapedit_basedn.basedn_entry), text );
                }
        }
@@ -155,7 +156,7 @@ static void edit_ldap_bdn_create(void) {
        gtk_table_set_row_spacings(GTK_TABLE(table), 8);
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
 
-       // First row
+       /* First row */
        top = 0;
        label = gtk_label_new(_("Hostname"));
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
@@ -165,7 +166,7 @@ static void edit_ldap_bdn_create(void) {
        gtk_table_attach(GTK_TABLE(table), host_label, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(host_label), 0, 0.5);
 
-       // Second row
+       /* Second row */
        top = 1;
        label = gtk_label_new(_("Port"));
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
@@ -175,7 +176,7 @@ static void edit_ldap_bdn_create(void) {
        gtk_table_attach(GTK_TABLE(table), port_label, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(port_label), 0, 0.5);
 
-       // Third row
+       /* Third row */
        top = 2;
        label = gtk_label_new(_("Search Base"));
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
@@ -184,7 +185,7 @@ static void edit_ldap_bdn_create(void) {
        basedn_entry = gtk_entry_new();
        gtk_table_attach(GTK_TABLE(table), basedn_entry, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
-       // Basedn list
+       /* Basedn list */
        vlbox = gtk_vbox_new(FALSE, 8);
        gtk_box_pack_start(GTK_BOX(vbox), vlbox, TRUE, TRUE, 0);
        gtk_container_set_border_width( GTK_CONTAINER(vlbox), 8 );
@@ -201,13 +202,13 @@ static void edit_ldap_bdn_create(void) {
        gtk_clist_set_column_title( GTK_CLIST(basedn_list), 0, _( "Available Search Base(s)" ) );
        gtk_clist_set_selection_mode(GTK_CLIST(basedn_list), GTK_SELECTION_BROWSE);
 
-       // Status line
+       /* Status line */
        hsbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH);
        statusbar = gtk_statusbar_new();
        gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
 
-       // Button panel
+       /* Button panel */
        gtkut_button_set_create(&hbbox, &ok_btn, _("OK"),
                                &cancel_btn, _("Cancel"), NULL, NULL);
        gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
@@ -256,24 +257,22 @@ void edit_ldap_bdn_load_data( const gchar *hostName, const gint iPort, const gin
        gtk_label_set_text(GTK_LABEL(ldapedit_basedn.host_label), hostName);
        gtk_label_set_text(GTK_LABEL(ldapedit_basedn.port_label), sPort);
        if( *sHost != '\0' ) {
-               // Test connection to server
+               /* Test connection to server */
                if( syldap_test_connect_s( sHost, iPort ) ) {
-                       // Attempt to read base DN
+                       /* Attempt to read base DN */
                        GList *baseDN = syldap_read_basedn_s( sHost, iPort, bindDN, bindPW, tov );
                        if( baseDN ) {
                                GList *node = baseDN;
-                               gchar *text[2];
+                               gchar *text[2] = { NULL, NULL };
 
                                while( node ) {
-                                       text[0] = g_strdup( node->data );
-                                       text[1] = NULL;
+                                       text[0] = (gchar *)node->data;
                                        gtk_clist_append(GTK_CLIST(ldapedit_basedn.basedn_list), text);
                                        node = g_list_next( node );
                                        flgDN = TRUE;
                                }
                                mgu_free_dlist( baseDN );
                                baseDN = node = NULL;
-                               text[0] = NULL;
                        }
                        ldapedit_basedn_bad_server = FALSE;
                        flgConn = TRUE;
@@ -281,7 +280,7 @@ void edit_ldap_bdn_load_data( const gchar *hostName, const gint iPort, const gin
        }
        g_free( sHost );
 
-       // Display appropriate message
+       /* Display appropriate message */
        if( flgConn ) {
                if( ! flgDN ) {
                        sMsg = _( "Could not read Search Base(s) from server - please set manually" );