Browse files

todo and retab

  • Loading branch information...
1 parent d8429bc commit d848ee350f65d3bd7cb2331aceca0d5727474f42 @lzap committed May 27, 2012
View
5 TODO
@@ -2,12 +2,7 @@ TODO
====
Remove F10 binding.
-Light/dark switch shortcut.
Web links clickable (one click).
Absolute filepaths clickable.
Relative filepaths clickable.
-Support for 3x2 layout.
Add a search feature. [/]
-
-Tentative
-Support for dynamic layouts.
View
68 src/about.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,43 +17,43 @@
public class About : Gtk.AboutDialog
{
- const string[] all_authors = {
+ const string[] all_authors = {
"Jacques-Pascal Deplaix <jp.deplaix@gmail.com>",
"Lukas Zapletal <http://lukas.zapletalovi.com>",
"" };
- private About(MainWindow parent_window)
- {
- this.transient_for = parent_window;
- this.program_name = "FourTerm";
- this.version = Config.VERSION;
- this.copyright = "Copyright © 2010 Jacques-Pascal Deplaix\n" +
+ private About(MainWindow parent_window)
+ {
+ this.transient_for = parent_window;
+ this.program_name = "FourTerm";
+ this.version = Config.VERSION;
+ this.copyright = "Copyright © 2010 Jacques-Pascal Deplaix\n" +
"Copyright © 2012 Lukas Zapletal";
- this.comments = tr("FourTerm is a lightweight terminal written in Vala");
- //this.logo = new Gdk.Pixbuf.from_xpm_data(Pictures.logo);
- this.website = "https://gitorious.org/~lzap/valaterm/fourterm";
- this.authors = all_authors;
- this.license = "Copyright © 2011 Jacques-Pascal Deplaix\n" +
- "Copyright © 2012 Lukas Zapletal" +
- "\n" +
- "\nFourTerm is free software: you can redistribute it and/or modify" +
- "\nit under the terms of the GNU General Public License as published by" +
- "\nthe Free Software Foundation, either version 3 of the License, or" +
- "\n(at your option) any later version." +
- "\n" +
- "\nThis program is distributed in the hope that it will be useful," +
- "\nbut WITHOUT ANY WARRANTY; without even the implied warranty of" +
- "\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" +
- "\nGNU General Public License for more details." +
- "\n" +
- "\nYou should have received a copy of the GNU General Public License" +
- "\nalong with this program. If not, see <http://www.gnu.org/licenses/>.";
- }
+ this.comments = tr("FourTerm is a lightweight terminal written in Vala");
+ //this.logo = new Gdk.Pixbuf.from_xpm_data(Pictures.logo);
+ this.website = "https://gitorious.org/~lzap/valaterm/fourterm";
+ this.authors = all_authors;
+ this.license = "Copyright © 2011 Jacques-Pascal Deplaix\n" +
+ "Copyright © 2012 Lukas Zapletal" +
+ "\n" +
+ "\nFourTerm is free software: you can redistribute it and/or modify" +
+ "\nit under the terms of the GNU General Public License as published by" +
+ "\nthe Free Software Foundation, either version 3 of the License, or" +
+ "\n(at your option) any later version." +
+ "\n" +
+ "\nThis program is distributed in the hope that it will be useful," +
+ "\nbut WITHOUT ANY WARRANTY; without even the implied warranty of" +
+ "\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" +
+ "\nGNU General Public License for more details." +
+ "\n" +
+ "\nYou should have received a copy of the GNU General Public License" +
+ "\nalong with this program. If not, see <http://www.gnu.org/licenses/>.";
+ }
- public static void display(MainWindow parent_window)
- {
- var window = new About(parent_window);
- window.run();
- window.destroy();
- }
+ public static void display(MainWindow parent_window)
+ {
+ var window = new About(parent_window);
+ window.run();
+ window.destroy();
+ }
}
View
12 src/check-button.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
public class CheckButton : Gtk.CheckButton
{
- public CheckButton(bool active)
- {
- this.active = active;
- }
-}
+ public CheckButton(bool active)
+ {
+ this.active = active;
+ }
+}
View
14 src/check-menu-item.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,9 +17,9 @@
public class CheckMenuItem : Gtk.CheckMenuItem
{
- public CheckMenuItem(string label, bool active)
- {
- this.label = label;
- this.active = active;
- }
-}
+ public CheckMenuItem(string label, bool active)
+ {
+ this.label = label;
+ this.active = active;
+ }
+}
View
12 src/color-button.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
public class ColorButton : Gtk.ColorButton
{
- public ColorButton(Gdk.Color color)
- {
- this.color = color;
- }
-}
+ public ColorButton(Gdk.Color color)
+ {
+ this.color = color;
+ }
+}
View
28 src/colors.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -57,31 +57,31 @@ namespace Colors
{ 0, 0x0000, 0x2b2b, 0x3636 } // 15 S_base03
};
- public Gdk.Color[] active_palette()
+ public Gdk.Color[] active_palette()
{
if (Settings.daylight_palette)
return solarized_light_palette;
else
return solarized_dark_palette;
}
- public Gdk.Color active_background_color()
+ public Gdk.Color active_background_color()
{
if (Settings.daylight_palette)
return solarized_light_palette[8];
else
return solarized_dark_palette[8];
}
- public Gdk.Color active_foreground_color()
+ public Gdk.Color active_foreground_color()
{
if (Settings.daylight_palette)
return solarized_light_palette[12];
else
return solarized_dark_palette[12];
}
- public Gdk.Color active_highlight_background_color()
+ public Gdk.Color active_highlight_background_color()
{
Gdk.Color c;
if (Settings.daylight_palette)
@@ -91,15 +91,15 @@ namespace Colors
return c;
}
- public Gdk.Color parse(string color) throws GLib.ConvertError
- {
- Gdk.Color value;
+ public Gdk.Color parse(string color) throws GLib.ConvertError
+ {
+ Gdk.Color value;
- if(!Gdk.Color.parse(color, out value))
- {
- throw new GLib.ConvertError.FAILED("\"%s\" couldn't be parsed as color", color);
- }
+ if(!Gdk.Color.parse(color, out value))
+ {
+ throw new GLib.ConvertError.FAILED("\"%s\" couldn't be parsed as color", color);
+ }
- return value;
- }
+ return value;
+ }
}
View
248 src/config-file.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
public class ConfigFile : GLib.Object
{
- private GLib.KeyFile file = new GLib.KeyFile();
- private bool has_errors = false;
+ private GLib.KeyFile file = new GLib.KeyFile();
+ private bool has_errors = false;
public ConfigFile()
{
@@ -28,145 +28,145 @@ public class ConfigFile : GLib.Object
}
catch(GLib.Error error)
{
- if(!(error is GLib.KeyFileError.PARSE))
- {
- this.has_errors = true;
- // FIXME: Do something !
- }
+ if(!(error is GLib.KeyFileError.PARSE))
+ {
+ this.has_errors = true;
+ // FIXME: Do something !
+ }
}
}
- public string get_string_key(string group, string key, string default_value)
- {
- try
- {
- return this.file.get_string(group, key);
- }
- catch(GLib.KeyFileError error)
- {
+ public string get_string_key(string group, string key, string default_value)
+ {
+ try
+ {
+ return this.file.get_string(group, key);
+ }
+ catch(GLib.KeyFileError error)
+ {
#if DEBUG
- this.display_get_key_error(error.message);
+ this.display_get_key_error(error.message);
#endif
- }
-
- this.file.set_string(group, key, default_value);
- return default_value;
- }
-
- public int get_integer_key(string group, string key, int default_value)
- {
- try
- {
- return this.file.get_integer(group, key);
- }
- catch(GLib.KeyFileError error)
- {
+ }
+
+ this.file.set_string(group, key, default_value);
+ return default_value;
+ }
+
+ public int get_integer_key(string group, string key, int default_value)
+ {
+ try
+ {
+ return this.file.get_integer(group, key);
+ }
+ catch(GLib.KeyFileError error)
+ {
#if DEBUG
- this.display_get_key_error(error.message);
+ this.display_get_key_error(error.message);
#endif
- }
-
- this.file.set_integer(group, key, default_value);
- return default_value;
- }
-
- public bool get_boolean_key(string group, string key, bool default_value)
- {
- try
- {
- return this.file.get_boolean(group, key);
- }
- catch(GLib.KeyFileError error)
- {
+ }
+
+ this.file.set_integer(group, key, default_value);
+ return default_value;
+ }
+
+ public bool get_boolean_key(string group, string key, bool default_value)
+ {
+ try
+ {
+ return this.file.get_boolean(group, key);
+ }
+ catch(GLib.KeyFileError error)
+ {
#if DEBUG
- this.display_get_key_error(error.message);
+ this.display_get_key_error(error.message);
#endif
- }
-
- this.file.set_boolean(group, key, default_value);
- return default_value;
- }
-
- public Gdk.Color get_color_key(string group, string key, Gdk.Color default_value)
- {
- try
- {
- return Colors.parse(this.file.get_string(group, key));
- }
- catch(GLib.Error error)
- {
+ }
+
+ this.file.set_boolean(group, key, default_value);
+ return default_value;
+ }
+
+ public Gdk.Color get_color_key(string group, string key, Gdk.Color default_value)
+ {
+ try
+ {
+ return Colors.parse(this.file.get_string(group, key));
+ }
+ catch(GLib.Error error)
+ {
#if DEBUG
- this.display_get_key_error(error.message);
+ this.display_get_key_error(error.message);
#endif
- }
+ }
- this.file.set_string(group, key, default_value.to_string());
- return default_value;
- }
+ this.file.set_string(group, key, default_value.to_string());
+ return default_value;
+ }
public void write()
{
- if(!this.has_errors)
- {
- try
- {
- FileUtils.set_contents(this.filename(), this.file.to_data());
- }
- catch(GLib.FileError error)
- {
- // FIXME: Do something !
- }
- }
+ if(!this.has_errors)
+ {
+ try
+ {
+ FileUtils.set_contents(this.filename(), this.file.to_data());
+ }
+ catch(GLib.FileError error)
+ {
+ // FIXME: Do something !
+ }
}
+ }
+
+ public void set_string(string group_name, string key, string str)
+ {
+ this.file.set_string(group_name, key, str);
+ }
+
+ public void set_boolean(string group_name, string key, bool value)
+ {
+ this.file.set_boolean(group_name, key, value);
+ }
+
+ public void set_integer(string group_name, string key, int value)
+ {
+ this.file.set_integer(group_name, key, value);
+ }
- public void set_string(string group_name, string key, string str)
- {
- this.file.set_string(group_name, key, str);
- }
-
- public void set_boolean(string group_name, string key, bool value)
- {
- this.file.set_boolean(group_name, key, value);
- }
-
- public void set_integer(string group_name, string key, int value)
- {
- this.file.set_integer(group_name, key, value);
- }
-
- private string filename()
- {
- string path = GLib.Environment.get_user_config_dir() + "/fourterm/";
- this.verify_dir(path);
-
- string file = path + "config.ini";
- this.verify_file(file);
-
- return file;
- }
-
- private void verify_dir(string dir)
- {
- if(!FileUtils.test(dir, FileTest.EXISTS))
- {
- // Create the dir
- DirUtils.create(dir, 0700);
- }
- }
-
- private void verify_file(string file)
- {
- if(!FileUtils.test(file, FileTest.EXISTS))
- {
- // Create the file
- FileStream.open(file, "w");
- }
- }
+ private string filename()
+ {
+ string path = GLib.Environment.get_user_config_dir() + "/fourterm/";
+ this.verify_dir(path);
+
+ string file = path + "config.ini";
+ this.verify_file(file);
+
+ return file;
+ }
+
+ private void verify_dir(string dir)
+ {
+ if(!FileUtils.test(dir, FileTest.EXISTS))
+ {
+ // Create the dir
+ DirUtils.create(dir, 0700);
+ }
+ }
+
+ private void verify_file(string file)
+ {
+ if(!FileUtils.test(file, FileTest.EXISTS))
+ {
+ // Create the file
+ FileStream.open(file, "w");
+ }
+ }
#if DEBUG
- private void display_get_key_error(string message)
- {
- GLib.stderr.printf("Error: %s. Using the default value.\n", message);
- }
+ private void display_get_key_error(string message)
+ {
+ GLib.stderr.printf("Error: %s. Using the default value.\n", message);
+ }
#endif
}
View
62 src/context-menu.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,37 +17,37 @@
public class ContextMenu : Gtk.Menu
{
- private ImageMenuItem item_copy = new ImageMenuItem(Icons.COPY);
- private ImageMenuItem item_paste = new ImageMenuItem(Icons.PASTE);
- private CheckMenuItem item_display_menubar = new CheckMenuItem(tr("Menu Bar"), Settings.show_menubar);
- private ImageMenuItem item_new_window = new ImageMenuItem(Icons.NEW, tr("New Window"));
+ private ImageMenuItem item_copy = new ImageMenuItem(Icons.COPY);
+ private ImageMenuItem item_paste = new ImageMenuItem(Icons.PASTE);
+ private CheckMenuItem item_display_menubar = new CheckMenuItem(tr("Menu Bar"), Settings.show_menubar);
+ private ImageMenuItem item_new_window = new ImageMenuItem(Icons.NEW, tr("New Window"));
- public signal void copy();
- public signal void paste();
- public signal void display_menubar(bool show);
- public signal void new_window();
+ public signal void copy();
+ public signal void paste();
+ public signal void display_menubar(bool show);
+ public signal void new_window();
- public ContextMenu()
- {
- this.append(this.item_copy);
- this.append(this.item_paste);
- this.append(new Gtk.SeparatorMenuItem());
- this.append(this.item_display_menubar);
- this.append(new Gtk.SeparatorMenuItem());
- this.append(this.item_new_window);
+ public ContextMenu()
+ {
+ this.append(this.item_copy);
+ this.append(this.item_paste);
+ this.append(new Gtk.SeparatorMenuItem());
+ this.append(this.item_display_menubar);
+ this.append(new Gtk.SeparatorMenuItem());
+ this.append(this.item_new_window);
- this.active_signals();
- }
+ this.active_signals();
+ }
- private void active_signals()
- {
- this.item_copy.activate.connect(() => this.copy());
- this.item_paste.activate.connect(() => this.paste());
- this.item_display_menubar.activate.connect(() =>
- {
- Settings.show_menubar = this.item_display_menubar.active;
- this.display_menubar(this.item_display_menubar.active);
- });
- this.item_new_window.activate.connect(() => this.new_window());
- }
-}
+ private void active_signals()
+ {
+ this.item_copy.activate.connect(() => this.copy());
+ this.item_paste.activate.connect(() => this.paste());
+ this.item_display_menubar.activate.connect(() =>
+ {
+ Settings.show_menubar = this.item_display_menubar.active;
+ this.display_menubar(this.item_display_menubar.active);
+ });
+ this.item_new_window.activate.connect(() => this.new_window());
+ }
+}
View
32 src/default-dialog.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,21 +17,21 @@
public abstract class DefaultDialog : Gtk.Dialog
{
- public DefaultDialog()
- {
- this.add_buttons(Icons.OK, Gtk.ResponseType.OK,
- Icons.CANCEL, Gtk.ResponseType.CANCEL);
- }
+ public DefaultDialog()
+ {
+ this.add_buttons(Icons.OK, Gtk.ResponseType.OK,
+ Icons.CANCEL, Gtk.ResponseType.CANCEL);
+ }
- protected abstract void ok_clicked();
+ protected abstract void ok_clicked();
- protected override void response(int response_id)
- {
- if(response_id == Gtk.ResponseType.OK)
- {
- this.ok_clicked();
- }
+ protected override void response(int response_id)
+ {
+ if(response_id == Gtk.ResponseType.OK)
+ {
+ this.ok_clicked();
+ }
- this.destroy();
- }
-}
+ this.destroy();
+ }
+}
View
12 src/font-button.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
public class FontButton : Gtk.FontButton
{
- public FontButton(string font)
- {
- this.font_name = font;
- }
-}
+ public FontButton(string font)
+ {
+ this.font_name = font;
+ }
+}
View
18 src/grid-manager.vala
@@ -56,17 +56,17 @@ public class GridManager {
//GLib.stdout.printf("%d %d\n", row, col);
}
- public int index
- {
- get
- {
+ public int index
+ {
+ get
+ {
return indices[row, col];
- }
+ }
- set
- {
+ set
+ {
row = value / rows;
col = value % cols;
- }
- }
+ }
+ }
}
View
44 src/icons.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -18,26 +18,26 @@
namespace Icons
{
#if VALA_0_12
- const string ABOUT = Gtk.Stock.ABOUT;
- const string PREFERENCES = Gtk.Stock.PREFERENCES;
- const string CLEAR = Gtk.Stock.CLEAR;
- const string COPY = Gtk.Stock.COPY;
- const string PASTE = Gtk.Stock.PASTE;
- const string NEW = Gtk.Stock.NEW;
- const string QUIT = Gtk.Stock.QUIT;
- const string OK = Gtk.Stock.OK;
- const string CANCEL = Gtk.Stock.CANCEL;
- const string SELECT_ALL = Gtk.Stock.SELECT_ALL;
+ const string ABOUT = Gtk.Stock.ABOUT;
+ const string PREFERENCES = Gtk.Stock.PREFERENCES;
+ const string CLEAR = Gtk.Stock.CLEAR;
+ const string COPY = Gtk.Stock.COPY;
+ const string PASTE = Gtk.Stock.PASTE;
+ const string NEW = Gtk.Stock.NEW;
+ const string QUIT = Gtk.Stock.QUIT;
+ const string OK = Gtk.Stock.OK;
+ const string CANCEL = Gtk.Stock.CANCEL;
+ const string SELECT_ALL = Gtk.Stock.SELECT_ALL;
#else
- const string ABOUT = Gtk.STOCK_ABOUT;
- const string PREFERENCES = Gtk.STOCK_PREFERENCES;
- const string CLEAR = Gtk.STOCK_CLEAR;
- const string COPY = Gtk.STOCK_COPY;
- const string PASTE = Gtk.STOCK_PASTE;
- const string NEW = Gtk.STOCK_NEW;
- const string QUIT = Gtk.STOCK_QUIT;
- const string OK = Gtk.STOCK_OK;
- const string CANCEL = Gtk.STOCK_CANCEL;
- const string SELECT_ALL = Gtk.STOCK_SELECT_ALL;
+ const string ABOUT = Gtk.STOCK_ABOUT;
+ const string PREFERENCES = Gtk.STOCK_PREFERENCES;
+ const string CLEAR = Gtk.STOCK_CLEAR;
+ const string COPY = Gtk.STOCK_COPY;
+ const string PASTE = Gtk.STOCK_PASTE;
+ const string NEW = Gtk.STOCK_NEW;
+ const string QUIT = Gtk.STOCK_QUIT;
+ const string OK = Gtk.STOCK_OK;
+ const string CANCEL = Gtk.STOCK_CANCEL;
+ const string SELECT_ALL = Gtk.STOCK_SELECT_ALL;
#endif
-}
+}
View
22 src/image-menu-item.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,14 +17,14 @@
public class ImageMenuItem : Gtk.ImageMenuItem
{
- public ImageMenuItem(string image, string? label = null)
- {
- this.label = image;
- this.use_stock = true;
+ public ImageMenuItem(string image, string? label = null)
+ {
+ this.label = image;
+ this.use_stock = true;
- if(label != null)
- {
- this.label = (!)(label);
- }
- }
-}
+ if(label != null)
+ {
+ this.label = (!)(label);
+ }
+ }
+}
View
170 src/main-window.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,22 +17,22 @@
public class MainWindow : Gtk.Window
{
- private static uint window_count = 0;
+ private static uint window_count = 0;
- private Menubar menubar = new Menubar();
+ private Menubar menubar = new Menubar();
private GridManager gridManager;
private Gee.ArrayList<Terminal> terminals;
- private Gee.ArrayList<Gtk.ScrolledWindow> scrolled_windows;
+ private Gee.ArrayList<Gtk.ScrolledWindow> scrolled_windows;
delegate Gtk.Widget WidgetCreator();
- public MainWindow()
- {
- this.title = "FourTerm";
- this.icon = new Gdk.Pixbuf.from_xpm_data(Pictures.logo);
- this.window_count++;
+ public MainWindow()
+ {
+ this.title = "FourTerm";
+ this.icon = new Gdk.Pixbuf.from_xpm_data(Pictures.logo);
+ this.window_count++;
this.terminals = new Gee.ArrayList<Terminal>();
- this.scrolled_windows = new Gee.ArrayList<Gtk.ScrolledWindow>();
+ this.scrolled_windows = new Gee.ArrayList<Gtk.ScrolledWindow>();
int rows = Settings.rows;
int cols = Settings.columns;
@@ -41,14 +41,14 @@ public class MainWindow : Gtk.Window
for (int i = 0; i < size; i++) {
var term = new Terminal();
- var sw = new Gtk.ScrolledWindow(null, null);
+ var sw = new Gtk.ScrolledWindow(null, null);
terminals.add(term);
scrolled_windows.add(sw);
- sw.add(term);
+ sw.add(term);
sw.set_size_request(10, 10);
}
- this.show_scrollbar(Settings.show_scrollbar);
+ this.show_scrollbar(Settings.show_scrollbar);
// create panes (minimum is 2x2)
int scrolled_window_create = 0;
@@ -57,12 +57,12 @@ public class MainWindow : Gtk.Window
return create_paned(typeof(Gtk.HPaned), cols,
() => scrolled_windows[scrolled_window_create++]);
});
- var main_box = new Gtk.VBox(false, 0);
- main_box.pack_start(this.menubar, false);
- main_box.pack_start(rows_pane);
- this.active_signals();
- this.add(main_box);
- }
+ var main_box = new Gtk.VBox(false, 0);
+ main_box.pack_start(this.menubar, false);
+ main_box.pack_start(rows_pane);
+ this.active_signals();
+ this.add(main_box);
+ }
// TODO share this on my blog or something :-)
private Gtk.Paned create_paned(Type pane_type, int left, WidgetCreator creator) {
@@ -78,42 +78,42 @@ public class MainWindow : Gtk.Window
}
}
- public void display(string shell_cwd = GLib.Environment.get_home_dir())
- {
- this.show_all();
+ public void display(string shell_cwd = GLib.Environment.get_home_dir())
+ {
+ this.show_all();
- this.resize(this.terminals[gridManager.index].calcul_width(80) * 2,
- this.terminals[gridManager.index].calcul_height(24) * 2);
+ this.resize(this.terminals[gridManager.index].calcul_width(80) * 2,
+ this.terminals[gridManager.index].calcul_height(24) * 2);
- // Do that after resize because Vte add rows if the main window is too small...
+ // Do that after resize because Vte add rows if the main window is too small...
foreach (Terminal t in terminals) {
- t.active_shell(shell_cwd);
+ t.active_shell(shell_cwd);
}
- }
-
- private void active_signals()
- {
- this.menubar.about.connect(() => About.display(this));
- this.menubar.preferences.connect(() =>
- {
- var dialog = new ParametersWindow(this);
+ }
+
+ private void active_signals()
+ {
+ this.menubar.about.connect(() => About.display(this));
+ this.menubar.preferences.connect(() =>
+ {
+ var dialog = new ParametersWindow(this);
foreach (Terminal t in terminals) {
dialog.font_changed.connect(t.set_font_from_string);
dialog.scrollback_lines_changed.connect(t.set_scrollback_lines);
dialog.transparency_changed.connect(t.set_background_transparent);
}
- dialog.show_scrollbar_changed.connect(this.show_scrollbar);
- dialog.show_all();
- });
- this.menubar.clear.connect(() => this.terminals[gridManager.index].reset(true, true));
- this.menubar.copy.connect(() => this.terminals[gridManager.index].copy_clipboard());
- this.menubar.paste.connect(() => this.terminals[gridManager.index].paste_clipboard());
- this.menubar.select_all.connect(() => this.terminals[gridManager.index].select_all());
- this.menubar.new_window.connect(this.new_window);
- this.menubar.quit.connect(this.exit);
-
- this.delete_event.connect(this.on_delete);
- this.destroy.connect(this.on_destroy);
+ dialog.show_scrollbar_changed.connect(this.show_scrollbar);
+ dialog.show_all();
+ });
+ this.menubar.clear.connect(() => this.terminals[gridManager.index].reset(true, true));
+ this.menubar.copy.connect(() => this.terminals[gridManager.index].copy_clipboard());
+ this.menubar.paste.connect(() => this.terminals[gridManager.index].paste_clipboard());
+ this.menubar.select_all.connect(() => this.terminals[gridManager.index].select_all());
+ this.menubar.new_window.connect(this.new_window);
+ this.menubar.quit.connect(this.exit);
+
+ this.delete_event.connect(this.on_delete);
+ this.destroy.connect(this.on_destroy);
foreach (Terminal t in terminals) {
t.child_exited.connect(() => t.active_shell(GLib.Environment.get_home_dir()));
@@ -162,7 +162,7 @@ public class MainWindow : Gtk.Window
return false;
});
- t.title_changed.connect((term, title) => {
+ t.title_changed.connect((term, title) => {
if (term == this.terminals[gridManager.index] && title != null)
this.set_title(title);
});
@@ -176,34 +176,34 @@ public class MainWindow : Gtk.Window
});
}
- //this.terminals[gridManager.index].title_changed.connect(this.set_title);
- this.terminals[gridManager.index].new_window.connect(this.new_window);
- this.terminals[gridManager.index].display_menubar.connect(this.menubar.set_visible);
- }
-
- private void on_destroy()
- {
- if(this.window_count < 2)
- {
- Gtk.main_quit();
- }
- else
- {
- this.window_count--;
- }
- }
-
- private void exit()
- {
- if(this.on_delete() == false)
- {
- this.destroy();
- }
- }
-
- private bool on_delete()
- {
- bool return_value = false;
+ //this.terminals[gridManager.index].title_changed.connect(this.set_title);
+ this.terminals[gridManager.index].new_window.connect(this.new_window);
+ this.terminals[gridManager.index].display_menubar.connect(this.menubar.set_visible);
+ }
+
+ private void on_destroy()
+ {
+ if(this.window_count < 2)
+ {
+ Gtk.main_quit();
+ }
+ else
+ {
+ this.window_count--;
+ }
+ }
+
+ private void exit()
+ {
+ if(this.on_delete() == false)
+ {
+ this.destroy();
+ }
+ }
+
+ private bool on_delete()
+ {
+ bool return_value = false;
foreach (Terminal t in terminals) {
if(t.has_foreground_process())
@@ -220,22 +220,22 @@ public class MainWindow : Gtk.Window
}
}
- return return_value;
- }
+ return return_value;
+ }
- private void new_window()
- {
- var window = new MainWindow();
- window.display(this.terminals[gridManager.index].get_shell_cwd());
- }
+ private void new_window()
+ {
+ var window = new MainWindow();
+ window.display(this.terminals[gridManager.index].get_shell_cwd());
+ }
- private void show_scrollbar(bool show)
- {
+ private void show_scrollbar(bool show)
+ {
foreach (Gtk.ScrolledWindow sw in scrolled_windows) {
if(show == true)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
else
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
}
- }
+ }
}
View
26 src/main.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,28 +17,28 @@
void main(string[] args)
{
- Gtk.init(ref args);
+ Gtk.init(ref args);
- var file = new ConfigFile();
- Settings.init(file);
+ var file = new ConfigFile();
+ Settings.init(file);
#if ENABLE_NLS
- GLib.Intl.setlocale(GLib.LocaleCategory.ALL, "");
- GLib.Intl.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALE_DIR);
- GLib.Intl.textdomain(Config.GETTEXT_PACKAGE);
+ GLib.Intl.setlocale(GLib.LocaleCategory.ALL, "");
+ GLib.Intl.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALE_DIR);
+ GLib.Intl.textdomain(Config.GETTEXT_PACKAGE);
#endif
- var window = new MainWindow();
- window.display();
+ var window = new MainWindow();
+ window.display();
- Gtk.main();
+ Gtk.main();
}
public unowned string tr(string str)
{
#if ENABLE_NLS
- return GLib._(str);
+ return GLib._(str);
#else
- return str;
+ return str;
#endif
-}
+}
View
118 src/menu-bar.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,70 +17,70 @@
public class Menubar : Gtk.MenuBar
{
- private ImageMenuItem item_about = new ImageMenuItem(Icons.ABOUT);
- private ImageMenuItem item_preferences = new ImageMenuItem(Icons.PREFERENCES);
- private ImageMenuItem item_clear = new ImageMenuItem(Icons.CLEAR);
- private ImageMenuItem item_copy = new ImageMenuItem(Icons.COPY);
- private ImageMenuItem item_paste = new ImageMenuItem(Icons.PASTE);
- private ImageMenuItem item_select_all = new ImageMenuItem(Icons.SELECT_ALL);
- private ImageMenuItem item_new_window = new ImageMenuItem(Icons.NEW, tr("New Window"));
- private ImageMenuItem item_quit = new ImageMenuItem(Icons.QUIT);
+ private ImageMenuItem item_about = new ImageMenuItem(Icons.ABOUT);
+ private ImageMenuItem item_preferences = new ImageMenuItem(Icons.PREFERENCES);
+ private ImageMenuItem item_clear = new ImageMenuItem(Icons.CLEAR);
+ private ImageMenuItem item_copy = new ImageMenuItem(Icons.COPY);
+ private ImageMenuItem item_paste = new ImageMenuItem(Icons.PASTE);
+ private ImageMenuItem item_select_all = new ImageMenuItem(Icons.SELECT_ALL);
+ private ImageMenuItem item_new_window = new ImageMenuItem(Icons.NEW, tr("New Window"));
+ private ImageMenuItem item_quit = new ImageMenuItem(Icons.QUIT);
- public signal void about();
- public signal void preferences();
- public signal void clear();
- public signal void copy();
- public signal void paste();
- public signal void select_all();
- public signal void new_window();
- public signal void quit();
+ public signal void about();
+ public signal void preferences();
+ public signal void clear();
+ public signal void copy();
+ public signal void paste();
+ public signal void select_all();
+ public signal void new_window();
+ public signal void quit();
- public Menubar()
- {
- var menu_file = new MenuItem(tr("File"), {
- this.item_new_window,
- new Gtk.SeparatorMenuItem(),
- this.item_quit});
+ public Menubar()
+ {
+ var menu_file = new MenuItem(tr("File"), {
+ this.item_new_window,
+ new Gtk.SeparatorMenuItem(),
+ this.item_quit});
- var menu_edit = new MenuItem(tr("Edit"), {
- this.item_copy,
- this.item_paste,
- new Gtk.SeparatorMenuItem(),
- this.item_select_all,
- new Gtk.SeparatorMenuItem(),
- this.item_preferences});
+ var menu_edit = new MenuItem(tr("Edit"), {
+ this.item_copy,
+ this.item_paste,
+ new Gtk.SeparatorMenuItem(),
+ this.item_select_all,
+ new Gtk.SeparatorMenuItem(),
+ this.item_preferences});
- var menu_tools = new MenuItem(tr("Tools"), {
- this.item_clear});
+ var menu_tools = new MenuItem(tr("Tools"), {
+ this.item_clear});
- var menu_help = new MenuItem(tr("Help"), {
- this.item_about});
+ var menu_help = new MenuItem(tr("Help"), {
+ this.item_about});
- this.append(menu_file);
- this.append(menu_edit);
- this.append(menu_tools);
- this.append(menu_help);
+ this.append(menu_file);
+ this.append(menu_edit);
+ this.append(menu_tools);
+ this.append(menu_help);
- this.active_signals();
- }
+ this.active_signals();
+ }
- public override void show()
- {
- if(Settings.show_menubar)
- {
- base.show();
- }
- }
+ public override void show()
+ {
+ if(Settings.show_menubar)
+ {
+ base.show();
+ }
+ }
- private void active_signals()
- {
- this.item_about.activate.connect(() => this.about());
- this.item_preferences.activate.connect(() => this.preferences());
- this.item_clear.activate.connect(() => this.clear());
- this.item_copy.activate.connect(() => this.copy());
- this.item_paste.activate.connect(() => this.paste());
- this.item_select_all.activate.connect(() => this.select_all());
- this.item_new_window.activate.connect(() => this.new_window());
- this.item_quit.activate.connect(() => this.quit());
- }
-}
+ private void active_signals()
+ {
+ this.item_about.activate.connect(() => this.about());
+ this.item_preferences.activate.connect(() => this.preferences());
+ this.item_clear.activate.connect(() => this.clear());
+ this.item_copy.activate.connect(() => this.copy());
+ this.item_paste.activate.connect(() => this.paste());
+ this.item_select_all.activate.connect(() => this.select_all());
+ this.item_new_window.activate.connect(() => this.new_window());
+ this.item_quit.activate.connect(() => this.quit());
+ }
+}
View
24 src/menu-item.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,16 +17,16 @@
public class MenuItem : Gtk.MenuItem
{
- public MenuItem(string label, Gtk.MenuItem[] items)
- {
- this.label = label;
+ public MenuItem(string label, Gtk.MenuItem[] items)
+ {
+ this.label = label;
- var submenu = new Gtk.Menu();
- this.set_submenu(submenu);
+ var submenu = new Gtk.Menu();
+ this.set_submenu(submenu);
- foreach(Gtk.MenuItem item in items)
- {
- submenu.append(item);
- }
- }
-}
+ foreach(Gtk.MenuItem item in items)
+ {
+ submenu.append(item);
+ }
+ }
+}
View
24 src/message-dialog.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,15 +17,15 @@
public class MessageDialog : Gtk.MessageDialog
{
- public MessageDialog(MainWindow parent, string message, string secondary_text)
- {
- Object(buttons: Gtk.ButtonsType.OK_CANCEL);
+ public MessageDialog(MainWindow parent, string message, string secondary_text)
+ {
+ Object(buttons: Gtk.ButtonsType.OK_CANCEL);
- this.transient_for = parent;
- this.text = message;
- this.secondary_text = secondary_text;
- this.title = secondary_text;
- this.modal = true;
- this.message_type = Gtk.MessageType.WARNING;
- }
-}
+ this.transient_for = parent;
+ this.text = message;
+ this.secondary_text = secondary_text;
+ this.title = secondary_text;
+ this.modal = true;
+ this.message_type = Gtk.MessageType.WARNING;
+ }
+}
View
18 src/parameter-box.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,12 +17,12 @@
public class ParameterBox : Gtk.HBox
{
- public ParameterBox(string label, Gtk.Widget chooser_widget)
- {
- this.homogeneous = true;
- this.spacing = 10;
+ public ParameterBox(string label, Gtk.Widget chooser_widget)
+ {
+ this.homogeneous = true;
+ this.spacing = 10;
- this.pack_start(new Gtk.Label(label));
- this.pack_start(chooser_widget);
- }
-}
+ this.pack_start(new Gtk.Label(label));
+ this.pack_start(chooser_widget);
+ }
+}
View
164 src/parameters-window.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,100 +17,100 @@
public class ParametersWindow : DefaultDialog
{
- private FontButton font_chooser = new FontButton(Settings.font);
- private SpinButton scrollback_lines_chooser = new SpinButton(Settings.scrollback_lines);
- private CheckButton transparency_chooser = new CheckButton(Settings.transparency);
- private CheckButton show_scrollbar_chooser = new CheckButton(Settings.show_scrollbar);
- private SpinButton rows_chooser = new SpinButton(Settings.rows);
- private SpinButton columns_chooser = new SpinButton(Settings.columns);
-
- public signal void font_changed(string font);
- public signal void scrollback_lines_changed(long lines);
- public signal void transparency_changed(bool tranparency);
- public signal void show_scrollbar_changed(bool show);
- public signal void rows_changed(int lines);
- public signal void columns_changed(int lines);
-
- public ParametersWindow(MainWindow parent_window)
- {
- this.title = tr("ValaTerm Preferences");
- this.transient_for = parent_window;
-
- var rows_box = new ParameterBox(tr("Rows:"),
- this.rows_chooser);
-
- var columns_box = new ParameterBox(tr("Columns:"),
- this.columns_chooser);
-
- var font_box = new ParameterBox(tr("Font:"), this.font_chooser);
-
- var scrollback_lines_box = new ParameterBox(tr("Scrollback lines:"),
- this.scrollback_lines_chooser);
-
- var transparency_box = new ParameterBox(tr("Transparency:"),
- this.transparency_chooser);
-
- var show_scrollbar_box = new ParameterBox(tr("Show scrollbar:"),
- this.show_scrollbar_chooser);
-
- var main_box = (Gtk.Box)(this.get_content_area());
- main_box.pack_start(rows_box);
- main_box.pack_start(columns_box);
- main_box.pack_start(font_box);
- main_box.pack_start(scrollback_lines_box);
- main_box.pack_start(transparency_box);
- main_box.pack_start(show_scrollbar_box);
+ private FontButton font_chooser = new FontButton(Settings.font);
+ private SpinButton scrollback_lines_chooser = new SpinButton(Settings.scrollback_lines);
+ private CheckButton transparency_chooser = new CheckButton(Settings.transparency);
+ private CheckButton show_scrollbar_chooser = new CheckButton(Settings.show_scrollbar);
+ private SpinButton rows_chooser = new SpinButton(Settings.rows);
+ private SpinButton columns_chooser = new SpinButton(Settings.columns);
+
+ public signal void font_changed(string font);
+ public signal void scrollback_lines_changed(long lines);
+ public signal void transparency_changed(bool tranparency);
+ public signal void show_scrollbar_changed(bool show);
+ public signal void rows_changed(int lines);
+ public signal void columns_changed(int lines);
+
+ public ParametersWindow(MainWindow parent_window)
+ {
+ this.title = tr("ValaTerm Preferences");
+ this.transient_for = parent_window;
+
+ var rows_box = new ParameterBox(tr("Rows:"),
+ this.rows_chooser);
+
+ var columns_box = new ParameterBox(tr("Columns:"),
+ this.columns_chooser);
+
+ var font_box = new ParameterBox(tr("Font:"), this.font_chooser);
+
+ var scrollback_lines_box = new ParameterBox(tr("Scrollback lines:"),
+ this.scrollback_lines_chooser);
+
+ var transparency_box = new ParameterBox(tr("Transparency:"),
+ this.transparency_chooser);
+
+ var show_scrollbar_box = new ParameterBox(tr("Show scrollbar:"),
+ this.show_scrollbar_chooser);
+
+ var main_box = (Gtk.Box)(this.get_content_area());
+ main_box.pack_start(rows_box);
+ main_box.pack_start(columns_box);
+ main_box.pack_start(font_box);
+ main_box.pack_start(scrollback_lines_box);
+ main_box.pack_start(transparency_box);
+ main_box.pack_start(show_scrollbar_box);
rows_chooser.set_range(2, 99);
columns_chooser.set_range(2, 99);
- }
+ }
- protected override void ok_clicked()
- {
+ protected override void ok_clicked()
+ {
bool restart = false;
- if(Settings.rows != this.rows_chooser.get_value_as_int())
- {
- Settings.rows = this.rows_chooser.get_value_as_int();
- this.rows_changed(this.rows_chooser.get_value_as_int());
+ if(Settings.rows != this.rows_chooser.get_value_as_int())
+ {
+ Settings.rows = this.rows_chooser.get_value_as_int();
+ this.rows_changed(this.rows_chooser.get_value_as_int());
restart = true;
- }
+ }
- if(Settings.columns != this.columns_chooser.get_value_as_int())
- {
- Settings.columns = this.columns_chooser.get_value_as_int();
- this.columns_changed(this.columns_chooser.get_value_as_int());
+ if(Settings.columns != this.columns_chooser.get_value_as_int())
+ {
+ Settings.columns = this.columns_chooser.get_value_as_int();
+ this.columns_changed(this.columns_chooser.get_value_as_int());
restart = true;
- }
-
- if(Settings.font != this.font_chooser.font_name)
- {
- Settings.font = this.font_chooser.font_name;
- this.font_changed(this.font_chooser.font_name);
- }
-
- if(Settings.scrollback_lines != this.scrollback_lines_chooser.get_value_as_int())
- {
- Settings.scrollback_lines = this.scrollback_lines_chooser.get_value_as_int();
- this.scrollback_lines_changed(this.scrollback_lines_chooser.get_value_as_int());
- }
-
- if(Settings.transparency != this.transparency_chooser.active)
- {
- Settings.transparency = this.transparency_chooser.active;
- this.transparency_changed(this.transparency_chooser.active);
- }
-
- if(Settings.show_scrollbar != this.show_scrollbar_chooser.active)
- {
- Settings.show_scrollbar = this.show_scrollbar_chooser.active;
- this.show_scrollbar_changed(this.show_scrollbar_chooser.active);
- }
+ }
+
+ if(Settings.font != this.font_chooser.font_name)
+ {
+ Settings.font = this.font_chooser.font_name;
+ this.font_changed(this.font_chooser.font_name);
+ }
+
+ if(Settings.scrollback_lines != this.scrollback_lines_chooser.get_value_as_int())
+ {
+ Settings.scrollback_lines = this.scrollback_lines_chooser.get_value_as_int();
+ this.scrollback_lines_changed(this.scrollback_lines_chooser.get_value_as_int());
+ }
+
+ if(Settings.transparency != this.transparency_chooser.active)
+ {
+ Settings.transparency = this.transparency_chooser.active;
+ this.transparency_changed(this.transparency_chooser.active);
+ }
+
+ if(Settings.show_scrollbar != this.show_scrollbar_chooser.active)
+ {
+ Settings.show_scrollbar = this.show_scrollbar_chooser.active;
+ this.show_scrollbar_changed(this.show_scrollbar_chooser.active);
+ }
if (restart) {
var dialog = new Gtk.MessageDialog(this, Gtk.DialogFlags.MODAL, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, tr("Please restart application"));
dialog.set_title(tr("Restart needed"));
dialog.run();
dialog.destroy();
}
- }
+ }
}
View
3,158 src/pictures.vala
1,579 additions, 1,579 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
268 src/settings.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,141 +17,141 @@
public class Settings : GLib.Object
{
- /* Groups */
- private const string TERMINAL = "Terminal";
- private const string MENUBAR = "MenuBar";
-
- /* Keys */
- private const string FONT = "Font";
- private const string SCROLLBACK_LINES = "Scrollback-Lines";
- private const string TRANSPARENCY = "Transparency";
- private const string DAYLIGHT_PALETTE = "Daylight-Palette";
- private const string SHOW = "Show";
- private const string SHOW_SCROLLBAR = "Show-Scrollbar";
- private const string ROWS = "Rows";
- private const string COLUMNS = "Columns";
-
- private static unowned ConfigFile file;
-
- public static void init(ConfigFile file)
- {
- Settings.file = file;
- }
-
- public static string font
- {
- // FIXME: Why owned (only) here ???
- owned get
- {
- return file.get_string_key(TERMINAL, FONT, "Terminus 10");
- }
-
- set
- {
- file.set_string(TERMINAL, FONT, value);
- file.write();
- }
- }
-
- public static int scrollback_lines
- {
- get
- {
- return file.get_integer_key(TERMINAL, SCROLLBACK_LINES, 500);
- }
-
- set
- {
- file.set_integer(TERMINAL, SCROLLBACK_LINES, value);
- file.write();
- }
- }
-
- public static bool daylight_palette
- {
- get
- {
- return file.get_boolean_key(TERMINAL, DAYLIGHT_PALETTE, false);
- }
-
- set
- {
- file.set_boolean(TERMINAL, DAYLIGHT_PALETTE, value);
- file.write();
- }
- }
-
- public static bool transparency
- {
- get
- {
- return file.get_boolean_key(TERMINAL, TRANSPARENCY, false);
- }
-
- set
- {
- file.set_boolean(TERMINAL, TRANSPARENCY, value);
- file.write();
- }
- }
-
- public static bool show_menubar
- {
- get
- {
- return file.get_boolean_key(MENUBAR, SHOW, true);
- }
-
- set
- {
- file.set_boolean(MENUBAR, SHOW, value);
- file.write();
- }
- }
-
- public static bool show_scrollbar
- {
- get
- {
- return file.get_boolean_key(TERMINAL, SHOW_SCROLLBAR, true);
- }
-
- set
- {
- file.set_boolean(TERMINAL, SHOW_SCROLLBAR, value);
- file.write();
- }
- }
-
- public static int rows
- {
- get
- {
- int v = file.get_integer_key(TERMINAL, ROWS, 2);
+ /* Groups */
+ private const string TERMINAL = "Terminal";
+ private const string MENUBAR = "MenuBar";
+
+ /* Keys */
+ private const string FONT = "Font";
+ private const string SCROLLBACK_LINES = "Scrollback-Lines";
+ private const string TRANSPARENCY = "Transparency";
+ private const string DAYLIGHT_PALETTE = "Daylight-Palette";
+ private const string SHOW = "Show";
+ private const string SHOW_SCROLLBAR = "Show-Scrollbar";
+ private const string ROWS = "Rows";
+ private const string COLUMNS = "Columns";
+
+ private static unowned ConfigFile file;
+
+ public static void init(ConfigFile file)
+ {
+ Settings.file = file;
+ }
+
+ public static string font
+ {
+ // FIXME: Why owned (only) here ???
+ owned get
+ {
+ return file.get_string_key(TERMINAL, FONT, "Terminus 10");
+ }
+
+ set
+ {
+ file.set_string(TERMINAL, FONT, value);
+ file.write();
+ }
+ }
+
+ public static int scrollback_lines
+ {
+ get
+ {
+ return file.get_integer_key(TERMINAL, SCROLLBACK_LINES, 500);
+ }
+
+ set
+ {
+ file.set_integer(TERMINAL, SCROLLBACK_LINES, value);
+ file.write();
+ }
+ }
+
+ public static bool daylight_palette
+ {
+ get
+ {
+ return file.get_boolean_key(TERMINAL, DAYLIGHT_PALETTE, false);
+ }
+
+ set
+ {
+ file.set_boolean(TERMINAL, DAYLIGHT_PALETTE, value);
+ file.write();
+ }
+ }
+
+ public static bool transparency
+ {
+ get
+ {
+ return file.get_boolean_key(TERMINAL, TRANSPARENCY, false);
+ }
+
+ set
+ {
+ file.set_boolean(TERMINAL, TRANSPARENCY, value);
+ file.write();
+ }
+ }
+
+ public static bool show_menubar
+ {
+ get
+ {
+ return file.get_boolean_key(MENUBAR, SHOW, true);
+ }
+
+ set
+ {
+ file.set_boolean(MENUBAR, SHOW, value);
+ file.write();
+ }
+ }
+
+ public static bool show_scrollbar
+ {
+ get
+ {
+ return file.get_boolean_key(TERMINAL, SHOW_SCROLLBAR, true);
+ }
+
+ set
+ {
+ file.set_boolean(TERMINAL, SHOW_SCROLLBAR, value);
+ file.write();
+ }
+ }
+
+ public static int rows
+ {
+ get
+ {
+ int v = file.get_integer_key(TERMINAL, ROWS, 2);
if (v < 2) v = 2;
return v;
- }
-
- set
- {
- file.set_integer(TERMINAL, ROWS, value);
- file.write();
- }
- }
-
- public static int columns
- {
- get
- {
- int v = file.get_integer_key(TERMINAL, COLUMNS, 2);
+ }
+
+ set
+ {
+ file.set_integer(TERMINAL, ROWS, value);
+ file.write();
+ }
+ }
+
+ public static int columns
+ {
+ get
+ {
+ int v = file.get_integer_key(TERMINAL, COLUMNS, 2);
if (v < 2) v = 2;
return v;
- }
-
- set
- {
- file.set_integer(TERMINAL, COLUMNS, value);
- file.write();
- }
- }
+ }
+
+ set
+ {
+ file.set_integer(TERMINAL, COLUMNS, value);
+ file.write();
+ }
+ }
}
View
16 src/spin-button.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,10 +17,10 @@
public class SpinButton : Gtk.SpinButton
{
- public SpinButton(double value)
- {
- this.set_range(-1, 10000);
- this.set_increments(1, 1);
- this.value = value;
- }
-}
+ public SpinButton(double value)
+ {
+ this.set_range(-1, 10000);
+ this.set_increments(1, 1);
+ this.value = value;
+ }
+}
View
170 src/terminal.vala
@@ -1,5 +1,5 @@
/****************************
-** Copyright © 2011 Jacques-Pascal Deplaix
+** Copyright © 2011 Jacques-Pascal Deplaix, Lukas Zapletal
**
** ValaTerm is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,26 +17,26 @@
public class Terminal : Vte.Terminal
{
- private ContextMenu context_menu = new ContextMenu();
- private GLib.Pid? child_pid = null;
+ private ContextMenu context_menu = new ContextMenu();
+ private GLib.Pid? child_pid = null;
#if VTE_SUP_0_26 && VALAC_SUP_0_12_1
- private unowned string shell = Terminal.get_shell();
+ private unowned string shell = Terminal.get_shell();
#endif
- public signal void title_changed(string title);
- public signal void new_window();
- public signal void display_menubar(bool show);
+ public signal void title_changed(string title);
+ public signal void new_window();
+ public signal void display_menubar(bool show);
- public Terminal()
- {
+ public Terminal()
+ {
this.scroll_on_keystroke = true;
this.background_transparent = Settings.transparency;
- this.scrollback_lines = Settings.scrollback_lines;
- this.set_font_from_string(Settings.font);
+ this.scrollback_lines = Settings.scrollback_lines;
+ this.set_font_from_string(Settings.font);
this.setup_colors();
- this.active_signals();
- }
+ this.active_signals();
+ }
public void setup_colors()
{
@@ -45,15 +45,15 @@ public class Terminal : Vte.Terminal
Colors.active_palette());
}
- private void active_signals()
- {
- this.button_press_event.connect(this.display_menu);
- this.window_title_changed.connect(() => this.title_changed(this.window_title));
+ private void active_signals()
+ {
+ this.button_press_event.connect(this.display_menu);
+ this.window_title_changed.connect(() => this.title_changed(this.window_title));
- this.context_menu.copy.connect(() => this.copy_clipboard());
- this.context_menu.paste.connect(() => this.paste_clipboard());
- this.context_menu.new_window.connect(() => this.new_window());
- this.context_menu.display_menubar.connect((a) => this.display_menubar(a));
+ this.context_menu.copy.connect(() => this.copy_clipboard());
+ this.context_menu.paste.connect(() => this.paste_clipboard());
+ this.context_menu.new_window.connect(() => this.new_window());
+ this.context_menu.display_menubar.connect((a) => this.display_menubar(a));
this.focus_in_event.connect((event) => {
this.set_color_background(Colors.active_highlight_background_color());
return false;
@@ -64,90 +64,90 @@ public class Terminal : Vte.Terminal
});
}
- public void active_shell(string dir)
- {
+ public void active_shell(string dir)
+ {
// This part can only be compiled by valac >= 0.12.1 (see commit: c677)
#if VTE_SUP_0_26 && VALAC_SUP_0_12_1
- try
- {
- string[] args = {};
-
- GLib.Shell.parse_argv(this.shell, out args);
- this.fork_command_full(Vte.PtyFlags.DEFAULT, dir, args, null, GLib.SpawnFlags.SEARCH_PATH, null, out this.child_pid);
- }
- catch(GLib.Error error)
- {
- // Do something !
- }
+ try
+ {
+ string[] args = {};
+
+ GLib.Shell.parse_argv(this.shell, out args);
+ this.fork_command_full(Vte.PtyFlags.DEFAULT, dir, args, null, GLib.SpawnFlags.SEARCH_PATH, null, out this.child_pid);
+ }
+ catch(GLib.Error error)
+ {
+ // Do something !
+ }
#else
- this.child_pid = this.fork_command(null, null, null, dir, true, true, true);
+ this.child_pid = this.fork_command(null, null, null, dir, true, true, true);
#endif
- }
+ }
- public int calcul_width(int column_count)
- {
- return (int)(this.get_char_width()) * column_count;
- }
+ public int calcul_width(int column_count)
+ {
+ return (int)(this.get_char_width()) * column_count;
+ }
- public int calcul_height(int row_count)
- {
- return (int)(this.get_char_height()) * row_count;
- }
+ public int calcul_height(int row_count)
+ {
+ return (int)(this.get_char_height()) * row_count;
+ }
- private bool display_menu(Gdk.EventButton event)
- {
- if(event.button == 3) // 3 is the right button
- {
- this.context_menu.show_all();
- context_menu.popup(null, null, null, event.button, event.time);
+ private bool display_menu(Gdk.EventButton event)
+ {
+ if(event.button == 3) // 3 is the right button
+ {
+ this.context_menu.show_all();
+ context_menu.popup(null, null, null, event.button, event.time);
- return true;
- }
+ return true;
+ }
- return false;
- }
+ return false;
+ }
- public bool has_foreground_process()
- {
+ public bool has_foreground_process()
+ {
#if GTK3
- int pty = this.pty_object.fd;
+ int pty = this.pty_object.fd;
#else
- int pty = this.pty;
+ int pty = this.pty;
#endif
- int fgpid = Posix.tcgetpgrp(pty);
- return fgpid != this.child_pid && fgpid != -1;
- }
+ int fgpid = Posix.tcgetpgrp(pty);
+ return fgpid != this.child_pid && fgpid != -1;
+ }
#if VTE_SUP_0_26 && VALAC_SUP_0_12_1
- private static unowned string get_shell()
- {
- unowned string? shell = GLib.Environment.get_variable("SHELL");
+ private static unowned string get_shell()
+ {
+ unowned string? shell = GLib.Environment.get_variable("SHELL");
- if(shell == null)
- {
- shell = "/bin/sh";
- }
+ if(shell == null)
+ {
+ shell = "/bin/sh";
+ }
- return (!)(shell);
- }
+ return (!)(shell);
+ }
#endif
- //FIXME: Is it portable ?
- public string? get_shell_cwd()
- {
- int pid = (!)(this.child_pid);
-
- try
- {
- return GLib.FileUtils.read_link("/proc/%d/cwd".printf(pid));
- }
- catch(GLib.FileError error)
- {
+ //FIXME: Is it portable ?
+ public string? get_shell_cwd()
+ {
+ int pid = (!)(this.child_pid);
+
+ try
+ {
+ return GLib.FileUtils.read_link("/proc/%d/cwd".printf(pid));
+ }
+ catch(GLib.FileError error)
+ {
#if DEBUG
- GLib.stderr.printf("Error: %s.\n", error.message);
+ GLib.stderr.printf("Error: %s.\n", error.message);
#endif
- }
+ }
- return null;
- }
+ return null;
+ }
}

0 comments on commit d848ee3

Please sign in to comment.