Tue, 11 Jun 2024 21:45:39 +0200
fix path textfield
application/window.c | file | annotate | diff | comparison | revisions | |
ui/gtk/text.c | file | annotate | diff | comparison | revisions |
--- a/application/window.c Tue Jun 11 21:31:21 2024 +0200 +++ b/application/window.c Tue Jun 11 21:45:39 2024 +0200 @@ -82,24 +82,19 @@ void* window_resource_table_getvalue(DavResource *res, int col) { switch (col) { - case 0: - { // icon + case 0: { // icon return res->iscollection ? folder_icon : file_icon; } - case 1: - { // resource name + case 1: { // resource name return res->name; } - case 2: - { // type + case 2: { // type return res->iscollection ? "Collection" : (res->contenttype ? res->contenttype : "Resource"); } - case 3: - { // last modified + case 3: { // last modified return util_date_str(res->lastmodified); } - case 4: - { // size + case 4: { // size return util_size_str(res->iscollection, res->contentlength); } }
--- a/ui/gtk/text.c Tue Jun 11 21:31:21 2024 +0200 +++ b/ui/gtk/text.c Tue Jun 11 21:45:39 2024 +0200 @@ -691,6 +691,7 @@ static gboolean path_textfield_btn_pressed(GtkWidget *widget, GdkEventButton *event, UiPathTextField *pathtf) { gtk_box_pack_start(GTK_BOX(pathtf->hbox), pathtf->entry, TRUE, TRUE, 0); gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->buttonbox); + pathtf->buttonbox = NULL; gtk_widget_show(pathtf->entry); gtk_widget_grab_focus(pathtf->entry); @@ -865,12 +866,16 @@ pathtf->current_nelm = nelm; GtkWidget *buttonbox = create_path_button_box(); + + // switch from entry to buttonbox or remove current buttonbox + if(pathtf->buttonbox) { + gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->buttonbox); + } else { + gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->entry); + } + gtk_box_pack_start(GTK_BOX(pathtf->hbox), buttonbox, FALSE, FALSE, 0); pathtf->buttonbox = buttonbox; - // switch from entry to buttonbox - gtk_container_remove(GTK_CONTAINER(pathtf->hbox), pathtf->entry); - gtk_box_pack_start(GTK_BOX(pathtf->hbox), buttonbox, FALSE, FALSE, 0); - for (int i=0;i<nelm;i++) { UiPathElm *elm = &path_elm[i];