From e80a4a91ab8cd4721f5007c9d9eb8cfbe997155e Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Fri, 22 Jun 2012 14:56:18 +0000 Subject: Premier essai d'interface graphique avec Glade 2 git-svn-id: file:///var/svn/2012-violon-leds/trunk@25 6be1fa4d-33ac-4c33-becc-79fcb3794bb6 --- tests/test7/Makefile | 33 ++++ tests/test7/test7.c | 46 +++++ tests/test7/win_main.glade | 476 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 555 insertions(+) create mode 100644 tests/test7/Makefile create mode 100644 tests/test7/test7.c create mode 100644 tests/test7/win_main.glade diff --git a/tests/test7/Makefile b/tests/test7/Makefile new file mode 100644 index 0000000..04be49c --- /dev/null +++ b/tests/test7/Makefile @@ -0,0 +1,33 @@ +CC=gcc +GTKBC=gtk-builder-convert +CFLAGS=-W -Wall -Werror -Wno-error=unused-parameter -g +LDFLAGS=-export-dynamic -Werror -g +EXEC=test7 + +CFLAGS+=$(shell pkg-config --cflags gtk+-2.0 gthread-2.0 libpulse) +LDFLAGS+=$(shell pkg-config --libs gtk+-2.0 gthread-2.0 libpulse) + +SRC= $(wildcard *.c) +OBJ= $(SRC:.c=.o) + +all: $(EXEC) + +$(EXEC): $(OBJ) + $(CC) -o $@ $^ $(LDFLAGS) + +#test7.c: win_main.xml + +%.xml: %.glade + $(GTKBC) $< $@ + +%.o: %.c + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + rm *.o *.xml + +mrproper: clean + rm $(EXEC) + diff --git a/tests/test7/test7.c b/tests/test7/test7.c new file mode 100644 index 0000000..7a3ca63 --- /dev/null +++ b/tests/test7/test7.c @@ -0,0 +1,46 @@ +/* + First run tutorial.glade through gtk-builder-convert with this command: + gtk-builder-convert tutorial.glade tutorial.xml + + Then save this file as main.c and compile it using this command + (those are backticks, not single quotes): + gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic + + Then execute it using: + ./tutorial + */ +#include +#include + +void on_win_main_destroy (GtkObject *object, gpointer user_data) { + gtk_main_quit(); +} + +void on_action1_activate(GtkObject *object, gpointer user_data) { + printf("action1\n"); +} + +int main (int argc, char *argv[]) { + GtkBuilder *builder; + GtkWidget *window; + +// int res; + + gtk_init (&argc, &argv); + + builder = gtk_builder_new (); + gtk_builder_add_from_file (builder, "win_main.glade", NULL); + + + window = GTK_WIDGET (gtk_builder_get_object (builder, "win_main")); + printf("window==%p\n", window); + gtk_builder_connect_signals (builder, NULL); + + g_object_unref (G_OBJECT (builder)); + + gtk_widget_show (window); + gtk_main (); + + return 0; +} + diff --git a/tests/test7/win_main.glade b/tests/test7/win_main.glade new file mode 100644 index 0000000..c8c9dcf --- /dev/null +++ b/tests/test7/win_main.glade @@ -0,0 +1,476 @@ + + + + + + 1 + 1 + + + + 2 + 2 + + + 3 + 3 + + + 4 + 4 + + + False + Music2Light + center + 440 + 250 + + + + True + False + + + True + False + + + True + False + False + _Fichier + True + + + True + False + + + gtk-new + True + False + False + True + True + + + + + gtk-open + True + False + False + True + True + + + + + gtk-save + True + False + False + True + True + + + + + gtk-save-as + True + False + False + True + True + + + + + True + False + False + + + + + gtk-quit + True + False + False + True + True + + + + + + + + + True + False + False + É_dition + True + + + True + False + + + gtk-cut + True + False + False + True + True + + + + + gtk-copy + True + False + False + True + True + + + + + gtk-paste + True + False + False + True + True + + + + + gtk-delete + True + False + False + True + True + + + + + + + + + True + False + False + _Affichage + True + + + + + True + False + False + Aid_e + True + + + True + False + + + gtk-about + True + False + False + True + True + + + + + + + + + False + True + 0 + + + + + True + False + + + True + False + 0 + in + + + True + False + 12 + + + True + True + 1 + + + + + + + True + False + <b>Input (Sound)</b> + True + + + + + True + True + 0 + + + + + True + False + 0 + in + + + True + False + 12 + + + True + False + 2 + 2 + + + True + True + True + action1 + + + + + True + True + True + action2 + + + 1 + 2 + + + + + True + True + True + action3 + + + 1 + 2 + + + + + True + True + True + action4 + + + 1 + 2 + 1 + 2 + + + + + + + + + True + False + <b>Transfer function (Effect)</b> + True + + + + + True + True + 1 + + + + + True + False + 0 + in + + + True + False + 12 + + + True + False + + + True + False + + + True + True + 1 + + + True + True + 0 + + + + + True + True + 1 + + + True + True + 1 + + + + + True + True + 1 + + + True + True + 2 + + + + + True + True + 0 + + + + + True + False + + + True + True + 1 + + + True + True + 0 + + + + + True + True + 1 + + + True + True + 1 + + + + + True + True + 1 + + + True + True + 2 + + + + + True + True + 1 + + + + + + + + + True + False + <b>Output (Light)</b> + True + + + + + True + True + 2 + + + + + True + True + 1 + + + + + True + False + 2 + + + False + True + 2 + + + + + + -- cgit v1.2.3