static void edit_person_attrib_add(gpointer data) { GtkCMCList *clist = GTK_CMCLIST(personEditDlg->clist_attrib); gboolean errFlg = FALSE; UserAttribute *attrib = NULL; gint row = personEditDlg->rowIndAttrib; if (gtk_cmclist_get_row_data(clist, row) == NULL) row = 0; attrib = edit_person_attrib_edit(&errFlg, NULL); if (!errFlg) { gchar *text[EMAIL_N_COLS]; text[ATTRIB_COL_NAME] = attrib->name; text[ATTRIB_COL_VALUE] = attrib->value; row = gtk_cmclist_insert(clist, 1 + row, text); gtk_cmclist_set_row_data(clist, row, attrib); gtk_cmclist_select_row(clist, row, 0); edit_person_attrib_clear(NULL); } }
/** * Update list with data for current row. * \param clist List to update. */ static void imp_ldif_update_row( GtkCMCList *clist ) { Ldif_FieldRec *rec; gchar *text[ FIELDS_N_COLS ]; gint row; if( impldif_dlg.rowIndSelect < 0 ) return; row = impldif_dlg.rowIndSelect; rec = gtk_cmclist_get_row_data( clist, row ); if (!rec) return; text[ FIELD_COL_RESERVED ] = ""; text[ FIELD_COL_SELECT ] = ""; text[ FIELD_COL_FIELD ] = rec->tagName; text[ FIELD_COL_ATTRIB ] = rec->userName; gtk_cmclist_freeze( clist ); gtk_cmclist_remove( clist, row ); if( row == impldif_dlg.rowCount - 1 ) { gtk_cmclist_append( clist, text ); } else { gtk_cmclist_insert( clist, row, text ); } if( rec->selected ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_SELECT, markxpm ); } if( rec->reserved ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_RESERVED, markxpm ); } gtk_cmclist_set_row_data( clist, row, rec ); gtk_cmclist_thaw( clist ); }
/** * Load list with LDIF fields read from file. * \param ldf LDIF control data. */ static void imp_ldif_load_fields( LdifFile *ldf ) { GtkCMCList *clist = GTK_CMCLIST(impldif_dlg.clist_field); GList *node, *list; gchar *text[ FIELDS_N_COLS ]; impldif_dlg.rowIndSelect = -1; impldif_dlg.rowCount = 0; if( ! ldf->accessFlag ) return; gtk_cmclist_clear( clist ); list = ldif_get_fieldlist( ldf ); node = list; while( node ) { Ldif_FieldRec *rec = node->data; gint row; text[ FIELD_COL_RESERVED ] = ""; text[ FIELD_COL_SELECT ] = ""; text[ FIELD_COL_FIELD ] = rec->tagName; text[ FIELD_COL_ATTRIB ] = rec->userName; row = gtk_cmclist_append( clist, text ); gtk_cmclist_set_row_data( clist, row, rec ); if( rec->selected ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_SELECT, markxpm ); } if( rec->reserved ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_RESERVED, markxpm ); } impldif_dlg.rowCount++; node = g_list_next( node ); } g_list_free( list ); list = NULL; ldif_set_accessed( ldf, FALSE ); }