Skip to content

Commit 0afe756

Browse files
author
SkyzohKey
committed
MainWindow and ProfileChooserWindow now have an icon. Quick enhancements for settings view, defined some app required const. This commit is the first one for rewriting Ricin using nice and cleaner code.
1 parent 2c7f2a1 commit 0afe756

4 files changed

Lines changed: 28 additions & 1 deletion

File tree

src/MainWindow.vala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ public class Ricin.MainWindow : Gtk.ApplicationWindow {
9393
public MainWindow (Gtk.Application app, string profile) {
9494
Object (application: app);
9595

96+
Gdk.Pixbuf app_icon = new Gdk.Pixbuf.from_resource ("/chat/tox/ricin/images/icons/Ricin-48x48.png");
97+
string profile_base = File.new_for_path (profile).get_basename ();
98+
string profile_name = profile_base.replace (".tox", "");
99+
string app_title = "%s (%s) - %s".printf (Ricin.APP_NAME, Ricin.APP_VERSION, profile_name);
100+
101+
this.set_title (app_title);
96102
this.set_size_request (920, 500);
103+
this.set_icon (app_icon);
97104

98105
var opts = Tox.Options.create ();
99106
opts.ipv6_enabled = true;

src/ProfileChooser.vala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ class Ricin.ProfileChooser : Gtk.ApplicationWindow {
1414

1515
public ProfileChooser (Gtk.Application app) {
1616
Object (application: app);
17-
this.title = "Ricin - Select a profile";
17+
18+
Gdk.Pixbuf app_icon = new Gdk.Pixbuf.from_resource ("/chat/tox/ricin/images/icons/Ricin-48x48.png");
19+
this.set_title ("%s - Select a profile".printf (Ricin.APP_NAME));
20+
this.set_icon (app_icon);
1821

1922
var dir = File.new_for_path (Tox.profile_dir ());
2023
string[] profiles = {};

src/Ricin.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
public class Ricin.Ricin : Gtk.Application {
2+
public static const string APP_NAME = "Ricin";
3+
public static const string APP_SUMMARY = "<b>Ricin</b> aims to be a <i>secure, lightweight, hackable and fully-customizable</i> chat client using the awesome and open-source <b>ToxCore</b> library.";
4+
public static const string APP_VERSION = "0.0.3-alpha";
5+
public static const string RES_BASE_PATH = "/chat/tox/ricin/";
6+
27
private string default_theme = "dark"; // Hardcoded until we have proper settings.
38

49
public Ricin () {

src/SettingsView.vala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,22 @@ class Ricin.SettingsView : Gtk.Notebook {
2121
[GtkChild] Gtk.Entry entry_proxy_port;
2222
*/
2323

24+
// About tab.
25+
[GtkChild] Gtk.Label label_app_name;
26+
[GtkChild] Gtk.Label label_app_description;
27+
[GtkChild] Gtk.Label label_app_version;
28+
2429
private weak Tox.Tox handle;
2530

2631
public SettingsView (Tox.Tox handle) {
2732
this.handle = handle;
33+
34+
// About tab →
35+
this.label_app_name.set_text (Ricin.APP_NAME);
36+
this.label_app_description.set_markup (Ricin.APP_SUMMARY);
37+
this.label_app_version.set_text (Ricin.APP_VERSION);
38+
39+
2840
this.label_tox_id.set_text (handle.id);
2941

3042
this.combobox_languages.append_text ("English (default)");

0 commit comments

Comments
 (0)