static void edit_person_attrib_delete(gpointer data) {
	GtkCMCList *clist = GTK_CMCLIST(personEditDlg->clist_attrib);
	gint row = personEditDlg->rowIndAttrib;
	UserAttribute *attrib = gtk_cmclist_get_row_data(clist, row);
	edit_person_attrib_clear(NULL);
	if (attrib) {
		/* Remove list entry */
		gtk_cmclist_remove(clist, row);
		addritem_free_attribute(attrib);
		attrib = NULL;
	}

	/* Position hilite bar */
	attrib = gtk_cmclist_get_row_data(clist, row);
	if (!attrib) {
		personEditDlg->rowIndAttrib = -1 + row;
	} 
	
	if (!personEditDlg->read_only)
		gtk_widget_set_sensitive(personEditDlg->attrib_del, gtk_cmclist_get_row_data(clist, 0) != NULL);
	
	edit_person_status_show(NULL);
}
Exemplo n.º 2
0
/**
 * 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 );
}