コード例 #1
0
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);
	}
}
コード例 #2
0
ファイル: importldif.c プロジェクト: twolife/claws
/**
 * 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 );
}