ui/gtk/text.c

changeset 38
acd8c4a9d3fe
parent 35
834d9c15a69f
child 44
473954dc6b74
equal deleted inserted replaced
37:9b754f1b7e16 38:acd8c4a9d3fe
689 } 689 }
690 690
691 static gboolean path_textfield_btn_pressed(GtkWidget *widget, GdkEventButton *event, UiPathTextField *pathtf) { 691 static gboolean path_textfield_btn_pressed(GtkWidget *widget, GdkEventButton *event, UiPathTextField *pathtf) {
692 gtk_box_pack_start(GTK_BOX(pathtf->hbox), pathtf->entry, TRUE, TRUE, 0); 692 gtk_box_pack_start(GTK_BOX(pathtf->hbox), pathtf->entry, TRUE, TRUE, 0);
693 gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->buttonbox); 693 gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->buttonbox);
694 pathtf->buttonbox = NULL;
694 695
695 gtk_widget_show(pathtf->entry); 696 gtk_widget_show(pathtf->entry);
696 gtk_widget_grab_focus(pathtf->entry); 697 gtk_widget_grab_focus(pathtf->entry);
697 698
698 return TRUE; 699 return TRUE;
863 ui_pathelm_destroy(pathtf->current_pathelms, pathtf->current_nelm); 864 ui_pathelm_destroy(pathtf->current_pathelms, pathtf->current_nelm);
864 pathtf->current_pathelms = path_elm; 865 pathtf->current_pathelms = path_elm;
865 pathtf->current_nelm = nelm; 866 pathtf->current_nelm = nelm;
866 867
867 GtkWidget *buttonbox = create_path_button_box(); 868 GtkWidget *buttonbox = create_path_button_box();
869
870 // switch from entry to buttonbox or remove current buttonbox
871 if(pathtf->buttonbox) {
872 gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->buttonbox);
873 } else {
874 gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->entry);
875 }
876 gtk_box_pack_start(GTK_BOX(pathtf->hbox), buttonbox, FALSE, FALSE, 0);
868 pathtf->buttonbox = buttonbox; 877 pathtf->buttonbox = buttonbox;
869
870 // switch from entry to buttonbox
871 gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->entry);
872 gtk_box_pack_start(GTK_BOX(pathtf->hbox), buttonbox, FALSE, FALSE, 0);
873 878
874 for (int i=0;i<nelm;i++) { 879 for (int i=0;i<nelm;i++) {
875 UiPathElm *elm = &path_elm[i]; 880 UiPathElm *elm = &path_elm[i];
876 881
877 cxmutstr name = cx_strdup(cx_strn(elm->name, elm->name_len)); 882 cxmutstr name = cx_strdup(cx_strn(elm->name, elm->name_len));

mercurial