Compare commits
No commits in common. "0cae59aeb1fd13f4881aaa2a7281676c5cd3af54" and "a56bb9073a6ff87932de541f0734fbae789ece38" have entirely different histories.
0cae59aeb1
...
a56bb9073a
@ -59,8 +59,6 @@
|
|||||||
<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>
|
||||||
@ -104,8 +102,6 @@
|
|||||||
<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>
|
||||||
@ -127,22 +123,16 @@
|
|||||||
<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="GtkEntry" id="entry_comment">
|
<object class="GtkLabel" id="label_comment">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="tooltip_text" translatable="yes">Click here to add a comment.</property>
|
<property name="label" translatable="yes">Comment</property>
|
||||||
<property name="editable">False</property>
|
<attributes>
|
||||||
<property name="max_length">128</property>
|
<attribute name="style" value="italic"/>
|
||||||
<property name="has_frame">False</property>
|
</attributes>
|
||||||
<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">True</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -187,6 +177,26 @@
|
|||||||
<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,8 +6,10 @@ typedef struct _YacosCartItemPriv {
|
|||||||
|
|
||||||
GtkWidget *label_title;
|
GtkWidget *label_title;
|
||||||
GtkWidget *label_description;
|
GtkWidget *label_description;
|
||||||
GtkWidget *entry_comment;
|
GtkWidget *label_comment;
|
||||||
GtkWidget *label_id;
|
GtkWidget *label_id;
|
||||||
|
|
||||||
|
GtkWidget *button_properties;
|
||||||
GtkWidget *button_delete;
|
GtkWidget *button_delete;
|
||||||
|
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
@ -64,7 +66,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_cart_item_button_delete_cb(GtkWidget *widget, gpointer user_data)
|
static void yacos_ceart_item_button_delete_cb(GtkWidget *widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
YacosCartItem *self = (YacosCartItem *)user_data;
|
YacosCartItem *self = (YacosCartItem *)user_data;
|
||||||
|
|
||||||
@ -82,10 +84,11 @@ 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.entry_comment = GTK_WIDGET(gtk_builder_get_object(builder, "entry_comment"));
|
self->priv.label_comment = GTK_WIDGET(gtk_builder_get_object(builder, "label_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"));
|
||||||
|
|
||||||
@ -98,26 +101,13 @@ 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_cart_item_button_delete_cb,
|
(GCallback) yacos_ceart_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)
|
||||||
@ -154,7 +144,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_entry_set_text(GTK_ENTRY(self->priv.entry_comment), "If you think this is an error, please contact a member of staff.");
|
gtk_label_set_text(GTK_LABEL(self->priv.label_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;
|
||||||
}
|
}
|
||||||
@ -179,13 +169,12 @@ 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_entry_set_text(GTK_ENTRY(self->priv.entry_comment), temp);
|
gtk_label_set_text(GTK_LABEL(self->priv.label_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +186,8 @@ 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_entry_set_text(GTK_ENTRY(self->priv.entry_comment), " ");
|
gtk_label_set_text(GTK_LABEL(self->priv.label_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