fixes gtk2legacy build

Wed, 22 Nov 2017 12:59:13 +0100

author
Olaf Wintermanm <olaf.wintermann@gmail.com>
date
Wed, 22 Nov 2017 12:59:13 +0100
changeset 151
11f3bb408051
parent 150
5cee4cb5ad79
child 152
62921b370c60

fixes gtk2legacy build

application/main.c file | annotate | diff | comparison | revisions
ui/gtk/dnd.c file | annotate | diff | comparison | revisions
ui/gtk/entry.c file | annotate | diff | comparison | revisions
ui/gtk/tree.c file | annotate | diff | comparison | revisions
--- 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");
--- 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 <string.h>
 
 #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));
--- 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) {
--- 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

mercurial