[gnome-control-center] CcPanel: remove redundant properties



commit 8c1127384a31fc5786d1009d6ff80fd10639b886
Author: Thomas Wood <thomas wood intel com>
Date:   Mon Jun 21 16:36:32 2010 +0100

    CcPanel: remove redundant properties
    
    Remove properties that are not used or not useful.
    
    The "id" property is implemented by the desktop entry
    X-GNOME-Settings-Panel value and the extension point implementation name.
    
    The "display-name" property is not used because the Name value from the
    desktop entry file is read instead.
    
    The "active" property is no longer needed, since the objects are not kept
    alive when the panel is inactive.

 libgnome-control-center/cc-panel.c |  138 +-----------------------------------
 libgnome-control-center/cc-panel.h |    8 --
 libgnome-control-center/cc-shell.c |    6 +--
 3 files changed, 2 insertions(+), 150 deletions(-)
---
diff --git a/libgnome-control-center/cc-panel.c b/libgnome-control-center/cc-panel.c
index c803e3c..c26a6f8 100644
--- a/libgnome-control-center/cc-panel.c
+++ b/libgnome-control-center/cc-panel.c
@@ -56,10 +56,8 @@ struct CcPanelPrivate
 
 enum
 {
-    PROP_ID = 1,
-    PROP_DISPLAY_NAME,
+    PROP_0,
     PROP_SHELL,
-    PROP_ACTIVE
 };
 
 G_DEFINE_ABSTRACT_TYPE (CcPanel, cc_panel, GTK_TYPE_ALIGNMENT)
@@ -76,16 +74,6 @@ cc_panel_set_property (GObject      *object,
 
   switch (prop_id)
     {
-    case PROP_ID:
-      /* construct only property */
-      g_free (panel->priv->id);
-      panel->priv->id = g_value_dup_string (value);
-      break;
-
-    case PROP_DISPLAY_NAME:
-      cc_panel_set_display_name (panel, g_value_get_string (value));
-      break;
-
     case PROP_SHELL:
       /* construct only property */
       panel->priv->shell = g_value_get_object (value);
@@ -109,22 +97,10 @@ cc_panel_get_property (GObject    *object,
 
   switch (prop_id)
     {
-    case PROP_ID:
-      g_value_set_string (value, panel->priv->id);
-      break;
-
-    case PROP_DISPLAY_NAME:
-      g_value_set_string (value, panel->priv->display_name);
-      break;
-
     case PROP_SHELL:
       g_value_set_object (value, panel->priv->shell);
       break;
 
-    case PROP_ACTIVE:
-      g_value_set_boolean (value, panel->priv->is_active);
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -160,20 +136,6 @@ cc_panel_class_init (CcPanelClass *klass)
 
   g_type_class_add_private (klass, sizeof (CcPanelPrivate));
 
-  pspec = g_param_spec_string ("id",
-                               "id",
-                               "Unique id of the Panel",
-                               NULL,
-                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-  g_object_class_install_property (object_class, PROP_ID, pspec );
-
-  pspec = g_param_spec_string ("display-name",
-                               "display name",
-                               "Display name of the Panel",
-                               NULL,
-                               G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-  g_object_class_install_property (object_class, PROP_DISPLAY_NAME, pspec);
-
   pspec = g_param_spec_object ("shell",
                                "Shell",
                                "Shell the Panel resides in",
@@ -181,14 +143,6 @@ cc_panel_class_init (CcPanelClass *klass)
                                G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
                                | G_PARAM_CONSTRUCT_ONLY);
   g_object_class_install_property (object_class, PROP_SHELL, pspec);
-
-  pspec = g_param_spec_boolean ("active",
-                                "Active",
-                                "Whether the panel is currently the active"
-                                " panel of the shell",
-                                FALSE,
-                                G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-  g_object_class_install_property (object_class, PROP_ACTIVE, pspec);
 }
 
 static void
@@ -211,93 +165,3 @@ cc_panel_get_shell (CcPanel *panel)
   return panel->priv->shell;
 }
 
-/**
- * cc_panel_get_id:
- * @panel: A #CcPanel
- *
- * Get the value of the #CcPanel:id property
- *
- * Returns: value of the id property, owned by the panel
- */
-const gchar*
-cc_panel_get_id (CcPanel *panel)
-{
-  g_return_val_if_fail (CC_IS_PANEL (panel), NULL);
-
-  return panel->priv->id;
-}
-
-
-/**
- * cc_panel_get_active:
- * @panel: A #CcPanel
- *
- * Get the current value of the #CcPanel:active property
- *
- * Returns: #TRUE if the panel is marked as active
- */
-gboolean
-cc_panel_get_active (CcPanel *panel)
-{
-  g_return_val_if_fail (CC_IS_PANEL (panel), FALSE);
-
-  return panel->priv->is_active;
-}
-
-/**
- * cc_panel_set_active:
- * @panel: A #CcPanel
- * @is_active: #TRUE if the panel is now active
- *
- * Mark the panel as active. This should only be called by CcShell
- * implementations.
- *
- */
-void
-cc_panel_set_active (CcPanel  *panel,
-                     gboolean  is_active)
-{
-  g_return_if_fail (CC_IS_PANEL (panel));
-
-  if (panel->priv->is_active != is_active)
-    {
-      gtk_widget_queue_resize (GTK_WIDGET (panel));
-
-      g_object_notify (G_OBJECT (panel), "active");
-    }
-}
-
-/**
- * cc_panel_set_display_name:
- * @panel: A #CcPanel
- * @display_name: Display name of the panel
- *
- * Set the value of the #CcPanel:display-name property.
- *
- */
-void
-cc_panel_set_display_name (CcPanel     *panel,
-                           const gchar *display_name)
-{
-  g_return_if_fail (CC_IS_PANEL (panel));
-  g_return_if_fail (display_name != NULL);
-
-  g_free (panel->priv->display_name);
-  panel->priv->display_name = g_strdup (display_name);
-}
-
-/**
- * cc_panel_get_display_name:
- * @panel: A #CcPanel
- *
- * Get the value of the #CcPanel:display-name property.
- *
- * Returns: the display name, owned by the panel
- */
-const gchar*
-cc_panel_get_display_name (CcPanel *panel)
-{
-  g_return_val_if_fail (CC_IS_PANEL (panel), NULL);
-
-  return panel->priv->display_name;
-}
diff --git a/libgnome-control-center/cc-panel.h b/libgnome-control-center/cc-panel.h
index 28942b4..1451d3a 100644
--- a/libgnome-control-center/cc-panel.h
+++ b/libgnome-control-center/cc-panel.h
@@ -70,16 +70,8 @@ struct _CcPanelClass
 
 GType        cc_panel_get_type         (void);
 
-const gchar* cc_panel_get_id           (CcPanel     *panel);
 CcShell*     cc_panel_get_shell        (CcPanel     *panel);
 
-const gchar* cc_panel_get_display_name (CcPanel     *panel);
-void         cc_panel_set_display_name (CcPanel     *panel,
-                                        const gchar *display_name);
-gboolean     cc_panel_get_active       (CcPanel     *panel);
-void         cc_panel_set_active       (CcPanel     *panel,
-                                        gboolean     is_active);
-
 
 G_END_DECLS
 
diff --git a/libgnome-control-center/cc-shell.c b/libgnome-control-center/cc-shell.c
index eda83b7..cee3177 100644
--- a/libgnome-control-center/cc-shell.c
+++ b/libgnome-control-center/cc-shell.c
@@ -158,16 +158,12 @@ cc_shell_set_active_panel (CcShell *shell,
   if (panel != shell->priv->active_panel)
     {
       /* remove the old panel */
-      cc_panel_set_active (shell->priv->active_panel, FALSE);
       g_object_unref (shell->priv->active_panel);
       shell->priv->active_panel = NULL;
 
       /* set the new panel */
       if (panel)
-        {
-          cc_panel_set_active (shell->priv->active_panel, TRUE);
-          shell->priv->active_panel = g_object_ref (panel);
-        }
+        shell->priv->active_panel = g_object_ref (panel);
 
       g_object_notify (G_OBJECT (shell), "active-panel");
     }



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