From: Linus Torvalds Date: Wed, 31 Aug 2011 19:09:19 +0000 (-0700) Subject: Add fake 'info' frame contents X-Git-Url: http://git.tdb.fi/?p=ext%2Fsubsurface.git;a=commitdiff_plain;h=a11dbbdb1856a05b97e872fd732682d9bf8ef49b Add fake 'info' frame contents It should have depth, time, place etc information, but right now it only has a fake depth that doesn't even get updated. Just to show the idea of the table usage. Signed-off-by: Linus Torvalds --- diff --git a/Makefile b/Makefile index 4105814..5bb40c2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC=gcc CFLAGS=-Wall -Wno-pointer-sign -g -OBJS=main.o profile.o divelist.o parse.o +OBJS=main.o profile.o info.o divelist.o parse.o parse: $(OBJS) $(CC) $(LDLAGS) -o parse $(OBJS) `xml2-config --libs` \ @@ -16,5 +16,8 @@ main.o: main.c dive.h display.h profile.o: profile.c dive.h display.h $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0` -c profile.c +info.o: info.c dive.h display.h + $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0` -c info.c + divelist.o: divelist.c dive.h display.h $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0` -c divelist.c diff --git a/display.h b/display.h index 8a8b426..327997f 100644 --- a/display.h +++ b/display.h @@ -7,6 +7,7 @@ extern int selected_dive; extern GtkWidget *dive_profile_frame(void); +extern GtkWidget *dive_info_frame(void); extern GtkWidget *create_dive_list(void); extern void repaint_dive(void); diff --git a/info.c b/info.c new file mode 100644 index 0000000..05bcf0f --- /dev/null +++ b/info.c @@ -0,0 +1,27 @@ +#include +#include +#include + +#include "dive.h" +#include "display.h" + +GtkWidget *dive_info_frame(void) +{ + GtkWidget *frame; + GtkWidget *hbox; + GtkWidget *depth; + + frame = gtk_frame_new("Dive info"); + gtk_widget_show(frame); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(frame), hbox); + + depth = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(depth), "54 ft"); + gtk_editable_set_editable(GTK_EDITABLE(depth), FALSE); + + gtk_box_pack_start(GTK_BOX(hbox), depth, FALSE, FALSE, 0); + + return frame; +} diff --git a/main.c b/main.c index 2df31c4..d3853fa 100644 --- a/main.c +++ b/main.c @@ -94,9 +94,12 @@ int main(int argc, char **argv) /* Frame for dive profile */ frame = dive_profile_frame(); gtk_table_attach_defaults(GTK_TABLE(table), frame, 1, 2, 1, 2); - dive_profile = frame; + /* Frame for dive info */ + frame = dive_info_frame(); + gtk_table_attach_defaults(GTK_TABLE(table), frame, 1, 2, 0, 1); + gtk_widget_set_app_paintable(win, TRUE); gtk_widget_show_all(win);