flashlight

parent 7539ad6f
Pipeline #57043 passed with stages
in 30 minutes and 50 seconds
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
version="1.1"
id="svg38"
sodipodi:docname="flashlight-off.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata44">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs42" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2125"
inkscape:window-height="1709"
id="namedview40"
showgrid="false"
inkscape:zoom="59"
inkscape:cx="10.051979"
inkscape:cy="8.1882921"
inkscape:window-x="1377"
inkscape:window-y="159"
inkscape:window-maximized="0"
inkscape:current-layer="g36" />
<g
fill="#2e3436"
id="g36">
<path
d="M7.994 0a6.01 6.01 0 0 0-5.87 4.777c-.528 2.533.69 5.036 2.874 6.327l.002.898A1 1 0 0 0 6 13h4a1 1 0 0 0 1-.998l.002-.9c2.183-1.293 3.399-3.797 2.87-6.33A6.01 6.01 0 0 0 7.993 0zm.002 2c1.9 0 3.529 1.322 3.918 3.182a3.99 3.99 0 0 1-2.312 4.484 1 1 0 0 0-.6.914L9 11H6.998v-.418a1 1 0 0 0-.602-.914 3.992 3.992 0 0 1-2.314-4.484A3.99 3.99 0 0 1 7.996 2z"
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;opacity:0.35"
color="#000"
font-weight="400"
font-family="sans-serif"
white-space="normal"
overflow="visible"
id="path30" />
<path
d="M6 15c0 .554.446 1 1 1h2c.554 0 1-.446 1-1v-1H6z"
id="path32"
style="opacity:0.35" />
<path
d="M6.992 5.994a.5.5 0 0 0-.347.86l1 1a.5.5 0 0 0 .707 0l1-1a.5.5 0 1 0-.707-.707l-.647.646-.646-.646a.5.5 0 0 0-.36-.153z"
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal"
color="#000"
font-weight="400"
font-family="sans-serif"
white-space="normal"
overflow="visible"
opacity=".35"
fill-rule="evenodd"
id="path34" />
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
version="1.1"
id="svg38"
sodipodi:docname="flashlight-on.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata44">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs42" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2125"
inkscape:window-height="1709"
id="namedview40"
showgrid="false"
inkscape:zoom="59"
inkscape:cx="10.051979"
inkscape:cy="8.1882921"
inkscape:window-x="2477"
inkscape:window-y="281"
inkscape:window-maximized="0"
inkscape:current-layer="g36" />
<g
fill="#2e3436"
id="g36">
<path
d="M7.994 0a6.01 6.01 0 0 0-5.87 4.777c-.528 2.533.69 5.036 2.874 6.327l.002.898A1 1 0 0 0 6 13h4a1 1 0 0 0 1-.998l.002-.9c2.183-1.293 3.399-3.797 2.87-6.33A6.01 6.01 0 0 0 7.993 0zm.002 2c1.9 0 3.529 1.322 3.918 3.182a3.99 3.99 0 0 1-2.312 4.484 1 1 0 0 0-.6.914L9 11H6.998v-.418a1 1 0 0 0-.602-.914 3.992 3.992 0 0 1-2.314-4.484A3.99 3.99 0 0 1 7.996 2z"
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal"
color="#000"
font-weight="400"
font-family="sans-serif"
white-space="normal"
overflow="visible"
id="path30" />
<path
d="M6 15c0 .554.446 1 1 1h2c.554 0 1-.446 1-1v-1H6z"
id="path32" />
<path
d="M6.992 5.994a.5.5 0 0 0-.347.86l1 1a.5.5 0 0 0 .707 0l1-1a.5.5 0 1 0-.707-.707l-.647.646-.646-.646a.5.5 0 0 0-.36-.153z"
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal"
color="#000"
font-weight="400"
font-family="sans-serif"
white-space="normal"
overflow="visible"
opacity=".35"
fill-rule="evenodd"
id="path34" />
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
version="1.1"
id="svg38"
sodipodi:docname="flashlight.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata44">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs42" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2125"
inkscape:window-height="1709"
id="namedview40"
showgrid="false"
inkscape:zoom="59"
inkscape:cx="10.051979"
inkscape:cy="8.1882921"
inkscape:window-x="686"
inkscape:window-y="211"
inkscape:window-maximized="0"
inkscape:current-layer="g36" />
<g
fill="#2e3436"
id="g36">
<path
d="M7.994 0a6.01 6.01 0 0 0-5.87 4.777c-.528 2.533.69 5.036 2.874 6.327l.002.898A1 1 0 0 0 6 13h4a1 1 0 0 0 1-.998l.002-.9c2.183-1.293 3.399-3.797 2.87-6.33A6.01 6.01 0 0 0 7.993 0zm.002 2c1.9 0 3.529 1.322 3.918 3.182a3.99 3.99 0 0 1-2.312 4.484 1 1 0 0 0-.6.914L9 11H6.998v-.418a1 1 0 0 0-.602-.914 3.992 3.992 0 0 1-2.314-4.484A3.99 3.99 0 0 1 7.996 2z"
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;fill:#ffffff;fill-opacity:1"
color="#000"
font-weight="400"
font-family="sans-serif"
white-space="normal"
overflow="visible"
id="path30" />
<path
d="M6 15c0 .554.446 1 1 1h2c.554 0 1-.446 1-1v-1H6z"
id="path32"
style="fill:#ffffff;fill-opacity:1" />
<path
d="M6.992 5.994a.5.5 0 0 0-.347.86l1 1a.5.5 0 0 0 .707 0l1-1a.5.5 0 1 0-.707-.707l-.647.646-.646-.646a.5.5 0 0 0-.36-.153z"
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;fill:#ffffff;fill-opacity:1;opacity:1"
color="#000"
font-weight="400"
font-family="sans-serif"
white-space="normal"
overflow="visible"
opacity=".35"
fill-rule="evenodd"
id="path34" />
</g>
</svg>
/*
* Copyright (C) 2020 Purism SPC
* SPDX-License-Identifier: GPL-3.0+
* Author: Julian Sparber <julian.sparber@puri.sm>
*/
/* Rotate Info widget */
#define G_LOG_DOMAIN "phosh-flashlightinfo"
#include "config.h"
#include "flashlightinfo.h"
#include "shell.h"
/**
* SECTION:phosh-rotate-info
* @short_description: A widget to display the rotate status
* @Title: PhoshRotateInfo
*/
typedef struct _PhoshFlashlightInfo {
PhoshStatusIcon parent;
} PhoshFlashlifhtInfo;
G_DEFINE_TYPE (PhoshFlashlightInfo, phosh_flashlight_info, PHOSH_TYPE_STATUS_ICON)
static void
set_state (PhoshFlashlightInfo *self)
{
phosh_status_icon_set_icon_name (PHOSH_STATUS_ICON (self), "flashlight");
phosh_status_icon_set_info (PHOSH_STATUS_ICON (self), "Flashlight");
}
static void
phosh_flashlight_info_finalize (GObject *object)
{
PhoshFlashlightInfo *self = PHOSH_FLASHLIGHT_INFO(object);
g_signal_handlers_disconnect_by_data (phosh_shell_get_default (), self);
G_OBJECT_CLASS (phosh_flashlight_info_parent_class)->finalize (object);
}
static void
phosh_flashlight_info_class_init (PhoshFlashlightInfoClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = phosh_flashlight_info_finalize;
}
static void
phosh_flashlight_info_init (PhoshFlashlightInfo *self)
{
g_signal_connect_swapped (self,
"clicked",
G_CALLBACK (set_state),
self);
set_state (self);
}
GtkWidget *
phosh_flashlight_info_new (void)
{
return g_object_new (PHOSH_TYPE_FLASHLIGHT_INFO, NULL);
}
/*
* Copyright (C) 2020 Purism SPC
*
* SPDX-License-Identifier: GPL-3.0+
*/
#pragma once
#include <gtk/gtk.h>
#include "status-icon.h"
G_BEGIN_DECLS
#define PHOSH_TYPE_FLASHLIGHT_INFO (phosh_flashlight_info_get_type())
G_DECLARE_FINAL_TYPE (PhoshFlashlightInfo, phosh_flashlight_info, PHOSH, FLASHLIGHT_INFO, PhoshStatusIcon)
GtkWidget * phosh_flashlight_info_new (void);
G_END_DECLS
......@@ -120,6 +120,8 @@ libphosh_sources = [
'sensor-proxy-manager.h',
'rotateinfo.c',
'rotateinfo.h',
'flashlightinfo.c',
'flashlightinfo.h',
'screen-saver-manager.c',
'screen-saver-manager.h',
'session-presence.c',
......
......@@ -33,5 +33,6 @@
<file alias="screen-rotation-portrait-symbolic.svg">../data/screen-rotation-portrait-symbolic.svg</file>
<file alias="screen-rotation-landscape-symbolic.svg">../data/screen-rotation-landscape-symbolic.svg</file>
<file alias="network-cellular-disabled-symbolic.svg">../data/network-cellular-disabled-symbolic.svg</file>
<file alias="flashlight.svg">../data/flashlight.svg</file>
</gresource>
</gresources>
......@@ -16,6 +16,7 @@
#include "settings/gvc-channel-bar.h"
#include "wwan/phosh-wwan-mm.h"
#include "rotateinfo.h"
#include "flashlightinfo.h"
#include "feedbackinfo.h"
#include "feedback-manager.h"
#include "notifications/notify-manager.h"
......@@ -75,6 +76,14 @@ brightness_value_changed_cb (GtkScale *scale_brightness, gpointer *unused)
}
static void
flashlight_setting_clicked_cb (PhoshSettings *self)
{
g_return_if_fail (PHOSH_IS_SETTINGS (self));
system("flashlight-toggle");
//g_signal_emit (self, signals[SETTING_DONE], 0);
}
static void
rotation_setting_clicked_cb (PhoshSettings *self)
{
......@@ -386,6 +395,7 @@ phosh_settings_class_init (PhoshSettingsClass *klass)
g_type_ensure (PHOSH_TYPE_ROTATE_INFO);
g_type_ensure (PHOSH_TYPE_FEEDBACK_INFO);
g_type_ensure (PHOSH_TYPE_MEDIA_PLAYER);
g_type_ensure (PHOSH_TYPE_FLASHLIGHT_INFO);
gtk_widget_class_bind_template_child (widget_class, PhoshSettings, box_settings);
gtk_widget_class_bind_template_child (widget_class, PhoshSettings, quick_settings);
......@@ -393,6 +403,7 @@ phosh_settings_class_init (PhoshSettingsClass *klass)
gtk_widget_class_bind_template_child (widget_class, PhoshSettings, list_notifications);
gtk_widget_class_bind_template_child (widget_class, PhoshSettings, sw_notifications);
gtk_widget_class_bind_template_callback (widget_class, flashlight_setting_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, battery_setting_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, rotation_setting_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, feedback_setting_clicked_cb);
......
......@@ -104,6 +104,20 @@
</child>
</object>
</child>
<child>
<object class="PhoshQuickSetting">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="clicked" handler="flashlight_setting_clicked_cb" object="PhoshSettings" swapped="yes"/>
<child>
<object class="PhoshFlashlightInfo" id="flashlightinfo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon-size">GTK_ICON_SIZE_LARGE_TOOLBAR</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
......
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