[gedit] commands-file: small refactorings in _gedit_cmd_file_open()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] commands-file: small refactorings in _gedit_cmd_file_open()
- Date: Fri, 5 Jun 2020 00:07:20 +0000 (UTC)
commit ecdb63cff58679de6af54461bcd33d76bfb53141
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 5 02:03:48 2020 +0200
commands-file: small refactorings in _gedit_cmd_file_open()
gedit/gedit-commands-file.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 94df6a6de..80deff8fd 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -369,7 +369,7 @@ open_dialog_response_cb (GeditFileChooserDialog *dialog,
{
GSList *files;
const GtkSourceEncoding *encoding;
- GSList *loaded;
+ GSList *loaded_files;
gedit_debug (DEBUG_COMMANDS);
@@ -397,8 +397,7 @@ open_dialog_response_cb (GeditFileChooserDialog *dialog,
if (window == NULL)
{
- window = gedit_app_create_window (GEDIT_APP (g_application_get_default ()),
- NULL);
+ window = gedit_app_create_window (GEDIT_APP (g_application_get_default ()), NULL);
gtk_widget_show (GTK_WIDGET (window));
gtk_window_present (GTK_WINDOW (window));
@@ -407,13 +406,9 @@ open_dialog_response_cb (GeditFileChooserDialog *dialog,
/* Remember the folder we navigated to */
_gedit_window_set_default_location (window, files->data);
- loaded = gedit_commands_load_locations (window,
- files,
- encoding,
- 0,
- 0);
+ loaded_files = gedit_commands_load_locations (window, files, encoding, 0, 0);
- g_slist_free (loaded);
+ g_slist_free (loaded_files);
g_slist_free_full (files, g_object_unref);
}
@@ -453,10 +448,11 @@ _gedit_cmd_file_open (GSimpleAction *action,
if (window != NULL)
{
GeditDocument *doc;
- GFile *default_path = NULL;
+ GFile *default_folder = NULL;
/* The file chooser dialog for opening files is not modal, so
- * ensure that at most one file chooser is opened.
+ * ensure that at most one file chooser is opened per main
+ * window.
*/
g_object_set_data_full (G_OBJECT (window),
GEDIT_OPEN_DIALOG_KEY,
@@ -473,19 +469,19 @@ _gedit_cmd_file_open (GSimpleAction *action,
if (location != NULL)
{
- default_path = g_file_get_parent (location);
+ default_folder = g_file_get_parent (location);
}
}
- if (default_path == NULL)
+ if (default_folder == NULL)
{
- default_path = _gedit_window_get_default_location (window);
+ default_folder = _gedit_window_get_default_location (window);
}
- if (default_path != NULL)
+ if (default_folder != NULL)
{
- gedit_file_chooser_dialog_set_current_folder (open_dialog, default_path);
- g_object_unref (default_path);
+ gedit_file_chooser_dialog_set_current_folder (open_dialog, default_folder);
+ g_object_unref (default_folder);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]