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>
|
||||
*/
|
||||
|
||||
#include "list-box-helper.h"
|
||||
#include "cc-camera-panel.h"
|
||||
#include "cc-camera-resources.h"
|
||||
#include "cc-util.h"
|
||||
|
@ -174,40 +173,36 @@ add_camera_app (CcCameraPanel *self,
|
|||
return;
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
gtk_widget_show (row);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_show (box);
|
||||
gtk_widget_set_margin_start (box, 12);
|
||||
gtk_widget_set_margin_end (box, 6);
|
||||
gtk_widget_set_margin_top (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_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));
|
||||
w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
gtk_widget_show (w);
|
||||
w = gtk_image_new_from_gicon (icon);
|
||||
gtk_widget_set_halign (w, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
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)));
|
||||
gtk_widget_show (w);
|
||||
gtk_widget_set_hexpand (w, TRUE);
|
||||
gtk_widget_set_margin_start (w, 12);
|
||||
gtk_widget_set_margin_end (w, 12);
|
||||
gtk_widget_set_halign (w, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
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 ();
|
||||
gtk_widget_show (w);
|
||||
gtk_switch_set_active (GTK_SWITCH (w), enabled);
|
||||
gtk_widget_set_halign (w, GTK_ALIGN_END);
|
||||
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,
|
||||
"disable-camera",
|
||||
w,
|
||||
|
@ -391,7 +386,7 @@ cc_camera_panel_constructed (GObject *object)
|
|||
widget = gtk_switch_new ();
|
||||
gtk_widget_show (widget);
|
||||
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",
|
||||
widget, "active",
|
||||
|
@ -433,10 +428,6 @@ cc_camera_panel_init (CcCameraPanel *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->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
|
||||
|
|
|
@ -3,18 +3,19 @@
|
|||
<interface>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<template class="CcCameraPanel" parent="CcPanel">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">true</property>
|
||||
|
||||
<!-- Empty page -->
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">empty</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<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>
|
||||
|
@ -22,13 +23,9 @@
|
|||
<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>
|
||||
|
@ -39,7 +36,6 @@
|
|||
</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"/>
|
||||
|
@ -47,17 +43,19 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">empty</property>
|
||||
</packing>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<!-- Cameras -->
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">content</property>
|
||||
<property name="child">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">true</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="HdyClamp">
|
||||
<property name="visible">True</property>
|
||||
<object class="AdwClamp">
|
||||
<property name="margin_top">32</property>
|
||||
<property name="margin_bottom">32</property>
|
||||
<property name="margin_start">12</property>
|
||||
|
@ -65,12 +63,10 @@
|
|||
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">true</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="hexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">true</property>
|
||||
<property name="margin-bottom">12</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="wrap">1</property>
|
||||
|
@ -80,7 +76,6 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">true</property>
|
||||
<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>
|
||||
|
@ -90,18 +85,17 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="camera_apps_list_box">
|
||||
<property name="visible">true</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="selection-mode">none</property>
|
||||
<style>
|
||||
<class name="view"/>
|
||||
<class name="frame"/>
|
||||
<class name="content"/>
|
||||
</style>
|
||||
|
||||
<child type="placeholder">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">true</property>
|
||||
<property name="margin">18</property>
|
||||
<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>
|
||||
|
@ -118,10 +112,10 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">content</property>
|
||||
</packing>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
|
|
@ -3,7 +3,7 @@ subdir('common')
|
|||
panels = [
|
||||
# 'applications',
|
||||
# 'background',
|
||||
# 'camera',
|
||||
'camera',
|
||||
# 'color',
|
||||
# 'datetime',
|
||||
# 'default-apps',
|
||||
|
|
|
@ -69,7 +69,7 @@ extern GType cc_notifications_panel_get_type (void);
|
|||
//extern GType cc_wwan_panel_get_type (void);
|
||||
#endif /* BUILD_WWAN */
|
||||
//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_usage_panel_get_type (void);
|
||||
//extern GType cc_lock_panel_get_type (void);
|
||||
|
@ -102,7 +102,7 @@ static CcPanelLoaderVtable default_panels[] =
|
|||
#ifdef BUILD_BLUETOOTH
|
||||
//PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),
|
||||
#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("datetime", cc_date_time_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