[network-manager-applet/lr/jtojnar-happy: 32/35] mobile-wizard: don't ask for plan name
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/jtojnar-happy: 32/35] mobile-wizard: don't ask for plan name
- Date: Fri, 26 Oct 2018 09:49:45 +0000 (UTC)
commit 7980103616ae85935857deeda13fdac2feccb8e2
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Mon Aug 27 19:20:59 2018 +0200
mobile-wizard: don't ask for plan name
We don't need it. All we need is the access technology and possibly an
APN name.
src/libnma/nma-mobile-wizard.c | 72 +++++++++++++++++++----------------------
src/libnma/nma-mobile-wizard.ui | 52 ++++-------------------------
src/mobile-helpers.c | 2 +-
3 files changed, 41 insertions(+), 85 deletions(-)
---
diff --git a/src/libnma/nma-mobile-wizard.c b/src/libnma/nma-mobile-wizard.c
index 78388586..cea92651 100644
--- a/src/libnma/nma-mobile-wizard.c
+++ b/src/libnma/nma-mobile-wizard.c
@@ -92,7 +92,6 @@ typedef struct {
GtkWidget *providers_view_radio;
GtkWidget *provider_unlisted_radio;
- GtkWidget *provider_unlisted_entry;
GtkWidget *provider_unlisted_type_combo;
gboolean provider_only_cdma;
@@ -140,7 +139,6 @@ assistant_closed (GtkButton *button, gpointer user_data)
if (family == NMA_MOBILE_FAMILY_UNKNOWN)
family = get_provider_unlisted_type (self);
- wiz_method->provider_name = g_strdup (gtk_entry_get_text (GTK_ENTRY
(priv->provider_unlisted_entry)));
if (family == NMA_MOBILE_FAMILY_3GPP)
wiz_method->gsm_apn = g_strdup (gtk_entry_get_text (GTK_ENTRY
(priv->plan_apn_entry)));
} else {
@@ -227,6 +225,7 @@ confirm_prepare (NMAMobileWizard *self)
NMAMobileWizardPrivate *priv = NMA_MOBILE_WIZARD_GET_PRIVATE (self);
NMAMobileProvider *provider = NULL;
NMAMobileAccessMethod *method = NULL;
+ const char *apn = NULL;
NMACountryInfo *country_info;
gboolean manual = FALSE;
GString *str;
@@ -241,10 +240,7 @@ confirm_prepare (NMAMobileWizard *self)
g_string_append (str, nma_mobile_provider_get_name (provider));
nma_mobile_provider_unref (provider);
} else {
- const char *unlisted_provider;
-
- unlisted_provider = gtk_entry_get_text (GTK_ENTRY (priv->provider_unlisted_entry));
- g_string_append (str, unlisted_provider);
+ g_string_append (str, _("Unlisted"));
}
country_info = get_selected_country (self);
@@ -253,11 +249,14 @@ confirm_prepare (NMAMobileWizard *self)
nma_country_info_unref (country_info);
gtk_label_set_text (GTK_LABEL (priv->confirm_provider), str->str);
+ gtk_widget_show (priv->confirm_provider);
g_string_free (str, TRUE);
- if (priv->dev_desc)
+ if (priv->dev_desc) {
gtk_label_set_text (GTK_LABEL (priv->confirm_device), priv->dev_desc);
- else {
+ gtk_widget_show (priv->confirm_device_label);
+ gtk_widget_show (priv->confirm_device);
+ } else {
gtk_widget_hide (priv->confirm_device_label);
gtk_widget_hide (priv->confirm_device);
}
@@ -265,27 +264,27 @@ confirm_prepare (NMAMobileWizard *self)
if (priv->provider_only_cdma) {
gtk_widget_hide (priv->confirm_plan_label);
gtk_widget_hide (priv->confirm_plan);
- gtk_widget_hide (priv->confirm_apn);
} else {
- const char *apn = NULL;
-
/* Plan */
gtk_widget_show (priv->confirm_plan_label);
gtk_widget_show (priv->confirm_plan);
- gtk_widget_show (priv->confirm_apn);
- if (method) {
+ if (method)
gtk_label_set_text (GTK_LABEL (priv->confirm_plan), nma_mobile_access_method_get_name
(method));
- apn = nma_mobile_access_method_get_3gpp_apn (method);
- } else {
+ else
gtk_label_set_text (GTK_LABEL (priv->confirm_plan), _("Unlisted"));
- apn = gtk_entry_get_text (GTK_ENTRY (priv->plan_apn_entry));
- }
+ apn = gtk_entry_get_text (GTK_ENTRY (priv->plan_apn_entry));
+ }
+
+ if (apn) {
str = g_string_new (NULL);
g_string_append_printf (str, "<span color=\"#999999\">APN: %s</span>", apn);
gtk_label_set_markup (GTK_LABEL (priv->confirm_apn), str->str);
g_string_free (str, TRUE);
+ gtk_widget_show (priv->confirm_apn);
+ } else {
+ gtk_widget_hide (priv->confirm_apn);
}
}
@@ -557,11 +556,7 @@ providers_update_complete (NMAMobileWizard *self)
if (provider)
nma_mobile_provider_unref (provider);
} else {
- const char *manual_provider;
-
- manual_provider = gtk_entry_get_text (GTK_ENTRY (priv->provider_unlisted_entry));
- gtk_assistant_set_page_complete (assistant, priv->providers_page,
- (manual_provider && strlen (manual_provider)));
+ gtk_assistant_set_page_complete (assistant, priv->providers_page, TRUE);
}
}
@@ -577,13 +572,13 @@ focus_providers_view (gpointer user_data)
}
static gboolean
-focus_provider_unlisted_entry (gpointer user_data)
+focus_provider_unlisted_type_combo (gpointer user_data)
{
NMAMobileWizard *self = user_data;
NMAMobileWizardPrivate *priv = NMA_MOBILE_WIZARD_GET_PRIVATE (self);
priv->providers_focus_id = 0;
- gtk_widget_grab_focus (priv->provider_unlisted_entry);
+ gtk_widget_grab_focus (priv->provider_unlisted_type_combo);
return FALSE;
}
@@ -599,13 +594,11 @@ providers_radio_toggled (GtkToggleButton *button, gpointer user_data)
if (!priv->providers_focus_id)
priv->providers_focus_id = g_idle_add (focus_providers_view, self);
gtk_widget_set_sensitive (priv->providers_view, TRUE);
- gtk_widget_set_sensitive (priv->provider_unlisted_entry, FALSE);
gtk_widget_set_sensitive (priv->provider_unlisted_type_combo, FALSE);
- } else {
+ } else if (priv->family == NMA_MOBILE_FAMILY_UNKNOWN) {
if (!priv->providers_focus_id)
- priv->providers_focus_id = g_idle_add (focus_provider_unlisted_entry, self);
+ priv->providers_focus_id = g_idle_add (focus_provider_unlisted_type_combo, self);
gtk_widget_set_sensitive (priv->providers_view, FALSE);
- gtk_widget_set_sensitive (priv->provider_unlisted_entry, TRUE);
gtk_widget_set_sensitive (priv->provider_unlisted_type_combo, TRUE);
}
@@ -649,9 +642,19 @@ providers_setup (NMAMobileWizard *self)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->providers_view));
g_assert (selection);
- /* Only show the CDMA/GSM combo if we don't know the device type */
- if (priv->family != NMA_MOBILE_FAMILY_UNKNOWN)
- gtk_widget_hide (priv->provider_unlisted_type_combo);
+ switch (priv->family) {
+ case NMA_MOBILE_FAMILY_3GPP:
+ gtk_combo_box_set_active (GTK_COMBO_BOX (priv->provider_unlisted_type_combo), 0);
+ gtk_widget_set_sensitive (priv->provider_unlisted_type_combo, FALSE);
+ break;
+ case NMA_MOBILE_FAMILY_CDMA:
+ gtk_combo_box_set_active (GTK_COMBO_BOX (priv->provider_unlisted_type_combo), 1);
+ gtk_widget_set_sensitive (priv->provider_unlisted_type_combo, FALSE);
+ break;
+ case NMA_MOBILE_FAMILY_UNKNOWN:
+ gtk_widget_set_sensitive (priv->provider_unlisted_type_combo, TRUE);
+ break;
+ }
}
static void
@@ -733,12 +736,6 @@ providers_prepare (NMAMobileWizard *self)
/* Initial completeness state */
providers_update_complete (self);
-
- /* If there's already a selected device, hide the GSM/CDMA radios */
- if (priv->family != NMA_MOBILE_FAMILY_UNKNOWN)
- gtk_widget_hide (priv->provider_unlisted_type_combo);
- else
- gtk_widget_show (priv->provider_unlisted_type_combo);
}
/**********************************************************/
@@ -1405,7 +1402,6 @@ nma_mobile_wizard_class_init (NMAMobileWizardClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, NMAMobileWizard, providers_view);
gtk_widget_class_bind_template_child_private (widget_class, NMAMobileWizard, provider_unlisted_radio);
gtk_widget_class_bind_template_child_private (widget_class, NMAMobileWizard,
provider_unlisted_type_combo);
- gtk_widget_class_bind_template_child_private (widget_class, NMAMobileWizard, provider_unlisted_entry);
gtk_widget_class_bind_template_child_private (widget_class, NMAMobileWizard, plan_page);
gtk_widget_class_bind_template_child_private (widget_class, NMAMobileWizard, plan_combo);
gtk_widget_class_bind_template_child_private (widget_class, NMAMobileWizard, plan_apn_entry);
diff --git a/src/libnma/nma-mobile-wizard.ui b/src/libnma/nma-mobile-wizard.ui
index 6326a512..ccda4026 100644
--- a/src/libnma/nma-mobile-wizard.ui
+++ b/src/libnma/nma-mobile-wizard.ui
@@ -301,55 +301,15 @@
</packing>
</child>
<child>
- <object class="GtkGrid">
+ <object class="GtkComboBoxText" id="provider_unlisted_type_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">25</property>
- <property name="row_spacing">12</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkComboBoxText" id="provider_unlisted_type_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="active">0</property>
- <items>
- <item id="0" translatable="yes">My provider uses GSM technology (GPRS, EDGE, UMTS,
HSPA)</item>
- <item id="1" translatable="yes">My provider uses CDMA technology (1xRTT, EVDO)</item>
- </items>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Provider:</property>
- <property name="mnemonic_widget">provider_unlisted_type_combo</property>
- <property name="xalign">1</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="provider_unlisted_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="width_chars">40</property>
- <signal name="changed" handler="providers_update_complete" swapped="yes"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
+ <property name="active">0</property>
+ <items>
+ <item id="0" translatable="yes">My provider uses GSM technology (GPRS, EDGE, UMTS, HSPA)</item>
+ <item id="1" translatable="yes">My provider uses CDMA technology (1xRTT, EVDO)</item>
+ </items>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/mobile-helpers.c b/src/mobile-helpers.c
index 9c1c965a..89b07ad9 100644
--- a/src/mobile-helpers.c
+++ b/src/mobile-helpers.c
@@ -265,7 +265,7 @@ mobile_helper_wizard (NMDeviceModemCapabilities capabilities,
NULL,
wizard_capability,
FALSE,
- mobile_wizard_done,
+ mobile_wizard_done,
info);
if (wizard) {
nma_mobile_wizard_present (wizard);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]