summaryrefslogtreecommitdiff
path: root/pluma/pluma-utils.c
diff options
context:
space:
mode:
authorLaurent Napias <[email protected]>2019-06-29 10:29:13 +0200
committerZenWalker <[email protected]>2019-07-06 21:46:58 +0200
commitdb655f3fb2f67b695d36369e584fcb598e0e1bea (patch)
treeff7a4404cb6f0d1d8ca3a08ee50c60641641f1b4 /pluma/pluma-utils.c
parent5153fb08a2e26015d07e7b3805de15d38bd05a9d (diff)
downloadpluma-db655f3fb2f67b695d36369e584fcb598e0e1bea.tar.bz2
pluma-db655f3fb2f67b695d36369e584fcb598e0e1bea.tar.xz
Remove trailing whitespaces
Diffstat (limited to 'pluma/pluma-utils.c')
-rw-r--r--pluma/pluma-utils.c178
1 files changed, 89 insertions, 89 deletions
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c
index a7216955..905b8f53 100644
--- a/pluma/pluma-utils.c
+++ b/pluma/pluma-utils.c
@@ -3,8 +3,8 @@
* This file is part of pluma
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
- * Copyright (C) 2000, 2002 Chema Celorio, Paolo Maggi
- * Copyright (C) 2003-2005 Paolo Maggi
+ * Copyright (C) 2000, 2002 Chema Celorio, Paolo Maggi
+ * Copyright (C) 2003-2005 Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,14 +18,14 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
-
+
/*
- * Modified by the pluma Team, 1998-2005. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
+ * Modified by the pluma Team, 1998-2005. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
*
* $Id$
*/
@@ -74,7 +74,7 @@ pluma_utils_uri_has_file_scheme (const gchar *uri)
gfile = g_file_new_for_uri (uri);
res = g_file_has_uri_scheme (gfile, "file");
-
+
g_object_unref (gfile);
return res;
}
@@ -227,7 +227,7 @@ pluma_dialog_add_button (GtkDialog *dialog,
gtk_widget_show (button);
- gtk_dialog_add_action_widget (dialog, button, response_id);
+ gtk_dialog_add_action_widget (dialog, button, response_id);
return button;
}
@@ -235,7 +235,7 @@ pluma_dialog_add_button (GtkDialog *dialog,
/*
* n: len of the string in bytes
*/
-gboolean
+gboolean
g_utf8_caselessnmatch (const char *s1, const char *s2, gssize n1, gssize n2)
{
gchar *casefold;
@@ -265,10 +265,10 @@ g_utf8_caselessnmatch (const char *s1, const char *s2, gssize n1, gssize n2)
goto finally_2;
ret = (strncmp (normalized_s1, normalized_s2, len_s2) == 0);
-
+
finally_2:
g_free (normalized_s1);
- g_free (normalized_s2);
+ g_free (normalized_s2);
return ret;
}
@@ -283,7 +283,7 @@ finally_2:
* for a specified gtk widget.
*/
void
-pluma_utils_set_atk_name_description (GtkWidget *widget,
+pluma_utils_set_atk_name_description (GtkWidget *widget,
const gchar *name,
const gchar *description)
{
@@ -311,8 +311,8 @@ pluma_utils_set_atk_name_description (GtkWidget *widget,
* between 2 specified widgets.
*/
void
-pluma_utils_set_atk_relation (GtkWidget *obj1,
- GtkWidget *obj2,
+pluma_utils_set_atk_relation (GtkWidget *obj1,
+ GtkWidget *obj2,
AtkRelationType rel_type )
{
AtkObject *atk_obj1, *atk_obj2;
@@ -340,9 +340,9 @@ pluma_utils_uri_exists (const gchar* text_uri)
{
GFile *gfile;
gboolean res;
-
+
g_return_val_if_fail (text_uri != NULL, FALSE);
-
+
pluma_debug_message (DEBUG_UTILS, "text_uri: %s", text_uri);
gfile = g_file_new_for_uri (text_uri);
@@ -420,7 +420,7 @@ pluma_utils_unescape_search_text (const gchar *text)
const gchar *cur;
const gchar *end;
const gchar *prev;
-
+
if (text == NULL)
return NULL;
@@ -431,15 +431,15 @@ pluma_utils_unescape_search_text (const gchar *text)
cur = text;
end = text + length;
prev = NULL;
-
- while (cur != end)
+
+ while (cur != end)
{
const gchar *next;
next = g_utf8_next_char (cur);
- if (prev && (*prev == '\\'))
+ if (prev && (*prev == '\\'))
{
- switch (*cur)
+ switch (*cur)
{
case 'n':
str = g_string_append (str, "\n");
@@ -459,21 +459,21 @@ pluma_utils_unescape_search_text (const gchar *text)
str = g_string_append_len (str, cur, next - cur);
break;
}
- }
- else if (*cur != '\\')
+ }
+ else if (*cur != '\\')
{
str = g_string_append_len (str, cur, next - cur);
- }
- else if ((next == end) && (*cur == '\\'))
+ }
+ else if ((next == end) && (*cur == '\\'))
{
str = g_string_append (str, "\\");
}
-
+
if (!drop_prev)
{
prev = cur;
}
- else
+ else
{
prev = NULL;
drop_prev = FALSE;
@@ -485,19 +485,19 @@ pluma_utils_unescape_search_text (const gchar *text)
return g_string_free (str, FALSE);
}
-void
+void
pluma_warning (GtkWindow *parent, const gchar *format, ...)
{
va_list args;
gchar *str;
GtkWidget *dialog;
GtkWindowGroup *wg = NULL;
-
+
g_return_if_fail (format != NULL);
if (parent != NULL)
wg = gtk_window_get_group (parent);
-
+
va_start (args, format);
str = g_strdup_vprintf (format, args);
va_end (args);
@@ -513,7 +513,7 @@ pluma_warning (GtkWindow *parent, const gchar *format, ...)
if (wg != NULL)
gtk_window_group_add_window (wg, GTK_WINDOW (dialog));
-
+
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
@@ -522,14 +522,14 @@ pluma_warning (GtkWindow *parent, const gchar *format, ...)
"response",
G_CALLBACK (gtk_widget_destroy),
NULL);
-
+
gtk_widget_show (dialog);
}
/*
* Doubles underscore to avoid spurious menu accels.
*/
-gchar *
+gchar *
pluma_utils_escape_underscores (const gchar* text,
gssize length)
{
@@ -623,7 +623,7 @@ pluma_utils_str_truncate (const gchar *string,
g_utf8_offset_to_pointer (string, num_left_chars) - string);
g_string_append (truncated, delimiter);
}
-
+
return g_string_free (truncated, FALSE);
}
@@ -676,7 +676,7 @@ pluma_utils_make_valid_utf8 (const char *name)
}
g_string_append (string, remainder);
-
+
g_assert (g_utf8_validate (string->str, -1, NULL));
return g_string_free (string, FALSE);
@@ -702,14 +702,14 @@ pluma_utils_uri_get_dirname (const gchar *uri)
if ((strlen (str) == 1) && (*str == '.'))
{
g_free (str);
-
+
return NULL;
}
res = pluma_utils_replace_home_dir_with_tilde (str);
g_free (str);
-
+
return res;
}
@@ -808,7 +808,7 @@ pluma_utils_replace_home_dir_with_tilde (const gchar *uri)
if (strcmp (uri, home) == 0)
{
g_free (home);
-
+
return g_strdup ("~");
}
@@ -823,8 +823,8 @@ pluma_utils_replace_home_dir_with_tilde (const gchar *uri)
res = g_strdup_printf ("~/%s", uri + strlen (home));
g_free (home);
-
- return res;
+
+ return res;
}
g_free (home);
@@ -1040,7 +1040,7 @@ pluma_utils_is_valid_uri (const gchar *uri)
if (!g_ascii_isxdigit (*p))
return FALSE;
- ++p;
+ ++p;
if (!g_ascii_isxdigit (*p))
return FALSE;
}
@@ -1127,12 +1127,12 @@ pluma_utils_get_ui_objects (const gchar *filename,
*error_widget = NULL;
builder = gtk_builder_new ();
-
+
if (root_objects != NULL)
{
- gtk_builder_add_objects_from_file (builder,
- filename,
- root_objects,
+ gtk_builder_add_objects_from_file (builder,
+ filename,
+ root_objects,
&error);
}
else
@@ -1164,8 +1164,8 @@ pluma_utils_get_ui_objects (const gchar *filename,
if (!*gobj)
{
- *error_widget = handle_builder_error (_("Unable to find the object '%s' inside file %s."),
- name,
+ *error_widget = handle_builder_error (_("Unable to find the object '%s' inside file %s."),
+ name,
filename_markup),
ret = FALSE;
break;
@@ -1196,25 +1196,25 @@ pluma_utils_get_ui_objects (const gchar *filename,
gchar *
pluma_utils_make_canonical_uri_from_shell_arg (const gchar *str)
-{
+{
GFile *gfile;
gchar *uri;
g_return_val_if_fail (str != NULL, NULL);
g_return_val_if_fail (*str != '\0', NULL);
-
- /* Note for the future:
+
+ /* Note for the future:
* FIXME: is still still relevant?
*
- * <federico> paolo: and flame whoever tells
- * you that file:///mate/test_files/hëllò
+ * <federico> paolo: and flame whoever tells
+ * you that file:///mate/test_files/hëllò
* doesn't work --- that's not a valid URI
*
- * <paolo> federico: well, another solution that
- * does not requires patch to _from_shell_args
- * is to check that the string returned by it
+ * <paolo> federico: well, another solution that
+ * does not requires patch to _from_shell_args
+ * is to check that the string returned by it
* contains only ASCII chars
- * <federico> paolo: hmmmm, isn't there
+ * <federico> paolo: hmmmm, isn't there
* mate_vfs_is_uri_valid() or something?
* <paolo>: I will use pluma_utils_is_valid_uri ()
*
@@ -1226,7 +1226,7 @@ pluma_utils_make_canonical_uri_from_shell_arg (const gchar *str)
if (pluma_utils_is_valid_uri (uri))
return uri;
-
+
g_free (uri);
return NULL;
}
@@ -1243,13 +1243,13 @@ pluma_utils_file_has_parent (GFile *gfile)
{
GFile *parent;
gboolean ret;
-
+
parent = g_file_get_parent (gfile);
ret = parent != NULL;
-
+
if (parent)
g_object_unref (parent);
-
+
return ret;
}
@@ -1275,9 +1275,9 @@ pluma_utils_basename_for_display (gchar const *uri)
{
GFileInfo *info;
info = g_file_query_info (gfile,
- G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
- G_FILE_QUERY_INFO_NONE,
- NULL,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
NULL);
if (info)
@@ -1291,7 +1291,7 @@ pluma_utils_basename_for_display (gchar const *uri)
/* This is a local file, and therefore we will use
* g_filename_display_basename on the local path */
gchar *local_path;
-
+
local_path = g_file_get_path (gfile);
name = g_filename_display_basename (local_path);
g_free (local_path);
@@ -1308,8 +1308,8 @@ pluma_utils_basename_for_display (gchar const *uri)
parse_name = g_file_get_parse_name (gfile);
base = g_filename_display_basename (parse_name);
name = g_uri_unescape_string (base, NULL);
-
- g_free (base);
+
+ g_free (base);
g_free (parse_name);
}
else
@@ -1341,7 +1341,7 @@ pluma_utils_basename_for_display (gchar const *uri)
*
* Filter, modify, unescape and change @uri to make it appropriate
* for display to users.
- *
+ *
* This function is a convenient wrapper for g_file_get_parse_name
*
* Return value: a string which represents @uri and can be displayed.
@@ -1364,9 +1364,9 @@ pluma_utils_uri_for_display (const gchar *uri)
* @selection_data: the #GtkSelectionData from drag_data_received
*
* Create a list of valid uri's from a uri-list drop.
- *
+ *
* Return value: (transfer full): a string array which will hold the uris or %NULL if there
- * were no valid uris. g_strfreev should be used when the
+ * were no valid uris. g_strfreev should be used when the
* string array is no longer used
*/
gchar **
@@ -1383,9 +1383,9 @@ pluma_utils_drop_get_uris (GtkSelectionData *selection_data)
for (i = 0; uris[i] != NULL; i++)
{
gchar *uri;
-
+
uri = pluma_utils_make_canonical_uri_from_shell_arg (uris[i]);
-
+
/* Silently ignore malformed URI/filename */
if (uri != NULL)
uri_list[p++] = uri;
@@ -1423,7 +1423,7 @@ null_ptr (gchar **ptr)
* scheme, user info, port, host and path. The return value pointer can be
* %NULL to ignore certain parts of the uri. If the function returns %TRUE, then
* all return value pointers should be freed using g_free
- *
+ *
* Return value: %TRUE if the uri could be properly decoded, %FALSE otherwise.
*/
gboolean
@@ -1435,7 +1435,7 @@ pluma_utils_decode_uri (const gchar *uri,
gchar **path
)
{
- /* Largely copied from glib/gio/gdummyfile.c:_g_decode_uri. This
+ /* Largely copied from glib/gio/gdummyfile.c:_g_decode_uri. This
* functionality should be in glib/gio, but for now we implement it
* ourselves (see bug #546182) */
@@ -1445,10 +1445,10 @@ pluma_utils_decode_uri (const gchar *uri,
/* From RFC 3986 Decodes:
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
- */
+ */
p = uri;
-
+
null_ptr (scheme);
null_ptr (user);
null_ptr (port);
@@ -1475,32 +1475,32 @@ pluma_utils_decode_uri (const gchar *uri,
c == '.'))
return FALSE;
}
-
+
if (scheme)
{
*scheme = g_malloc (p - uri);
out = *scheme;
-
+
for (in = uri; in < p - 1; in++)
*out++ = g_ascii_tolower (*in);
-
+
*out = '\0';
}
-
+
hier_part_start = p;
hier_part_end = p + strlen (p);
-
+
if (hier_part_start[0] == '/' && hier_part_start[1] == '/')
{
const char *authority_start, *authority_end;
const char *userinfo_start, *userinfo_end;
const char *host_start, *host_end;
const char *port_start;
-
+
authority_start = hier_part_start + 2;
/* authority is always followed by / or nothing */
authority_end = memchr (authority_start, '/', hier_part_end - authority_start);
-
+
if (authority_end == NULL)
authority_end = hier_part_end;
@@ -1509,14 +1509,14 @@ pluma_utils_decode_uri (const gchar *uri,
*/
userinfo_end = memchr (authority_start, '@', authority_end - authority_start);
-
+
if (userinfo_end)
{
userinfo_start = authority_start;
-
+
if (user)
*user = g_uri_unescape_segment (userinfo_start, userinfo_end, NULL);
-
+
if (user && *user == NULL)
{
if (scheme)
@@ -1524,7 +1524,7 @@ pluma_utils_decode_uri (const gchar *uri,
return FALSE;
}
-
+
host_start = userinfo_end + 1;
}
else
@@ -1550,7 +1550,7 @@ pluma_utils_decode_uri (const gchar *uri,
if (path)
*path = g_uri_unescape_segment (hier_part_start, hier_part_end, "/");
-
+
return TRUE;
}