Commit 5ee628b8 authored by Danilo Galete's avatar Danilo Galete 💬
Browse files

Change: project

parent 656b118c
{
"app-id" : "org.gnome.finance",
"app-id" : "org.gnome.Finance",
"runtime" : "org.gnome.Platform",
"runtime-version" : "3.38",
"sdk" : "org.gnome.Sdk",
......@@ -49,7 +49,7 @@
"sources" : [
{
"type" : "git",
"url" : "file:///home/galetedanilo/Projects/Finance"
"url" : "https://gitlab.gnome.org/galetedanilo/finance.git"
}
]
}
......
......@@ -286,6 +286,7 @@ finance_application_startup (GApplication *app)
"app.quit",
quit_accels);
G_APPLICATION_CLASS (finance_application_parent_class)->startup (app);
}
......@@ -304,5 +305,5 @@ finance_application_class_init (FinanceApplicationClass *klass)
static void
finance_application_init (FinanceApplication *self)
{
g_set_application_name (_("Finance"));
}
......@@ -28,6 +28,10 @@ struct _FinancePreferencesWindow
HdyPreferencesWindow parent_instance;
/* The Widgets */
GtkWidget *action_row_international;
GtkWidget *action_row_local;
GtkWidget *radio_button_international;
GtkWidget *radio_button_local;
GtkWidget *spin_decimal_places;
GtkWidget *switch_amount;
GtkWidget *switch_currency_symbol;
......@@ -38,6 +42,28 @@ struct _FinancePreferencesWindow
G_DEFINE_TYPE (FinancePreferencesWindow, finance_preferences_window, HDY_TYPE_PREFERENCES_WINDOW)
static void
on_currency_symbol_international_toggled (GtkToggleButton *button,
gpointer user_data)
{
FinancePreferencesWindow *self = FINANCE_PREFERENCES_WINDOW (user_data);
(void)button;
g_settings_set_enum (self->settings, "symbol-type", FINANCE_INTERNATIONAL);
}
static void
on_currency_symbol_local_toggled (GtkToggleButton *button,
gpointer user_data)
{
FinancePreferencesWindow *self = FINANCE_PREFERENCES_WINDOW (user_data);
(void)button;
g_settings_set_enum (self->settings, "symbol-type", FINANCE_LOCAL);
}
static void
finance_preferences_window_dispose (GObject *object)
{
......@@ -58,20 +84,33 @@ finance_preferences_window_class_init (FinancePreferencesWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/finance/gui/finance-preferences-window.ui");
/* The Widgets */
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, action_row_international);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, action_row_local);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, radio_button_international);
gtk_widget_class_bind_template_child (widget_class, FinancePreferencesWindow, radio_button_local);
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_international_toggled);
gtk_widget_class_bind_template_callback (widget_class, on_currency_symbol_local_toggled);
}
static void
finance_preferences_window_init (FinancePreferencesWindow *self)
{
FinanceSymbol symbol;
gtk_widget_init_template (GTK_WIDGET (self));
hdy_action_row_add_prefix (HDY_ACTION_ROW (self->action_row_international),
self->radio_button_international);
hdy_action_row_add_prefix (HDY_ACTION_ROW (self->action_row_local),
self->radio_button_local);
self->settings = g_settings_new ("org.gnome.finance");
g_settings_bind (self->settings, "date",
......@@ -89,4 +128,11 @@ 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_button_local), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->radio_button_international), TRUE);
}
......@@ -9,6 +9,14 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkRadioButton" id="radio_button_group">
<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>
......@@ -33,6 +41,8 @@
<object class="GtkSwitch" id="switch_date">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</child>
</object>
......@@ -47,6 +57,8 @@
<object class="GtkSwitch" id="switch_amount">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</child>
</object>
......@@ -71,6 +83,8 @@
<object class="GtkSpinButton" id="spin_decimal_places">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="adjustment">adjustment1</property>
<property name="numeric">True</property>
<property name="value">1</property>
......@@ -98,10 +112,30 @@
<object class="GtkSwitch" id="switch_currency_symbol">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="HdyActionRow" id="action_row_local">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">Currency symbol local</property>
<property name="activatable-widget">radio_button_local</property>
<property name="sensitive" bind-source="switch_currency_symbol" bind-property="active" bind-flags="sync-create">False</property>
</object>
</child>
<child>
<object class="HdyActionRow" id="action_row_international">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">Currency symbol international</property>
<property name="activatable-widget">radio_button_international</property>
<property name="sensitive" bind-source="switch_currency_symbol" bind-property="active" bind-flags="sync-create">False</property>
</object>
</child>
<style>
<class name="preferences"/>
</style>
......@@ -110,4 +144,22 @@
</object>
</child>
</template>
<object class="GtkRadioButton" id="radio_button_local">
<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>
<property name="group">radio_button_group</property>
<signal name="toggled" handler="on_currency_symbol_local_toggled" swapped="no"/>
</object>
<object class="GtkRadioButton" id="radio_button_international">
<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>
<property name="group">radio_button_group</property>
<signal name="toggled" handler="on_currency_symbol_international_toggled" swapped="no"/>
</object>
</interface>
......@@ -150,7 +150,7 @@ finance_window_class_init (FinanceWindowClass *klass)
g_type_ensure (FINANCE_TYPE_PANE);
g_type_ensure (FINANCE_TYPE_TRANSACTION);
g_type_ensure (FINANCE_TYPE_TRANSACTIONS_VIEW);
g_type_ensure (FINANCE_TYPE_VIEW_TRANSACTIONS);
G_OBJECT_CLASS (klass)->dispose = finance_window_dispose;
......
......@@ -24,7 +24,7 @@
#include "finance-pane.h"
#include "finance-transaction.h"
#include "finance-transactions-view.h"
#include "finance-view-transactions.h"
G_BEGIN_DECLS
......
/* finance-transactions-view.c
/* finance-view-transactions.c
*
* Copyright 2021 galetedanilo <galetedanilo@gmail.com>
* Copyright 2021 Danilo Fernandes Galete <galetedanilo@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,17 +18,14 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include "finance-transactions-view.h"
#include "finance-view-transactions.h"
struct _FinanceTransactionsView
struct _FinanceViewTransactions
{
GtkBox parent_instance;
/* The widgets */
GtkFlowBox *flow_box;
GtkBox parent_instance;
};
G_DEFINE_TYPE (FinanceTransactionsView, finance_transactions_view, GTK_TYPE_BOX)
G_DEFINE_TYPE (FinanceViewTransactions, finance_view_transactions, GTK_TYPE_BOX)
enum {
PROP_0,
......@@ -38,26 +35,26 @@ enum {
static GParamSpec *properties [N_PROPS];
GtkWidget *
finance_transactions_view_new (void)
finance_view_transactions_new (void)
{
return g_object_new (FINANCE_TYPE_TRANSACTIONS_VIEW, NULL);
return g_object_new (FINANCE_TYPE_VIEW_TRANSACTIONS, NULL);
}
static void
finance_transactions_view_finalize (GObject *object)
finance_view_transactions_finalize (GObject *object)
{
FinanceTransactionsView *self = (FinanceTransactionsView *)object;
FinanceViewTransactions *self = (FinanceViewTransactions *)object;
G_OBJECT_CLASS (finance_transactions_view_parent_class)->finalize (object);
G_OBJECT_CLASS (finance_view_transactions_parent_class)->finalize (object);
}
static void
finance_transactions_view_get_property (GObject *object,
finance_view_transactions_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
FinanceTransactionsView *self = FINANCE_TRANSACTIONS_VIEW (object);
FinanceViewTransactions *self = FINANCE_VIEW_TRANSACTIONS (object);
switch (prop_id)
{
......@@ -67,12 +64,12 @@ finance_transactions_view_get_property (GObject *object,
}
static void
finance_transactions_view_set_property (GObject *object,
finance_view_transactions_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
FinanceTransactionsView *self = FINANCE_TRANSACTIONS_VIEW (object);
FinanceViewTransactions *self = FINANCE_VIEW_TRANSACTIONS (object);
switch (prop_id)
{
......@@ -82,28 +79,16 @@ finance_transactions_view_set_property (GObject *object,
}
static void
finance_transactions_view_class_init (FinanceTransactionsViewClass *klass)
finance_view_transactions_class_init (FinanceViewTransactionsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = finance_transactions_view_finalize;
object_class->get_property = finance_transactions_view_get_property;
object_class->set_property = finance_transactions_view_set_property;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/finance/views/finance-transactions-view.ui");
gtk_widget_class_bind_template_child (widget_class, FinanceTransactionsView, flow_box);
object_class->finalize = finance_view_transactions_finalize;
object_class->get_property = finance_view_transactions_get_property;
object_class->set_property = finance_view_transactions_set_property;
}
static void
finance_transactions_view_init (FinanceTransactionsView *self)
finance_view_transactions_init (FinanceViewTransactions *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
/* for (int x = 0; x < 5; x++) */
/* { */
/* GtkWidget *child = finance_view_child_new (); */
/* gtk_flow_box_insert (GTK_FLOW_BOX (self->flow_box), child, -1); */
/* } */
}
/* finance-transactions-view.h
/* finance-view-transactions.h
*
* Copyright 2021 galetedanilo <galetedanilo@gmail.com>
*
......@@ -18,8 +18,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef __FINANCE_TRANSACTIONS_VIEW_H__
#define __FINANCE_TRANSACTIONS_VIEW_H__
#ifndef __FINANCE_VIEW_TRANSACTIONS_H__
#define __FINANCE_VIEW_TRANSACTIONS_H__
#include <gtk/gtk.h>
......@@ -27,12 +27,12 @@
G_BEGIN_DECLS
#define FINANCE_TYPE_TRANSACTIONS_VIEW (finance_transactions_view_get_type())
#define FINANCE_TYPE_VIEW_TRANSACTIONS (finance_view_transactions_get_type())
G_DECLARE_FINAL_TYPE (FinanceTransactionsView, finance_transactions_view, FINANCE, TRANSACTIONS_VIEW, GtkBox)
G_DECLARE_FINAL_TYPE (FinanceViewTransactions, finance_view_transactions, FINANCE, VIEW_TRANSACTIONS, GtkBox)
GtkWidget * finance_transactions_view_new (void);
GtkWidget * finance_view_transactions_new (void);
G_END_DECLS
#endif /* __FINANCE_TRANSACTIONS_VIEW_H__ */
#endif /* __FINANCE_VIEW_TRANSACTIONS_H__ */
......@@ -2,55 +2,49 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<template class="FinanceTransactionsView" parent="GtkBox">
<template class="FinanceViewTransactions" parent="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<object class="GtkSearchEntry" id="search_entry">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="can-focus">True</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="primary-icon-name">edit-find-symbolic</property>
<property name="primary-icon-activatable">False</property>
<property name="primary-icon-sensitive">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkRevealer">
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-type">none</property>
<property name="reveal-child">True</property>
<child>
<object class="GtkFlowBox" id="flow_box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="homogeneous">True</property>
<property name="column-spacing">10</property>
<property name="row-spacing">10</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-type">none</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
</template>
......
......@@ -5,6 +5,6 @@ built_sources += gnome.compile_resources(
)
sources += files(
'finance-transactions-view.c',
'finance-view-child.c',
'finance-view-transactions.c',
)
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/finance/views">
<file compressed="true">finance-transactions-view.ui</file>
<file compressed="true">finance-view-child.ui</file>
<file compressed="true">finance-view-transactions.ui</file>
</gresource>
</gresources>
......@@ -49,7 +49,6 @@ checkbutton.row-check {
.preferences list > row {
border-right: 1px solid #CCC;
border-left: 1px solid #CCC;
padding: 1em;
}
.preferences list > row:first-child {
......
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