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 <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2011-08-31 12:09:19 -07:00
parent 7017d17562
commit a11dbbdb18
4 changed files with 36 additions and 2 deletions

View file

@ -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

View file

@ -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);

27
info.c Normal file
View file

@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#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;
}

5
main.c
View file

@ -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);