diff --git a/CMakeLists.txt b/CMakeLists.txt
index a731d45..8a0ebfd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,8 +18,9 @@ add_custom_command(DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/glade/*.glade "${CMAKE_CU
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resources.c
COMMAND glib-compile-resources --target="${CMAKE_CURRENT_BINARY_DIR}/resources.c" --sourcedir="${CMAKE_CURRENT_SOURCE_DIR}" --generate-source "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.gresource.xml")
+FILE(GLOB_RECURSE HEADERS "src/*.h")
aux_source_directory(./src SRC_LIST)
-add_executable(${PROJECT_NAME} ${SRC_LIST} "${CMAKE_CURRENT_BINARY_DIR}/resources.c")
+add_executable(${PROJECT_NAME} ${SRC_LIST} "${CMAKE_CURRENT_BINARY_DIR}/resources.c" "${HEADERS}")
add_dependencies(${PROJECT_NAME} glib-resources)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/resources.c PROPERTIES GENERATED 1)
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES})
diff --git a/glade/cartItem.glade b/glade/cartItem.glade
new file mode 100644
index 0000000..e72dd15
--- /dev/null
+++ b/glade/cartItem.glade
@@ -0,0 +1,201 @@
+
+
+
+
+
+
diff --git a/glade/mainWindow.glade b/glade/mainWindow.glade
index 3ea92d9..a32a008 100644
--- a/glade/mainWindow.glade
+++ b/glade/mainWindow.glade
@@ -2,204 +2,9 @@
-
- True
- False
- 4
-
-
- 100
- 100
- True
- False
- baseline
- center
- crossfade
-
-
- True
- False
- True
-
-
- page0
- page0
-
-
-
-
- True
- False
- gtk-missing-image
-
-
- page1
- page1
- 1
-
-
-
-
- False
- True
- 0
-
-
-
-
- d
- True
- False
- center
- vertical
-
-
- True
- False
-
-
- True
- False
- Title
- True
-
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- ######
-
-
-
-
-
- False
- True
- end
- 1
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
-
-
- True
- False
- Description
- True
-
-
- False
- True
- 0
-
-
-
-
- False
- True
- 1
-
-
-
-
- True
- False
-
-
-
- False
- True
- 0
-
-
-
-
- False
- True
- 2
-
-
-
-
- True
- True
- 1
-
-
-
-
- True
- False
- vertical
- True
-
-
- gtk-delete
- True
- True
- True
- True
- True
-
-
- False
- True
- end
- 0
-
-
-
-
- gtk-properties
- True
- True
- True
- True
- True
-
-
- False
- True
- end
- 1
-
-
-
-
- False
- False
- end
- 2
-
-
-
-
+
+ 640
+ 400
False
False
@@ -217,7 +22,7 @@
500
slide-left-right
-
+
True
False
vertical
@@ -250,6 +55,18 @@
1
+
+
+ True
+ False
+ Swipe item to check out, or swipe card to display currently checked out items.
+
+
+ False
+ True
+ 2
+
+
page_introduction
@@ -257,13 +74,37 @@
-
+
True
False
+ vertical
+
+
+ True
+ False
+
+
+ True
+ True
+ 0
+
+
+
+
+ True
+ False
+ Swipe additional item to add to cart, or swipe ID card to complete transaction.
+
+
+ False
+ True
+ 1
+
+
- page_checkout
- page1
+ page_cart
+ page0
1
@@ -274,18 +115,6 @@
0
-
-
- True
- False
- Status
-
-
- False
- True
- 1
-
-
diff --git a/src/cart_item.c b/src/cart_item.c
new file mode 100644
index 0000000..f06aacb
--- /dev/null
+++ b/src/cart_item.c
@@ -0,0 +1,39 @@
+#include "cart_item.h"
+
+G_DEFINE_TYPE(YacosCartItem, yacos_cart_item, GTK_TYPE_LIST_BOX_ROW)
+
+static void yacos_cart_item_dispose(GObject *obj)
+{
+ /* destroy parent container. This destroys all widgets inside */
+ G_OBJECT_CLASS(yacos_cart_item_parent_class)->dispose(obj);
+}
+
+static void yacos_cart_item_constructed(GObject *obj)
+{
+ G_OBJECT_CLASS(yacos_cart_item_parent_class)->constructed(obj);
+}
+
+static void yacos_cart_item_class_init(YacosCartItemClass *klass)
+{
+ GObjectClass *oclass = G_OBJECT_CLASS(klass);
+ oclass->dispose = yacos_cart_item_dispose;
+ oclass->constructed = yacos_cart_item_constructed;
+}
+
+static void yacos_cart_item_init(YacosCartItem *self)
+{
+ GtkBuilder *builder;
+ GtkWidget *box;
+ builder = gtk_builder_new_from_resource("/net/notsyncing/yacos/glade/cartItem.glade");
+ box = GTK_WIDGET(gtk_builder_get_object(builder, "cart_item"));
+ gtk_container_add(GTK_CONTAINER(self), box);
+
+ // TODO: Get elements
+
+ g_object_unref(builder);
+}
+
+GtkWidget *yacos_cart_item_new(void)
+{
+ return GTK_WIDGET(g_object_new(TYPE_YACOS_CART_ITEM, NULL));
+}
diff --git a/src/cart_item.h b/src/cart_item.h
new file mode 100644
index 0000000..fd0ef56
--- /dev/null
+++ b/src/cart_item.h
@@ -0,0 +1,34 @@
+#ifndef CART_ITEM_H
+#define CART_ITEM_H
+
+#include
+
+G_BEGIN_DECLS
+G_DECLARE_FINAL_TYPE(YacosCartItem, yacos_cart_item, YACOS, CART_ITEM, GtkListBoxRow)
+
+#define TYPE_YACOS_CART_ITEM (yacos_cart_item_get_type())
+
+typedef struct _YacosCartItemPriv {
+ GtkLabel label_title;
+ GtkLabel label_description;
+ GtkLabel label_comment;
+ GtkLabel label_id;
+
+ GtkButton button_properties;
+ GtkButton button_delete;
+
+ GtkImage image;
+} YacosCartItemPriv;
+
+struct _YacosCartItem {
+ /* Inheritance */
+ GtkListBoxRow parent;
+ /* Custom Elements */
+ YacosCartItemPriv priv;
+};
+
+GtkWidget *yacos_cart_item_new(void);
+
+G_END_DECLS
+
+#endif // CART_ITEM_H
diff --git a/src/main.c b/src/main.c
index 754935c..64fd699 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,40 @@
-#include
+#include
+#include "main_window.h"
+#include "cart_item.h"
-int main()
+struct app_state {
+ struct mainWindow *mainWindow;
+};
+
+static void activate(GtkApplication* app, gpointer user_data)
{
- printf("Hello World!\n");
- return 0;
+ struct app_state *app_state = user_data;
+ struct mainWindow **mainWindow = &(app_state->mainWindow);
+
+ *mainWindow = mainWindow_new(app);
+ if (*mainWindow) {
+ gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW((*mainWindow)->main_window));
+ gtk_widget_show_all((*mainWindow)->main_window);
+
+ // For testing only
+ gtk_stack_set_visible_child((*mainWindow)->stack_main, (*mainWindow)->page_cart.box);
+ GtkWidget *le = yacos_cart_item_new();
+ gtk_list_box_insert((*mainWindow)->page_cart.list, le, -1);
+ gtk_widget_show(le);
+ }
+}
+
+
+int main(int argc, char *argv[])
+{
+ GtkApplication *app;
+ int status;
+ struct app_state app_state;
+
+ app = gtk_application_new ("net.notysyncing.yacos", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect (app, "activate", G_CALLBACK (activate), &app_state);
+ status = g_application_run (G_APPLICATION (app), argc, argv);
+ g_object_unref (app);
+
+ return status;
}
diff --git a/src/main_window.c b/src/main_window.c
new file mode 100644
index 0000000..457ed81
--- /dev/null
+++ b/src/main_window.c
@@ -0,0 +1,25 @@
+#include "main_window.h"
+
+struct mainWindow *mainWindow_new(GtkApplication *app)
+{
+ GtkBuilder *builder;
+ struct mainWindow *mainWindow;
+
+ builder = gtk_builder_new_from_resource("/net/notsyncing/yacos/glade/mainWindow.glade");
+
+ mainWindow = malloc(sizeof(struct mainWindow));
+ mainWindow->main_window = GTK_WIDGET(gtk_builder_get_object(builder, "main_window"));
+
+ mainWindow->stack_main = GTK_STACK(gtk_builder_get_object(builder, "stack_main"));
+
+ mainWindow->page_intro.box = GTK_WIDGET(gtk_builder_get_object(builder, "box_intro"));
+
+ mainWindow->page_cart.box = GTK_WIDGET(gtk_builder_get_object(builder, "box_cart"));
+ mainWindow->page_cart.list = GTK_LIST_BOX(gtk_builder_get_object(builder, "list_main"));
+
+ gtk_builder_connect_signals(builder, NULL);
+
+ g_object_unref(G_OBJECT(builder));
+
+ return mainWindow;
+}
diff --git a/src/main_window.h b/src/main_window.h
new file mode 100644
index 0000000..aa8df61
--- /dev/null
+++ b/src/main_window.h
@@ -0,0 +1,25 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+
+struct mainWindow {
+ GtkWidget *main_window;
+
+ GtkStack *stack_main;
+
+ struct page_intro {
+ GtkWidget *box;
+ } page_intro;
+
+ struct page_cart {
+ GtkWidget *box;
+ GtkListBox *list;
+ } page_cart;
+
+
+};
+
+struct mainWindow *mainWindow_new();
+
+#endif // MAINWINDOW_H
diff --git a/yacos.gresource.xml b/yacos.gresource.xml
index 7c4516f..451513c 100644
--- a/yacos.gresource.xml
+++ b/yacos.gresource.xml
@@ -1,6 +1,7 @@
-
+
glade/mainWindow.glade
+ glade/cartItem.glade