diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2023-11-02 15:07:39 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2023-12-12 11:31:06 +0000 |
commit | 5a57c07b217a35a263616c165ea8a9269de27583 (patch) | |
tree | 35115d71b80c9e4a433f39b03126830ceab55291 /src | |
parent | c592cde3f0e09a1538ec062dfdeff20f8a10ea88 (diff) |
iface-modem-3gpp-profile-manager: reorder code
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-3gpp-profile-manager.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/mm-iface-modem-3gpp-profile-manager.c b/src/mm-iface-modem-3gpp-profile-manager.c index 94130794..b5f9a2bc 100644 --- a/src/mm-iface-modem-3gpp-profile-manager.c +++ b/src/mm-iface-modem-3gpp-profile-manager.c @@ -125,47 +125,6 @@ mm_iface_modem_3gpp_profile_manager_updated (MMIfaceModem3gppProfileManager *sel priv->updated_timeout_source = g_timeout_add_seconds (UPDATED_TIMEOUT_SECS, (GSourceFunc) profile_manager_updated_emit, self); } -static gboolean -profile_manager_fail_if_connected_bearer (MMIfaceModem3gppProfileManager *self, - const gchar *index_field, - gint profile_id, - MMBearerApnType apn_type, - GError **error) -{ - g_autoptr(MMBearerList) bearer_list = NULL; - g_autoptr(MMBaseBearer) bearer = NULL; - - g_object_get (self, MM_IFACE_MODEM_BEARER_LIST, &bearer_list, NULL); - if (bearer_list) { - if (g_strcmp0 (index_field, "profile-id") == 0) - bearer = mm_bearer_list_find_by_profile_id (bearer_list, profile_id); - else if (g_strcmp0 (index_field, "apn-type") == 0) - bearer = mm_bearer_list_find_by_apn_type (bearer_list, apn_type); - else - g_assert_not_reached (); - } - - /* If a bearer is found reporting the profile id we're targeting to use, - * it means we have a known connected bearer, and we must abort the - * operation right away. */ - if (bearer) { - if (g_strcmp0 (index_field, "profile-id") == 0) { - g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_CONNECTED, - "Cannot use profile %d: found an already connected bearer", profile_id); - } else if (g_strcmp0 (index_field, "apn-type") == 0) { - g_autofree gchar *apn_type_str = NULL; - - apn_type_str = mm_bearer_apn_type_build_string_from_mask (apn_type); - g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_CONNECTED, - "Cannot use profile %s: found an already connected bearer", apn_type_str); - } else - g_assert_not_reached (); - return FALSE; - } - - return TRUE; -} - /*****************************************************************************/ /* Set profile (3GPP profile management interface) */ @@ -391,6 +350,47 @@ profile_manager_check_activated_profile_ready (MMIfaceModem3gppProfileManager *s set_profile_step (task); } +static gboolean +profile_manager_fail_if_connected_bearer (MMIfaceModem3gppProfileManager *self, + const gchar *index_field, + gint profile_id, + MMBearerApnType apn_type, + GError **error) +{ + g_autoptr(MMBearerList) bearer_list = NULL; + g_autoptr(MMBaseBearer) bearer = NULL; + + g_object_get (self, MM_IFACE_MODEM_BEARER_LIST, &bearer_list, NULL); + if (bearer_list) { + if (g_strcmp0 (index_field, "profile-id") == 0) + bearer = mm_bearer_list_find_by_profile_id (bearer_list, profile_id); + else if (g_strcmp0 (index_field, "apn-type") == 0) + bearer = mm_bearer_list_find_by_apn_type (bearer_list, apn_type); + else + g_assert_not_reached (); + } + + /* If a bearer is found reporting the profile id we're targeting to use, + * it means we have a known connected bearer, and we must abort the + * operation right away. */ + if (bearer) { + if (g_strcmp0 (index_field, "profile-id") == 0) { + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_CONNECTED, + "Cannot use profile %d: found an already connected bearer", profile_id); + } else if (g_strcmp0 (index_field, "apn-type") == 0) { + g_autofree gchar *apn_type_str = NULL; + + apn_type_str = mm_bearer_apn_type_build_string_from_mask (apn_type); + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_CONNECTED, + "Cannot use profile %s: found an already connected bearer", apn_type_str); + } else + g_assert_not_reached (); + return FALSE; + } + + return TRUE; +} + static void set_profile_step_check_activated_profile (GTask *task) { |