[ghex/gtk4-port: 6/91] Add STUB and Makefile for testing.




commit b9c90df90c1a9045eb9b7607dc841a5d83a6fdf5
Author: Logan Rathbone <poprocks gmail com>
Date:   Sun Jan 3 17:59:55 2021 -0500

    Add STUB and Makefile for testing.
    
    STUB can now build and make a window appear. Hooray!

 src/Makefile | 16 ++++++++++++++++
 src/STUB.c   | 40 ++++++++++++++++++++++++++++++++++++++++
 src/gtkhex.c |  6 ++++++
 3 files changed, 62 insertions(+)
---
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 00000000..4d16b2cc
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,16 @@
+# TEMPORARY MAKEFILE FOR TESTING PURPOSES ONLY
+
+DEBUG=-g
+CC=gcc
+GTK_CFLAGS=$(shell pkg-config --libs --cflags gtk4)
+CFLAGS=-Wall -Wextra -std=c11 -pedantic \
+       $(GTK_CFLAGS) \
+       -I../build -I. \
+       $(DEBUG)
+
+STUB: gtkhex.o hex-document.o
+
+clean:
+       rm -f STUB *.o
+
+.PHONY: clean
diff --git a/src/STUB.c b/src/STUB.c
new file mode 100644
index 00000000..414b0577
--- /dev/null
+++ b/src/STUB.c
@@ -0,0 +1,40 @@
+#include <gtkhex.h>
+
+static void
+activate (GtkApplication *app,
+          gpointer        user_data)
+{
+  GtkWidget *window;
+  HexDocument *doc;
+  GtkWidget *hex;
+  GtkWidget *box;
+
+  window = gtk_application_window_new (app);
+  gtk_window_set_title (GTK_WINDOW (window), "Window");
+  gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
+
+  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_window_set_child (GTK_WINDOW (window), box);
+
+  doc = hex_document_new ();
+  hex = gtk_hex_new (doc);
+
+  gtk_box_append (GTK_BOX (box), hex);
+
+  gtk_widget_show (window);
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  GtkApplication *app;
+  int status;
+
+  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
+  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+  status = g_application_run (G_APPLICATION (app), argc, argv);
+  g_object_unref (app);
+
+  return status;
+}
diff --git a/src/gtkhex.c b/src/gtkhex.c
index a91fe207..f6850a95 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -1835,6 +1835,11 @@ void gtk_hex_paste_from_clipboard(GtkHex *gh)
 
 static void gtk_hex_real_copy_to_clipboard(GtkHex *gh)
 {
+       // LAR - REWRITE FOR GTK4
+       (void)gh;
+       g_debug("%s: NOT IMPLEMENTED", __func__);
+
+#if 0
        gint start_pos; 
        gint end_pos;
        GtkHexClass *klass = GTK_HEX_CLASS(GTK_WIDGET_GET_CLASS(gh));
@@ -1848,6 +1853,7 @@ static void gtk_hex_real_copy_to_clipboard(GtkHex *gh)
                gtk_clipboard_set_text(klass->clipboard, text, end_pos - start_pos);
                g_free(text);
        }
+#endif
 }
 
 static void gtk_hex_real_cut_to_clipboard(GtkHex *gh)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]