Skip to content

Commit

Permalink
Revert "Added scheme theme manager and replaced menu"
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanleesipes committed Feb 17, 2015
1 parent 3e56844 commit 3dfa03b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 81 deletions.
5 changes: 1 addition & 4 deletions src/Notebook.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ namespace EvolveJournal{
public Gtk.Button newtabbutton;
public string null_buffer = "";
public bool use_linenum;

public EvolveWindow mother;

public EvolveNotebook(EvolveWindow mother)
public EvolveNotebook()
{
this.mother = mother;
show_border = false;
set_scrollable(true);
use_linenum = true;
Expand Down
4 changes: 1 addition & 3 deletions src/Tab.vala
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ namespace EvolveJournal

source_view.show();
scroller.show();

this.parent_notebook.mother.change_scheme.connect((scheme) => {text_buffer.set_style_scheme(new Gtk.SourceStyleSchemeManager().get_default().get_scheme(scheme)); stdout.printf(scheme + "\n");});

}

Expand Down Expand Up @@ -214,4 +212,4 @@ namespace EvolveJournal
}
}
}
}
}
85 changes: 11 additions & 74 deletions src/Window.vala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2014 Ryan Sipes & Barry Smith
/* Copyright 2014 Ryan Sipes
*
* This file is part of Evolve Journal.
*
Expand Down Expand Up @@ -29,13 +29,6 @@ namespace EvolveJournal {
private Gtk.Button save_button;
public Gtk.HeaderBar headbar;
private EvolveNotebook notebook;

public Gtk.ComboBoxText combo_box;

public SimpleAction about_action;
public SimpleAction saveas_action;

public signal void change_scheme(string scheme);

public EvolveWindow (Gtk.Application application)
{
Expand Down Expand Up @@ -125,7 +118,7 @@ namespace EvolveJournal {
print_operation.run(Gtk.PrintOperationAction.PRINT_DIALOG, this);
});

saveas_action = new SimpleAction("saveas_action", null);
var saveas_action = new SimpleAction("saveas_action", null);
saveas_action.activate.connect(()=> {
message("Saving As...");
save_file(notebook, true);
Expand All @@ -137,7 +130,7 @@ namespace EvolveJournal {
notebook.new_tab(notebook.null_buffer, false, "");
});

about_action = new SimpleAction("about_action", null);
var about_action = new SimpleAction("about_action", null);
about_action.activate.connect(()=> {
queue_draw();
Idle.add(()=>{
Expand Down Expand Up @@ -181,71 +174,16 @@ namespace EvolveJournal {
//Menu button not finished an ready for Beta release.
MenuButton menu_button = new MenuButton();
var popover = new Popover(menu_button);
// popover.set_modal(true);

Gtk.Box menu_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
menu_box.width_request = 100;
menu_box.visible = true;
popover.add(menu_box);

Gtk.Button saveas_button = new Gtk.Button();
saveas_button.visible = true;
saveas_button.set_relief(ReliefStyle.NONE);
saveas_button.clicked.connect(()=> {
message("Saving As...");
save_file(notebook, true);
});
saveas_button.set_label("Save As...");
menu_box.add(saveas_button);

Gtk.Button about_button = new Gtk.Button();
about_button.visible = true;
about_button.set_relief(ReliefStyle.NONE);
about_button.clicked.connect(()=> {
queue_draw();
Idle.add(()=>{
Gtk.show_about_dialog(this,
"program-name", "Journal",
"copyright", "Copyright \u00A9 2015 Ryan Sipes",
"website", "https://evolve-os.com",
"website-label", "Evolve OS",
"license-type", Gtk.License.GPL_2_0,
"comments", "A simple text-editor with sharing features.",
"version", "0.7.1 (Beta 3)",
"logo-icon-name", "journal",
"artists", new string[]{
"Alejandro Seoane <[email protected]>"
},
"authors", new string[]{
"Ryan Sipes <[email protected]>",
"Ikey Doherty <[email protected]>",
"Barry Smith <[email protected]>"
});
return false;
});
});
about_button.set_label("About");
menu_box.add(about_button);

combo_box = new Gtk.ComboBoxText();
combo_box.set_halign(Gtk.Align.END);
string[] schemes = Gtk.SourceStyleSchemeManager.get_default().get_scheme_ids();
for (int count = 0; count < schemes.length; count ++)
combo_box.append_text(schemes[count]);
combo_box.changed.connect(() => {this.change_scheme(combo_box.get_active_text());});
combo_box.set_active(0);
combo_box.visible = true;
menu_box.add(combo_box);

//menu_button.image = new Image.from_icon_name("open-menu-symbolic", IconSize.SMALL_TOOLBAR);
popover.set_modal(true);
menu_button.image = new Image.from_icon_name("open-menu-symbolic", IconSize.SMALL_TOOLBAR);
menu_button.set_popover(popover);
menu_button.show();
//Gtk.Menu menu = new Gtk.Menu();
//menu_button.set_menu_model(menu);
GLib.Menu menu = new GLib.Menu();
menu_button.set_menu_model(menu);
menu_button.set_use_popover(true);
//menu.append("Print", "app.print_action");
//menu.append("Save As...", "app.saveas_action");
//menu.append("About", "app.about_action");
menu.append("Save As...", "app.saveas_action");
menu.append("About", "app.about_action");

headbar.pack_end (menu_button);
headbar.pack_end (share_button);
Expand All @@ -258,9 +196,8 @@ namespace EvolveJournal {
notebook.show_all();
headbar.show_all();
}

public void set_notebook(){
notebook = new EvolveNotebook(this);
notebook = new EvolveNotebook();
}

public EvolveNotebook get_notebook(){
Expand Down Expand Up @@ -305,4 +242,4 @@ namespace EvolveJournal {
file.on_save_clicked(typed_text, save_notebook, save_as);
}
}
}
}

0 comments on commit 3dfa03b

Please sign in to comment.