Compare commits

..

No commits in common. "6985002bdcb14d499b8bed49345a34038a334dbf" and "f545d3d21ecd0816bec8868e99200db96e1b4350" have entirely different histories.

7 changed files with 15 additions and 59 deletions

View File

@ -96,16 +96,13 @@ GtkWidget *yacos_cart_item_new(void)
void yacos_cart_item_set_id(YacosCartItem *self, yacos_tag_id tag_id)
{
gchar *id_str;
gchar *id_str2;
self->priv.tag_id = tag_id;
id_str = yacos_tag_id_to_str(tag_id);
id_str2 = g_strdup_printf("#%s", id_str);
g_free(id_str);
gtk_label_set_text(GTK_LABEL(self->priv.label_id), id_str2);
gtk_label_set_text(GTK_LABEL(self->priv.label_id), id_str);
g_free(id_str2);
g_free(id_str);
}
static void yacos_cart_item_fetch_meta_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
@ -154,11 +151,6 @@ void yacos_cart_item_fetch_meta(YacosCartItem *self)
gchar *url;
gchar *id_str;
gtk_label_set_text(GTK_LABEL(self->priv.label_title), "Loading ...");
gtk_label_set_text(GTK_LABEL(self->priv.label_description), "");
gtk_label_set_text(GTK_LABEL(self->priv.label_comment), "");
id_str = yacos_tag_id_to_str(self->priv.tag_id);
url = g_strdup_printf("%s?meta&id=%s", self->priv.api.url_base, id_str);
@ -171,13 +163,3 @@ void yacos_cart_item_fetch_meta(YacosCartItem *self)
yacos_cart_item_fetch_meta_cb,
self);
}
void yacos_cart_item_fetch_image(YacosCartItem *self)
{
return;
}
yacos_tag_id yacos_cart_item_get_id(YacosCartItem *self)
{
return self->priv.tag_id;
}

View File

@ -16,7 +16,6 @@ GtkWidget *yacos_cart_item_new(void);
void yacos_cart_item_set_id(YacosCartItem *self, yacos_tag_id tag_id);
void yacos_cart_item_fetch_meta(YacosCartItem *self);
void yacos_cart_item_fetch_image(YacosCartItem *self);
yacos_tag_id yacos_cart_item_get_id(YacosCartItem *self);
G_END_DECLS

View File

@ -30,7 +30,7 @@ static void activate(GtkApplication* app, gpointer user_data)
g_signal_connect(scanner, "newtag",
(GCallback) mainWindow_scan_tags, (*mainWindow));
//mainWindow_scan_tags(scanner, *mainWindow); // TODO: For testing only
mainWindow_scan_tags(scanner, *mainWindow); // TODO: For testing only
}

View File

@ -29,28 +29,8 @@ void mainWindow_scan_tags(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();
GList *l;
yacos_tag_id tag_id;
GList *stack_children;
GList *ll;
gboolean found = 0;
for (l = yacos_scanner_get_present_tags(scanner); l != NULL; l = l->next) {
tag_id = ((struct yacos_scanner_tag*) l->data)->tag_id;
stack_children = gtk_container_get_children(mainWindow->page_cart.list);
for (ll = stack_children; ll != NULL; ll = ll->next) {
if (yacos_cart_item_get_id(((YacosCartItem *) ll->data)) == tag_id) {
found = 1;
break;
}
}
if (found)
continue;
yacos_cart_item_set_id(YACOS_CART_ITEM(le), tag_id);
yacos_cart_item_fetch_meta(YACOS_CART_ITEM(le));
yacos_cart_item_fetch_image(YACOS_CART_ITEM(le));
gtk_list_box_insert(mainWindow->page_cart.list, le, -1);
gtk_widget_show(le);
}
yacos_cart_item_set_id(YACOS_CART_ITEM(le), 123);
yacos_cart_item_fetch_meta(YACOS_CART_ITEM(le));
gtk_list_box_insert(mainWindow->page_cart.list, le, -1);
gtk_widget_show(le);
}

View File

@ -100,9 +100,9 @@ static int yacos_scanner_list(YacosScanner *self)
if (new_tags) {
for (l = self->detected_tags; l != NULL; l = l->next) {
g_info("Found %X (%d)",
((struct yacos_scanner_tag*)l->data)->tag_id,
((struct yacos_scanner_tag*)l->data)->tag_type);
g_warning("Found %x (%d)",
((struct yacos_scanner_tag*)l->data)->tag_id,
((struct yacos_scanner_tag*)l->data)->tag_type);
}
}
@ -152,6 +152,8 @@ static void yacos_scanner_init(YacosScanner *self)
{
self->detected_tags = NULL;
return; // TODO: Disabled during development
g_debug("Using libnfc %s", nfc_version());
nfc_init(&self->nfc_ctx);
if (!self->nfc_ctx) {
@ -175,11 +177,5 @@ YacosScanner *yacos_scanner_new(void)
// Free afterwards using g_free
gchar *yacos_tag_id_to_str(yacos_tag_id tag_id)
{
return g_strdup_printf("%X", tag_id);
}
GList *yacos_scanner_get_present_tags(YacosScanner *scanner)
{
return scanner->detected_tags;
return g_strdup_printf("%d", tag_id);
}

View File

@ -25,7 +25,6 @@ struct yacos_scanner_tag {
};
gchar *yacos_tag_id_to_str(yacos_tag_id tag_id);
GList *yacos_scanner_get_present_tags(YacosScanner *scanner);
G_END_DECLS

View File

@ -2,7 +2,7 @@
// This is just a dummy implementation during the development of the GTK+3 GUI
if (isset($_GET['meta'])) {
if ($_GET['id'] == "BF09CE") {
if ($_GET['id'] == "1") {
?>
{
"title" : "Cute Wifi Cat",
@ -10,7 +10,7 @@ if (isset($_GET['meta'])) {
"comment" : "It's mewine!"
}
<?php
} else if ($_GET['id'] == "BE6200") {
} else if ($_GET['id'] == "2") {
?>
{
"title" : "Crazy Stuff",