# HG changeset patch # User Olaf Wintermanm # Date 1511351953 -3600 # Node ID 11f3bb408051372c8e4700a602fa7b91a4da4c60 # Parent 5cee4cb5ad7904b20fc862b87289eb338d23f977 fixes gtk2legacy build diff -r 5cee4cb5ad79 -r 11f3bb408051 application/main.c --- a/application/main.c Wed Nov 22 09:49:26 2017 +0100 +++ b/application/main.c Wed Nov 22 12:59:13 2017 +0100 @@ -149,7 +149,7 @@ } void application_startup(UiEvent *event, void *data) { - UiIcon *icon = ui_icon("folder", 16); + UiIcon *icon = ui_icon("gnome-folder", 16); img = ui_icon_image(icon); if(!img) { fprintf(stderr, "Cannot load folder icon\n"); diff -r 5cee4cb5ad79 -r 11f3bb408051 ui/gtk/dnd.c --- a/ui/gtk/dnd.c Wed Nov 22 09:49:26 2017 +0100 +++ b/ui/gtk/dnd.c Wed Nov 22 12:59:13 2017 +0100 @@ -31,6 +31,29 @@ #include #include "dnd.h" +#include "../../ucx/buffer.h" + +#ifdef UI_GTK2LEGACY +static gboolean selection_data_set_uris(GtkSelectionData *selection_data, char **uris) { + UcxBuffer *buf = ucx_buffer_new(NULL, 1024, UCX_BUFFER_AUTOEXTEND); + char *uri; + int i = 0; + while((uri = uris[i]) != NULL) { + ucx_buffer_puts(buf, uri); + ucx_buffer_puts(buf, "\r\n"); + } + GdkAtom type = gdk_atom_intern("text/uri-list", FALSE); + gtk_selection_data_set(selection_data, type, 8, (guchar*)buf->space, buf->pos); + ucx_buffer_free(buf); + return TRUE; +} +static char** selection_data_get_uris(GtkSelectionData *selection_data) { + // TODO: implement + return NULL; +} +#define gtk_selection_data_set_uris selection_data_set_uris +#define gtk_selection_data_get_uris selection_data_get_uris +#endif void ui_selection_settext(UiSelection *sel, char *str, int len) { if(!gtk_selection_data_set_text(sel->data, str, len)); diff -r 5cee4cb5ad79 -r 11f3bb408051 ui/gtk/entry.c --- a/ui/gtk/entry.c Wed Nov 22 09:49:26 2017 +0100 +++ b/ui/gtk/entry.c Wed Nov 22 12:59:13 2017 +0100 @@ -84,6 +84,11 @@ if(step == 0) { step = 1; } +#ifdef UI_GTK2LEGACY + if(min == max) { + max = min + 1; + } +#endif GtkWidget *spin = gtk_spin_button_new_with_range(min, max, step); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), digits); if(var) { diff -r 5cee4cb5ad79 -r 11f3bb408051 ui/gtk/tree.c --- a/ui/gtk/tree.c Wed Nov 22 09:49:26 2017 +0100 +++ b/ui/gtk/tree.c Wed Nov 22 12:59:13 2017 +0100 @@ -151,16 +151,6 @@ } -static gboolean drag_failed( - GtkWidget *widget, - GdkDragContext *context, - GtkDragResult result, - gpointer udata) -{ - printf("drag failed: %d\n", result); - -} - static GtkTargetEntry targetentries[] = { { "STRING", 0, 0 }, @@ -216,7 +206,6 @@ //g_signal_connect(view, "drag-begin", G_CALLBACK(drag_begin), NULL); //g_signal_connect(view, "drag-end", G_CALLBACK(drag_end), NULL); - //g_signal_connect(view, "drag-failed", G_CALLBACK(drag_failed), NULL); // add TreeView as observer to the UiList to update the TreeView if the // data changes