Skip to content

Commit b2b7b6f

Browse files
Merge pull request #112 from SubhadeepJasu/metainfo-fix
Fix Metainfo and some other things
2 parents 129984f + 054a493 commit b2b7b6f

File tree

7 files changed

+107
-10
lines changed

7 files changed

+107
-10
lines changed

data/com.github.subhadeepjasu.pebbles.gschema.xml.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@
102102
<summary>Choose the number system</summary>
103103
<description>Select the number system.</description>
104104
</key>
105+
<key name="calculus-mode" type="b">
106+
<default>false</default>
107+
<summary>Calculus Mode: Derivative/Definite Integral</summary>
108+
<description>True if Definite Integral mode, False if Derivative mode</description>
109+
</key>
105110
<key name="last-input-scientific" type="s">
106111
<default>"0"</default>
107112
<summary>Last input in Scientific View</summary>
@@ -117,6 +122,21 @@
117122
<summary>Last input in Calculator View</summary>
118123
<description>Last input in Calculator View</description>
119124
</key>
125+
<key name="last-input-calculus-upper-lim" type="s">
126+
<default>""</default>
127+
<summary>Last input upper limit in Calculus View</summary>
128+
<description>Last input upper limit for definite integral in Calculus View</description>
129+
</key>
130+
<key name="last-input-calculus-lower-lim" type="s">
131+
<default>""</default>
132+
<summary>Last input lower limit in Calculus View</summary>
133+
<description>Last input lower limit for definite integral in Calculus View</description>
134+
</key>
135+
<key name="last-input-calculus-x" type="s">
136+
<default>""</default>
137+
<summary>Last input x limit in Calculus View</summary>
138+
<description>Last input x limit for derivative in Calculus View</description>
139+
</key>
120140
<key name="last-input-graphing" type="as">
121141
<default>[]</default>
122142
<summary>Last input equations in Graphing View</summary>

data/com.github.subhadeepjasu.pebbles.metainfo.xml.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<categories>
5050
<category>Calculator</category>
5151
</categories>
52-
<developer id="com.github.SubhadeepJasu">
52+
<developer id="com.github.subhadeepjasu">
5353
<name>Subhadeep Jasu</name>
5454
</developer>
5555
<url type="homepage">https://subhadeepjasu.github.io/#/project/pebbles</url>
@@ -61,18 +61,18 @@
6161
</custom>
6262
<branding>
6363
<color type="primary" scheme_preference="light">#84AEAA</color>
64-
<color type="primary" scheme_preference="dark">rgb(39,40,99)</color>
64+
<color type="primary" scheme_preference="dark">#272863</color>
6565
</branding>
6666
<translation type="gettext" source_locale="en_US">com.github.subhadeepjasu.pebbles</translation>
6767
<launchable type="desktop-id">com.github.subhadeepjasu.pebbles.desktop</launchable>
6868
<screenshots>
6969
<screenshot type="default" environment="pantheon">
7070
<caption>Scientific Mode</caption>
71-
<image>https://raw.githubusercontent.com/SubhadeepJasu/pebbles/master/screenshots/ScreenshotScientific.png</image>
71+
<image>https://raw.githubusercontent.com/SubhadeepJasu/pebbles/master/screenshots/ScientificMode.png</image>
7272
</screenshot>
7373
<screenshot environment="pantheon:dark">
7474
<caption>Scientific Mode</caption>
75-
<image>https://raw.githubusercontent.com/SubhadeepJasu/pebbles/master/screenshots/ScreenshotScientificDark.png</image>
75+
<image>https://raw.githubusercontent.com/SubhadeepJasu/pebbles/master/screenshots/ScientificModeDark.png</image>
7676
</screenshot>
7777
</screenshots>
7878
<content_rating type="oars-1.1">

data/ui/date_view.blp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22
// SPDX-FileCopyrightText: 2026 Subhadeep Jasu <subhadeep107@proton.me>
33
using Gtk 4.0;
4-
using Adw 1;
54

65
template $PebblesDateView: $PebblesView {
76
selected_view: bind date_stack.visible-child-name;

src/Settings.vala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace Pebbles {
2323
public const string KEY_DECIMAL_PLACES = "decimal-places";
2424
public const string KEY_INTEGRATION_RESOLUTION = "integration-resolution";
2525
public const string KEY_DERIVATIVE_ACCURACY = "derivative-accuracy";
26+
public const string KEY_CALCULUS_MODE = "calculus-mode";
2627
public const string KEY_FOREX_API_KEY = "forex-api-key";
2728
public const string KEY_FOREX_API_TIMESTAMP = "forex-timestamp";
2829
public const string KEY_FOREX_RATES_CACHE = "forex-rates-cache";
@@ -32,6 +33,9 @@ namespace Pebbles {
3233
public const string KEY_LAST_INPUT_SCIENTIFIC = "last-input-scientific";
3334
public const string KEY_LAST_INPUT_PROGRAMMER = "last-input-programmer";
3435
public const string KEY_LAST_INPUT_CALCULUS = "last-input-calculus";
36+
public const string KEY_LAST_INPUT_CALCULUS_X = "last-input-calculus-x";
37+
public const string KEY_LAST_INPUT_CALCULUS_UPPER_LIM = "last-input-calculus-upper-lim";
38+
public const string KEY_LAST_INPUT_CALCULUS_LOWER_LIM = "last-input-calculus-lower-lim";
3539
public const string KEY_LAST_INPUT_GRAPHING = "last-input-graphing";
3640
public const string KEY_DATE_DIFF_FROM = "date-diff-from";
3741
public const string KEY_DATE_DIFF_TO = "date-diff-to";
@@ -60,6 +64,7 @@ namespace Pebbles {
6064
keys.append (KEY_GLOBAL_ANGLE_UNIT);
6165
keys.append (KEY_GLOBAL_WORD_LENGTH);
6266
keys.append (KEY_NUMBER_SYSTEM);
67+
keys.append (KEY_CALCULUS_MODE);
6368
keys.append (KEY_LAST_INPUT_SCIENTIFIC);
6469
keys.append (KEY_LAST_INPUT_PROGRAMMER);
6570
keys.append (KEY_LAST_INPUT_CALCULUS);
@@ -181,6 +186,11 @@ namespace Pebbles {
181186
set { set_enum (KEY_NUMBER_SYSTEM, value); }
182187
}
183188

189+
public bool calculus_mode {
190+
get { return get_boolean (KEY_CALCULUS_MODE); }
191+
set { set_boolean (KEY_CALCULUS_MODE, value); }
192+
}
193+
184194
public string last_input_scientific {
185195
owned get { return get_string (KEY_LAST_INPUT_SCIENTIFIC); }
186196
set { set_string (KEY_LAST_INPUT_SCIENTIFIC, value); }
@@ -196,6 +206,21 @@ namespace Pebbles {
196206
set { set_string (KEY_LAST_INPUT_CALCULUS, value); }
197207
}
198208

209+
public string last_input_calculus_x {
210+
owned get { return get_string (KEY_LAST_INPUT_CALCULUS_X); }
211+
set { set_string (KEY_LAST_INPUT_CALCULUS_X, value); }
212+
}
213+
214+
public string last_input_calculus_upper_lim {
215+
owned get { return get_string (KEY_LAST_INPUT_CALCULUS_UPPER_LIM); }
216+
set { set_string (KEY_LAST_INPUT_CALCULUS_UPPER_LIM, value); }
217+
}
218+
219+
public string last_input_calculus_lower_lim {
220+
owned get { return get_string (KEY_LAST_INPUT_CALCULUS_LOWER_LIM); }
221+
set { set_string (KEY_LAST_INPUT_CALCULUS_LOWER_LIM, value); }
222+
}
223+
199224
public string[] last_input_graphing {
200225
owned get { return get_strv (KEY_LAST_INPUT_GRAPHING); }
201226
set { set_strv (KEY_LAST_INPUT_GRAPHING, value); }

src/shell/MainWindow.vala

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ namespace Pebbles {
7373
public Gtk.Stack date_header_box_stack;
7474
public Gtk.Switch diff_mode_switch;
7575
public Gtk.Switch add_mode_switch;
76+
public Granite.ModeSwitch calculus_mode_button;
7677
[GtkChild]
7778
private unowned Gtk.Box currency_header_box;
7879
[GtkChild]
@@ -274,12 +275,14 @@ namespace Pebbles {
274275
on_change_mode ();
275276
});
276277

277-
var calculus_mode_button = new Granite.ModeSwitch.from_icon_name (
278+
calculus_mode_button = new Granite.ModeSwitch.from_icon_name (
278279
"derivative-mode-symbolic",
279280
"integral-mode-symbolic"
280281
);
281282
calculus_header_box.append (calculus_mode_button);
282-
283+
if (settings.load_last_session) {
284+
calculus_mode_button.active = settings.calculus_mode;
285+
}
283286
calculus_mode_button.notify["active"].connect (() => {
284287
calculus_view.integral_mode = calculus_mode_button.active;
285288
});
@@ -682,6 +685,14 @@ namespace Pebbles {
682685
on_memory_clear (global ? "global" : Context.SCIENTIFIC);
683686
});
684687

688+
calculus_view.on_memory_recall.connect ((global) => {
689+
return on_memory_recall (global ? "global" : Context.CALCULUS);
690+
});
691+
692+
calculus_view.on_memory_clear.connect ((global) => {
693+
on_memory_clear (global ? "global" : Context.CALCULUS);
694+
});
695+
685696
statistics_view.on_memory_recall.connect ((global) => {
686697
return on_memory_recall (global ? "global" : Context.STATISTICS);
687698
});
@@ -939,7 +950,6 @@ namespace Pebbles {
939950
protected void history_recall (HistoryModel _history) {
940951
switch (_history.context) {
941952
case Context.SCIENTIFIC:
942-
case Context.CALCULUS:
943953
case Context.GRAPHING:
944954
settings.global_angle_unit = (GlobalAngleUnit) _history.metadata.metadata_1;
945955
switch (settings.global_angle_unit) {
@@ -960,6 +970,28 @@ namespace Pebbles {
960970
break;
961971
}
962972
break;
973+
case Context.CALCULUS:
974+
settings.global_angle_unit = (GlobalAngleUnit) _history.metadata.metadata_1;
975+
switch (settings.global_angle_unit) {
976+
case RAD:
977+
angle_mode.label_text = "RAD";
978+
graph_angle_mode.label_text = "RAD";
979+
calculus_angle_mode.label_text = "RAD";
980+
break;
981+
case GRAD:
982+
angle_mode.label_text = "GRA";
983+
graph_angle_mode.label_text = "GRA";
984+
calculus_angle_mode.label_text = "GRA";
985+
break;
986+
case DEG:
987+
angle_mode.label_text = "DEG";
988+
graph_angle_mode.label_text = "DEG";
989+
calculus_angle_mode.label_text = "DEG";
990+
break;
991+
}
992+
settings.calculus_mode = _history.metadata.metadata_2 == 1;
993+
calculus_mode_button.active = settings.calculus_mode;
994+
break;
963995
case Context.PROGRAMMER:
964996
settings.global_word_length = (GlobalWordLength) _history.metadata.metadata_1;
965997
switch (settings.global_word_length) {

src/shell/views/CalculusView.vala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ namespace Pebbles {
6969
protected string constant_label { get; private set; default = "C"; }
7070
protected string constant_desc { get; private set; default = ""; }
7171

72+
private Settings settings;
73+
7274
public signal void on_evaluate (
7375
string input,
7476
bool integral_mode,
@@ -80,6 +82,7 @@ namespace Pebbles {
8082
public signal void on_memory_clear (bool global);
8183

8284
construct {
85+
settings = Pebbles.Settings.get_default ();
8386
display.on_input.connect ((text) => {
8487
on_evaluate (
8588
text,
@@ -89,6 +92,10 @@ namespace Pebbles {
8992
);
9093
});
9194

95+
if (settings.load_last_session) {
96+
integral_mode = settings.calculus_mode;
97+
}
98+
9299
load_constant_button ();
93100
Settings.get_default ().changed.connect ((key) => {
94101
if (key == "constant-key-value1" || key == "constant-key-value2") {
@@ -99,6 +106,7 @@ namespace Pebbles {
99106

100107
public void show_result (string result) {
101108
display.show_result (result);
109+
settings.calculus_mode = integral_mode;
102110
}
103111

104112
[GtkCallback]
@@ -244,8 +252,6 @@ namespace Pebbles {
244252
}
245253

246254
private void load_constant_button () {
247-
var settings = Pebbles.Settings.get_default ();
248-
249255
var key = shift_button.active ? settings.constant_key_value2 : settings.constant_key_value1;
250256
switch (key) {
251257
case ARCHIMEDES:

src/shell/widgets/displays/CalculusDisplay.vala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ namespace Pebbles {
8686

8787
});
8888

89+
if (settings.load_last_session) {
90+
limit_entry_a.text = settings.last_input_calculus_lower_lim;
91+
limit_entry_b.text = settings.last_input_calculus_upper_lim;
92+
limit_entry_der.text = settings.last_input_calculus_x;
93+
}
94+
8995
focus_controller_main = new Gtk.EventControllerFocus ();
9096
focus_controller_main.enter.connect (() => {
9197
focused_entry = main_entry;
@@ -120,16 +126,19 @@ namespace Pebbles {
120126
[GtkCallback]
121127
public void set_limit_a (Gtk.Editable entry) {
122128
limit_a = double.parse (entry.text);
129+
settings.last_input_calculus_lower_lim = entry.text;
123130
}
124131

125132
[GtkCallback]
126133
public void set_limit_b (Gtk.Editable entry) {
127134
limit_b = double.parse (entry.text);
135+
settings.last_input_calculus_upper_lim = entry.text;
128136
}
129137

130138
[GtkCallback]
131139
public void set_limit_x (Gtk.Editable entry) {
132140
limit_x = double.parse (entry.text);
141+
settings.last_input_calculus_x = entry.text;
133142
}
134143

135144
[GtkCallback]
@@ -148,6 +157,12 @@ namespace Pebbles {
148157
main_entry.set_text (data.input);
149158
main_entry.set_position ((int) main_entry.text_length);
150159
main_label.set_text (data.result);
160+
if (data.metadata.metadata_2 == 1) {
161+
limit_entry_a.text = data.metadata.metadata_3;
162+
limit_entry_b.text = data.metadata.metadata_4;
163+
} else {
164+
limit_entry_der.text = data.metadata.metadata_3;
165+
}
151166
}
152167

153168
public void show_result (string result) {

0 commit comments

Comments
 (0)