Skip to content

Commit

Permalink
Can now move pages between windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Sipes committed Mar 17, 2015
1 parent c73b036 commit 3a808af
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/Notebook.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class EvolveNotebook: Gtk.Notebook{
public Gtk.Button newtabbutton;
public string null_buffer = "";
public bool use_linenum;
private const Gtk.TargetEntry[] targets = {
{"EvolveJournal.EvolveNotebook", 0,0}
};

public EvolveWindow mother;

Expand All @@ -36,6 +39,9 @@ public class EvolveNotebook: Gtk.Notebook{
set_scrollable(true);
use_linenum = true;

//connect drag drop handlers
set_group_name("notebook");

create_window.connect((p, x, y)=> {
var w = (mother.application as EvolveJournal.App).create_window();
w.move(x, y);
Expand All @@ -48,6 +54,12 @@ public class EvolveNotebook: Gtk.Notebook{
set_subtitle_text(tab);
});

/*page_removed.connect((c,n)=> {
if(this.get_n_pages() <= 0){
this.new_tab(this.null_buffer, false, "");
}
});*/

mother.application.notify["show-tabs"].connect(()=> {
bool tabs;
mother.application.get("show-tabs", out tabs);
Expand Down
11 changes: 5 additions & 6 deletions src/Tab.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ public class EvolveTab : Gtk.Box
public Button close_btn;
public Image close_btn_indicator;
public SourceView source_view;
public EvolveNotebook parent_notebook;

public EvolveTab(EvolveNotebook notebook){
//Grab Notebook
parent_notebook = notebook;
//Set up Scrolled Window.
scroller = new ScrolledWindow (null, null);
scroller.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
Expand Down Expand Up @@ -74,11 +71,11 @@ public class EvolveTab : Gtk.Box
source_view.show();
scroller.show();

scheme_selector();
scheme_selector(notebook);
}

public void scheme_selector(){
this.parent_notebook.mother.change_scheme.connect((scheme) => {
public void scheme_selector(EvolveNotebook notebook){
notebook.mother.change_scheme.connect((scheme) => {
text_buffer.set_style_scheme(new Gtk.SourceStyleSchemeManager().get_default().get_scheme(scheme));
});
}
Expand All @@ -103,6 +100,7 @@ public class EvolveTab : Gtk.Box
}

public void remove_tab() {
EvolveNotebook parent_notebook = (EvolveNotebook)this.get_parent();
if (edited == true){
EvolveWindow win = (EvolveWindow)this.get_toplevel();
// The MessageDialog
Expand Down Expand Up @@ -131,6 +129,7 @@ public class EvolveTab : Gtk.Box

public void set_close_btn_indicator(){
EvolveWindow win = (EvolveWindow)this.get_toplevel();
EvolveNotebook parent_notebook = (EvolveNotebook)this.get_parent();
if (edited == true){
close_btn.set_image(new Image.from_icon_name("software-update-urgent-symbolic", IconSize.BUTTON));
if (parent_notebook.get_n_pages() == 1){
Expand Down
1 change: 1 addition & 0 deletions src/Window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class EvolveWindow : Gtk.ApplicationWindow {

public signal void change_scheme(string scheme);


public EvolveWindow (EvolveJournal.App application)
{
Object(application: application);
Expand Down

0 comments on commit 3a808af

Please sign in to comment.