[gnome-control-center] removable-media: Replace custom function with standard g_strv_contains
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] removable-media: Replace custom function with standard g_strv_contains
- Date: Mon, 28 Oct 2019 21:25:45 +0000 (UTC)
commit 6a4c7847e4351fbd07edfdb15b82fe192e182ee4
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Sep 26 11:09:53 2019 +1200
removable-media: Replace custom function with standard g_strv_contains
It was added to GLib 2.44
panels/removable-media/cc-removable-media-panel.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
---
diff --git a/panels/removable-media/cc-removable-media-panel.c
b/panels/removable-media/cc-removable-media-panel.c
index cbd3efb12..57591719a 100644
--- a/panels/removable-media/cc-removable-media-panel.c
+++ b/panels/removable-media/cc-removable-media-panel.c
@@ -140,23 +140,6 @@ add_elem_to_str_array (char **v,
return (char **) g_ptr_array_free (array, FALSE);
}
-static int
-media_panel_g_strv_find (char **strv,
- const char *find_me)
-{
- guint index;
-
- g_return_val_if_fail (find_me != NULL, -1);
-
- for (index = 0; strv[index] != NULL; ++index) {
- if (g_strcmp0 (strv[index], find_me) == 0) {
- return index;
- }
- }
-
- return -1;
-}
-
static void
autorun_get_preferences (CcRemovableMediaPanel *self,
const char *x_content_type,
@@ -182,13 +165,13 @@ autorun_get_preferences (CcRemovableMediaPanel *self,
x_content_open_folder = g_settings_get_strv (self->media_settings,
PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
if (x_content_start_app != NULL) {
- *pref_start_app = media_panel_g_strv_find (x_content_start_app, x_content_type) != -1;
+ *pref_start_app = g_strv_contains ((const gchar * const *) x_content_start_app, x_content_type);
}
if (x_content_ignore != NULL) {
- *pref_ignore = media_panel_g_strv_find (x_content_ignore, x_content_type) != -1;
+ *pref_ignore = g_strv_contains ((const gchar * const *) x_content_ignore, x_content_type);
}
if (x_content_open_folder != NULL) {
- *pref_open_folder = media_panel_g_strv_find (x_content_open_folder, x_content_type) != -1;
+ *pref_open_folder = g_strv_contains ((const gchar * const *) x_content_open_folder, x_content_type);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]