Skip to content
Snippets Groups Projects
Commit daa19c51 authored by Guido Gunther's avatar Guido Gunther :zzz:
Browse files

settings: add button to lock screen

parent 84a4df53
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ typedef struct
GtkWidget *btn_settings;
GDesktopAppInfo *settings_info;
GtkWidget *btn_airplane_mode;
GtkWidget *btn_silent_mode;
GtkWidget *btn_lock_screen;
} PhoshSettingsPrivate;
......@@ -90,6 +90,14 @@ settings_clicked_cb (PhoshSettings *self, gpointer *unused)
}
static void
lock_screen_clicked_cb (PhoshSettings *self, gpointer *unused)
{
phosh_shell_lock (phosh());
g_signal_emit (self, signals[SETTING_DONE], 0);
}
static void
phosh_settings_constructed (GObject *object)
{
......@@ -135,11 +143,17 @@ phosh_settings_constructed (GObject *object)
G_CALLBACK (settings_clicked_cb),
self);
image = gtk_image_new_from_icon_name ("system-lock-screen-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_button_set_image(GTK_BUTTON (priv->btn_lock_screen), image);
g_signal_connect_swapped (priv->btn_lock_screen,
"clicked",
G_CALLBACK (lock_screen_clicked_cb),
self);
/* FIXME: just so we have some buttons */
image = gtk_image_new_from_icon_name ("airplane-mode-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_button_set_image(GTK_BUTTON (priv->btn_airplane_mode), image);
image = gtk_image_new_from_icon_name ("audio-volume-muted-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_button_set_image(GTK_BUTTON (priv->btn_silent_mode), image);
G_OBJECT_CLASS (phosh_settings_parent_class)->constructed (object);
}
......@@ -163,7 +177,7 @@ phosh_settings_class_init (PhoshSettingsClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, scale_brightness);
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, btn_rotation);
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, btn_settings);
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, btn_silent_mode);
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, btn_lock_screen);
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, btn_airplane_mode);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="PhoshSettings" parent="GtkWindow">
<property name="width_request">250</property>
<property name="can_focus">False</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
......@@ -162,7 +165,7 @@
<property name="can_focus">False</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="btn_silent_mode">
<object class="GtkButton" id="btn_settings">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -200,7 +203,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="btn_settings">
<object class="GtkButton" id="btn_lock_screen">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -234,8 +237,5 @@
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</template>
</interface>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment