[gnome-calculator] Set headerbar title based on calculator mode
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Set headerbar title based on calculator mode
- Date: Tue, 26 Nov 2013 02:14:43 +0000 (UTC)
commit 9ce7c0f92d7a558122e563b765cb180bf02b27e9
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Nov 25 12:38:54 2013 -0600
Set headerbar title based on calculator mode
https://bugzilla.gnome.org/show_bug.cgi?id=705909
src/math-window.vala | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/math-window.vala b/src/math-window.vala
index ee06589..6beb5fa 100644
--- a/src/math-window.vala
+++ b/src/math-window.vala
@@ -21,18 +21,20 @@ public class MathWindow : Gtk.ApplicationWindow
public MathButtons buttons { get { return _buttons; } }
private bool right_aligned;
+ private Gtk.HeaderBar headerbar;
+
public MathWindow (Gtk.Application app, MathEquation equation)
{
Object (application: app);
_equation = equation;
set_title (/* Title of main window */
_("Calculator"));
+
icon_name = "gnome-calculator";
role = "gnome-calculator";
resizable = false;
- var headerbar = new Gtk.HeaderBar ();
- headerbar.set_title (_("Calculator"));
+ headerbar = new Gtk.HeaderBar ();
headerbar.show_close_button = true;
headerbar.show_fallback_app_menu = true;
headerbar.show ();
@@ -63,6 +65,30 @@ public class MathWindow : Gtk.ApplicationWindow
_buttons = new MathButtons (equation);
vbox.pack_start (buttons, true, true, 0);
buttons.show ();
+ buttons.notify["mode"].connect (mode_changed_cb);
+ }
+
+ private void mode_changed_cb ()
+ {
+ switch (buttons.mode)
+ {
+ default:
+ case ButtonMode.BASIC:
+ headerbar.set_title (_("Basic Mode"));
+ break;
+
+ case ButtonMode.ADVANCED:
+ headerbar.set_title (_("Advanced Mode"));
+ break;
+
+ case ButtonMode.FINANCIAL:
+ headerbar.set_title (_("Financial Mode"));
+ break;
+
+ case ButtonMode.PROGRAMMING:
+ headerbar.set_title (_("Programming Mode"));
+ break;
+ }
}
public void critical_error (string title, string contents)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]