Skip to content

Commit

Permalink
Definitive fix lint & build
Browse files Browse the repository at this point in the history
  • Loading branch information
eudaldgr committed Jul 27, 2020
1 parent 1a3e5f5 commit 56e64d0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class Elements : Gtk.Application {
var provider = new Gtk.CssProvider ();
provider.load_from_resource ("/com/github/eudaldgr/elements/stylesheet.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
provider,
Gdk.Screen.get_default (),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);

Expand Down
36 changes: 18 additions & 18 deletions src/Layouts/HeaderBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ public class HeaderBar : Gtk.HeaderBar {
Popover popover = Popover.get_instance ();

public Gtk.Button info_button = new Gtk.Button.from_icon_name ("help-contents-symbolic");
public ModeButton periodicView_mode = new Granite.Widgets.ModeButton ();
public Granite.Widgets.ModeButton periodic_view_mode = new Granite.Widgets.ModeButton ();

HeaderBar () {
this.get_style_context ().add_class ("flat");

generateInfoButton ();
generatePeriodicViewMode ();
generate_info_button ();
generate_periodic_view_mode ();

this.show_close_button = true;
this.custom_title = periodicView_mode;
this.custom_title = periodic_view_mode;
this.pack_end (info_button);
}

Expand All @@ -25,19 +25,19 @@ public class HeaderBar : Gtk.HeaderBar {
return instance;
}

generatePeriodicViewMode () {
private void generate_periodic_view_mode () {
var label1 = new Gtk.Label (_("Main"));
var label2 = new Gtk.Label (_("Electronegativity"));

label1.name = "main_view";
label2.name = "electronegativity_view";

periodicView_mode.append (label1);
periodicView_mode.append (label2);
periodicView_mode.notify["selected"].connect (on_periodicView_mode_changed);
periodic_view_mode.append (label1);
periodic_view_mode.append (label2);
periodic_view_mode.notify["selected"].connect (on_periodic_view_mode_changed);
}

generateInfoButton () {
private void generate_info_button () {
var pop = new Gtk.Popover (info_button);
pop.add (popover);

Expand All @@ -47,25 +47,25 @@ public class HeaderBar : Gtk.HeaderBar {
});
}

showPeriodicViewMode (bool answer) {
periodicView_mode.visible = answer;
public void show_periodic_view_mode (bool answer) {
periodic_view_mode.visible = answer;
}

showInfoButton (bool answer) {
public void show_info_button (bool answer) {
info_button.visible = answer;
}

setSelectedPeriodicViewMode (int answer) {
periodicView_mode.selected = answer;
public void set_selected_periodic_view_mode (int answer) {
periodic_view_mode.selected = answer;
}

on_periodicView_mode_changed () {
switch (periodicView_mode.selected) {
private void on_periodic_view_mode_changed () {
switch (periodic_view_mode.selected) {
case 1:
stack.getStack ().visible_child_name = "electronegativity_view";
stack.get_stack ().visible_child_name = "electronegativity_view";
break;
default:
stack.getStack ().visible_child_name = "main_view";
stack.get_stack ().visible_child_name = "main_view";
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Layouts/Popover.vala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Popover : Gtk.Grid {
this.margin = 5;
this.row_spacing = 5;

stack.getStack ().notify["visible-child"].connect ( () => {
stack.get_stack ().notify["visible-child"].connect ( () => {
this.remove_column (0);

for (int i = 0; i <= TYPES.NAME[1,i].length; i++) {
Expand All @@ -24,7 +24,7 @@ public class Popover : Gtk.Grid {

this.add (button);

switch (stack.getStack ().get_visible_child_name ()) {
switch (stack.get_stack ().get_visible_child_name ()) {
case "electronegativity_view":
button.label = TYPES.NAME[i,1];
button.get_style_context ().add_class (TYPES.CSS_TAG[i,1]);
Expand Down
18 changes: 9 additions & 9 deletions src/Layouts/Stack.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ public class Stack : Object {
return instance;
}

public Gtk.Stack getStack () {
public Gtk.Stack get_stack () {
return this.stack;
}

public void loadViews (Gtk.Window window) {
public void load_views (Gtk.Window window) {
var main_view = new PeriodicView ("main_view");
var electro_view = new PeriodicView ("electronegativity_view");

stack.add_titled (main_view, "main_view", _("Main"));
stack.add_titled (electro_view, "electronegativity_view", _("Electronegativity"));

stack.notify["visible-child"].connect ( () => {
var headerBar = HeaderBar.get_instance ();
var header_bar = HeaderBar.get_instance ();

if (stack.get_visible_child_name () == "main_view") {
headerBar.showInfoButton (true);
headerBar.showPeriodicViewMode (true);
headerBar.setSelectedPeriodicViewMode (0);
header_bar.show_info_button (true);
header_bar.show_periodic_view_mode (true);
header_bar.set_selected_periodic_view_mode (0);
}

if (stack.get_visible_child_name () == "electronegativity_view") {
headerBar.showInfoButton (true);
headerBar.showPeriodicViewMode (true);
headerBar.setSelectedPeriodicViewMode (1);
header_bar.show_info_button (true);
header_bar.show_periodic_view_mode (true);
header_bar.set_selected_periodic_view_mode (1);
}
});

Expand Down
6 changes: 3 additions & 3 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ public class MainWindow : Gtk.ApplicationWindow {
private uint configure_id;

private Stack stack = Stack.get_instance ();
private HeaderBar headerBar = HeaderBar.get_instance ();
private HeaderBar header_bar = HeaderBar.get_instance ();

public MainWindow (Gtk.Application application) {
Object (application: application,
icon_name: "com.github.eudaldgr.elements");

this.show_all ();
this.set_titlebar (headerBar);
this.set_titlebar (header_bar);

stack.loadViews (this);
stack.load_views (this);

settings = new Settings ("com.github.eudaldgr.elements");

Expand Down
4 changes: 2 additions & 2 deletions src/Views/Main.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
public class PeriodicView : Gtk.Grid {
public static headerBar = HeaderBar.get_instance ();
HeaderBar header_bar = HeaderBar.get_instance ();

static PeriodicView? instance;

Expand All @@ -11,7 +11,7 @@ public class PeriodicView : Gtk.Grid {
}

public PeriodicView (string id) {
headerBar.showPeriodicViewMode (true);
header_bar.show_periodic_view_mode (true);

this.row_spacing = 3;
this.column_spacing = 3;
Expand Down

0 comments on commit 56e64d0

Please sign in to comment.