Commit b2dfb4d4 authored by Danilo Galete's avatar Danilo Galete 💬
Browse files

Change Project: mobile application

parent f502c2d4
......@@ -28,10 +28,6 @@ struct _FinancePreferencesWindow
HdyPreferencesWindow parent_instance;
/* The Widgets */
GtkWidget *radio_international;
GtkWidget *radio_local;
GtkWidget *row_international;
GtkWidget *row_local;
GtkWidget *spin_decimal_places;
GtkWidget *switch_amount;
GtkWidget *switch_currency_symbol;
......@@ -42,18 +38,6 @@ struct _FinancePreferencesWindow
G_DEFINE_TYPE (FinancePreferencesWindow, finance_preferences_window, HDY_TYPE_PREFERENCES_WINDOW)
static void
on_currency_symbol_local (FinancePreferencesWindow *self)
{
g_settings_set_enum (self->settings, "symbol-type", FINANCE_LOCAL);
}
static void
on_currency_symbol_international (FinancePreferencesWindow *self)
{
g_settings_set_enum (self->settings, "symbol-type", FINANCE_INTERNATIONAL);
}
static void
finance_preferences_window_dispose (GObject *object)
{
......@@ -73,35 +57,21 @@ finance_preferences_window_class_init (FinancePreferencesWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/finance/gui/finance-preferences-window.ui");
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, radio_international);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, radio_local);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, row_international);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, row_local);
/* The Widgets */
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, spin_decimal_places);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, switch_amount);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, switch_currency_symbol);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, switch_date);
/* All signal */
gtk_widget_class_bind_template_callback (widget_class, on_currency_symbol_local);
gtk_widget_class_bind_template_callback (widget_class, on_currency_symbol_international);
}
static void
finance_preferences_window_init (FinancePreferencesWindow *self)
{
FinanceSymbol symbol;
gtk_widget_init_template (GTK_WIDGET (self));
g_object_bind_property (self->switch_currency_symbol, "active",
self->row_local, "sensitive",
G_BINDING_DEFAULT);
g_object_bind_property (self->switch_currency_symbol, "active",
self->row_international, "sensitive",
G_BINDING_DEFAULT);
self->settings = g_settings_new ("org.gnome.finance");
g_settings_bind (self->settings, "date",
......@@ -119,11 +89,4 @@ finance_preferences_window_init (FinancePreferencesWindow *self)
g_settings_bind (self->settings, "currency-symbol",
self->switch_currency_symbol, "active",
G_SETTINGS_BIND_DEFAULT);
symbol = g_settings_get_enum (self->settings, "symbol-type");
if (symbol == FINANCE_LOCAL)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->radio_local), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->radio_international), TRUE);
}
......@@ -9,14 +9,6 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkRadioButton" id="radiobutton1">
<property name="label" translatable="yes">radiobutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
</object>
<template class="FinancePreferencesWindow" parent="HdyPreferencesWindow">
<property name="can-focus">False</property>
<property name="can-swipe-back">True</property>
......@@ -110,44 +102,6 @@
</child>
</object>
</child>
<child>
<object class="HdyActionRow" id="row_local">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="sensitive">False</property>
<property name="title" translatable="yes">Sets local currency symbol</property>
<property name="activatable-widget">radio_local</property>
<signal name="activated" handler="on_currency_symbol_local" swapped="yes" />
<child>
<object class="GtkRadioButton" id="radio_local">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<property name="group">radiobutton1</property>
</object>
</child>
</object>
</child>
<child>
<object class="HdyActionRow" id="row_international">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="sensitive">False</property>
<property name="title" translatable="yes">Sets international currency symbol</property>
<property name="activatable-widget">radio_international</property>
<signal name="activated" handler="on_currency_symbol_international" swapped="yes" />
<child>
<object class="GtkRadioButton" id="radio_international">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<property name="group">radiobutton1</property>
</object>
</child>
</object>
</child>
<style>
<class name="preferences"/>
</style>
......
......@@ -26,17 +26,17 @@ struct _FinanceWindow
HdyApplicationWindow parent_instance;
/* Template widgets */
GtkWidget *content;
GtkWidget *content_left;
GtkWidget *box_content;
GtkWidget *box_content_left;
GtkWidget *header_bar_right;
GtkWidget *header_bar_squeezer;
GtkWidget *label_title;
GtkWidget *leaflet;
GtkWidget *stack;
GtkWidget *stack_switcher_top;
GtkWidget *stack_transactions;
GtkWidget *title_label;
GtkWidget *transaction;
GtkWidget *view_switcher_bottom;
GtkWidget *view_switcher_top;
GSettings *settings;
};
......@@ -46,10 +46,13 @@ G_DEFINE_TYPE (FinanceWindow, finance_window, HDY_TYPE_APPLICATION_WINDOW)
static void
finance_window_prepare_new_transaction (FinanceWindow *self)
{
hdy_squeezer_set_child_enabled (HDY_SQUEEZER (self->header_bar_squeezer),
self->stack_switcher_top,
FALSE);
gtk_widget_set_sensitive (self->transaction, TRUE);
gtk_label_set_text (GTK_LABEL (self->title_label), _("New"));
hdy_header_bar_set_show_close_button (HDY_HEADER_BAR (self->header_bar_right), FALSE);
hdy_leaflet_set_visible_child (HDY_LEAFLET (self->leaflet), self->content);
gtk_label_set_text (GTK_LABEL (self->label_title), _("New"));
hdy_leaflet_set_visible_child (HDY_LEAFLET (self->leaflet), self->box_content);
gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "transactions");
gtk_stack_set_visible_child (GTK_STACK (self->stack_transactions), self->transaction);
}
......@@ -84,9 +87,12 @@ on_cancel_button_clicked (GtkButton *button,
(void)button;
hdy_squeezer_set_child_enabled (HDY_SQUEEZER (self->header_bar_squeezer),
self->stack_switcher_top,
TRUE);
gtk_widget_set_sensitive (self->transaction, FALSE);
gtk_label_set_text (GTK_LABEL (self->title_label), _("Finance"));
hdy_header_bar_set_show_close_button (HDY_HEADER_BAR (self->header_bar_right), TRUE);
gtk_label_set_text (GTK_LABEL (self->label_title), _("Finance"));
gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "home");
}
......@@ -101,7 +107,7 @@ on_headerbar_squeezer_notify (GObject *object,
hdy_view_switcher_bar_set_reveal (HDY_VIEW_SWITCHER_BAR (self->view_switcher_bottom),
hdy_squeezer_get_visible_child (HDY_SQUEEZER (object))
!= self->view_switcher_top);
!= self->stack_switcher_top);
}
static void
......@@ -112,7 +118,7 @@ on_swipe_back_clicked (GtkButton *button,
(void)button;
hdy_leaflet_set_visible_child (HDY_LEAFLET (self->leaflet), self->content_left);
hdy_leaflet_set_visible_child (HDY_LEAFLET (self->leaflet), self->box_content_left);
}
static void
......@@ -123,7 +129,7 @@ on_swipe_forward_clicked (GtkButton *button,
(void)button;
hdy_leaflet_set_visible_child (HDY_LEAFLET (self->leaflet), self->content);
hdy_leaflet_set_visible_child (HDY_LEAFLET (self->leaflet), self->box_content);
}
static void
......@@ -150,17 +156,17 @@ finance_window_class_init (FinanceWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/finance/gui/finance-window.ui");
/* The Widgets */
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, content);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, content_left);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, box_content);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, box_content_left);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, header_bar_right);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, header_bar_squeezer);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, label_title);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, leaflet);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, stack);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, stack_switcher_top);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, stack_transactions);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, title_label);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, transaction);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, view_switcher_bottom);
gtk_widget_class_bind_template_child (widget_class, FinanceWindow, view_switcher_top);
/* The CallBacks */
gtk_widget_class_bind_template_callback (widget_class, on_add_credit_clicked);
......
......@@ -3,7 +3,7 @@
<interface>
<requires lib="gtk+" version="3.24"/>
<requires lib="libhandy" version="0.0"/>
<object class="GtkPopoverMenu" id="hamburger_menu_popover">
<object class="GtkPopoverMenu" id="popover_menu_hamburger">
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
......@@ -120,31 +120,31 @@
</child>
</object>
<template class="FinanceWindow" parent="HdyApplicationWindow">
<property name="height-request">600</property>
<property name="can-focus">False</property>
<property name="window-position">center</property>
<property name="default-width">900</property>
<property name="default-height">600</property>
<property name="icon_name">gnome-finance</property>
<property name="title" translatable="yes">Finance</property>
<child>
<object class="HdyLeaflet" id="leaflet">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="visible-child">content</property>
<property name="can-swipe-back">True</property>
<property name="visible-child">box_content</property>
<child>
<object class="GtkBox" id="content_left">
<object class="GtkBox" id="box_content_left">
<property name="visible">True</property>
<property name="sensitive" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean"/>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="sensitive" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean">True</property>
<child>
<object class="GtkHeaderBar" id="header_bar_left">
<object class="HdyHeaderBar" id="header_bar_left">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">Finance</property>
<property name="spacing">0</property>
<child>
<object class="GtkButton" id="add_credit_button">
<object class="GtkButton" id="button_add_credit">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
......@@ -159,14 +159,14 @@
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="add_credit_button-atkobject">
<object class="AtkObject" id="button_add_credit-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Add a new credit</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="add_debit_button">
<object class="GtkButton" id="button_add_debit">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
......@@ -181,7 +181,7 @@
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="add_debit_button-atkobject">
<object class="AtkObject" id="button_add_debit-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Add a new debit</property>
</object>
</child>
......@@ -191,11 +191,11 @@
</packing>
</child>
<child>
<object class="GtkButton" id="go_swipe_forward_button">
<property name="visible" bind-source="leaflet" bind-property="folded" bind-flags="sync-create"/>
<object class="GtkButton" id="button_go_swipe_forward">
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Go forward</property>
<property name="visible" bind-source="leaflet" bind-property="folded" bind-flags="sync-create">False</property>
<signal name="clicked" handler="on_swipe_forward_clicked" object="FinanceWindow" swapped="no"/>
<child>
<object class="GtkImage">
......@@ -206,7 +206,7 @@
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="go_swipe_forward_button-atkobject">
<object class="AtkObject" id="button_go_swipe_forward-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Go forward</property>
</object>
</child>
......@@ -217,12 +217,12 @@
</packing>
</child>
<child>
<object class="GtkMenuButton" id="hamburger_menu_button">
<object class="GtkMenuButton" id="menu_button_hamburger">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">False</property>
<property name="popover">hamburger_menu_popover</property>
<property name="popover">popover_menu_hamburger</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
......@@ -239,7 +239,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="deselect_all_button">
<object class="GtkButton" id="button_deselect_all">
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Deselect all</property>
......@@ -253,7 +253,7 @@
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="deselect_all_button-atkobject">
<object class="AtkObject" id="button_deselect_all-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Deselect all</property>
</object>
</child>
......@@ -264,7 +264,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="counter_label">
<object class="GtkLabel" id="label_counter">
<property name="can-focus">True</property>
<property name="label">count</property>
</object>
......@@ -294,7 +294,7 @@
</object>
</child>
<child>
<object class="GtkBox" id="content">
<object class="GtkBox" id="box_content">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
......@@ -303,8 +303,8 @@
<object class="HdyHeaderBar" id="header_bar_right">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
<property name="centering-policy">strict</property>
<property name="show-close-button" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean">True</property>
<child type="title">
<object class="HdySqueezer" id="header_bar_squeezer">
<property name="visible">True</property>
......@@ -312,15 +312,15 @@
<property name="homogeneous">True</property>
<signal name="notify::visible-child" handler="on_headerbar_squeezer_notify" object="FinanceWindow" swapped="no"/>
<child>
<object class="GtkStackSwitcher" id="view_switcher_top">
<property name="visible" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean">True</property>
<object class="GtkStackSwitcher" id="stack_switcher_top">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="homogeneous">True</property>
<property name="stack">stack</property>
</object>
</child>
<child>
<object class="GtkLabel" id="title_label">
<object class="GtkLabel" id="label_title">
<property name="name">title_label</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
......@@ -331,12 +331,12 @@
</object>
</child>
<child>
<object class="GtkButton" id="go_swipe_back_button">
<property name="visible" bind-source="leaflet" bind-property="folded">False</property>
<property name="sensitive" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean"/>
<object class="GtkButton" id="button_go_swipe_back">
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Go back</property>
<property name="visible" bind-source="leaflet" bind-property="folded" bind-flags="sync-create">False</property>
<property name="sensitive" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean">True</property>
<signal name="clicked" handler="on_swipe_back_clicked" object="FinanceWindow" swapped="no"/>
<child>
<object class="GtkImage">
......@@ -347,25 +347,25 @@
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="go_swipe_back_button-atkobject">
<object class="AtkObject" id="button_go_swipe_back-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Go Back</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="cancel_button">
<object class="GtkButton" id="button_cancel">
<property name="label" translatable="yes">_Cancel</property>
<property name="width-request">70</property>
<property name="visible" bind-source="transaction" bind-property="sensitive" bind-flags="default"/>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Cancel</property>
<property name="valign">center</property>
<property name="use-underline">True</property>
<property name="visible" bind-source="transaction" bind-property="sensitive" bind-flags="sync-create">False</property>
<signal name="clicked" handler="on_cancel_button_clicked" object="FinanceWindow" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="cancel_button-atkobject">
<object class="AtkObject" id="button_cancel-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Cancel</property>
</object>
</child>
......@@ -378,18 +378,18 @@
</packing>
</child>
<child>
<object class="GtkButton" id="done_button">
<object class="GtkButton" id="button_done">
<property name="label" translatable="yes">_Done</property>
<property name="width-request">70</property>
<property name="visible" bind-source="transaction" bind-property="sensitive" bind-flags="default"/>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Done</property>
<property name="valign">center</property>
<property name="use-underline">True</property>
<property name="visible" bind-source="transaction" bind-property="sensitive" bind-flags="sync-create">False</property>
<signal name="clicked" handler="on_done_button_clicked" object="FinanceWindow" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="done_button-atkobject">
<object class="AtkObject" id="button_done-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Done</property>
</object>
</child>
......@@ -432,10 +432,18 @@
<property name="can-focus">False</property>
<property name="transition-type">slide-down</property>
<child>
<object class="FinanceTransaction" id="transaction">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="FinanceTransaction" id="transaction">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="mobile" bind-source="leaflet" bind-property="folded" bind-flags="sync-create">False</property>
</object>
</child>
</object>
</child>
</object>
......@@ -466,9 +474,9 @@
</child>
<child>
<object class="HdyViewSwitcherBar" id="view_switcher_bottom">
<property name="visible" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean"/>
<property name="can-focus">False</property>
<property name="stack">stack</property>
<property name="visible" bind-source="transaction" bind-property="sensitive" bind-flags="invert-boolean">True</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -481,4 +489,10 @@
</object>
</child>
</template>
<object class="HdyHeaderGroup">
<headerbars>
<headerbar name="header_bar_left"/>
<headerbar name="header_bar_right"/>
</headerbars>
</object>
</interface>
This diff is collapsed.
......@@ -31,7 +31,7 @@ G_BEGIN_DECLS
#define FINANCE_TYPE_TRANSACTION (finance_transaction_get_type())
G_DECLARE_FINAL_TYPE (FinanceTransaction, finance_transaction, FINANCE, TRANSACTION, GtkBox)
G_DECLARE_FINAL_TYPE (FinanceTransaction, finance_transaction, FINANCE, TRANSACTION, GtkGrid)
GtkWidget * finance_transaction_new (void);
......@@ -102,6 +102,11 @@ void finance_transaction_set_notes (FinanceTransaction *sel
void finance_transaction_clear (FinanceTransaction *self);
gboolean finance_transaction_get_mobile (FinanceTransaction *self);
void finance_transaction_set_mobile (FinanceTransaction *self,
gboolean mobile);
G_END_DECLS
#endif /* __FINANCE_TRANSACTION_H__ */
This diff is collapsed.
......@@ -42,7 +42,7 @@ finance_utils_random_rgba_color (void)
* By GNOME Human Interface Guidelines
* See: https://gitlab.gnome.org/Community/Design/HIG-app-icons/blob/master/GNOME%20HIG.gpl
*/
int rgb[24][3] = {
int rgb[22][3] = {
{ 53, 132, 228},
{ 28, 113, 216},
{ 26, 95, 180},
......@@ -62,14 +62,12 @@ finance_utils_random_rgba_color (void)
{205, 171, 143},
{181, 131, 90},
{ 99, 69, 44},
{255, 255, 255},
{246, 245, 244},
{119, 118, 123},
{ 94, 92, 100},
{ 61, 56, 70},
};
id = g_random_int_range (0, 23);
id = g_random_int_range (0, 21);
color.red = rgb [id] [0] / 255.;
color.green = rgb [id] [1] / 255.;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment