static gboolean imp_ldif_field_list_toggle( GtkCList *clist, GdkEventButton *event, gpointer data ) { if( ! event ) return FALSE; if( impldif_dlg.rowIndSelect < 0 ) return FALSE; if( event->button == 1 ) { if( event->type == GDK_2BUTTON_PRESS ) { Ldif_FieldRec *rec = gtk_clist_get_row_data( clist, impldif_dlg.rowIndSelect ); if( rec ) { rec->selected = ! rec->selected; imp_ldif_update_row( clist ); } } } return FALSE; }
static void imp_ldif_modify_pressed( GtkWidget *widget, gpointer data ) { GtkCList *clist = GTK_CLIST(impldif_dlg.clist_field); Ldif_FieldRec *rec; gint row; if( impldif_dlg.rowIndSelect < 0 ) return; row = impldif_dlg.rowIndSelect; rec = gtk_clist_get_row_data( clist, impldif_dlg.rowIndSelect ); g_free( rec->userName ); rec->userName = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.name_attrib), 0, -1 ); rec->selected = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( impldif_dlg.check_select) ); imp_ldif_update_row( clist ); gtk_clist_select_row( clist, row, 0 ); gtk_label_set_text( GTK_LABEL(impldif_dlg.name_ldif), "" ); gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_attrib), "" ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( impldif_dlg.check_select), FALSE ); }
/** * Callback function to toggle selected LDIF field. * \param clist List to update. * \param event Event object. * \param data Data. */ static gboolean imp_ldif_field_list_toggle( GtkCMCList *clist, GdkEventButton *event, gpointer data ) { Ldif_FieldRec *rec; gboolean toggle = FALSE; if( ! event ) return FALSE; if( impldif_dlg.rowIndSelect < 0 ) return FALSE; if( event->button == 1 ) { /* If single click in select column */ if( event->type == GDK_BUTTON_PRESS ) { gint x = event->x; gint y = event->y; gint row, col; if (!gtk_cmclist_get_selection_info( clist, x, y, &row, &col )) return FALSE; if( col != FIELD_COL_SELECT ) return FALSE; if( row > impldif_dlg.rowCount ) return FALSE; /* Set row */ impldif_dlg.rowIndSelect = row; toggle = TRUE; } /* If double click anywhere in row */ else if( event->type == GDK_2BUTTON_PRESS ) { toggle = TRUE; } } /* Toggle field selection */ if( toggle ) { rec = gtk_cmclist_get_row_data( clist, impldif_dlg.rowIndSelect ); if( rec ) { ldif_field_toggle( rec ); imp_ldif_update_row( clist ); } } return FALSE; }