[gnome-control-center/wip/carlosg/centralized-panel-auto-orientation: 198/200] display: Add API to get the PanelOrientationManaged DisplayConfig property




commit b91a83c402fcced3f8e3e8e49c353eb430231724
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jun 11 16:01:14 2020 +0200

    display: Add API to get the PanelOrientationManaged DisplayConfig property
    
    This property indicates whether the builtin panel orientation is managed by
    an accelerometer, thus shouldn't be managed by the display panel.

 panels/display/cc-display-config-dbus.c | 19 +++++++++++++++++++
 panels/display/cc-display-config.c      |  6 ++++++
 panels/display/cc-display-config.h      |  3 +++
 3 files changed, 28 insertions(+)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 13e9b20fd..43b0ab2fc 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -1269,6 +1269,23 @@ cc_display_config_dbus_is_scaled_mode_valid (CcDisplayConfig *pself,
   return is_scaled_mode_allowed (self, mode, scale);
 }
 
+static gboolean
+cc_display_config_dbus_get_panel_orientation_managed (CcDisplayConfig *pself)
+{
+  CcDisplayConfigDBus *self = CC_DISPLAY_CONFIG_DBUS (pself);
+  gboolean retval;
+  GVariant *v;
+
+  v = g_dbus_proxy_get_cached_property (self->proxy, "PanelOrientationManaged");
+  if (!v)
+    return FALSE;
+
+  retval = g_variant_get_boolean (v);
+  g_variant_unref (v);
+
+  return retval;
+}
+
 static void
 cc_display_config_dbus_init (CcDisplayConfigDBus *self)
 {
@@ -1565,6 +1582,8 @@ cc_display_config_dbus_class_init (CcDisplayConfigDBusClass *klass)
   parent_class->is_layout_logical = cc_display_config_dbus_is_layout_logical;
   parent_class->is_scaled_mode_valid = cc_display_config_dbus_is_scaled_mode_valid;
   parent_class->set_minimum_size = cc_display_config_dbus_set_minimum_size;
+  parent_class->get_panel_orientation_managed =
+    cc_display_config_dbus_get_panel_orientation_managed;
 
   pspec = g_param_spec_variant ("state",
                                 "GVariant",
diff --git a/panels/display/cc-display-config.c b/panels/display/cc-display-config.c
index 80aabc4f1..4cacdbff6 100644
--- a/panels/display/cc-display-config.c
+++ b/panels/display/cc-display-config.c
@@ -627,3 +627,9 @@ cc_display_config_is_scaled_mode_valid (CcDisplayConfig *self,
   g_return_val_if_fail (CC_IS_DISPLAY_MODE (mode), FALSE);
   return CC_DISPLAY_CONFIG_GET_CLASS (self)->is_scaled_mode_valid (self, mode, scale);
 }
+
+gboolean
+cc_display_config_get_panel_orientation_managed (CcDisplayConfig *self)
+{
+  return CC_DISPLAY_CONFIG_GET_CLASS (self)->get_panel_orientation_managed (self);
+}
diff --git a/panels/display/cc-display-config.h b/panels/display/cc-display-config.h
index ef4332ff7..fa5b3a583 100644
--- a/panels/display/cc-display-config.h
+++ b/panels/display/cc-display-config.h
@@ -160,6 +160,7 @@ struct _CcDisplayConfigClass
   gboolean (*is_scaled_mode_valid) (CcDisplayConfig  *self,
                                     CcDisplayMode    *mode,
                                     double            scale);
+  gboolean (* get_panel_orientation_managed) (CcDisplayConfig    *self);
 };
 
 
@@ -186,6 +187,8 @@ void              cc_display_config_set_minimum_size        (CcDisplayConfig
 gboolean          cc_display_config_is_scaled_mode_valid    (CcDisplayConfig    *self,
                                                              CcDisplayMode      *mode,
                                                              double              scale);
+gboolean          cc_display_config_get_panel_orientation_managed
+                                                            (CcDisplayConfig    *self);
 
 const char*       cc_display_monitor_get_display_name       (CcDisplayMonitor   *monitor);
 gboolean          cc_display_monitor_is_active              (CcDisplayMonitor   *monitor);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]