Commit a7b1188e authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther

wwaninfo: Only show wwan icon if a modem is present

Closes: #64Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent 3a0e8eab
Pipeline #49907 passed with stages
in 17 minutes and 23 seconds
......@@ -116,7 +116,7 @@
<property name="margin_top">24</property>
<child>
<object class="PhoshWWanInfo" id="wwaninfo">
<property name="visible">True</property>
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="halign">end</property>
......
......@@ -22,7 +22,7 @@
<property name="can_focus">False</property>
<child>
<object class="PhoshWWanInfo" id="wwaninfo">
<property name="visible">True</property>
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="margin-left">0</property>
<property name="size">16</property>
......
......@@ -190,9 +190,12 @@ update_icon_data(PhoshWWanInfo *self, GParamSpec *psepc, PhoshWWanMM *wwan)
g_autoptr(GdkPixbuf) src = NULL, dest = NULL;
g_autofree gchar *icon_name = NULL;
const char *access_tec;
gboolean visible;
g_debug ("Updating wwan icon");
g_return_if_fail (PHOSH_IS_WWAN_INFO (self));
visible = phosh_wwan_is_present (PHOSH_WWAN (self->wwan));
g_debug ("Updating wwan icon, shown: %d", visible);
gtk_widget_set_visible (GTK_WIDGET (self), visible);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET(self)));
/* SIM missing */
......@@ -226,6 +229,14 @@ update_icon_data(PhoshWWanInfo *self, GParamSpec *psepc, PhoshWWanMM *wwan)
}
static gboolean
on_idle (PhoshWWanInfo *self)
{
update_icon_data (self, NULL, NULL);
return FALSE;
}
static void
phosh_wwan_info_constructed (GObject *object)
{
......@@ -234,6 +245,7 @@ phosh_wwan_info_constructed (GObject *object)
"notify::access-tec",
"notify::unlocked",
"notify::sim",
"notify::present",
NULL,
};
......@@ -250,8 +262,7 @@ phosh_wwan_info_constructed (GObject *object)
G_CALLBACK (update_icon_data),
self);
}
update_icon_data (self, NULL, NULL);
g_idle_add ((GSourceFunc) on_idle, self);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment