[gedit] Small refactoring
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Small refactoring
- Date: Sat, 22 Dec 2012 18:19:49 +0000 (UTC)
commit 40948fce3e559c99640aaea866fef588b83241d1
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Dec 22 19:18:13 2012 +0100
Small refactoring
Use "continue" to avoid one level of indentation
gedit/gedit-commands-file.c | 76 ++++++++++++++++++++++---------------------
1 files changed, 39 insertions(+), 37 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index a2c5daf..a47667c 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -128,12 +128,12 @@ load_file_list (GeditWindow *window,
gint column_pos,
gboolean create)
{
- GeditTab *tab;
- GSList *loaded_files = NULL; /* Number of files to load */
- gboolean jump_to = TRUE; /* Whether to jump to the new tab */
- GList *win_docs;
- GSList *files_to_load = NULL;
- const GSList *l;
+ GeditTab *tab;
+ GSList *loaded_files = NULL; /* Number of files to load */
+ gboolean jump_to = TRUE; /* Whether to jump to the new tab */
+ GList *win_docs;
+ GSList *files_to_load = NULL;
+ const GSList *l;
gint num_loaded_files = 0;
gedit_debug (DEBUG_COMMANDS);
@@ -144,45 +144,47 @@ load_file_list (GeditWindow *window,
* in "window" and remove duplicates from "uris" list */
for (l = files; l != NULL; l = l->next)
{
- if (!is_duplicated_file (files_to_load, l->data))
+ if (is_duplicated_file (files_to_load, l->data))
+ {
+ continue;
+ }
+
+ tab = get_tab_from_file (win_docs, l->data);
+ if (tab != NULL)
{
- tab = get_tab_from_file (win_docs, l->data);
- if (tab != NULL)
+ if (l == files)
{
- if (l == files)
- {
- GeditDocument *doc;
+ GeditDocument *doc;
- gedit_window_set_active_tab (window, tab);
- jump_to = FALSE;
- doc = gedit_tab_get_document (tab);
+ gedit_window_set_active_tab (window, tab);
+ jump_to = FALSE;
+ doc = gedit_tab_get_document (tab);
- if (line_pos > 0)
+ if (line_pos > 0)
+ {
+ if (column_pos > 0)
{
- if (column_pos > 0)
- {
- gedit_document_goto_line_offset (doc,
- line_pos - 1,
- column_pos - 1);
- }
- else
- {
- gedit_document_goto_line (doc, line_pos - 1);
- }
-
- gedit_view_scroll_to_cursor (gedit_tab_get_view (tab));
+ gedit_document_goto_line_offset (doc,
+ line_pos - 1,
+ column_pos - 1);
+ }
+ else
+ {
+ gedit_document_goto_line (doc, line_pos - 1);
}
- }
- ++num_loaded_files;
- loaded_files = g_slist_prepend (loaded_files,
- gedit_tab_get_document (tab));
- }
- else
- {
- files_to_load = g_slist_prepend (files_to_load,
- l->data);
+ gedit_view_scroll_to_cursor (gedit_tab_get_view (tab));
+ }
}
+
+ ++num_loaded_files;
+ loaded_files = g_slist_prepend (loaded_files,
+ gedit_tab_get_document (tab));
+ }
+ else
+ {
+ files_to_load = g_slist_prepend (files_to_load,
+ l->data);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]