[latexila] Avoid using "var"
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Avoid using "var"
- Date: Mon, 13 Jun 2011 01:17:30 +0000 (UTC)
commit 9cdc0f9dd059a378c65262bb6ebcac69e4b78f24
Author: Sébastien Wilmet <swilmet src gnome org>
Date: Sun Jun 12 22:49:07 2011 +0200
Avoid using "var"
src/app_settings.vala | 39 ++++++++++++------------
src/application.vala | 18 +++++-----
src/build_tool_dialog.vala | 8 ++--
src/build_view.vala | 2 +-
src/dialogs.vala | 57 ++++++++++++++++++-----------------
src/document.vala | 69 ++++++++++++++++++++++--------------------
src/documents_panel.vala | 6 ++--
src/file_browser.vala | 2 +-
src/latex_menu.vala | 18 +++++-----
src/main.vala | 23 ++++++++------
src/main_window.vala | 24 +++++++-------
src/preferences_dialog.vala | 12 ++++----
src/symbols.vala | 12 ++++----
src/tab_info_bar.vala | 14 ++++----
src/templates.vala | 8 ++--
src/utils.vala | 13 ++++----
16 files changed, 167 insertions(+), 158 deletions(-)
---
diff --git a/src/app_settings.vala b/src/app_settings.vala
index b9eea61..ead4af3 100644
--- a/src/app_settings.vala
+++ b/src/app_settings.vala
@@ -64,8 +64,8 @@ public class AppSettings : GLib.Settings
editor.changed["use-default-font"].connect ((setting, key) =>
{
- var val = setting.get_boolean (key);
- var font = val ? system_font : editor.get_string ("editor-font");
+ bool val = setting.get_boolean (key);
+ string font = val ? system_font : editor.get_string ("editor-font");
set_font (font);
});
@@ -78,12 +78,13 @@ public class AppSettings : GLib.Settings
editor.changed["scheme"].connect ((setting, key) =>
{
- var scheme_id = setting.get_string (key);
+ string scheme_id = setting.get_string (key);
- var manager = Gtk.SourceStyleSchemeManager.get_default ();
- var scheme = manager.get_scheme (scheme_id);
+ Gtk.SourceStyleSchemeManager manager =
+ Gtk.SourceStyleSchemeManager.get_default ();
+ Gtk.SourceStyleScheme scheme = manager.get_scheme (scheme_id);
- foreach (var doc in Application.get_default ().get_documents ())
+ foreach (Document doc in Application.get_default ().get_documents ())
doc.style_scheme = scheme;
// we don't use doc.set_style_scheme_from_string() for performance reason
@@ -95,47 +96,47 @@ public class AppSettings : GLib.Settings
setting.get (key, "u", out val);
val = val.clamp (1, 24);
- foreach (var view in Application.get_default ().get_views ())
+ foreach (DocumentView view in Application.get_default ().get_views ())
view.tab_width = val;
});
editor.changed["insert-spaces"].connect ((setting, key) =>
{
- var val = setting.get_boolean (key);
+ bool val = setting.get_boolean (key);
- foreach (var view in Application.get_default ().get_views ())
+ foreach (DocumentView view in Application.get_default ().get_views ())
view.insert_spaces_instead_of_tabs = val;
});
editor.changed["display-line-numbers"].connect ((setting, key) =>
{
- var val = setting.get_boolean (key);
+ bool val = setting.get_boolean (key);
- foreach (var view in Application.get_default ().get_views ())
+ foreach (DocumentView view in Application.get_default ().get_views ())
view.show_line_numbers = val;
});
editor.changed["highlight-current-line"].connect ((setting, key) =>
{
- var val = setting.get_boolean (key);
+ bool val = setting.get_boolean (key);
- foreach (var view in Application.get_default ().get_views ())
+ foreach (DocumentView view in Application.get_default ().get_views ())
view.highlight_current_line = val;
});
editor.changed["bracket-matching"].connect ((setting, key) =>
{
- var val = setting.get_boolean (key);
+ bool val = setting.get_boolean (key);
- foreach (var doc in Application.get_default ().get_documents ())
+ foreach (Document doc in Application.get_default ().get_documents ())
doc.highlight_matching_brackets = val;
});
editor.changed["auto-save"].connect ((setting, key) =>
{
- var val = setting.get_boolean (key);
+ bool val = setting.get_boolean (key);
- foreach (var doc in Application.get_default ().get_documents ())
+ foreach (Document doc in Application.get_default ().get_documents ())
doc.tab.auto_save = val;
});
@@ -144,7 +145,7 @@ public class AppSettings : GLib.Settings
uint val;
setting.get (key, "u", out val);
- foreach (var doc in Application.get_default ().get_documents ())
+ foreach (Document doc in Application.get_default ().get_documents ())
doc.tab.auto_save_interval = val;
});
@@ -163,7 +164,7 @@ public class AppSettings : GLib.Settings
private void set_font (string font)
{
- foreach (var view in Application.get_default ().get_views ())
+ foreach (DocumentView view in Application.get_default ().get_views ())
view.set_font_from_string (font);
}
}
diff --git a/src/application.vala b/src/application.vala
index d7c1018..13129cc 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -156,7 +156,7 @@ public class Application : GLib.Object
};
List<Gdk.Pixbuf> list = null;
- foreach (var filename in filenames)
+ foreach (string filename in filenames)
{
try
{
@@ -187,7 +187,7 @@ public class Application : GLib.Object
public List<Document> get_documents ()
{
List<Document> res = null;
- foreach (var w in windows)
+ foreach (MainWindow w in windows)
res.concat (w.get_documents ());
return res;
}
@@ -196,7 +196,7 @@ public class Application : GLib.Object
public List<DocumentView> get_views ()
{
List<DocumentView> res = null;
- foreach (var w in windows)
+ foreach (MainWindow w in windows)
res.concat (w.get_views ());
return res;
}
@@ -210,15 +210,15 @@ public class Application : GLib.Object
return Unique.Response.OK;
}
- var workspace = data.get_workspace ();
- var screen = data.get_screen ();
+ uint workspace = data.get_workspace ();
+ Gdk.Screen screen = data.get_screen ();
// if active_window not on current workspace, try to find an other window on the
// current workspace.
if (! active_window.is_on_workspace_screen (screen, workspace))
{
- var found = false;
- foreach (var w in windows)
+ bool found = false;
+ foreach (MainWindow w in windows)
{
if (w == active_window)
continue;
@@ -249,7 +249,7 @@ public class Application : GLib.Object
if (active_window != null)
active_window.save_state (true);
- var window = new MainWindow ();
+ MainWindow window = new MainWindow ();
active_window = window;
notify_property ("active-window");
@@ -298,7 +298,7 @@ public class Application : GLib.Object
{
if (uri.length == 0)
continue;
- var location = File.new_for_uri (uri);
+ File location = File.new_for_uri (uri);
active_window.open_document (location, jump_to);
jump_to = false;
}
diff --git a/src/build_tool_dialog.vala b/src/build_tool_dialog.vala
index 3f3510e..fc96238 100644
--- a/src/build_tool_dialog.vala
+++ b/src/build_tool_dialog.vala
@@ -95,7 +95,7 @@ private class BuildToolDialog : Dialog
button_down = (Button) builder.get_object ("button_down");
// packing widget
- var content_area = (Box) get_content_area ();
+ Box content_area = (Box) get_content_area ();
content_area.pack_start (main_vbox, true, true, 0);
content_area.show_all ();
@@ -105,12 +105,12 @@ private class BuildToolDialog : Dialog
}
catch (Error e)
{
- var message = "Error: %s".printf (e.message);
+ string message = "Error: %s".printf (e.message);
stderr.printf ("%s\n", message);
- var label_error = new Label (message);
+ Label label_error = new Label (message);
label_error.set_line_wrap (true);
- var content_area = (Box) get_content_area ();
+ Box content_area = (Box) get_content_area ();
content_area.pack_start (label_error, true, true, 0);
content_area.show_all ();
}
diff --git a/src/build_view.vala b/src/build_view.vala
index 977aff0..82bc2a0 100644
--- a/src/build_view.vala
+++ b/src/build_view.vala
@@ -168,7 +168,7 @@ public class BuildView : HBox
});
// with a scrollbar
- var sw = Utils.add_scrollbar (view);
+ Widget sw = Utils.add_scrollbar (view);
pack_start (sw);
VBox vbox = new VBox (false, 0);
diff --git a/src/dialogs.vala b/src/dialogs.vala
index 367cfc9..691680a 100644
--- a/src/dialogs.vala
+++ b/src/dialogs.vala
@@ -34,7 +34,7 @@ namespace Dialogs
{
return_if_fail (unsaved_docs.length () >= 2);
- var dialog = new Dialog.with_buttons (null,
+ Dialog dialog = new Dialog.with_buttons (null,
window,
DialogFlags.DESTROY_WITH_PARENT,
_("Close without Saving"), ResponseType.CLOSE,
@@ -44,21 +44,21 @@ namespace Dialogs
dialog.has_separator = false;
- var hbox = new HBox (false, 12);
+ HBox hbox = new HBox (false, 12);
hbox.border_width = 5;
- var content_area = (VBox) dialog.get_content_area ();
+ VBox content_area = (VBox) dialog.get_content_area ();
content_area.pack_start (hbox, true, true, 0);
/* image */
- var image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
+ Image image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
image.set_alignment ((float) 0.5, (float) 0.0);
hbox.pack_start (image, false, false, 0);
- var vbox = new VBox (false, 12);
+ VBox vbox = new VBox (false, 12);
hbox.pack_start (vbox, true, true, 0);
/* primary label */
- var primary_label = new Label (null);
+ Label primary_label = new Label (null);
primary_label.set_line_wrap (true);
primary_label.set_use_markup (true);
primary_label.set_alignment ((float) 0.0, (float) 0.5);
@@ -70,25 +70,25 @@ namespace Dialogs
vbox.pack_start (primary_label, false, false, 0);
- var vbox2 = new VBox (false, 8);
+ VBox vbox2 = new VBox (false, 8);
vbox.pack_start (vbox2, false, false, 0);
- var select_label = new Label (_("Select the documents you want to save:"));
+ Label select_label = new Label (_("Select the documents you want to save:"));
select_label.set_line_wrap (true);
select_label.set_alignment ((float) 0.0, (float) 0.5);
vbox2.pack_start (select_label, false, false, 0);
/* unsaved documents list with checkboxes */
- var treeview = new TreeView ();
+ TreeView treeview = new TreeView ();
treeview.set_size_request (260, 120);
treeview.headers_visible = false;
treeview.enable_search = false;
- var store = new ListStore (UnsavedDocColumn.N_COLUMNS, typeof (bool),
+ ListStore store = new ListStore (UnsavedDocColumn.N_COLUMNS, typeof (bool),
typeof (string), typeof (Document));
// fill the list
- foreach (var doc in unsaved_docs)
+ foreach (Document doc in unsaved_docs)
{
TreeIter iter;
store.append (out iter);
@@ -100,11 +100,11 @@ namespace Dialogs
}
treeview.set_model (store);
- var renderer1 = new CellRendererToggle ();
+ CellRendererToggle renderer1 = new CellRendererToggle ();
renderer1.toggled.connect ((path_str) =>
{
- var path = new TreePath.from_string (path_str);
+ TreePath path = new TreePath.from_string (path_str);
TreeIter iter;
bool active;
store.get_iter (out iter, path);
@@ -113,11 +113,11 @@ namespace Dialogs
store.set (iter, UnsavedDocColumn.SAVE, ! active, -1);
});
- var column = new TreeViewColumn.with_attributes ("Save?", renderer1,
+ TreeViewColumn column = new TreeViewColumn.with_attributes ("Save?", renderer1,
"active", UnsavedDocColumn.SAVE, null);
treeview.append_column (column);
- var renderer2 = new CellRendererText ();
+ CellRendererText renderer2 = new CellRendererText ();
column = new TreeViewColumn.with_attributes ("Name", renderer2,
"text", UnsavedDocColumn.NAME, null);
treeview.append_column (column);
@@ -128,7 +128,8 @@ namespace Dialogs
vbox2.pack_start (sw, true, true, 0);
/* secondary label */
- var secondary_label = new Label (_("If you don't save, all your changes will be permanently lost."));
+ Label secondary_label = new Label (
+ _("If you don't save, all your changes will be permanently lost."));
secondary_label.set_line_wrap (true);
secondary_label.set_alignment ((float) 0.0, (float) 0.5);
secondary_label.set_selectable (true);
@@ -136,7 +137,7 @@ namespace Dialogs
hbox.show_all ();
- var resp = dialog.run ();
+ int resp = dialog.run ();
// close without saving
if (resp == ResponseType.CLOSE)
@@ -146,7 +147,7 @@ namespace Dialogs
else if (resp == ResponseType.ACCEPT)
{
// close all saved documents
- foreach (var doc in window.get_documents ())
+ foreach (Document doc in window.get_documents ())
{
if (! doc.get_modified ())
window.close_tab (doc.tab);
@@ -155,7 +156,7 @@ namespace Dialogs
// get unsaved docs to save
List<Document> selected_docs = null;
TreeIter iter;
- var valid = store.get_iter_first (out iter);
+ bool valid = store.get_iter_first (out iter);
while (valid)
{
bool selected;
@@ -175,7 +176,7 @@ namespace Dialogs
}
selected_docs.reverse ();
- foreach (var doc in selected_docs)
+ foreach (Document doc in selected_docs)
{
if (window.save_document (doc, false))
window.close_tab (doc.tab, true);
@@ -197,7 +198,7 @@ namespace Dialogs
{
return_if_fail (basenames.length > 0);
- var dialog = new Dialog.with_buttons (null,
+ Dialog dialog = new Dialog.with_buttons (null,
window,
DialogFlags.DESTROY_WITH_PARENT,
Stock.CANCEL, ResponseType.CANCEL,
@@ -212,7 +213,7 @@ namespace Dialogs
content_area.pack_start (hbox, true, true, 0);
/* image */
- var image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
+ Image image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
image.set_alignment ((float) 0.5, (float) 0.0);
hbox.pack_start (image, false, false, 0);
@@ -220,7 +221,7 @@ namespace Dialogs
hbox.pack_start (vbox, true, true, 0);
/* primary label */
- var primary_label = new Label (null);
+ Label primary_label = new Label (null);
primary_label.set_line_wrap (true);
primary_label.set_use_markup (true);
primary_label.set_alignment ((float) 0.0, (float) 0.5);
@@ -233,7 +234,7 @@ namespace Dialogs
VBox vbox2 = new VBox (false, 8);
vbox.pack_start (vbox2, false, false);
- var select_label = new Label (_("Select the files you want to delete:"));
+ Label select_label = new Label (_("Select the files you want to delete:"));
select_label.set_line_wrap (true);
select_label.set_alignment ((float) 0.0, (float) 0.5);
vbox2.pack_start (select_label, false, false, 0);
@@ -259,11 +260,11 @@ namespace Dialogs
}
treeview.set_model (store);
- var renderer1 = new CellRendererToggle ();
+ CellRendererToggle renderer1 = new CellRendererToggle ();
renderer1.toggled.connect ((path_str) =>
{
- var path = new TreePath.from_string (path_str);
+ TreePath path = new TreePath.from_string (path_str);
TreeIter iter;
bool active;
store.get_iter (out iter, path);
@@ -272,11 +273,11 @@ namespace Dialogs
store.set (iter, CleanFileColumn.DELETE, ! active, -1);
});
- var column = new TreeViewColumn.with_attributes ("Delete?", renderer1,
+ TreeViewColumn column = new TreeViewColumn.with_attributes ("Delete?", renderer1,
"active", CleanFileColumn.DELETE, null);
treeview.append_column (column);
- var renderer2 = new CellRendererText ();
+ CellRendererText renderer2 = new CellRendererText ();
column = new TreeViewColumn.with_attributes ("Name", renderer2,
"text", CleanFileColumn.NAME, null);
treeview.append_column (column);
diff --git a/src/document.vala b/src/document.vala
index e4c1e9f..7565eb2 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -78,7 +78,7 @@ public class Document : Gtk.SourceBuffer
found_tag = new TextTag ("found");
found_tag_selected = new TextTag ("found_selected");
sync_found_tags ();
- var tag_table = get_tag_table ();
+ TextTagTable tag_table = get_tag_table ();
tag_table.add (found_tag);
tag_table.add (found_tag_selected);
notify["style-scheme"].connect (sync_found_tags);
@@ -137,7 +137,7 @@ public class Document : Gtk.SourceBuffer
{
stderr.printf ("Error: %s\n", e.message);
- var primary_msg = _("Impossible to load the file '%s'.")
+ string primary_msg = _("Impossible to load the file '%s'.")
.printf (location.get_parse_name ());
tab.add_message (primary_msg, e.message, MessageType.ERROR);
}
@@ -181,7 +181,8 @@ public class Document : Gtk.SourceBuffer
try
{
- var settings = new GLib.Settings ("org.gnome.latexila.preferences.editor");
+ GLib.Settings settings =
+ new GLib.Settings ("org.gnome.latexila.preferences.editor");
bool make_backup = ! backup_made
&& settings.get_boolean ("create-backup-copy");
@@ -212,10 +213,11 @@ public class Document : Gtk.SourceBuffer
{
if (e is IOError.WRONG_ETAG)
{
- var primary_msg = _("The file %s has been modified since reading it.")
+ string primary_msg = _("The file %s has been modified since reading it.")
.printf (location.get_parse_name ());
- var secondary_msg = _("If you save it, all the external changes could be lost. Save it anyway?");
- var infobar = tab.add_message (primary_msg, secondary_msg,
+ string secondary_msg =
+ _("If you save it, all the external changes could be lost. Save it anyway?");
+ TabInfoBar infobar = tab.add_message (primary_msg, secondary_msg,
MessageType.WARNING);
infobar.add_stock_button_with_text (_("Save Anyway"), Stock.SAVE,
ResponseType.YES);
@@ -231,8 +233,9 @@ public class Document : Gtk.SourceBuffer
{
stderr.printf ("Error: %s\n", e.message);
- var primary_msg = _("Impossible to save the file.");
- var infobar = tab.add_message (primary_msg, e.message, MessageType.ERROR);
+ string primary_msg = _("Impossible to save the file.");
+ TabInfoBar infobar = tab.add_message (primary_msg, e.message,
+ MessageType.ERROR);
infobar.add_ok_button ();
}
}
@@ -260,11 +263,11 @@ public class Document : Gtk.SourceBuffer
private void update_syntax_highlighting ()
{
- var lm = Gtk.SourceLanguageManager.get_default ();
+ Gtk.SourceLanguageManager lm = Gtk.SourceLanguageManager.get_default ();
string content_type = null;
try
{
- var info = location.query_info (FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ FileInfo info = location.query_info (FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
FileQueryInfoFlags.NONE, null);
content_type = info.get_content_type ();
}
@@ -354,7 +357,7 @@ public class Document : Gtk.SourceBuffer
string current_etag = null;
try
{
- var file_info = location.query_info (FILE_ATTRIBUTE_ETAG_VALUE,
+ FileInfo file_info = location.query_info (FILE_ATTRIBUTE_ETAG_VALUE,
FileQueryInfoFlags.NONE, null);
current_etag = file_info.get_etag ();
}
@@ -368,7 +371,7 @@ public class Document : Gtk.SourceBuffer
public void set_style_scheme_from_string (string scheme_id)
{
- var manager = SourceStyleSchemeManager.get_default ();
+ SourceStyleSchemeManager manager = SourceStyleSchemeManager.get_default ();
style_scheme = manager.get_scheme (scheme_id);
}
@@ -383,11 +386,11 @@ public class Document : Gtk.SourceBuffer
TextIter start, end;
get_selection_bounds (out start, out end);
- var start_line = start.get_line ();
- var end_line = end.get_line ();
+ int start_line = start.get_line ();
+ int end_line = end.get_line ();
begin_user_action ();
- for (var i = start_line ; i <= end_line ; i++)
+ for (int i = start_line ; i <= end_line ; i++)
{
TextIter iter;
get_iter_at_line (out iter, i);
@@ -406,13 +409,13 @@ public class Document : Gtk.SourceBuffer
TextIter start, end;
get_selection_bounds (out start, out end);
- var start_line = start.get_line ();
- var end_line = end.get_line ();
- var line_count = get_line_count ();
+ int start_line = start.get_line ();
+ int end_line = end.get_line ();
+ int line_count = get_line_count ();
begin_user_action ();
- for (var i = start_line ; i <= end_line ; i++)
+ for (int i = start_line ; i <= end_line ; i++)
{
get_iter_at_line (out start, i);
@@ -422,12 +425,12 @@ public class Document : Gtk.SourceBuffer
else
get_iter_at_line (out end, i + 1);
- var line = get_text (start, end, false);
+ string line = get_text (start, end, false);
/* find the first '%' character */
- var j = 0;
- var start_delete = -1;
- var stop_delete = -1;
+ int j = 0;
+ int start_delete = -1;
+ int stop_delete = -1;
while (line[j] != '\0')
{
if (line[j] == '%')
@@ -525,7 +528,7 @@ public class Document : Gtk.SourceBuffer
{
return_val_if_fail (line >= -1, false);
- var ret = true;
+ bool ret = true;
TextIter iter;
if (line >= get_line_count ())
@@ -638,7 +641,7 @@ public class Document : Gtk.SourceBuffer
get_start_iter (out start);
get_iter_at_mark (out insert, get_insert ());
- var next_match_after_cursor_found = ! select;
+ bool next_match_after_cursor_found = ! select;
uint i = 0;
while (iter_forward_search (start, null, out try_match_start, out try_match_end))
@@ -693,7 +696,7 @@ public class Document : Gtk.SourceBuffer
get_iter_at_mark (out start_search, get_insert ());
get_start_iter (out start);
- var increment = false;
+ bool increment = false;
if (start_search.has_tag (found_tag_selected))
{
get_iter_at_mark (out start_search, get_mark ("search_selected_end"));
@@ -738,10 +741,10 @@ public class Document : Gtk.SourceBuffer
get_iter_at_mark (out start_search, get_insert ());
get_end_iter (out end);
- var decrement = false;
- var move_cursor = true;
+ bool decrement = false;
+ bool move_cursor = true;
- var start_prev = start_search;
+ TextIter start_prev = start_search;
start_prev.backward_char ();
// the cursor is on a match
@@ -794,7 +797,7 @@ public class Document : Gtk.SourceBuffer
private bool iter_forward_search (TextIter start, TextIter? end,
out TextIter match_start, out TextIter match_end)
{
- var found = false;
+ bool found = false;
while (! found)
{
found = source_iter_forward_search (start, search_text, get_search_flags (),
@@ -816,7 +819,7 @@ public class Document : Gtk.SourceBuffer
private bool iter_backward_search (TextIter start, TextIter? end,
out TextIter match_start, out TextIter match_end)
{
- var found = false;
+ bool found = false;
while (! found)
{
found = source_iter_backward_search (start, search_text, get_search_flags (),
@@ -949,7 +952,7 @@ public class Document : Gtk.SourceBuffer
int len)
{
// remove tags in text inserted
- var left_text = location;
+ TextIter left_text = location;
left_text.backward_chars (len);
remove_tag (found_tag, left_text, location);
remove_tag (found_tag_selected, left_text, location);
@@ -1040,7 +1043,7 @@ public class Document : Gtk.SourceBuffer
private void set_search_match_colors (TextTag text_tag)
{
- var style_scheme = get_style_scheme ();
+ SourceStyleScheme style_scheme = get_style_scheme ();
SourceStyle style = null;
if (style_scheme != null)
diff --git a/src/documents_panel.vala b/src/documents_panel.vala
index 7c4dcde..489d2f2 100644
--- a/src/documents_panel.vala
+++ b/src/documents_panel.vala
@@ -38,7 +38,7 @@ public class DocumentsPanel : Notebook
public void add_tab (DocumentTab tab, int position, bool jump_to)
{
- var event_box = new EventBox ();
+ EventBox event_box = new EventBox ();
event_box.add (tab.label);
event_box.button_press_event.connect ((event) =>
{
@@ -54,10 +54,10 @@ public class DocumentsPanel : Notebook
return false;
});
- var i = this.insert_page (tab, event_box, position);
+ int page_pos = this.insert_page (tab, event_box, position);
this.set_tab_reorderable (tab, true);
if (jump_to)
- this.set_current_page (i);
+ this.set_current_page (page_pos);
}
public void remove_tab (DocumentTab tab)
diff --git a/src/file_browser.vala b/src/file_browser.vala
index 1b1ce94..2f086a7 100644
--- a/src/file_browser.vala
+++ b/src/file_browser.vala
@@ -231,7 +231,7 @@ public class FileBrowser : VBox
column.set_attributes (text_renderer, "text", FileColumn.NAME, null);
// with a scrollbar
- var sw = Utils.add_scrollbar (tree_view);
+ Widget sw = Utils.add_scrollbar (tree_view);
pack_start (sw);
tree_view.row_activated.connect ((path) =>
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index 3d700f8..cd272fe 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -422,22 +422,22 @@ public class LatexMenu : Gtk.ActionGroup
this.main_window = main_window;
// menus under toolitems
- var sectioning = get_menu_tool_action ("SectioningToolItem", _("Sectioning"),
- "sectioning-section");
+ Gtk.Action sectioning = get_menu_tool_action ("SectioningToolItem",
+ _("Sectioning"), "sectioning-section");
- var sizes = get_menu_tool_action ("CharacterSizeToolItem", _("Characters Sizes"),
- "character-size");
+ Gtk.Action sizes = get_menu_tool_action ("CharacterSizeToolItem",
+ _("Characters Sizes"), "character-size");
- var references = get_menu_tool_action ("ReferencesToolItem", _("References"),
- "references");
+ Gtk.Action references = get_menu_tool_action ("ReferencesToolItem",
+ _("References"), "references");
- var math_env = get_menu_tool_action ("MathEnvironmentsToolItem",
+ Gtk.Action math_env = get_menu_tool_action ("MathEnvironmentsToolItem",
_("Math Environments"), "math");
- var math_left_del = get_menu_tool_action ("MathLeftDelimitersToolItem",
+ Gtk.Action math_left_del = get_menu_tool_action ("MathLeftDelimitersToolItem",
_("Left Delimiters"), "delimiters-left");
- var math_right_del = get_menu_tool_action ("MathRightDelimitersToolItem",
+ Gtk.Action math_right_del = get_menu_tool_action ("MathRightDelimitersToolItem",
_("Right Delimiters"), "delimiters-right");
add_actions (latex_action_entries, this);
diff --git a/src/main.vala b/src/main.vala
index 73e6726..f849a1c 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -61,7 +61,8 @@ int main (string[] args)
Gtk.init (ref args);
/* command line options */
- var context = new OptionContext (_("- Integrated LaTeX Environment for GNOME"));
+ OptionContext context =
+ new OptionContext (_("- Integrated LaTeX Environment for GNOME"));
context.add_main_entries (options, Config.GETTEXT_PACKAGE);
context.add_group (Gtk.get_option_group (false));
@@ -93,7 +94,7 @@ int main (string[] args)
// since remaining_args.length == 0, we use a dynamic array
string[] uris = {};
- foreach (var arg in remaining_args)
+ foreach (string arg in remaining_args)
// The command line argument can be absolute or relative.
// With URI's, that's always absolute, so no problem.
uris += File.new_for_path (arg).get_uri ();
@@ -101,7 +102,7 @@ int main (string[] args)
data.set_uris (uris);
}
- var app = new Unique.App ("org.gnome.latexila", null);
+ Unique.App app = new Unique.App ("org.gnome.latexila", null);
app.add_command ("new_window", Application.NEW_WINDOW);
if (app.is_running)
@@ -110,22 +111,22 @@ int main (string[] args)
bool ok = true;
if (option_new_window)
{
- var resp = app.send_message (Application.NEW_WINDOW, null);
+ Unique.Response resp = app.send_message (Application.NEW_WINDOW, null);
ok = resp == Unique.Response.OK;
}
if (ok && command_open)
{
- var resp = app.send_message (Unique.Command.OPEN, data);
+ Unique.Response resp = app.send_message (Unique.Command.OPEN, data);
ok = resp == Unique.Response.OK;
}
if (ok && option_new_document)
{
- var resp = app.send_message (Unique.Command.NEW, null);
+ Unique.Response resp = app.send_message (Unique.Command.NEW, null);
ok = resp == Unique.Response.OK;
}
if (! option_new_window && ! command_open && ! option_new_document)
{
- var resp = app.send_message (Unique.Command.ACTIVATE, null);
+ Unique.Response resp = app.send_message (Unique.Command.ACTIVATE, null);
ok = resp == Unique.Response.OK;
}
@@ -137,13 +138,15 @@ int main (string[] args)
/* start a new application */
else
{
- var latexila = Application.get_default ();
+ Application latexila = Application.get_default ();
/* reopen files on startup */
- var editor_settings = new GLib.Settings ("org.gnome.latexila.preferences.editor");
+ GLib.Settings editor_settings =
+ new GLib.Settings ("org.gnome.latexila.preferences.editor");
if (editor_settings.get_boolean ("reopen-files"))
{
- var window_settings = new GLib.Settings ("org.gnome.latexila.state.window");
+ GLib.Settings window_settings =
+ new GLib.Settings ("org.gnome.latexila.state.window");
string[] uris = window_settings.get_strv ("documents");
latexila.open_documents (uris);
diff --git a/src/main_window.vala b/src/main_window.vala
index 72666ad..43d5e1f 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -246,7 +246,7 @@ public class MainWindow : Window
/* components */
initialize_menubar_and_toolbar ();
- var menu = ui_manager.get_widget ("/MainMenu");
+ Widget menu = ui_manager.get_widget ("/MainMenu");
main_toolbar = (Toolbar) ui_manager.get_widget ("/MainToolbar");
main_toolbar.set_style (ToolbarStyle.ICONS);
@@ -509,7 +509,7 @@ public class MainWindow : Window
try
{
- var path = Path.build_filename (Config.DATA_DIR, "ui", "ui.xml");
+ string path = Path.build_filename (Config.DATA_DIR, "ui", "ui.xml");
ui_manager.add_ui_from_file (path);
}
catch (GLib.Error err)
@@ -773,7 +773,7 @@ public class MainWindow : Window
*/
if (! force_close && tab.document.get_modified ())
{
- var dialog = new MessageDialog (this,
+ Dialog dialog = new MessageDialog (this,
DialogFlags.DESTROY_WITH_PARENT,
MessageType.QUESTION,
ButtonsType.NONE,
@@ -834,11 +834,11 @@ public class MainWindow : Window
{
if (screen != null)
{
- var cur_name = screen.get_display ().get_name ();
- var cur_n = screen.get_number ();
+ string cur_name = screen.get_display ().get_name ();
+ int cur_n = screen.get_number ();
Gdk.Screen s = this.get_screen ();
- var name = s.get_display ().get_name ();
- var n = s.get_number ();
+ string name = s.get_display ().get_name ();
+ int n = s.get_number ();
if (cur_name != name || cur_n != n)
return false;
@@ -910,7 +910,7 @@ public class MainWindow : Window
return true;
}
- var file_chooser = new FileChooserDialog (_("Save File"), this,
+ FileChooserDialog file_chooser = new FileChooserDialog (_("Save File"), this,
FileChooserAction.SAVE,
Stock.CANCEL, ResponseType.CANCEL,
Stock.SAVE, ResponseType.ACCEPT,
@@ -941,7 +941,7 @@ public class MainWindow : Window
/* if the file exists, ask the user if the file can be replaced */
if (file.query_exists ())
{
- var confirmation = new MessageDialog (this,
+ MessageDialog confirmation = new MessageDialog (this,
DialogFlags.DESTROY_WITH_PARENT,
MessageType.QUESTION,
ButtonsType.NONE,
@@ -950,13 +950,13 @@ public class MainWindow : Window
confirmation.add_button (Stock.CANCEL, ResponseType.CANCEL);
- var button_replace = new Button.with_label (_("Replace"));
- var icon = new Image.from_stock (Stock.SAVE_AS, IconSize.BUTTON);
+ Button button_replace = new Button.with_label (_("Replace"));
+ Image icon = new Image.from_stock (Stock.SAVE_AS, IconSize.BUTTON);
button_replace.set_image (icon);
confirmation.add_action_widget (button_replace, ResponseType.YES);
button_replace.show ();
- var response = confirmation.run ();
+ int response = confirmation.run ();
confirmation.destroy ();
if (response != ResponseType.YES)
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index b1d4e01..d2a4759 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -482,21 +482,21 @@ public class PreferencesDialog : Dialog
list_store.set_sort_column_id (StyleSchemes.ID, SortType.ASCENDING);
treeview.set_model (list_store);
- var renderer = new CellRendererText ();
- var column = new TreeViewColumn.with_attributes (
+ CellRendererText renderer = new CellRendererText ();
+ TreeViewColumn column = new TreeViewColumn.with_attributes (
"Name and description", renderer,
"markup", StyleSchemes.DESC, null);
treeview.append_column (column);
- var select = treeview.get_selection ();
+ TreeSelection select = treeview.get_selection ();
select.set_mode (SelectionMode.SINGLE);
/* fill style scheme list store */
- var manager = SourceStyleSchemeManager.get_default ();
+ SourceStyleSchemeManager manager = SourceStyleSchemeManager.get_default ();
foreach (string id in manager.get_scheme_ids ())
{
- var scheme = manager.get_scheme (id);
- var desc = "<b>%s</b> - %s".printf (scheme.name, scheme.description);
+ SourceStyleScheme scheme = manager.get_scheme (id);
+ string desc = "<b>%s</b> - %s".printf (scheme.name, scheme.description);
TreeIter iter;
list_store.append (out iter);
list_store.set (iter,
diff --git a/src/symbols.vala b/src/symbols.vala
index 6c9443b..9a1a284 100644
--- a/src/symbols.vala
+++ b/src/symbols.vala
@@ -723,7 +723,7 @@ public class Symbols : VBox
{
try
{
- var pixbuf = new Gdk.Pixbuf.from_file (info.icon);
+ Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file (info.icon);
TreeIter iter;
categories_store.append (out iter);
categories_store.set (iter,
@@ -740,7 +740,7 @@ public class Symbols : VBox
}
// mosed used symbols
- var pixbuf = Utils.get_pixbuf_from_stock (Stock.ABOUT, IconSize.MENU);
+ Gdk.Pixbuf pixbuf = Utils.get_pixbuf_from_stock (Stock.ABOUT, IconSize.MENU);
TreeIter iter;
categories_store.append (out iter);
categories_store.set (iter,
@@ -794,7 +794,7 @@ public class Symbols : VBox
symbol_view.row_spacing = 0;
symbol_view.column_spacing = 0;
- var sw = Utils.add_scrollbar (symbol_view);
+ Widget sw = Utils.add_scrollbar (symbol_view);
pack_start (sw);
sw.show_all ();
@@ -840,8 +840,8 @@ public class Symbols : VBox
// unselect the symbol, so the user can insert several times the same symbol
symbol_view.unselect_all ();
- var path = selected_items.nth_data (0);
- var model = symbol_view.get_model ();
+ TreePath path = selected_items.nth_data (0);
+ TreeModel model = symbol_view.get_model ();
TreeIter iter = {};
if (path != null && model.get_iter (out iter, path))
@@ -926,7 +926,7 @@ public class Symbols : VBox
{
try
{
- var pixbuf = new Gdk.Pixbuf.from_file (symbol.filename);
+ Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file (symbol.filename);
// some characters ('<' for example) generate errors for the tooltip,
// so we must escape it
diff --git a/src/tab_info_bar.vala b/src/tab_info_bar.vala
index c8a3c2a..38aef92 100644
--- a/src/tab_info_bar.vala
+++ b/src/tab_info_bar.vala
@@ -23,7 +23,7 @@ public class TabInfoBar : InfoBar
{
public TabInfoBar (string primary_msg, string secondary_msg, MessageType msg_type)
{
- var content_area = (HBox) get_content_area ();
+ HBox content_area = (HBox) get_content_area ();
// icon
string stock_id;
@@ -44,22 +44,22 @@ public class TabInfoBar : InfoBar
break;
}
- var image = new Image.from_stock (stock_id, IconSize.DIALOG);
+ Image image = new Image.from_stock (stock_id, IconSize.DIALOG);
image.set_alignment ((float) 0.5, (float) 0.0);
content_area.pack_start (image, false, false, 0);
// text
- var vbox = new VBox (false, 10);
+ VBox vbox = new VBox (false, 10);
content_area.pack_start (vbox, true, true, 0);
- var primary_label = new Label ("<b>" + primary_msg + "</b>");
+ Label primary_label = new Label ("<b>" + primary_msg + "</b>");
vbox.pack_start (primary_label, false, false, 0);
primary_label.set_alignment ((float) 0.0, (float) 0.5);
primary_label.set_selectable (true);
primary_label.set_line_wrap (true);
primary_label.set_use_markup (true);
- var secondary_label = new Label ("<small>" + secondary_msg + "</small>");
+ Label secondary_label = new Label ("<small>" + secondary_msg + "</small>");
vbox.pack_start (secondary_label, false, false, 0);
secondary_label.set_alignment ((float) 0.0, (float) 0.5);
secondary_label.set_selectable (true);
@@ -82,8 +82,8 @@ public class TabInfoBar : InfoBar
public void add_stock_button_with_text (string text, string stock_id, int response_id)
{
- var button = (Button) add_button (text, response_id);
- var image = new Image.from_stock (stock_id, IconSize.BUTTON);
+ Button button = (Button) add_button (text, response_id);
+ Image image = new Image.from_stock (stock_id, IconSize.BUTTON);
button.set_image (image);
}
}
diff --git a/src/templates.vala b/src/templates.vala
index b87629c..d7bd5e9 100644
--- a/src/templates.vala
+++ b/src/templates.vala
@@ -254,8 +254,8 @@ public class Templates : GLib.Object
/* name */
HBox hbox = new HBox (false, 5);
- var label = new Label (_("Name of the new template:"));
- var entry = new Entry ();
+ Label label = new Label (_("Name of the new template:"));
+ Entry entry = new Entry ();
hbox.pack_start (label, false, false, 0);
hbox.pack_start (entry, false, false, 0);
@@ -264,8 +264,8 @@ public class Templates : GLib.Object
/* icon */
// we take the default store because it contains all the icons
IconView icon_view = create_icon_view (default_store);
- var scrollbar = Utils.add_scrollbar (icon_view);
- var frame = new Frame (_("Choose an icon:"));
+ Widget scrollbar = Utils.add_scrollbar (icon_view);
+ Frame frame = new Frame (_("Choose an icon:"));
frame.add (scrollbar);
content_area.pack_start (frame, true, true, 10);
diff --git a/src/utils.vala b/src/utils.vala
index b42a870..db18389 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -32,8 +32,8 @@ namespace Utils
if (str.length <= max_length)
return str;
- var half_length = (max_length - 4) / 2;
- var l = str.length;
+ uint half_length = (max_length - 4) / 2;
+ int l = str.length;
return str[0:half_length] + "..." + str[l-half_length:l];
}
@@ -68,7 +68,8 @@ namespace Utils
{
Mount mount = location.find_enclosing_mount (null);
string mount_name = mount.get_name ();
- var dirname = uri_get_dirname (location.get_path () ?? location.get_uri ());
+ string? dirname =
+ uri_get_dirname (location.get_path () ?? location.get_uri ());
if (dirname == null || dirname == ".")
return mount_name;
@@ -154,7 +155,7 @@ namespace Utils
public Widget add_scrollbar (Widget child)
{
- var scrollbar = new ScrolledWindow (null, null);
+ ScrolledWindow scrollbar = new ScrolledWindow (null, null);
scrollbar.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
scrollbar.add (child);
return scrollbar;
@@ -238,8 +239,8 @@ namespace Utils
public Gdk.Pixbuf get_pixbuf_from_stock (string stock_id, Gtk.IconSize size)
{
- var w = new Gtk.Invisible ();
- var pixbuf = w.render_icon (stock_id, size, "vala");
+ Gtk.Invisible w = new Gtk.Invisible ();
+ Gdk.Pixbuf pixbuf = w.render_icon (stock_id, size, "vala");
return pixbuf;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]