After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748135 - --mode command-line option to start calculator in desired mode
--mode command-line option to start calculator in desired mode
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-19 10:35 UTC by Moo
Modified: 2016-10-11 09:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add support for --mode (1.07 KB, patch)
2015-04-19 11:14 UTC, Moo
committed Details | Review
command-line: added option to select mode from CLI (2.11 KB, patch)
2016-09-17 03:46 UTC, Robert Roth
committed Details | Review

Description Moo 2015-04-19 10:35:02 UTC
I propose a --mode command-line option.

$ gnome-calculator --mode=MODE

Where MODE is one of 'advanced', 'financial', or 'programming'.

== Rationale ==
Financial software could have a toolbar button or menu entry or something else to let the user launch gnome-calculator in financial mode.

Programming software could have a toolbar button or menu entry or something else to let the user launch gnome-calculator in programming mode.

Software can integrate with gnome-calculator and let the user get a calculator in a mode that is expected from the context.

== Example ==
$ gnome-calculator --mode=programming
$ gnome-calculator --mode=programming --equation=1024*1024
Comment 1 Moo 2015-04-19 11:14:27 UTC
Created attachment 301925 [details] [review]
Patch to add support for --mode

Probably does not even work. I was unable to get gnome-calculator to even build.
Comment 2 Robert Roth 2016-09-17 03:46:37 UTC
Created attachment 335747 [details] [review]
command-line: added option to select mode from CLI
Comment 3 Robert Roth 2016-09-17 06:17:58 UTC
My attached patch is based on Moo's patch, only extended to work properly. Of course, this will happen only for the next cycle.
Comment 4 Robert Roth 2016-10-11 07:25:51 UTC
Fix pushed to master.

Attachment 301925 [details] pushed as 56c9e3e - Patch to add support for --mode
Attachment 335747 [details] pushed as f9d760e - command-line: added option to select mode from CLI
Comment 5 Moo 2016-10-11 08:25:40 UTC
Thanks Robert, you're awesome! :)

Next step would perhaps be to make use of it from within some GNOME software.

Suggestions for programming mode:
- Anjuta
- Glade Interface Designer
- GNOME Builder
- Geany

Suggestions for financial mode:
- Gnumeric
- GnuCash
- HomeBank

Suggestions for advanced or programming mode:
- Nemiver
Comment 6 Robert Roth 2016-10-11 08:43:46 UTC
I think those are separate feature requests for each application, so we'll have to handle those separately in each product. 
However, I'm not sure if apps would add shortcuts just to start calculator in a given mode, as it adds a hard-dependency on another application (calculator in this case), and having hard-links just to start another application would be against the current goals of simplifying toolbars and menus. In any case, the mode cli switch could be useful in several different contexts, e.g. unity quick menus, or simply launching from CLI.
Comment 7 Moo 2016-10-11 09:11:23 UTC
Indeed, those are for separate feature requests.
I just mentioned a few applications as candidates.

Yes, a hard dependency would be undesirable.

Maybe it could be an optional dependency that only adds a entry to the toolbar or menubar if the application exists on the system?

if (system.hasCalculator) {
    toolbar.add("Calculator", calc);
    menubar.add("Calculator", calc);
}

public void calc() {
    system.execute("gnome-calculator --mode=programming");
}