mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 03:51:18 +00:00
commit
daddc63144
2 changed files with 14 additions and 13 deletions
|
@ -168,19 +168,19 @@ void Dialog::UpdateData( bool retrieve ){
|
||||||
break;
|
break;
|
||||||
case DLG_COMBO_INT:
|
case DLG_COMBO_INT:
|
||||||
{
|
{
|
||||||
GList *lst = GTK_LIST( GTK_COMBO( data->object )->list )->children;
|
GList *lst = gtk_container_get_children( GTK_CONTAINER( GTK_COMBO( data->object )->list ) );
|
||||||
char *label;
|
const char *labeltext;
|
||||||
const char *entry;
|
const char *entrytext;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*(int*)data->buffer = -1;
|
*(int*)data->buffer = -1;
|
||||||
entry = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( data->object )->entry ) );
|
entrytext = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( data->object )->entry ) );
|
||||||
|
|
||||||
for ( i = 0; lst != NULL; lst = g_list_next( lst ) )
|
for ( i = 0; lst != NULL; lst = g_list_next( lst ) )
|
||||||
{
|
{
|
||||||
label = gtk_label_get_text( GTK_LABEL( lst->data ) );
|
labeltext = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( lst->data ) ) ) );
|
||||||
|
|
||||||
if ( strcmp( label, entry ) == 0 ) {
|
if ( strcmp( labeltext, entrytext ) == 0 ) {
|
||||||
*(int*)data->buffer = i;
|
*(int*)data->buffer = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -238,20 +238,21 @@ void Dialog::UpdateData( bool retrieve ){
|
||||||
gtk_adjustment_set_value( GTK_ADJUSTMENT( data->object ), ( *(int*)data->buffer ) );
|
gtk_adjustment_set_value( GTK_ADJUSTMENT( data->object ), ( *(int*)data->buffer ) );
|
||||||
break;
|
break;
|
||||||
case DLG_COMBO_INT: {
|
case DLG_COMBO_INT: {
|
||||||
GList *lst = GTK_LIST( GTK_COMBO( data->object )->list )->children;
|
GList *lst = gtk_container_get_children( GTK_CONTAINER( GTK_COMBO( data->object )->list ) );
|
||||||
char *entry = NULL;
|
const char *text = NULL;
|
||||||
|
GtkEntry *entry = GTK_ENTRY( GTK_COMBO( data->object )->entry );
|
||||||
|
|
||||||
if ( *(int*)data->buffer != -1 ) {
|
if ( *(int*)data->buffer != -1 ) {
|
||||||
lst = g_list_nth( lst, *(int*)data->buffer );
|
lst = g_list_nth( lst, *(int*)data->buffer );
|
||||||
if ( lst != NULL ) {
|
if ( lst != NULL ) {
|
||||||
entry = gtk_label_get_text( GTK_LABEL( lst->data ) );
|
text = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( lst->data ) ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( entry ) {
|
if ( text ) {
|
||||||
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( data->object )->entry ), entry );
|
gtk_entry_set_text( entry, text );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( data->object )->entry ), "" );
|
gtk_entry_set_text( entry, "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void OnClose( GtkWidget *widget, gpointer data ){
|
||||||
static void popup_selected( GtkWidget *widget, gpointer data ){
|
static void popup_selected( GtkWidget *widget, gpointer data ){
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
|
|
||||||
str = gtk_label_get_text( GTK_LABEL( widget ) );
|
str = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( widget ) ) ) );
|
||||||
gtk_entry_set_text( GTK_ENTRY( data ), str );
|
gtk_entry_set_text( GTK_ENTRY( data ), str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue