camera: Port to GTK4
This commit is contained in:
parent
75f6566a91
commit
eff96c4cb1
4 changed files with 105 additions and 120 deletions
|
@ -18,7 +18,6 @@
|
||||||
* Author: Matthias Clasen <mclasen@redhat.com>
|
* Author: Matthias Clasen <mclasen@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "list-box-helper.h"
|
|
||||||
#include "cc-camera-panel.h"
|
#include "cc-camera-panel.h"
|
||||||
#include "cc-camera-resources.h"
|
#include "cc-camera-resources.h"
|
||||||
#include "cc-util.h"
|
#include "cc-util.h"
|
||||||
|
@ -174,40 +173,36 @@ add_camera_app (CcCameraPanel *self,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
gtk_widget_show (row);
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_widget_show (box);
|
|
||||||
gtk_widget_set_margin_start (box, 12);
|
gtk_widget_set_margin_start (box, 12);
|
||||||
gtk_widget_set_margin_end (box, 6);
|
gtk_widget_set_margin_end (box, 6);
|
||||||
gtk_widget_set_margin_top (box, 12);
|
gtk_widget_set_margin_top (box, 12);
|
||||||
gtk_widget_set_margin_bottom (box, 12);
|
gtk_widget_set_margin_bottom (box, 12);
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
gtk_widget_set_hexpand (box, TRUE);
|
gtk_widget_set_hexpand (box, TRUE);
|
||||||
gtk_container_add (GTK_CONTAINER (self->camera_apps_list_box), row);
|
gtk_list_box_append (self->camera_apps_list_box, row);
|
||||||
|
|
||||||
icon = g_app_info_get_icon (G_APP_INFO (app_info));
|
icon = g_app_info_get_icon (G_APP_INFO (app_info));
|
||||||
w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
w = gtk_image_new_from_gicon (icon);
|
||||||
gtk_widget_show (w);
|
|
||||||
gtk_widget_set_halign (w, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (w, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||||
gtk_size_group_add_widget (self->camera_icon_size_group, w);
|
gtk_size_group_add_widget (self->camera_icon_size_group, w);
|
||||||
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
|
gtk_box_append (GTK_BOX (box), w);
|
||||||
|
|
||||||
w = gtk_label_new (g_app_info_get_name (G_APP_INFO (app_info)));
|
w = gtk_label_new (g_app_info_get_name (G_APP_INFO (app_info)));
|
||||||
gtk_widget_show (w);
|
gtk_widget_set_hexpand (w, TRUE);
|
||||||
gtk_widget_set_margin_start (w, 12);
|
gtk_widget_set_margin_start (w, 12);
|
||||||
gtk_widget_set_margin_end (w, 12);
|
gtk_widget_set_margin_end (w, 12);
|
||||||
gtk_widget_set_halign (w, GTK_ALIGN_START);
|
gtk_widget_set_halign (w, GTK_ALIGN_START);
|
||||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||||
gtk_label_set_xalign (GTK_LABEL (w), 0);
|
gtk_label_set_xalign (GTK_LABEL (w), 0);
|
||||||
gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
|
gtk_box_append (GTK_BOX (box), w);
|
||||||
|
|
||||||
w = gtk_switch_new ();
|
w = gtk_switch_new ();
|
||||||
gtk_widget_show (w);
|
|
||||||
gtk_switch_set_active (GTK_SWITCH (w), enabled);
|
gtk_switch_set_active (GTK_SWITCH (w), enabled);
|
||||||
gtk_widget_set_halign (w, GTK_ALIGN_END);
|
gtk_widget_set_halign (w, GTK_ALIGN_END);
|
||||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||||
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
|
gtk_box_append (GTK_BOX (box), w);
|
||||||
g_settings_bind (self->privacy_settings,
|
g_settings_bind (self->privacy_settings,
|
||||||
"disable-camera",
|
"disable-camera",
|
||||||
w,
|
w,
|
||||||
|
@ -391,7 +386,7 @@ cc_camera_panel_constructed (GObject *object)
|
||||||
widget = gtk_switch_new ();
|
widget = gtk_switch_new ();
|
||||||
gtk_widget_show (widget);
|
gtk_widget_show (widget);
|
||||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||||
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 4);
|
gtk_box_append (GTK_BOX (box), widget);
|
||||||
|
|
||||||
g_settings_bind (self->privacy_settings, "disable-camera",
|
g_settings_bind (self->privacy_settings, "disable-camera",
|
||||||
widget, "active",
|
widget, "active",
|
||||||
|
@ -433,10 +428,6 @@ cc_camera_panel_init (CcCameraPanel *self)
|
||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (self));
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
gtk_list_box_set_header_func (self->camera_apps_list_box,
|
|
||||||
cc_list_box_update_header_func,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
self->camera_icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
|
self->camera_icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
|
||||||
|
|
||||||
self->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
|
self->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
|
||||||
|
|
|
@ -3,125 +3,119 @@
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.14"/>
|
<requires lib="gtk+" version="3.14"/>
|
||||||
<template class="CcCameraPanel" parent="CcPanel">
|
<template class="CcCameraPanel" parent="CcPanel">
|
||||||
<property name="visible">True</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="stack">
|
<object class="GtkStack" id="stack">
|
||||||
<property name="visible">true</property>
|
|
||||||
|
<!-- Empty page -->
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkStackPage">
|
||||||
<property name="visible">true</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkImage">
|
|
||||||
<property name="visible">true</property>
|
|
||||||
<property name="valign">start</property>
|
|
||||||
<property name="pixel-size">96</property>
|
|
||||||
<property name="icon-name">camera-disabled-symbolic</property>
|
|
||||||
<style>
|
|
||||||
<class name="dim-label"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="fill">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">true</property>
|
|
||||||
<property name="margin-top">20</property>
|
|
||||||
<property name="margin-bottom">15</property>
|
|
||||||
<property name="label" translatable="yes">Camera is turned off</property>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="scale" value="1.44"/>
|
|
||||||
</attributes>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">true</property>
|
|
||||||
<property name="label" translatable="yes">No applications can capture photos or video.</property>
|
|
||||||
<style>
|
|
||||||
<class name="dim-label"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="name">empty</property>
|
<property name="name">empty</property>
|
||||||
</packing>
|
<property name="child">
|
||||||
</child>
|
<object class="GtkBox">
|
||||||
<child>
|
<property name="orientation">vertical</property>
|
||||||
<object class="GtkScrolledWindow">
|
<property name="valign">center</property>
|
||||||
<property name="visible">true</property>
|
|
||||||
<property name="hscrollbar-policy">never</property>
|
|
||||||
<child>
|
|
||||||
<object class="HdyClamp">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="margin_top">32</property>
|
|
||||||
<property name="margin_bottom">32</property>
|
|
||||||
<property name="margin_start">12</property>
|
|
||||||
<property name="margin_end">12</property>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkImage">
|
||||||
<property name="visible">true</property>
|
<property name="valign">start</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="pixel-size">96</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="icon-name">camera-disabled-symbolic</property>
|
||||||
<child>
|
<style>
|
||||||
<object class="GtkLabel">
|
<class name="dim-label"/>
|
||||||
<property name="visible">true</property>
|
</style>
|
||||||
<property name="margin-bottom">12</property>
|
</object>
|
||||||
<property name="label" translatable="yes">Use of the camera allows applications to capture photos and video. Disabling the camera may cause some applications to not function properly.</property>
|
</child>
|
||||||
<property name="wrap">1</property>
|
<child>
|
||||||
<property name="max-width-chars">50</property>
|
<object class="GtkLabel">
|
||||||
<property name="xalign">0</property>
|
<property name="margin-top">20</property>
|
||||||
</object>
|
<property name="margin-bottom">15</property>
|
||||||
</child>
|
<property name="label" translatable="yes">Camera is turned off</property>
|
||||||
<child>
|
<attributes>
|
||||||
<object class="GtkLabel">
|
<attribute name="scale" value="1.44"/>
|
||||||
<property name="visible">true</property>
|
</attributes>
|
||||||
<property name="margin-bottom">12</property>
|
</object>
|
||||||
<property name="label" translatable="yes">Allow the applications below to use your camera.</property>
|
</child>
|
||||||
<property name="wrap">1</property>
|
<child>
|
||||||
<property name="max-width-chars">50</property>
|
<object class="GtkLabel">
|
||||||
<property name="xalign">0</property>
|
<property name="label" translatable="yes">No applications can capture photos or video.</property>
|
||||||
</object>
|
<style>
|
||||||
</child>
|
<class name="dim-label"/>
|
||||||
<child>
|
</style>
|
||||||
<object class="GtkListBox" id="camera_apps_list_box">
|
</object>
|
||||||
<property name="visible">true</property>
|
</child>
|
||||||
<property name="can-focus">1</property>
|
</object>
|
||||||
<property name="selection-mode">none</property>
|
</property>
|
||||||
<style>
|
</object>
|
||||||
<class name="view"/>
|
</child>
|
||||||
<class name="frame"/>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<child type="placeholder">
|
<!-- Cameras -->
|
||||||
|
<child>
|
||||||
|
<object class="GtkStackPage">
|
||||||
|
<property name="name">content</property>
|
||||||
|
<property name="child">
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="hscrollbar-policy">never</property>
|
||||||
|
<child>
|
||||||
|
<object class="AdwClamp">
|
||||||
|
<property name="margin_top">32</property>
|
||||||
|
<property name="margin_bottom">32</property>
|
||||||
|
<property name="margin_start">12</property>
|
||||||
|
<property name="margin_end">12</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="visible">true</property>
|
<property name="margin-bottom">12</property>
|
||||||
<property name="margin">18</property>
|
<property name="label" translatable="yes">Use of the camera allows applications to capture photos and video. Disabling the camera may cause some applications to not function properly.</property>
|
||||||
<property name="label" translatable="yes">No Applications Have Asked for Camera Access</property>
|
<property name="wrap">1</property>
|
||||||
<property name="wrap">true</property>
|
|
||||||
<property name="max-width-chars">50</property>
|
<property name="max-width-chars">50</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="margin-bottom">12</property>
|
||||||
|
<property name="label" translatable="yes">Allow the applications below to use your camera.</property>
|
||||||
|
<property name="wrap">1</property>
|
||||||
|
<property name="max-width-chars">50</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="camera_apps_list_box">
|
||||||
|
<property name="selection-mode">none</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="dim-label" />
|
<class name="content"/>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<child type="placeholder">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="margin-start">18</property>
|
||||||
|
<property name="margin-end">18</property>
|
||||||
|
<property name="margin-top">18</property>
|
||||||
|
<property name="margin-bottom">18</property>
|
||||||
|
<property name="label" translatable="yes">No Applications Have Asked for Camera Access</property>
|
||||||
|
<property name="wrap">true</property>
|
||||||
|
<property name="max-width-chars">50</property>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label" />
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="name">content</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -3,7 +3,7 @@ subdir('common')
|
||||||
panels = [
|
panels = [
|
||||||
# 'applications',
|
# 'applications',
|
||||||
# 'background',
|
# 'background',
|
||||||
# 'camera',
|
'camera',
|
||||||
# 'color',
|
# 'color',
|
||||||
# 'datetime',
|
# 'datetime',
|
||||||
# 'default-apps',
|
# 'default-apps',
|
||||||
|
|
|
@ -69,7 +69,7 @@ extern GType cc_notifications_panel_get_type (void);
|
||||||
//extern GType cc_wwan_panel_get_type (void);
|
//extern GType cc_wwan_panel_get_type (void);
|
||||||
#endif /* BUILD_WWAN */
|
#endif /* BUILD_WWAN */
|
||||||
//extern GType cc_location_panel_get_type (void);
|
//extern GType cc_location_panel_get_type (void);
|
||||||
//extern GType cc_camera_panel_get_type (void);
|
extern GType cc_camera_panel_get_type (void);
|
||||||
//extern GType cc_microphone_panel_get_type (void);
|
//extern GType cc_microphone_panel_get_type (void);
|
||||||
//extern GType cc_usage_panel_get_type (void);
|
//extern GType cc_usage_panel_get_type (void);
|
||||||
//extern GType cc_lock_panel_get_type (void);
|
//extern GType cc_lock_panel_get_type (void);
|
||||||
|
@ -102,7 +102,7 @@ static CcPanelLoaderVtable default_panels[] =
|
||||||
#ifdef BUILD_BLUETOOTH
|
#ifdef BUILD_BLUETOOTH
|
||||||
//PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),
|
//PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),
|
||||||
#endif
|
#endif
|
||||||
//PANEL_TYPE("camera", cc_camera_panel_get_type, NULL),
|
PANEL_TYPE("camera", cc_camera_panel_get_type, NULL),
|
||||||
//PANEL_TYPE("color", cc_color_panel_get_type, NULL),
|
//PANEL_TYPE("color", cc_color_panel_get_type, NULL),
|
||||||
//PANEL_TYPE("datetime", cc_date_time_panel_get_type, NULL),
|
//PANEL_TYPE("datetime", cc_date_time_panel_get_type, NULL),
|
||||||
//PANEL_TYPE("default-apps", cc_default_apps_panel_get_type, NULL),
|
//PANEL_TYPE("default-apps", cc_default_apps_panel_get_type, NULL),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue