Commit 5e214df1 authored by Julian Sparber's avatar Julian Sparber Committed by Guido Gunther
Browse files

Rotation: Move rotation to quicksettings

parent 4fe04006
<?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"
id="svg8"
version="1.1"
height="16"
width="16"
sodipodi:docname="screen-rotation-landscape-symbolic.svg"
inkscape:version="1.0beta2 (2b71d25d45, 2019-12-03)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
inkscape:document-rotation="0"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1016"
id="namedview10"
showgrid="false"
inkscape:zoom="19.8125"
inkscape:cx="-0.63091483"
inkscape:cy="8"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<metadata
id="metadata14">
<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 />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs12" />
<g
transform="translate(-17.966098,-9.83008)"
id="g851" />
<g
id="g880"
transform="rotate(-90,13,13)">
<path
inkscape:connector-curvature="0"
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;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:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M 12.19531,0 C 10.99372,0 10,1.00125 10,2.20117 v 1 9.59766 1 C 10,14.99875 10.99372,16 12.19531,16 h 5.60938 C 19.00628,16 20,14.99875 20,13.79883 v -1 -9.59766 -1 C 20,1.00125 19.00628,0 17.80469,0 Z m 0,3 h 5.60938 C 17.92848,3 18,3.0703 18,3.20117 v 9.59766 C 18,12.92973 17.9285,13 17.80469,13 H 12.19531 C 12.07152,13 12,12.92973 12,12.79883 V 3.20117 C 12,3.07027 12.07152,3 12.19531,3 Z"
id="rect27159-7" />
<path
inkscape:connector-curvature="0"
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;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:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.35;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 21,6 v 2 h 1 0.79883 C 22.92972,8 23,8.0715 23,8.19531 v 5.60938 C 23,13.92847 22.92972,14 22.79883,14 H 22 21 v 2 h 1 0.79883 1 C 24.99876,16 26,15.00628 26,13.80469 V 8.19531 C 26,6.99372 24.99876,6 23.79883,6 h -1 H 22 Z"
id="rect4055" />
</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"
inkscape:version="1.0beta2 (2b71d25d45, 2019-12-03)"
sodipodi:docname="screen-rotation-portrait-symbolic.svg"
width="16"
height="16"
version="1.1"
id="svg8">
<sodipodi:namedview
inkscape:current-layer="svg8"
inkscape:window-maximized="1"
inkscape:window-y="0"
inkscape:window-x="0"
inkscape:cy="8"
inkscape:cx="-0.63091483"
inkscape:zoom="19.8125"
showgrid="false"
id="namedview10"
inkscape:window-height="1016"
inkscape:window-width="1920"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
inkscape:document-rotation="0"
bordercolor="#666666"
pagecolor="#ffffff" />
<metadata
id="metadata14">
<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="defs12" />
<g
id="g851"
transform="translate(-17.966098,-9.83008)" />
<g
transform="translate(-10)"
id="g880">
<path
id="rect27159-7"
d="M 12.19531,0 C 10.99372,0 10,1.00125 10,2.20117 v 1 9.59766 1 C 10,14.99875 10.99372,16 12.19531,16 h 5.60938 C 19.00628,16 20,14.99875 20,13.79883 v -1 -9.59766 -1 C 20,1.00125 19.00628,0 17.80469,0 Z m 0,3 h 5.60938 C 17.92848,3 18,3.0703 18,3.20117 v 9.59766 C 18,12.92973 17.9285,13 17.80469,13 H 12.19531 C 12.07152,13 12,12.92973 12,12.79883 V 3.20117 C 12,3.07027 12.07152,3 12.19531,3 Z"
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;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:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
inkscape:connector-curvature="0" />
<path
id="rect4055"
d="m 21,6 v 2 h 1 0.79883 C 22.92972,8 23,8.0715 23,8.19531 v 5.60938 C 23,13.92847 22.92972,14 22.79883,14 H 22 21 v 2 h 1 0.79883 1 C 24.99876,16 26,15.00628 26,13.80469 V 8.19531 C 26,6.99372 24.99876,6 23.79883,6 h -1 H 22 Z"
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;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:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.35;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
inkscape:connector-curvature="0" />
</g>
</svg>
......@@ -111,6 +111,8 @@ phosh_sources = [
'proximity.c',
'sensor-proxy-manager.c',
'sensor-proxy-manager.h',
'rotateinfo.c',
'rotateinfo.h',
'screen-saver-manager.c',
'screen-saver-manager.h',
'session-presence.c',
......
......@@ -24,5 +24,7 @@
<file alias="eye-not-looking-symbolic.svg">../data/eye-not-looking-symbolic.svg</file>
<file alias="eye-open-negative-filled-symbolic.svg">../data/eye-open-negative-filled-symbolic.svg</file>
<file alias="network-wireless-disabled-symbolic.svg">../data/network-wireless-disabled-symbolic.svg</file>
<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>
</gresource>
</gresources>
/*
* 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-rotateinfo"
#include "config.h"
#include "rotateinfo.h"
#include "shell.h"
/**
* SECTION:phosh-rotate-info
* @short_description: A widget to display the rotate status
* @Title: PhoshRotateInfo
*/
typedef struct _PhoshRotateInfo {
PhoshStatusIcon parent;
} PhoshRotateInfo;
G_DEFINE_TYPE (PhoshRotateInfo, phosh_rotate_info, PHOSH_TYPE_STATUS_ICON)
static void
set_state (PhoshRotateInfo *self)
{
if (!phosh_shell_get_rotation (phosh_shell_get_default ())) {
phosh_status_icon_set_icon_name (PHOSH_STATUS_ICON (self), "screen-rotation-portrait-symbolic");
phosh_status_icon_set_info (PHOSH_STATUS_ICON (self), "Portrait");
} else {
phosh_status_icon_set_icon_name (PHOSH_STATUS_ICON (self), "screen-rotation-landscape-symbolic");
phosh_status_icon_set_info (PHOSH_STATUS_ICON (self), "Landscape");
}
}
static void
phosh_rotate_info_finalize (GObject *object)
{
PhoshRotateInfo *self = PHOSH_ROTATE_INFO(object);
g_signal_handlers_disconnect_by_data (phosh_shell_get_default (), self);
G_OBJECT_CLASS (phosh_rotate_info_parent_class)->finalize (object);
}
static void
phosh_rotate_info_class_init (PhoshRotateInfoClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = phosh_rotate_info_finalize;
}
static void
phosh_rotate_info_init (PhoshRotateInfo *self)
{
g_signal_connect_swapped (phosh_shell_get_default (),
"notify::rotation",
G_CALLBACK (set_state),
self);
set_state (self);
}
GtkWidget *
phosh_rotate_info_new (void)
{
return g_object_new (PHOSH_TYPE_ROTATE_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_ROTATE_INFO (phosh_rotate_info_get_type())
G_DECLARE_FINAL_TYPE (PhoshRotateInfo, phosh_rotate_info, PHOSH, ROTATE_INFO, PhoshStatusIcon)
GtkWidget * phosh_rotate_info_new (void);
G_END_DECLS
......@@ -16,6 +16,7 @@
#include "settings/brightness.h"
#include "settings/gvc-channel-bar.h"
#include "wwan/phosh-wwan-mm.h"
#include "rotateinfo.h"
#include <pulse/pulseaudio.h>
#include "gvc-mixer-control.h"
......@@ -36,7 +37,6 @@ typedef struct
GtkWidget *quick_setting;
GtkWidget *scale_brightness;
GtkWidget *output_vol_bar;
GtkWidget *btn_rotation;
GtkWidget *btn_settings;
GDesktopAppInfo *settings_info;
......@@ -72,14 +72,14 @@ brightness_value_changed_cb (GtkScale *scale_brightness, gpointer *unused)
static void
rotation_changed_cb (PhoshSettings *self, GParamSpec *pspec, GtkSwitch *btn)
rotation_setting_clicked_cb (PhoshSettings *self)
{
PhoshShell *shell = phosh_shell_get_default ();
gboolean rotate;
gboolean rotated;
g_return_if_fail (PHOSH_IS_SETTINGS (self));
rotate = gtk_switch_get_active(btn);
phosh_shell_rotate_display (shell, rotate ? 90 : 0);
rotated = phosh_shell_get_rotation (shell);
phosh_shell_rotate_display (shell, !rotated ? 90 : 0);
g_signal_emit (self, signals[SETTING_DONE], 0);
}
......@@ -260,13 +260,6 @@ phosh_settings_constructed (GObject *object)
gtk_box_pack_start (GTK_BOX (priv->box_settings), priv->output_vol_bar, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (priv->box_settings), priv->output_vol_bar, 1);
if (phosh_shell_get_rotation (phosh_shell_get_default ()))
gtk_switch_set_active (GTK_SWITCH (priv->btn_rotation), TRUE);
g_signal_connect_swapped (priv->btn_rotation,
"notify::active",
G_CALLBACK (rotation_changed_cb),
self);
gtk_style_context_remove_class (gtk_widget_get_style_context (priv->btn_settings),
"button");
gtk_style_context_remove_class (gtk_widget_get_style_context (priv->btn_settings),
......@@ -353,12 +346,12 @@ phosh_settings_class_init (PhoshSettingsClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, box_settings);
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, quick_setting);
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_lock_screen);
gtk_widget_class_bind_template_child_private (widget_class, PhoshSettings, btn_shutdown);
gtk_widget_class_bind_template_callback (widget_class, batteryinfo_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, rotation_setting_clicked_cb);
}
......@@ -366,6 +359,7 @@ static void
phosh_settings_init (PhoshSettings *self)
{
g_type_ensure (PHOSH_TYPE_QUICK_SETTING);
g_type_ensure (PHOSH_TYPE_ROTATE_INFO);
gtk_widget_init_template (GTK_WIDGET (self));
}
......
......@@ -49,6 +49,20 @@
</child>
</object>
</child>
<child>
<object class="PhoshQuickSetting">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="clicked" handler="rotation_setting_clicked_cb" object="PhoshSettings" swapped="yes"/>
<child>
<object class="PhoshRotateInfo" id="rotateinfo">
<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">True</property>
......@@ -95,74 +109,6 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkListBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="selection_mode">none</property>
<property name="activate_on_single_click">False</property>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel">
<property name="height_request">32</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_top">8</property>
<property name="margin_bottom">8</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Rotation</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="btn_rotation">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin_right">12</property>
<property name="margin_end">12</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="phosh-settings-row"/>
</style>
</object>
</child>
<style>
<class name="phosh-settings-listboxrow"/>
</style>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</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