Compare commits

..

No commits in common. "c7dbe01c220b0b502dde557c934e944b395cf875" and "040d74b8c475f0dabb84d9b15e1ff3b2f6d367fd" have entirely different histories.

4 changed files with 9 additions and 111 deletions

View File

@ -163,10 +163,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="always_show_image">True</property> <property name="always_show_image">True</property>
</object> </object>
@ -183,10 +179,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="always_show_image">True</property> <property name="always_show_image">True</property>
</object> </object>

View File

@ -1,46 +1,27 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "main_window.h" #include "main_window.h"
#include "scanner.h"
// TODO: For testing only
#include "cart_item.h" #include "cart_item.h"
struct app_state { struct app_state {
struct mainWindow *mainWindow; struct mainWindow *mainWindow;
}; };
static void newtag(YacosScanner *scanner, struct mainWindow *mainWindow)
{
// TODO: 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);
}
static void activate(GtkApplication* app, gpointer user_data) static void activate(GtkApplication* app, gpointer user_data)
{ {
struct app_state *app_state = user_data; struct app_state *app_state = user_data;
struct mainWindow **mainWindow = &(app_state->mainWindow); struct mainWindow **mainWindow = &(app_state->mainWindow);
YacosScanner *scanner;
*mainWindow = mainWindow_new(app); *mainWindow = mainWindow_new(app);
if (!(*mainWindow)) { if (*mainWindow) {
g_error("Error initializing mainWindow.");
return;
}
gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW((*mainWindow)->main_window)); gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW((*mainWindow)->main_window));
gtk_widget_show_all((*mainWindow)->main_window); gtk_widget_show_all((*mainWindow)->main_window);
scanner = yacos_scanner_new(); // For testing only
if (!scanner) { gtk_stack_set_visible_child((*mainWindow)->stack_main, (*mainWindow)->page_cart.box);
g_error("Error initializing scanner."); GtkWidget *le = yacos_cart_item_new();
gtk_list_box_insert((*mainWindow)->page_cart.list, le, -1);
gtk_widget_show(le);
} }
g_signal_connect(scanner, "newtag",
(GCallback) newtag, (*mainWindow));
} }

View File

@ -1,60 +0,0 @@
#include "scanner.h"
struct _YacosScanner {
GObject parent_instance;
// TODO: Private data goes here
};
G_DEFINE_TYPE(YacosScanner, yacos_scanner, G_TYPE_OBJECT)
enum {
SIGNAL_NEWTAG = 0,
SIGNAL_COUNT
};
guint yacos_scanner_signals[SIGNAL_COUNT];
static gboolean *yacos_scanner_read (gpointer user_data)
{
YacosScanner *self = YACOS_SCANNER(user_data);
// TODO: Scan for tags
g_signal_emit(self, yacos_scanner_signals[SIGNAL_NEWTAG], 0);
return G_SOURCE_CONTINUE;
}
static void yacos_scanner_finalize(GObject *gobject)
{
YacosScanner *obj = yacos_scanner_get_instance_private(YACOS_SCANNER(gobject));
// TODO: clean up
G_OBJECT_CLASS(yacos_scanner_parent_class)->finalize(gobject);
}
static void yacos_scanner_class_init(YacosScannerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
yacos_scanner_signals[SIGNAL_NEWTAG] =
g_signal_newv("newtag",
G_TYPE_FROM_CLASS(object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
NULL, NULL, NULL, NULL,
G_TYPE_NONE,
0,
NULL);
object_class->finalize = yacos_scanner_finalize;
}
static void yacos_scanner_init(YacosScanner *self)
{
g_timeout_add(1000, G_SOURCE_FUNC(yacos_scanner_read), self);
}
YacosScanner *yacos_scanner_new(void)
{
return g_object_new(YACOS_TYPE_SCANNER, 0);
}

View File

@ -1,15 +0,0 @@
#ifndef SCANNER_H
#define SCANNER_H
#include <glib-object.h>
G_BEGIN_DECLS
#define YACOS_TYPE_SCANNER yacos_scanner_get_type()
G_DECLARE_FINAL_TYPE(YacosScanner, yacos_scanner, YACOS, SCANNER, GObject)
YacosScanner *yacos_scanner_new(void);
G_END_DECLS
#endif // SCANNER_H