-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from zesterer/master
Added scheme theme manager and replaced menu
- Loading branch information
Showing
3 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* Copyright 2014 Ryan Sipes | ||
/* Copyright 2014 Ryan Sipes & Barry Smith | ||
* | ||
* This file is part of Evolve Journal. | ||
* | ||
|
@@ -29,6 +29,13 @@ 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) | ||
{ | ||
|
@@ -118,7 +125,7 @@ namespace EvolveJournal { | |
print_operation.run(Gtk.PrintOperationAction.PRINT_DIALOG, this); | ||
}); | ||
|
||
var saveas_action = new SimpleAction("saveas_action", null); | ||
saveas_action = new SimpleAction("saveas_action", null); | ||
saveas_action.activate.connect(()=> { | ||
message("Saving As..."); | ||
save_file(notebook, true); | ||
|
@@ -130,7 +137,7 @@ namespace EvolveJournal { | |
notebook.new_tab(notebook.null_buffer, false, ""); | ||
}); | ||
|
||
var about_action = new SimpleAction("about_action", null); | ||
about_action = new SimpleAction("about_action", null); | ||
about_action.activate.connect(()=> { | ||
queue_draw(); | ||
Idle.add(()=>{ | ||
|
@@ -174,16 +181,71 @@ 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); | ||
menu_button.image = new Image.from_icon_name("open-menu-symbolic", IconSize.SMALL_TOOLBAR); | ||
// 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); | ||
menu_button.set_popover(popover); | ||
menu_button.show(); | ||
GLib.Menu menu = new GLib.Menu(); | ||
menu_button.set_menu_model(menu); | ||
//Gtk.Menu menu = new Gtk.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); | ||
|
@@ -196,8 +258,9 @@ namespace EvolveJournal { | |
notebook.show_all(); | ||
headbar.show_all(); | ||
} | ||
|
||
public void set_notebook(){ | ||
notebook = new EvolveNotebook(); | ||
notebook = new EvolveNotebook(this); | ||
} | ||
|
||
public EvolveNotebook get_notebook(){ | ||
|
@@ -242,4 +305,4 @@ namespace EvolveJournal { | |
file.on_save_clicked(typed_text, save_notebook, save_as); | ||
} | ||
} | ||
} | ||
} |