Compare commits
3 Commits
a56bb9073a
...
0cae59aeb1
Author | SHA1 | Date | |
---|---|---|---|
0cae59aeb1 | |||
da2ebe85dd | |||
d2790f7f7e |
@ -59,6 +59,8 @@
|
|||||||
<object class="GtkLabel" id="label_title">
|
<object class="GtkLabel" id="label_title">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">2</property>
|
||||||
|
<property name="margin_bottom">1</property>
|
||||||
<property name="label" translatable="yes">Title</property>
|
<property name="label" translatable="yes">Title</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
<attributes>
|
<attributes>
|
||||||
@ -102,6 +104,8 @@
|
|||||||
<object class="GtkLabel" id="label_description">
|
<object class="GtkLabel" id="label_description">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">2</property>
|
||||||
|
<property name="margin_top">1</property>
|
||||||
<property name="label" translatable="yes">Description</property>
|
<property name="label" translatable="yes">Description</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
</object>
|
</object>
|
||||||
@ -123,16 +127,22 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label_comment">
|
<object class="GtkEntry" id="entry_comment">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label" translatable="yes">Comment</property>
|
<property name="tooltip_text" translatable="yes">Click here to add a comment.</property>
|
||||||
<attributes>
|
<property name="editable">False</property>
|
||||||
<attribute name="style" value="italic"/>
|
<property name="max_length">128</property>
|
||||||
</attributes>
|
<property name="has_frame">False</property>
|
||||||
|
<property name="placeholder_text" translatable="yes">Click here to add a comment.</property>
|
||||||
|
<property name="input_hints">GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_NONE</property>
|
||||||
|
<property name="enable_emoji_completion">True</property>
|
||||||
|
<style>
|
||||||
|
<class name="entry_comment"/>
|
||||||
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -177,26 +187,6 @@
|
|||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="button_properties">
|
|
||||||
<property name="label">gtk-properties</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">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="always_show_image">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="pack_type">end</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -6,10 +6,8 @@ typedef struct _YacosCartItemPriv {
|
|||||||
|
|
||||||
GtkWidget *label_title;
|
GtkWidget *label_title;
|
||||||
GtkWidget *label_description;
|
GtkWidget *label_description;
|
||||||
GtkWidget *label_comment;
|
GtkWidget *entry_comment;
|
||||||
GtkWidget *label_id;
|
GtkWidget *label_id;
|
||||||
|
|
||||||
GtkWidget *button_properties;
|
|
||||||
GtkWidget *button_delete;
|
GtkWidget *button_delete;
|
||||||
|
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
@ -66,7 +64,7 @@ static void yacos_cart_item_class_init(YacosCartItemClass *klass)
|
|||||||
oclass->finalize = yacos_cart_item_finalize;
|
oclass->finalize = yacos_cart_item_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void yacos_ceart_item_button_delete_cb(GtkWidget *widget, gpointer user_data)
|
static void yacos_cart_item_button_delete_cb(GtkWidget *widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
YacosCartItem *self = (YacosCartItem *)user_data;
|
YacosCartItem *self = (YacosCartItem *)user_data;
|
||||||
|
|
||||||
@ -84,11 +82,10 @@ static void yacos_cart_item_init(YacosCartItem *self)
|
|||||||
|
|
||||||
self->priv.label_id = GTK_WIDGET(gtk_builder_get_object(builder, "label_id"));
|
self->priv.label_id = GTK_WIDGET(gtk_builder_get_object(builder, "label_id"));
|
||||||
self->priv.label_title = GTK_WIDGET(gtk_builder_get_object(builder, "label_title"));
|
self->priv.label_title = GTK_WIDGET(gtk_builder_get_object(builder, "label_title"));
|
||||||
self->priv.label_comment = GTK_WIDGET(gtk_builder_get_object(builder, "label_comment"));
|
self->priv.entry_comment = GTK_WIDGET(gtk_builder_get_object(builder, "entry_comment"));
|
||||||
self->priv.label_description = GTK_WIDGET(gtk_builder_get_object(builder, "label_description"));
|
self->priv.label_description = GTK_WIDGET(gtk_builder_get_object(builder, "label_description"));
|
||||||
|
|
||||||
self->priv.button_delete = GTK_WIDGET(gtk_builder_get_object(builder, "button_delete"));
|
self->priv.button_delete = GTK_WIDGET(gtk_builder_get_object(builder, "button_delete"));
|
||||||
self->priv.button_properties = GTK_WIDGET(gtk_builder_get_object(builder, "button_properties"));
|
|
||||||
|
|
||||||
self->priv.image = GTK_WIDGET(gtk_builder_get_object(builder, "image_item"));
|
self->priv.image = GTK_WIDGET(gtk_builder_get_object(builder, "image_item"));
|
||||||
|
|
||||||
@ -101,13 +98,26 @@ static void yacos_cart_item_init(YacosCartItem *self)
|
|||||||
|
|
||||||
g_signal_connect(self->priv.button_delete,
|
g_signal_connect(self->priv.button_delete,
|
||||||
"clicked",
|
"clicked",
|
||||||
(GCallback) yacos_ceart_item_button_delete_cb,
|
(GCallback) yacos_cart_item_button_delete_cb,
|
||||||
self);
|
self);
|
||||||
|
|
||||||
|
|
||||||
gtk_container_add(GTK_CONTAINER(self), self->priv.box);
|
gtk_container_add(GTK_CONTAINER(self), self->priv.box);
|
||||||
|
|
||||||
g_object_unref(builder);
|
g_object_unref(builder);
|
||||||
|
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkCssProvider *provider;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (self->priv.entry_comment);
|
||||||
|
provider = gtk_css_provider_new ();
|
||||||
|
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
|
||||||
|
".entry_comment {\n"
|
||||||
|
" font-style: italic;\n"
|
||||||
|
"}\n", -1, NULL);
|
||||||
|
gtk_style_context_add_provider (context,
|
||||||
|
GTK_STYLE_PROVIDER (provider),
|
||||||
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
g_object_unref (provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *yacos_cart_item_new(void)
|
GtkWidget *yacos_cart_item_new(void)
|
||||||
@ -144,7 +154,7 @@ static void yacos_cart_item_fetch_meta_cb (SoupSession *session, SoupMessage *ms
|
|||||||
gtk_label_set_text(GTK_LABEL(self->priv.label_title), "Unknown article");
|
gtk_label_set_text(GTK_LABEL(self->priv.label_title), "Unknown article");
|
||||||
gtk_widget_override_color(self->priv.label_title, GTK_STATE_FLAG_NORMAL, &color_error);
|
gtk_widget_override_color(self->priv.label_title, GTK_STATE_FLAG_NORMAL, &color_error);
|
||||||
gtk_label_set_text(GTK_LABEL(self->priv.label_description), "This article will be ignored on checkout.");
|
gtk_label_set_text(GTK_LABEL(self->priv.label_description), "This article will be ignored on checkout.");
|
||||||
gtk_label_set_text(GTK_LABEL(self->priv.label_comment), "If you think this is an error, please contact a member of staff.");
|
gtk_entry_set_text(GTK_ENTRY(self->priv.entry_comment), "If you think this is an error, please contact a member of staff.");
|
||||||
self->priv.status = YACOS_CART_ITEM_STATUS_INVALID;
|
self->priv.status = YACOS_CART_ITEM_STATUS_INVALID;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -169,12 +179,13 @@ static void yacos_cart_item_fetch_meta_cb (SoupSession *session, SoupMessage *ms
|
|||||||
|
|
||||||
json_reader_read_member (reader, "comment");
|
json_reader_read_member (reader, "comment");
|
||||||
temp = json_reader_get_string_value (reader);
|
temp = json_reader_get_string_value (reader);
|
||||||
gtk_label_set_text(GTK_LABEL(self->priv.label_comment), temp);
|
gtk_entry_set_text(GTK_ENTRY(self->priv.entry_comment), temp);
|
||||||
json_reader_end_member (reader);
|
json_reader_end_member (reader);
|
||||||
|
|
||||||
g_object_unref (reader);
|
g_object_unref (reader);
|
||||||
g_object_unref (parser);
|
g_object_unref (parser);
|
||||||
|
|
||||||
|
gtk_editable_set_editable(GTK_EDITABLE(self->priv.entry_comment), TRUE);
|
||||||
self->priv.status = YACOS_CART_ITEM_STATUS_VALID;
|
self->priv.status = YACOS_CART_ITEM_STATUS_VALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +197,7 @@ void yacos_cart_item_fetch_meta(YacosCartItem *self)
|
|||||||
|
|
||||||
gtk_label_set_text(GTK_LABEL(self->priv.label_title), "Loading ...");
|
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_description), "");
|
||||||
gtk_label_set_text(GTK_LABEL(self->priv.label_comment), "");
|
gtk_entry_set_text(GTK_ENTRY(self->priv.entry_comment), " ");
|
||||||
|
|
||||||
|
|
||||||
id_str = yacos_tag_id_to_str(self->priv.tag_id);
|
id_str = yacos_tag_id_to_str(self->priv.tag_id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user