Skip to content

Commit

Permalink
Change naming conventions of methods to comply with vala naming conve…
Browse files Browse the repository at this point in the history
…ntions
  • Loading branch information
GijsGoudzwaard committed Aug 23, 2024
1 parent 1f2972a commit 6cfacdc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Application : Granite.Application {
foreach (File file in files) {
var uri = file.get_path ().replace ("%20", " ").replace ("file://", "");

var name = Image.getFileName (uri);
var type = Image.getFileType (file.get_basename ());
var name = Image.get_file_name (uri);
var type = Image.get_file_type (file.get_basename ());

if (Image.is_valid (type.down ())) {
this.images += new Image (uri, name, type.down ());
Expand Down
8 changes: 4 additions & 4 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ public class MainWindow : Gtk.Window {
foreach (string uri in data.get_uris ()) {
uri = uri.replace ("%20", " "). replace ("file://", "");

var name = Image.getFileName (uri);
var type = Image.getFileType (name);
var name = Image.get_file_name (uri);
var type = Image.get_file_type (name);

if (Image.is_valid (type.down ())) {
this.images += new Image (uri, name, type.down ());
Expand Down Expand Up @@ -227,8 +227,8 @@ public class MainWindow : Gtk.Window {

if (file_chooser.run () == Gtk.ResponseType.ACCEPT) {
foreach (string uri in file_chooser.get_filenames ()) {
var name = Image.getFileName (uri);
var type = Image.getFileType (name);
var name = Image.get_file_name (uri);
var type = Image.get_file_type (name);

if (Image.is_valid (type.down ())) {
this.images += new Image (uri, name, type.down ());
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Image.vala
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class Image {
* @param string path
* @return string
*/
public static string getFileName (string path) {
public static string get_file_name (string path) {
var array = path.split ("/");

return array[array.length - 1];
Expand All @@ -80,7 +80,7 @@ public class Image {
* @param string name
* @return string
*/
public static string getFileType (string name) {
public static string get_file_type (string name) {
var array = name.split (".");

return array[array.length - 1];
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/JpegOptim.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class JpegOptim {
*
* @return void
*/
public void addImage (string image) {
public void add_image (string image) {
this.images += image;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/OptiPng.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class OptiPng {
*
* @return void
*/
public void addImage (string image) {
public void add_image (string image) {
this.images += image;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Optimizer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class Optimizer {

foreach (var image in this.images) {
if (Utils.in_array ({"jpg", "jpeg"}, image.type)) {
jpegoptim.addImage (image.path);
jpegoptim.add_image (image.path);
} else if (Utils.in_array ({"png", "bmp"}, image.type)) {
optipng.addImage (image.path);
optipng.add_image (image.path);
}
}

Expand Down

0 comments on commit 6cfacdc

Please sign in to comment.