[latexila/wip/build-tools-revamp] Use latexila_utils_get_extension() in the Vala code
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/wip/build-tools-revamp] Use latexila_utils_get_extension() in the Vala code
- Date: Wed, 21 May 2014 20:39:19 +0000 (UTC)
commit 994625ece25abcc5a92c902be8ccafe242435e64
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed May 21 22:38:36 2014 +0200
Use latexila_utils_get_extension() in the Vala code
src/file_browser.vala | 4 ++--
src/main_window_build_tools.vala | 2 +-
src/utils.vala | 21 ---------------------
3 files changed, 3 insertions(+), 24 deletions(-)
---
diff --git a/src/file_browser.vala b/src/file_browser.vala
index df8a524..7e18e9d 100644
--- a/src/file_browser.vala
+++ b/src/file_browser.vala
@@ -175,7 +175,7 @@ public class FileBrowser : Grid
return;
}
- string extension = Utils.get_extension (basename);
+ string extension = Latexila.utils_get_extension (basename);
if (extension != ".dvi" &&
extension != ".pdf" &&
extension != ".ps")
@@ -435,7 +435,7 @@ public class FileBrowser : Grid
continue;
}
- string extension = Utils.get_extension (basename);
+ string extension = Latexila.utils_get_extension (basename);
string stock_id = get_extension_stock_id (extension);
insert_file (false, stock_id, basename);
}
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index 3b76297..d44b596 100644
--- a/src/main_window_build_tools.vala
+++ b/src/main_window_build_tools.vala
@@ -195,7 +195,7 @@ public class MainWindowBuildTools
}
string path = active_doc.get_main_file ().get_parse_name ();
- string ext = Utils.get_extension (path);
+ string ext = Latexila.utils_get_extension (path);
string[] extensions = tool.extensions.split (" ");
bool sensitive = tool.extensions.length == 0 || ext in extensions;
diff --git a/src/utils.vala b/src/utils.vala
index 274c5c5..b010389 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -106,27 +106,6 @@ namespace Utils
}
}
- // get file's extension (with the dot)
- public string get_extension (string path)
- {
- return path[get_extension_pos (path):path.length].down ();
- }
-
- private long get_extension_pos (string path)
- {
- long l = path.length;
-
- for (long i = l - 1 ; i >= 0 ; i--)
- {
- if (path[i] == '/')
- return l;
- else if (path[i] == '.')
- return i;
- }
-
- return l;
- }
-
public void delete_file (File file)
{
if (! file.query_exists ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]