From 3a6d7676eb4c3fe5f55be308ca473fa51b52d2f7 Mon Sep 17 00:00:00 2001 From: MShrimp4 Date: Wed, 16 Feb 2022 09:18:13 +0900 Subject: [PATCH 1/2] Remove dependence on exo_str_is_equal(), exo_str_looks_like_an_uri() Related: exo #82 exo_str_is_equal => g_strcmp0 () == 0 exo_str_looks_like_an_uri => g_uri_is_valid (uri, G_URI_FLAGS_NONE, NULL) --- exo-desktop-item-edit/exo-die-editor.c | 12 ++++++------ exo-desktop-item-edit/main.c | 4 ++-- exo-open/main.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/exo-desktop-item-edit/exo-die-editor.c b/exo-desktop-item-edit/exo-die-editor.c index 6b4c3fe0..ada24ea5 100644 --- a/exo-desktop-item-edit/exo-die-editor.c +++ b/exo-desktop-item-edit/exo-die-editor.c @@ -963,7 +963,7 @@ exo_die_editor_set_name (ExoDieEditor *editor, g_return_if_fail (g_utf8_validate (name, -1, NULL)); /* check if we have a new name */ - if (!exo_str_is_equal (editor->name, name)) + if (g_strcmp0 (editor->name, name) != 0) { /* apply the new name */ g_free (editor->name); @@ -1009,7 +1009,7 @@ exo_die_editor_set_comment (ExoDieEditor *editor, g_return_if_fail (g_utf8_validate (comment, -1, NULL)); /* check if we have a new comment here */ - if (!exo_str_is_equal (editor->comment, comment)) + if (g_strcmp0 (editor->comment, comment) != 0) { /* apply the new comment */ g_free (editor->comment); @@ -1055,7 +1055,7 @@ exo_die_editor_set_command (ExoDieEditor *editor, g_return_if_fail (g_utf8_validate (command, -1, NULL)); /* check if we have a new command here */ - if (!exo_str_is_equal (editor->command, command)) + if (g_strcmp0 (editor->command, command) != 0) { /* apply the new command */ g_free (editor->command); @@ -1102,7 +1102,7 @@ exo_die_editor_set_url (ExoDieEditor *editor, g_return_if_fail (g_utf8_validate (url, -1, NULL)); /* check if we have a new URL here */ - if (!exo_str_is_equal (editor->url, url)) + if (g_strcmp0 (editor->url, url) != 0) { /* apply the new URL */ g_free (editor->url); @@ -1149,7 +1149,7 @@ exo_die_editor_set_path (ExoDieEditor *editor, g_return_if_fail (g_utf8_validate (path, -1, NULL)); /* check if we have a new URL here */ - if (!exo_str_is_equal (editor->path, path)) + if (g_strcmp0 (editor->path, path) != 0) { /* apply the new URL */ g_free (editor->path); @@ -1202,7 +1202,7 @@ exo_die_editor_set_icon (ExoDieEditor *editor, g_return_if_fail (g_utf8_validate (icon, -1, NULL)); /* check if we have a new icon here */ - if (!exo_str_is_equal (editor->icon, icon)) + if (g_strcmp0 (editor->icon, icon) != 0) { /* apply the new icon */ g_free (editor->icon); diff --git a/exo-desktop-item-edit/main.c b/exo-desktop-item-edit/main.c index 6af5aa9f..2a41a4a3 100644 --- a/exo-desktop-item-edit/main.c +++ b/exo-desktop-item-edit/main.c @@ -241,14 +241,14 @@ main (int argc, char **argv) G_KEY_FILE_DESKTOP_KEY_COMMENT, STR_FB (opt_comment, "")); /* type specific stuff */ - if (exo_str_is_equal (opt_type, G_KEY_FILE_DESKTOP_TYPE_LINK)) + if (g_strcmp0 (opt_type, G_KEY_FILE_DESKTOP_TYPE_LINK) == 0) { g_key_file_set_value (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, STR_FB (opt_icon, "user-bookmarks")); g_key_file_set_value (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_URL, STR_FB (opt_url, "")); } - else if (exo_str_is_equal (opt_type, G_KEY_FILE_DESKTOP_TYPE_DIRECTORY)) + else if (g_strcmp0 (opt_type, G_KEY_FILE_DESKTOP_TYPE_DIRECTORY) == 0) { g_key_file_set_value (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, STR_FB (opt_icon, "")); diff --git a/exo-open/main.c b/exo-open/main.c index 00179736..bf9b8544 100644 --- a/exo-open/main.c +++ b/exo-open/main.c @@ -383,7 +383,7 @@ exo_open_find_scheme (const gchar *string) /* regular expression to check if it looks like an url, we don't need to check * for a complete url (http://) because this is already matched by the - * exo_str_looks_like_an_uri() test */ + * g_uri_is_valid () test */ if (g_regex_match_simple (MATCH_PATTERN_HTTP, string, G_REGEX_CASELESS, 0)) return g_strconcat ("http://", string, NULL); @@ -681,7 +681,7 @@ main (gint argc, gchar **argv) /* successfully launched a desktop file */ continue; } - else if (exo_str_looks_like_an_uri (*argv)) + else if (g_uri_is_valid (*argv, G_URI_FLAGS_NONE, NULL)) { /* use the argument directly */ uri = g_strdup (*argv); -- GitLab From 7fdf15689d3cca88a69dc545950c80424b3ff0ac Mon Sep 17 00:00:00 2001 From: MShrimp4 Date: Wed, 18 May 2022 12:04:16 +0900 Subject: [PATCH 2/2] Remove another occurrence of exo_str_looks_like_an_uri() --- exo-open/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exo-open/main.c b/exo-open/main.c index bf9b8544..68493369 100644 --- a/exo-open/main.c +++ b/exo-open/main.c @@ -289,7 +289,7 @@ exo_open_launch_desktop_file (const gchar *arg) G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_URL, NULL); - if (!exo_str_looks_like_an_uri (link)) + if (!g_uri_is_valid (link, G_URI_FLAGS_NONE, NULL)) { parent = g_file_get_parent (gfile); file_dir = g_file_get_path (parent); -- GitLab