[gnome-commander] Use public function when calling a member function; renaming accordingly
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Use public function when calling a member function; renaming accordingly
- Date: Sun, 11 Jul 2021 21:45:32 +0000 (UTC)
commit c5d11ebd07aaf766fd8cce5ee52aa17593212b92
Author: Uwe Scholz <u scholz83 gmx de>
Date: Sat Jul 10 22:23:11 2021 +0200
Use public function when calling a member function; renaming accordingly
src/dialogs/gnome-cmd-chmod-dialog.cc | 4 +--
src/dialogs/gnome-cmd-chown-dialog.cc | 6 ++---
src/dialogs/gnome-cmd-delete-dialog.cc | 2 +-
src/dialogs/gnome-cmd-file-props-dialog.cc | 12 ++++-----
src/dialogs/gnome-cmd-mkdir-dialog.cc | 2 +-
src/gnome-cmd-dir.cc | 2 +-
src/gnome-cmd-file-list.cc | 2 +-
src/gnome-cmd-file.cc | 43 ++----------------------------
src/utils.cc | 4 +--
src/utils.h | 4 +--
10 files changed, 21 insertions(+), 60 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-chmod-dialog.cc b/src/dialogs/gnome-cmd-chmod-dialog.cc
index 1486153f..9f904fb6 100644
--- a/src/dialogs/gnome-cmd-chmod-dialog.cc
+++ b/src/dialogs/gnome-cmd-chmod-dialog.cc
@@ -94,7 +94,7 @@ static void do_chmod (GnomeCmdFile *in, guint32 permissions, gboolean recursive,
for (GList *i = gnome_cmd_dir_get_files (dir); i; i = i->next)
{
GnomeCmdFile *f = (GnomeCmdFile *) i->data;
- auto filename = GetGfileAttributeString(f->gFile, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
+ auto filename = get_gfile_attribute_string(f->gFile, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
if (!f->is_dotdot && strcmp (filename, ".") != 0
&& !g_file_info_get_is_symlink(f->gFileInfo))
{
@@ -234,7 +234,7 @@ GtkWidget *gnome_cmd_chmod_dialog_new (GList *files)
dialog->priv->f = (GnomeCmdFile *) dialog->priv->files->data;
g_return_val_if_fail (dialog->priv->f != NULL, NULL);
- dialog->priv->permissions = GetGfileAttributeUInt32(dialog->priv->f->gFile, G_FILE_ATTRIBUTE_UNIX_MODE)
& 0xFFF;
+ dialog->priv->permissions = get_gfile_attribute_uint32(dialog->priv->f->gFile,
G_FILE_ATTRIBUTE_UNIX_MODE) & 0xFFF;
show_perms (dialog);
diff --git a/src/dialogs/gnome-cmd-chown-dialog.cc b/src/dialogs/gnome-cmd-chown-dialog.cc
index 11d5813c..9477ce40 100644
--- a/src/dialogs/gnome-cmd-chown-dialog.cc
+++ b/src/dialogs/gnome-cmd-chown-dialog.cc
@@ -72,7 +72,7 @@ static void do_chown (GnomeCmdFile *in, uid_t uid, gid_t gid, gboolean recurse)
{
GnomeCmdFile *f = (GnomeCmdFile *) i->data;
- auto filename = GetGfileAttributeString(f->gFile, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
+ auto filename = get_gfile_attribute_string(f->gFile, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
if (!f->is_dotdot && strcmp (filename, ".") != 0
&& !g_file_info_get_is_symlink(f->gFileInfo))
{
@@ -188,8 +188,8 @@ GtkWidget *gnome_cmd_chown_dialog_new (GList *files)
GnomeCmdFile *f = GNOME_CMD_FILE (dialog->priv->files->data);
gnome_cmd_chown_component_set (GNOME_CMD_CHOWN_COMPONENT (dialog->priv->chown_component),
- GetGfileAttributeUInt32(f->gFile, G_FILE_ATTRIBUTE_UNIX_UID),
- GetGfileAttributeUInt32(f->gFile, G_FILE_ATTRIBUTE_UNIX_GID));
+ get_gfile_attribute_uint32(f->gFile, G_FILE_ATTRIBUTE_UNIX_UID),
+ get_gfile_attribute_uint32(f->gFile, G_FILE_ATTRIBUTE_UNIX_GID));
return GTK_WIDGET (dialog);
}
diff --git a/src/dialogs/gnome-cmd-delete-dialog.cc b/src/dialogs/gnome-cmd-delete-dialog.cc
index 3c4beabe..27fcc9bc 100644
--- a/src/dialogs/gnome-cmd-delete-dialog.cc
+++ b/src/dialogs/gnome-cmd-delete-dialog.cc
@@ -198,7 +198,7 @@ static gboolean perform_delete_operation_r(DeleteData *deleteData, GList *gnomeC
if ((numDirs == 1 && numFiles == 0) // Empty directory
|| (get_gfile_attribute_boolean(gFile, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK)) //We want delete
symlinks!
- || (GetGfileAttributeUInt32(gFile, G_FILE_ATTRIBUTE_STANDARD_TYPE) != G_FILE_TYPE_DIRECTORY)) //
Not a directory
+ || (get_gfile_attribute_uint32(gFile, G_FILE_ATTRIBUTE_STANDARD_TYPE) != G_FILE_TYPE_DIRECTORY))
// Not a directory
{
// DELETE IT!
if (!g_file_delete (gFile, nullptr, &tmpError) &&
diff --git a/src/dialogs/gnome-cmd-file-props-dialog.cc b/src/dialogs/gnome-cmd-file-props-dialog.cc
index 57be2f9d..5321c811 100644
--- a/src/dialogs/gnome-cmd-file-props-dialog.cc
+++ b/src/dialogs/gnome-cmd-file-props-dialog.cc
@@ -187,7 +187,7 @@ static void on_dialog_ok (GtkButton *btn, GnomeCmdFilePropsDialogPrivate *data)
{
auto perms = gnome_cmd_chmod_component_get_perms (GNOME_CMD_CHMOD_COMPONENT (data->chmod_component));
- if (perms != (GetGfileAttributeUInt32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_MODE) & 0xFFF ))
+ if (perms != (get_gfile_attribute_uint32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_MODE) & 0xFFF ))
retValue = data->f->chmod(perms, &error);
}
@@ -196,8 +196,8 @@ static void on_dialog_ok (GtkButton *btn, GnomeCmdFilePropsDialogPrivate *data)
uid_t uid = gnome_cmd_chown_component_get_owner (GNOME_CMD_CHOWN_COMPONENT (data->chown_component));
gid_t gid = gnome_cmd_chown_component_get_group (GNOME_CMD_CHOWN_COMPONENT (data->chown_component));
- if ( uid != GetGfileAttributeUInt32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_UID)
- || gid != GetGfileAttributeUInt32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_GID))
+ if ( uid != get_gfile_attribute_uint32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_UID)
+ || gid != get_gfile_attribute_uint32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_GID))
{
retValue = data->f->chown(uid, gid, &error);
}
@@ -494,8 +494,8 @@ inline GtkWidget *create_permissions_tab (GnomeCmdFilePropsDialogPrivate *data)
g_object_set_data_full (G_OBJECT (data->dialog), "chown_component", data->chown_component,
g_object_unref);
gtk_widget_show (data->chown_component);
gnome_cmd_chown_component_set (GNOME_CMD_CHOWN_COMPONENT (data->chown_component),
- GetGfileAttributeUInt32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_UID),
- GetGfileAttributeUInt32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_GID));
+ get_gfile_attribute_uint32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_UID),
+ get_gfile_attribute_uint32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_GID));
GtkWidget *cat = create_category (data->dialog, data->chown_component, _("Owner and group"));
gtk_box_pack_start (GTK_BOX (vbox), cat, TRUE, TRUE, 0);
@@ -506,7 +506,7 @@ inline GtkWidget *create_permissions_tab (GnomeCmdFilePropsDialogPrivate *data)
g_object_set_data_full (G_OBJECT (data->dialog), "chmod_component", data->chmod_component,
g_object_unref);
gtk_widget_show (data->chmod_component);
gnome_cmd_chmod_component_set_perms (GNOME_CMD_CHMOD_COMPONENT (data->chmod_component),
- GetGfileAttributeUInt32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_MODE) & 0xFFF);
+ get_gfile_attribute_uint32(data->f->gFile, G_FILE_ATTRIBUTE_UNIX_MODE) & 0xFFF);
cat = create_category (data->dialog, data->chmod_component, _("Access permissions"));
gtk_box_pack_start (GTK_BOX (vbox), cat, TRUE, TRUE, 0);
diff --git a/src/dialogs/gnome-cmd-mkdir-dialog.cc b/src/dialogs/gnome-cmd-mkdir-dialog.cc
index 0ce6679c..2dc09534 100644
--- a/src/dialogs/gnome-cmd-mkdir-dialog.cc
+++ b/src/dialogs/gnome-cmd-mkdir-dialog.cc
@@ -56,7 +56,7 @@ GSList *make_gfile_list (GnomeCmdDir *dir, string filename)
if (uriScheme && strcmp (uriScheme, "smb")==0 && g_path_is_absolute (filename.c_str()))
{
- if (GetGfileAttributeUInt32(dir_gFile, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY
+ if (get_gfile_attribute_uint32(dir_gFile, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY
&& !g_file_get_parent (dir_gFile))
{
filename.erase(0,1);
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index ce067ae8..b2546aef 100644
--- a/src/gnome-cmd-dir.cc
+++ b/src/gnome-cmd-dir.cc
@@ -699,7 +699,7 @@ GFile *gnome_cmd_dir_get_absolute_path_gfile (GnomeCmdDir *dir, string absolute_
if (uriScheme && strcmp (uriScheme, "smb") == 0)
{
- while (GetGfileAttributeUInt32(dir_gFile, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY)
+ while (get_gfile_attribute_uint32(dir_gFile, G_FILE_ATTRIBUTE_STANDARD_TYPE) ==
G_FILE_TYPE_DIRECTORY)
{
auto gFileParent = g_file_get_parent(dir_gFile);
g_object_unref (dir_gFile);
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 1bf25a2d..245c0509 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -1277,7 +1277,7 @@ static void mime_exec_single (GnomeCmdFile *f)
return;
}
- if(!f->chmod(GetGfileAttributeUInt32(f->gFile, G_FILE_ATTRIBUTE_UNIX_MODE) |
GNOME_CMD_PERM_USER_EXEC, nullptr))
+ if(!f->chmod(get_gfile_attribute_uint32(f->gFile, G_FILE_ATTRIBUTE_UNIX_MODE) |
GNOME_CMD_PERM_USER_EXEC, nullptr))
{
return;
}
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index 900df199..4755b643 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -530,52 +530,13 @@ gboolean GnomeCmdFile::GetGfileAttributeBoolean(const char *attribute)
gchar *GnomeCmdFile::GetGfileAttributeString(const char *attribute)
{
- g_return_val_if_fail (gFile != nullptr, nullptr);
-
- GError *error;
- error = nullptr;
- auto gcmdFileInfo = g_file_query_info(this->gFile,
- attribute,
- G_FILE_QUERY_INFO_NONE,
- nullptr,
- &error);
- if (gcmdFileInfo && error)
- {
- g_message ("retrieving file info failed: %s", error->message);
- g_error_free (error);
- return nullptr;
- }
-
- auto gFileAttributeString = g_strdup(g_file_info_get_attribute_string (gcmdFileInfo, attribute));
- g_object_unref(gcmdFileInfo);
-
- return gFileAttributeString;
+ return get_gfile_attribute_string(this->gFile, attribute);
}
guint32 GnomeCmdFile::GetGfileAttributeUInt32(const char *attribute)
{
- GError *error;
- error = nullptr;
- guint32 gFileAttributeUInt32 = 0;
-
- auto gcmdFileInfo = g_file_query_info(this->gFile,
- attribute,
- G_FILE_QUERY_INFO_NONE,
- nullptr,
- &error);
- if (error)
- {
- g_message ("retrieving file info failed: %s", error->message);
- g_error_free (error);
- }
- else
- {
- gFileAttributeUInt32 = g_file_info_get_attribute_uint32 (gcmdFileInfo, attribute);
- g_object_unref(gcmdFileInfo);
- }
-
- return gFileAttributeUInt32;
+ return get_gfile_attribute_uint32(this->gFile, attribute);
}
diff --git a/src/utils.cc b/src/utils.cc
index 3ae3e6fe..d32cca54 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -1148,7 +1148,7 @@ gchar *string_double_underscores (const gchar *string)
return escaped;
}
-guint32 GetGfileAttributeUInt32(GFile *gFile, const char *attribute)
+guint32 get_gfile_attribute_uint32(GFile *gFile, const char *attribute)
{
GError *error;
error = nullptr;
@@ -1200,7 +1200,7 @@ gboolean get_gfile_attribute_boolean(GFile *gFile, const char *attribute)
}
-gchar *GetGfileAttributeString(GFile *gFile, const char *attribute)
+gchar *get_gfile_attribute_string(GFile *gFile, const char *attribute)
{
GError *error;
error = nullptr;
diff --git a/src/utils.h b/src/utils.h
index 638e8d2b..035ed336 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -415,6 +415,6 @@ gchar *string_double_underscores (const gchar *string);
gboolean get_gfile_attribute_boolean(GFile *gFile, const char *attribute);
-guint32 GetGfileAttributeUInt32(GFile *gFile, const char *attribute);
+guint32 get_gfile_attribute_uint32(GFile *gFile, const char *attribute);
-gchar *GetGfileAttributeString(GFile *gFile, const char *attribute);
+gchar *get_gfile_attribute_string(GFile *gFile, const char *attribute);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]