[gnome-panel] panel: Remove enable_animations key for toplevels



commit d991991b18ab78deba1adf6f2502eaa3cd790944
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Mar 23 18:16:40 2011 +0100

    panel: Remove enable_animations key for toplevels
    
    Instead, we simply use the gtk-enable-animations property of
    GtkSettings.

 data/org.gnome.gnome-panel.toplevel.gschema.xml |    5 --
 gnome-panel/panel-profile.c                     |    2 -
 gnome-panel/panel-toplevel.c                    |   54 ++++++++++++++++++-----
 gnome-panel/panel-toplevel.h                    |    2 -
 gnome-panel/panel-toplevel.schemas.in           |    7 +--
 5 files changed, 44 insertions(+), 26 deletions(-)
---
diff --git a/data/org.gnome.gnome-panel.toplevel.gschema.xml b/data/org.gnome.gnome-panel.toplevel.gschema.xml
index 48c11f6..1946bec 100644
--- a/data/org.gnome.gnome-panel.toplevel.gschema.xml
+++ b/data/org.gnome.gnome-panel.toplevel.gschema.xml
@@ -65,11 +65,6 @@
       <summary>Automatically hide panel into corner</summary>
       <description>If true, the panel is automatically hidden into a corner of the screen when the pointer leaves the panel area. Moving the pointer to that corner again will cause the panel to re-appear.</description>
     </key>
-    <key name="enable-animations" type="b">
-      <default>true</default>
-      <summary>Enable animations</summary>
-      <description>If true, hiding and un-hiding of this panel will be animated rather than happening instantly.</description>
-    </key>
     <key name="enable-buttons" type="b">
       <default>false</default>
       <summary>Enable hide buttons</summary>
diff --git a/gnome-panel/panel-profile.c b/gnome-panel/panel-profile.c
index c54e270..21de7a3 100644
--- a/gnome-panel/panel-profile.c
+++ b/gnome-panel/panel-profile.c
@@ -1067,7 +1067,6 @@ panel_profile_toplevel_change_notify (GConfClient   *client,
 	else UPDATE_CENTERED ("x_centered", x, x_right)
 	else UPDATE_CENTERED ("y_centered", y, y_bottom)
 	else UPDATE_BOOL ("auto_hide", auto_hide)
-	else UPDATE_BOOL ("enable_animations", animate)
 	else UPDATE_BOOL ("enable_buttons", enable_buttons)
 	else UPDATE_BOOL ("enable_arrows", enable_arrows)
 	else UPDATE_INT ("hide_delay", hide_delay)
@@ -1596,7 +1595,6 @@ panel_profile_load_toplevel (GConfClient       *client,
 	GET_STRING ("orientation", orientation);
 	GET_INT ("size", size);
 	GET_BOOL ("auto_hide", auto_hide);
-	GET_BOOL ("enable_animations", animate);
 	GET_BOOL ("enable_buttons", enable_buttons);
 	GET_BOOL ("enable_arrows", enable_arrows);
 	GET_INT ("hide_delay", hide_delay);
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index 262aa9f..90c26c9 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -225,6 +225,9 @@ static GSList       *toplevel_list = NULL;
 
 static void panel_toplevel_calculate_animation_end_geometry (PanelToplevel *toplevel);
 
+static void panel_toplevel_set_animate          (PanelToplevel *toplevel,
+						 gboolean       animate);
+
 static void panel_toplevel_update_monitor       (PanelToplevel *toplevel);
 static void panel_toplevel_set_monitor_internal (PanelToplevel *toplevel,
 						 int            monitor,
@@ -3383,12 +3386,36 @@ panel_toplevel_drag_threshold_changed (PanelToplevel *toplevel)
 }
 
 static void
+panel_toplevel_enable_animations_changed (PanelToplevel *toplevel)
+{
+	gboolean enable_animations;
+
+	enable_animations = TRUE;
+	g_object_get (G_OBJECT (toplevel->priv->gtk_settings),
+		      "gtk-enable-animations", &enable_animations,
+		      NULL);
+
+	panel_toplevel_set_animate (toplevel, enable_animations);
+}
+
+static void
+panel_toplevel_disconnect_gtk_settings (PanelToplevel *toplevel)
+{
+	if (!toplevel->priv->gtk_settings)
+		return;
+
+	g_signal_handlers_disconnect_by_func (toplevel->priv->gtk_settings,
+					      G_CALLBACK (panel_toplevel_drag_threshold_changed),
+					      toplevel);
+	g_signal_handlers_disconnect_by_func (toplevel->priv->gtk_settings,
+					      G_CALLBACK (panel_toplevel_enable_animations_changed),
+					      toplevel);
+}
+
+static void
 panel_toplevel_update_gtk_settings (PanelToplevel *toplevel)
 {
-	if (toplevel->priv->gtk_settings)
-		g_signal_handlers_disconnect_by_func (toplevel->priv->gtk_settings,
-						      G_CALLBACK (panel_toplevel_drag_threshold_changed),
-						      toplevel);
+	panel_toplevel_disconnect_gtk_settings (toplevel);
 
 	toplevel->priv->gtk_settings = gtk_widget_get_settings (GTK_WIDGET (toplevel->priv->panel_widget));
 
@@ -3398,6 +3425,13 @@ panel_toplevel_update_gtk_settings (PanelToplevel *toplevel)
 				  toplevel);
 
 	panel_toplevel_drag_threshold_changed (toplevel);
+
+	g_signal_connect_swapped (G_OBJECT (toplevel->priv->gtk_settings),
+				  "notify::gtk-enable-animations",
+				  G_CALLBACK (panel_toplevel_enable_animations_changed),
+				  toplevel);
+
+	panel_toplevel_enable_animations_changed (toplevel);
 }
 
 static void
@@ -3591,12 +3625,8 @@ panel_toplevel_finalize (GObject *object)
 
 	toplevel_list = g_slist_remove (toplevel_list, toplevel);
 
-	if (toplevel->priv->gtk_settings) {
-		g_signal_handlers_disconnect_by_func (toplevel->priv->gtk_settings,
-						      G_CALLBACK (panel_toplevel_drag_threshold_changed),
-						      toplevel);
-		toplevel->priv->gtk_settings = NULL;
-	}
+	panel_toplevel_disconnect_gtk_settings (toplevel);
+	toplevel->priv->gtk_settings = NULL;
 
 	if (toplevel->priv->description)
 		g_free (toplevel->priv->description);
@@ -3833,7 +3863,7 @@ panel_toplevel_class_init (PanelToplevelClass *klass)
 			"Animate",
 			"Enable hiding/showing animations",
 			TRUE,
-			G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+			G_PARAM_READABLE));
 
 	g_object_class_install_property (
 		gobject_class,
@@ -4715,7 +4745,7 @@ panel_toplevel_get_unhide_delay (PanelToplevel *toplevel)
 	return toplevel->priv->unhide_delay;
 }
 
-void
+static void
 panel_toplevel_set_animate (PanelToplevel *toplevel,
 			    gboolean       animate)
 {
diff --git a/gnome-panel/panel-toplevel.h b/gnome-panel/panel-toplevel.h
index 35142d5..ceb60ec 100644
--- a/gnome-panel/panel-toplevel.h
+++ b/gnome-panel/panel-toplevel.h
@@ -142,8 +142,6 @@ void                 panel_toplevel_set_unhide_delay       (PanelToplevel
 							    int                  unhide_delay);
 int                  panel_toplevel_get_unhide_delay       (PanelToplevel       *toplevel);
 
-void                 panel_toplevel_set_animate            (PanelToplevel       *toplevel,
-							    gboolean             animate);
 gboolean             panel_toplevel_get_animate            (PanelToplevel       *toplevel);
 void                 panel_toplevel_set_animation_speed    (PanelToplevel       *toplevel,
 							    PanelAnimationSpeed  animation_speed);
diff --git a/gnome-panel/panel-toplevel.schemas.in b/gnome-panel/panel-toplevel.schemas.in
index 99cae74..6970d7e 100644
--- a/gnome-panel/panel-toplevel.schemas.in
+++ b/gnome-panel/panel-toplevel.schemas.in
@@ -227,11 +227,8 @@
       <type>bool</type>
       <default>true</default>
       <locale name="C">
-        <short>Enable animations</short>
-        <long>
-          If true, hiding and un-hiding of this panel will be animated
-          rather than happening instantly.
-        </long>
+        <short>Deprecated</short>
+        <long></long>
       </locale>
     </schema>
  



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