mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-12 15:47:35 +00:00
MainWindow: show error message when making calls isn't possible
This commit is contained in:
parent
f63936d772
commit
a9bd1ebae6
3 changed files with 66 additions and 0 deletions
|
@ -56,6 +56,9 @@ struct _CallsMainWindow
|
||||||
HdyViewSwitcherBar *switcher_bar;
|
HdyViewSwitcherBar *switcher_bar;
|
||||||
GtkStack *main_stack;
|
GtkStack *main_stack;
|
||||||
|
|
||||||
|
GtkRevealer *permanent_error_revealer;
|
||||||
|
GtkLabel *permanent_error_label;
|
||||||
|
|
||||||
CallsNewCallBox *new_call;
|
CallsNewCallBox *new_call;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,6 +161,36 @@ set_property (GObject *object,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
state_changed_cb (CallsMainWindow *self,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
CallsManager *manager)
|
||||||
|
{
|
||||||
|
const gchar *error = NULL;
|
||||||
|
switch (calls_manager_get_state (manager))
|
||||||
|
{
|
||||||
|
case CALLS_MANAGER_STATE_READY:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CALLS_MANAGER_STATE_NO_ORIGIN:
|
||||||
|
error = _("Can't place calls: No SIM card");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CALLS_MANAGER_STATE_UNKNOWN:
|
||||||
|
case CALLS_MANAGER_STATE_NO_PROVIDER:
|
||||||
|
error = _("Can't place calls: No backend service");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CALLS_MANAGER_STATE_NO_PLUGIN:
|
||||||
|
error = _("Can't place calls: No plugin");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_label_set_text (self->permanent_error_label, error);
|
||||||
|
gtk_revealer_set_reveal_child (self->permanent_error_revealer, error != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
constructed (GObject *object)
|
constructed (GObject *object)
|
||||||
{
|
{
|
||||||
|
@ -218,6 +251,13 @@ constructed (GObject *object)
|
||||||
self->title_label,
|
self->title_label,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (calls_manager_get_default (),
|
||||||
|
"notify::state",
|
||||||
|
G_CALLBACK (state_changed_cb),
|
||||||
|
self);
|
||||||
|
|
||||||
|
state_changed_cb (self, NULL, calls_manager_get_default ());
|
||||||
|
|
||||||
G_OBJECT_CLASS (calls_main_window_parent_class)->constructed (object);
|
G_OBJECT_CLASS (calls_main_window_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +329,8 @@ calls_main_window_class_init (CallsMainWindowClass *klass)
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, narrow_switcher);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, narrow_switcher);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, switcher_bar);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, switcher_bar);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, main_stack);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, main_stack);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, permanent_error_revealer);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, permanent_error_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,3 +14,10 @@ hdykeypad > button, .dial-button, .delete-button {
|
||||||
.phone-number-entry {
|
.phone-number-entry {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-state-message {
|
||||||
|
background-color: @error_color;
|
||||||
|
border-bottom: 1px solid darker(@error_color);
|
||||||
|
color: @theme_base_color;
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,23 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="permanent_error_revealer">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="reveal_child">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="permanent_error_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">No modem found</property>
|
||||||
|
<style>
|
||||||
|
<class name="error-state-message"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="main_stack">
|
<object class="GtkStack" id="main_stack">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
Loading…
Reference in a new issue