[gnome-shell] st: Remove st-tooltip



commit d81958a07498f3076f19e95847345a24e18bdfdd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Feb 13 12:08:05 2012 -0500

    st: Remove st-tooltip
    
    StTooltip has been plagued by lots of issues, and we recently ditched
    it in the dash. Remove it for good.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670034

 data/theme/gnome-shell.css        |   11 -
 docs/reference/st/st-docs.sgml.in |    1 -
 js/ui/dnd.js                      |    4 +-
 js/ui/main.js                     |    1 -
 js/ui/panelMenu.js                |   16 +-
 js/ui/status/accessibility.js     |    2 +-
 js/ui/status/bluetooth.js         |    2 +-
 js/ui/status/network.js           |    2 +-
 js/ui/status/power.js             |    2 +-
 js/ui/status/volume.js            |    2 +-
 src/Makefile-st.am                |    2 -
 src/shell-global.c                |   42 ---
 src/st/st-button.c                |    4 -
 src/st/st-tooltip.c               |  525 -------------------------------------
 src/st/st-tooltip.h               |   91 -------
 src/st/st-widget.c                |  455 +-------------------------------
 src/st/st-widget.h                |   14 -
 17 files changed, 13 insertions(+), 1163 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index ad4fd7a..8f569c1 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -79,17 +79,6 @@ StScrollBar StButton#vhandle:hover
     background-color: #292929;
 }
 
-StTooltip StLabel {
-    border: 1px solid rgba(255,255,255,0.6);
-    border-radius: 5px;
-    padding: 2px 12px;
-    background-color: rgba(0,0,0,0.9);
-    color: #ffffff;
-    font-size: 0.8em;
-    font-weight: normal;
-    text-align: center;
-}
-
 .check-box ShellGenericContainer {
     spacing: .8em;
 }
diff --git a/docs/reference/st/st-docs.sgml.in b/docs/reference/st/st-docs.sgml.in
index 730b2d4..764c5ea 100644
--- a/docs/reference/st/st-docs.sgml.in
+++ b/docs/reference/st/st-docs.sgml.in
@@ -30,7 +30,6 @@
       <xi:include href="xml/st-entry.xml"/>
       <xi:include href="xml/st-icon.xml"/>
       <xi:include href="xml/st-label.xml"/>
-      <xi:include href="xml/st-tooltip.xml"/>
     </chapter>
     <chapter id="containers">
       <title>Containers</title>
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index cb8b913..04149cc 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -103,8 +103,8 @@ const _Draggable = new Lang.Class({
         this._dragInProgress = false; // The drag has been started, and has not been dropped or cancelled yet.
         this._animationInProgress = false; // The drag is over and the item is in the process of animating to its original position (snapping back or reverting).
 
-        // During the drag, we eat enter/leave events so that actors don't prelight or show
-        // tooltips. But we remember the actors that we first left/last entered so we can
+        // During the drag, we eat enter/leave events so that actors don't prelight.
+        // But we remember the actors that we first left/last entered so we can
         // fix up the hover state after the drag ends.
         this._firstLeaveActor = null;
         this._lastEnterActor = null;
diff --git a/js/ui/main.js b/js/ui/main.js
index 6d8f4ac..279a453 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -190,7 +190,6 @@ function start() {
     let constraint = new Clutter.BindConstraint({ source: global.stage,
                                                   coordinate: Clutter.BindCoordinate.SIZE });
     uiGroup.add_constraint(constraint);
-    St.set_ui_root(global.stage, uiGroup);
     global.window_group.reparent(uiGroup);
     global.overlay_group.reparent(uiGroup);
     global.stage.add_actor(uiGroup);
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index 66f4813..6f15d2a 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -215,13 +215,13 @@ Signals.addSignalMethods(Button.prototype);
  *
  * This class manages one System Status indicator (network, keyboard,
  * volume, bluetooth...), which is just a PanelMenuButton with an
- * icon and a tooltip
+ * icon.
  */
 const SystemStatusButton = new Lang.Class({
     Name: 'SystemStatusButton',
     Extends: Button,
 
-    _init: function(iconName, tooltipText, nameText) {
+    _init: function(iconName, nameText) {
         this.parent(0.0, nameText);
 
         this._iconActor = new St.Icon({ icon_name: iconName,
@@ -229,7 +229,6 @@ const SystemStatusButton = new Lang.Class({
                                         style_class: 'system-status-icon' });
         this.actor.add_actor(this._iconActor);
         this.actor.add_style_class_name('panel-status-button');
-        this.setTooltip(tooltipText);
     },
 
     setIcon: function(iconName) {
@@ -238,16 +237,5 @@ const SystemStatusButton = new Lang.Class({
 
     setGIcon: function(gicon) {
         this._iconActor.gicon = gicon;
-    },
-
-    setTooltip: function(text) {
-        if (text != null) {
-            this.tooltip = text;
-            this.actor.has_tooltip = true;
-            this.actor.tooltip_text = text;
-        } else {
-            this.actor.has_tooltip = false;
-            this.tooltip = null;
-        }
     }
 });
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index bda0e01..42d3a3c 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -44,7 +44,7 @@ const ATIndicator = new Lang.Class({
     Extends: PanelMenu.SystemStatusButton,
 
     _init: function() {
-        this.parent('preferences-desktop-accessibility', null, _("Accessibility"));
+        this.parent('preferences-desktop-accessibility', _("Accessibility"));
 
         let highContrast = this._buildHCItem();
         this.menu.addMenuItem(highContrast);
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 34b1b18..ea864a7 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -28,7 +28,7 @@ const Indicator = new Lang.Class({
     Extends: PanelMenu.SystemStatusButton,
 
     _init: function() {
-        this.parent('bluetooth-disabled', null, _("Bluetooth"));
+        this.parent('bluetooth-disabled', _("Bluetooth"));
 
         this._applet = new GnomeBluetoothApplet.Applet();
 
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index f6cd8d0..5c6babe 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1538,7 +1538,7 @@ const NMApplet = new Lang.Class({
     Extends: PanelMenu.SystemStatusButton,
 
     _init: function() {
-        this.parent('network-error', null, _("Network"));
+        this.parent('network-error', _("Network"));
 
         this._client = NMClient.Client.new();
 
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 9391bf8..84f6b2d 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -56,7 +56,7 @@ const Indicator = new Lang.Class({
     Extends: PanelMenu.SystemStatusButton,
 
     _init: function() {
-        this.parent('battery-missing', null, _("Battery"));
+        this.parent('battery-missing', _("Battery"));
 
         this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
 
diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js
index ac4382f..ff907ca 100644
--- a/js/ui/status/volume.js
+++ b/js/ui/status/volume.js
@@ -22,7 +22,7 @@ const Indicator = new Lang.Class({
     Extends: PanelMenu.SystemStatusButton,
 
     _init: function() {
-        this.parent('audio-volume-muted', null, _("Volume"));
+        this.parent('audio-volume-muted', _("Volume"));
 
         this._control = new Gvc.MixerControl({ name: 'GNOME Shell Volume Control' });
         this._control.connect('state-changed', Lang.bind(this, this._onControlStateChanged));
diff --git a/src/Makefile-st.am b/src/Makefile-st.am
index b6ba99c..8561f61 100644
--- a/src/Makefile-st.am
+++ b/src/Makefile-st.am
@@ -70,7 +70,6 @@ st_source_h =					\
 	st/st-theme.h				\
 	st/st-theme-context.h			\
 	st/st-theme-node.h			\
-	st/st-tooltip.h				\
 	st/st-types.h				\
 	st/st-widget.h				\
 	st/st-widget-accessible.h		\
@@ -128,7 +127,6 @@ st_source_c =					\
 	st/st-theme-node.c			\
 	st/st-theme-node-drawing.c		\
 	st/st-theme-node-transition.c		\
-	st/st-tooltip.c				\
 	st/st-widget.c				\
 	$(NULL)
 
diff --git a/src/shell-global.c b/src/shell-global.c
index ed73f29..38fb89e 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -802,46 +802,6 @@ global_stage_after_paint (ClutterStage *stage,
 }
 
 static void
-constrain_tooltip (StTooltip             *tooltip,
-                   const ClutterGeometry *geometry,
-                   ClutterGeometry       *adjusted_geometry,
-                   gpointer               data)
-{
-  const ClutterGeometry *tip_area = st_tooltip_get_tip_area (tooltip);
-  ShellGlobal *global = shell_global_get ();
-  MetaScreen *screen = shell_global_get_screen (global);
-  int n_monitors = meta_screen_get_n_monitors (screen);
-  int i;
-
-  *adjusted_geometry = *geometry;
-
-  /* A point that determines what screen we'll constrain to */
-  int x = tip_area->x + tip_area->width / 2;
-  int y = tip_area->y + tip_area->height / 2;
-
-  for (i = 0; i < n_monitors; i++)
-    {
-      MetaRectangle rect;
-      meta_screen_get_monitor_geometry (screen, i, &rect);
-      if (x >= rect.x && x < rect.x + rect.width &&
-          y >= rect.y && y < rect.y + rect.height)
-        {
-          if (adjusted_geometry->x + adjusted_geometry->width > rect.x + rect.width)
-            adjusted_geometry->x = rect.x + rect.width - adjusted_geometry->width;
-          if (adjusted_geometry->x < rect.x)
-            adjusted_geometry->x = rect.x;
-
-          if (adjusted_geometry->y + adjusted_geometry->height > rect.y + rect.height)
-            adjusted_geometry->y = rect.y + rect.height - adjusted_geometry->height;
-          if (adjusted_geometry->y < rect.y)
-            adjusted_geometry->y = rect.y;
-
-          return;
-        }
-    }
-}
-
-static void
 update_font_options (GtkSettings  *settings,
                      ClutterStage *stage)
 {
@@ -870,8 +830,6 @@ update_font_options (GtkSettings  *settings,
   else
     st_theme_context_set_default_resolution (context);
 
-  st_tooltip_set_constrain_func (stage, constrain_tooltip, NULL, NULL);
-
   /* Clutter (as of 0.9) passes comprehensively wrong font options
    * override whatever set_font_flags() did above.
    *
diff --git a/src/st/st-button.c b/src/st/st-button.c
index 4d146ef..91415cc 100644
--- a/src/st/st-button.c
+++ b/src/st/st-button.c
@@ -163,8 +163,6 @@ st_button_button_press (ClutterActor       *actor,
   StButton *button = ST_BUTTON (actor);
   StButtonMask mask = ST_BUTTON_MASK_FROM_BUTTON (event->button);
 
-  st_widget_hide_tooltip (ST_WIDGET (actor));
-
   if (button->priv->button_mask & mask)
     {
       if (button->priv->grabbed == 0)
@@ -209,8 +207,6 @@ st_button_key_press (ClutterActor    *actor,
 {
   StButton *button = ST_BUTTON (actor);
 
-  st_widget_hide_tooltip (ST_WIDGET (actor));
-
   if (button->priv->button_mask & ST_BUTTON_ONE)
     {
       if (event->keyval == CLUTTER_KEY_space ||
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 4b22db9..5ef88c6 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -38,7 +38,6 @@
 #include "st-private.h"
 #include "st-texture-cache.h"
 #include "st-theme-context.h"
-#include "st-tooltip.h"
 #include "st-theme-node-transition.h"
 
 #include "st-widget-accessible.h"
@@ -57,11 +56,8 @@ struct _StWidgetPrivate
   gchar        *inline_style;
 
   StThemeNodeTransition *transition_animation;
-  guint tooltip_timeout_id;
 
   gboolean      is_stylable : 1;
-  gboolean      has_tooltip : 1;
-  gboolean      show_tooltip : 1;
   gboolean      is_style_dirty : 1;
   gboolean      draw_bg_color : 1;
   gboolean      draw_border_internal : 1;
@@ -69,8 +65,6 @@ struct _StWidgetPrivate
   gboolean      hover : 1;
   gboolean      can_focus : 1;
 
-  StTooltip    *tooltip;
-
   StTextDirection   direction;
 
   AtkObject *accessible;
@@ -98,8 +92,6 @@ enum
   PROP_STYLE_CLASS,
   PROP_STYLE,
   PROP_STYLABLE,
-  PROP_HAS_TOOLTIP,
-  PROP_TOOLTIP_TEXT,
   PROP_TRACK_HOVER,
   PROP_HOVER,
   PROP_CAN_FOCUS,
@@ -130,10 +122,6 @@ static gboolean st_widget_real_navigate_focus (StWidget         *widget,
 
 static AtkObject * st_widget_get_accessible (ClutterActor *actor);
 
-static void st_widget_start_tooltip_timeout (StWidget *widget);
-static void st_widget_do_show_tooltip (StWidget *widget);
-static void st_widget_do_hide_tooltip (StWidget *widget);
-
 static void
 st_widget_set_property (GObject      *gobject,
                         guint         prop_id,
@@ -168,14 +156,6 @@ st_widget_set_property (GObject      *gobject,
         }
       break;
 
-    case PROP_HAS_TOOLTIP:
-      st_widget_set_has_tooltip (actor, g_value_get_boolean (value));
-      break;
-
-    case PROP_TOOLTIP_TEXT:
-      st_widget_set_tooltip_text (actor, g_value_get_string (value));
-      break;
-
     case PROP_TRACK_HOVER:
       st_widget_set_track_hover (actor, g_value_get_boolean (value));
       break;
@@ -229,14 +209,6 @@ st_widget_get_property (GObject    *gobject,
       g_value_set_boolean (value, priv->is_stylable);
       break;
 
-    case PROP_HAS_TOOLTIP:
-      g_value_set_boolean (value, priv->has_tooltip);
-      break;
-
-    case PROP_TOOLTIP_TEXT:
-      g_value_set_string (value, st_widget_get_tooltip_text (actor));
-      break;
-
     case PROP_TRACK_HOVER:
       g_value_set_boolean (value, priv->track_hover);
       break;
@@ -291,19 +263,6 @@ st_widget_dispose (GObject *gobject)
 
   st_widget_remove_transition (actor);
 
-  if (priv->tooltip_timeout_id)
-    {
-      g_source_remove (priv->tooltip_timeout_id);
-      priv->tooltip_timeout_id = 0;
-    }
-
-  if (priv->tooltip)
-    {
-      clutter_actor_destroy (CLUTTER_ACTOR (priv->tooltip));
-      g_object_unref (priv->tooltip);
-      priv->tooltip = NULL;
-    }
-
   /* The real dispose of this accessible is done on
    * AtkGObjectAccessible weak ref callback
    */
@@ -374,38 +333,6 @@ st_widget_get_preferred_height (ClutterActor *self,
 }
 
 static void
-st_widget_allocate (ClutterActor          *actor,
-                    const ClutterActorBox *box,
-                    ClutterAllocationFlags flags)
-{
-  StWidget *self = ST_WIDGET (actor);
-  StWidgetPrivate *priv = self->priv;
-  ClutterActorClass *klass;
-  ClutterGeometry area;
-  ClutterVertex in_v, out_v;
-
-  klass = CLUTTER_ACTOR_CLASS (st_widget_parent_class);
-  klass->allocate (actor, box, flags);
-
-  /* update tooltip position */
-  if (priv->tooltip)
-    {
-      in_v.x = in_v.y = in_v.z = 0;
-      clutter_actor_apply_transform_to_point (actor, &in_v, &out_v);
-      area.x = out_v.x;
-      area.y = out_v.y;
-
-      in_v.x = box->x2 - box->x1;
-      in_v.y = box->y2 - box->y1;
-      clutter_actor_apply_transform_to_point (actor, &in_v, &out_v);
-      area.width = out_v.x - area.x;
-      area.height = out_v.y - area.y;
-
-      st_tooltip_set_tip_area (priv->tooltip, &area);
-    }
-}
-
-static void
 st_widget_paint (ClutterActor *actor)
 {
   StWidget *self = ST_WIDGET (actor);
@@ -453,9 +380,6 @@ st_widget_map (ClutterActor *actor)
   CLUTTER_ACTOR_CLASS (st_widget_parent_class)->map (actor);
 
   st_widget_ensure_style (self);
-
-  if (self->priv->show_tooltip)
-    st_widget_do_show_tooltip (self);
 }
 
 static void
@@ -468,8 +392,6 @@ st_widget_unmap (ClutterActor *actor)
 
   if (priv->track_hover && priv->hover)
     st_widget_set_hover (self, FALSE);
-
-  st_widget_do_hide_tooltip (self);
 }
 
 static void notify_children_of_style_change (ClutterContainer *container);
@@ -696,19 +618,6 @@ st_widget_leave (ClutterActor         *actor,
     return FALSE;
 }
 
-static gboolean
-st_widget_motion (ClutterActor       *actor,
-                  ClutterMotionEvent *motion)
-{
-  StWidget *widget = ST_WIDGET (actor);
-  StWidgetPrivate *priv = widget->priv;
-
-  if (priv->has_tooltip)
-    st_widget_start_tooltip_timeout (widget);
-
-  return FALSE;
-}
-
 static void
 st_widget_key_focus_in (ClutterActor *actor)
 {
@@ -740,18 +649,6 @@ st_widget_key_press_event (ClutterActor    *actor,
   return FALSE;
 }
 
-static void
-st_widget_hide (ClutterActor *actor)
-{
-  StWidget *widget = (StWidget *) actor;
-
-  /* hide the tooltip, if there is one */
-  if (widget->priv->tooltip)
-    clutter_actor_hide (CLUTTER_ACTOR (widget->priv->tooltip));
-
-  CLUTTER_ACTOR_CLASS (st_widget_parent_class)->hide (actor);
-}
-
 static gboolean
 st_widget_get_paint_volume (ClutterActor *self,
                             ClutterPaintVolume *volume)
@@ -804,7 +701,6 @@ st_widget_class_init (StWidgetClass *klass)
 
   actor_class->get_preferred_width = st_widget_get_preferred_width;
   actor_class->get_preferred_height = st_widget_get_preferred_height;
-  actor_class->allocate = st_widget_allocate;
   actor_class->paint = st_widget_paint;
   actor_class->get_paint_volume = st_widget_get_paint_volume;
   actor_class->parent_set = st_widget_parent_set;
@@ -813,11 +709,9 @@ st_widget_class_init (StWidgetClass *klass)
 
   actor_class->enter_event = st_widget_enter;
   actor_class->leave_event = st_widget_leave;
-  actor_class->motion_event = st_widget_motion;
   actor_class->key_focus_in = st_widget_key_focus_in;
   actor_class->key_focus_out = st_widget_key_focus_out;
   actor_class->key_press_event = st_widget_key_press_event;
-  actor_class->hide = st_widget_hide;
 
   actor_class->get_accessible = st_widget_get_accessible;
 
@@ -894,35 +788,6 @@ st_widget_class_init (StWidgetClass *klass)
                                    pspec);
 
   /**
-   * StWidget:has-tooltip:
-   *
-   * Determines whether the widget has a tooltip. If set to %TRUE, causes the
-   * widget to monitor hover state (i.e. sets #ClutterActor:reactive and
-   * #StWidget:track-hover).
-   */
-  pspec = g_param_spec_boolean ("has-tooltip",
-                                "Has Tooltip",
-                                "Determines whether the widget has a tooltip",
-                                FALSE,
-                                ST_PARAM_READWRITE);
-  g_object_class_install_property (gobject_class,
-                                   PROP_HAS_TOOLTIP,
-                                   pspec);
-
-
-  /**
-   * StWidget:tooltip-text:
-   *
-   * text displayed on the tooltip
-   */
-  pspec = g_param_spec_string ("tooltip-text",
-                               "Tooltip Text",
-                               "Text displayed on the tooltip",
-                               "",
-                               ST_PARAM_READWRITE);
-  g_object_class_install_property (gobject_class, PROP_TOOLTIP_TEXT, pspec);
-
-  /**
    * StWidget:track-hover:
    *
    * Determines whether the widget tracks pointer hover state. If
@@ -1550,211 +1415,6 @@ st_widget_set_direction (StWidget *self, StTextDirection dir)
     st_widget_style_changed (self);
 }
 
-static void
-st_widget_ensure_tooltip_parented (StWidget *widget, ClutterStage *stage)
-{
-  StWidgetPrivate *priv;
-  ClutterContainer *ui_root;
-  ClutterActor *tooltip, *parent;
-
-  priv = widget->priv;
-
-  ui_root = st_get_ui_root (stage);
-
-  tooltip = CLUTTER_ACTOR (priv->tooltip);
-  parent = clutter_actor_get_parent (tooltip);
-
-  if (G_UNLIKELY (parent != CLUTTER_ACTOR (ui_root)))
-    {
-      if (parent)
-        clutter_container_remove_actor (CLUTTER_CONTAINER (parent), tooltip);
-
-      clutter_container_add_actor (ui_root, tooltip);
-    }
-}
-
-/**
- * st_widget_set_has_tooltip:
- * @widget: A #StWidget
- * @has_tooltip: %TRUE if the widget should display a tooltip
- *
- * Enables tooltip support on the #StWidget.
- *
- * Note that setting has-tooltip to %TRUE will cause
- * #ClutterActor:reactive and #StWidget:track-hover to be set %TRUE as
- * well, but you must clear these flags yourself (if appropriate) when
- * setting it %FALSE.
- */
-void
-st_widget_set_has_tooltip (StWidget *widget,
-                           gboolean  has_tooltip)
-{
-  StWidgetPrivate *priv;
-  ClutterActor *stage;
-
-  g_return_if_fail (ST_IS_WIDGET (widget));
-
-  priv = widget->priv;
-
-  priv->has_tooltip = has_tooltip;
-
-  if (has_tooltip)
-    {
-      clutter_actor_set_reactive ((ClutterActor*) widget, TRUE);
-      st_widget_set_track_hover (widget, TRUE);
-
-      if (!priv->tooltip)
-        {
-          priv->tooltip = g_object_new (ST_TYPE_TOOLTIP, NULL);
-          g_object_ref_sink (priv->tooltip);
-
-          stage = clutter_actor_get_stage (CLUTTER_ACTOR (widget));
-          if (stage != NULL)
-            st_widget_ensure_tooltip_parented (widget, CLUTTER_STAGE (stage));
-        }
-    }
-  else
-    {
-      if (priv->tooltip_timeout_id)
-        {
-          g_source_remove (priv->tooltip_timeout_id);
-          priv->tooltip_timeout_id = 0;
-        }
-
-      if (priv->tooltip)
-        {
-          clutter_actor_destroy (CLUTTER_ACTOR (priv->tooltip));
-          g_object_unref (priv->tooltip);
-          priv->tooltip = NULL;
-        }
-    }
-}
-
-/**
- * st_widget_get_has_tooltip:
- * @widget: A #StWidget
- *
- * Returns the current value of the has-tooltip property. See
- * st_tooltip_set_has_tooltip() for more information.
- *
- * Returns: current value of has-tooltip on @widget
- */
-gboolean
-st_widget_get_has_tooltip (StWidget *widget)
-{
-  g_return_val_if_fail (ST_IS_WIDGET (widget), FALSE);
-
-  return widget->priv->has_tooltip;
-}
-
-/**
- * st_widget_set_tooltip_text:
- * @widget: A #StWidget
- * @text: text to set as the tooltip
- *
- * Set the tooltip text of the widget. This will set StWidget::has-tooltip to
- * %TRUE. A value of %NULL will unset the tooltip and set has-tooltip to %FALSE.
- *
- */
-void
-st_widget_set_tooltip_text (StWidget    *widget,
-                            const gchar *text)
-{
-  StWidgetPrivate *priv;
-
-  g_return_if_fail (ST_IS_WIDGET (widget));
-
-  priv = widget->priv;
-
-  if (text == NULL)
-    st_widget_set_has_tooltip (widget, FALSE);
-  else
-    {
-      st_widget_set_has_tooltip (widget, TRUE);
-      st_tooltip_set_label (priv->tooltip, text);
-    }
-}
-
-/**
- * st_widget_get_tooltip_text:
- * @widget: A #StWidget
- *
- * Get the current tooltip string
- *
- * Returns: The current tooltip string, owned by the #StWidget
- */
-const gchar*
-st_widget_get_tooltip_text (StWidget *widget)
-{
-  StWidgetPrivate *priv;
-
-  g_return_val_if_fail (ST_IS_WIDGET (widget), NULL);
-  priv = widget->priv;
-
-  if (!priv->has_tooltip)
-    return NULL;
-
-  return st_tooltip_get_label (widget->priv->tooltip);
-}
-
-/**
- * st_widget_show_tooltip:
- * @widget: A #StWidget
- *
- * Force the tooltip for @widget to be shown
- *
- */
-void
-st_widget_show_tooltip (StWidget *widget)
-{
-  g_return_if_fail (ST_IS_WIDGET (widget));
-
-  widget->priv->show_tooltip = TRUE;
-  if (CLUTTER_ACTOR_IS_MAPPED (widget))
-    st_widget_do_show_tooltip (widget);
-}
-
-static void
-st_widget_do_show_tooltip (StWidget *widget)
-{
-  ClutterActor *stage, *tooltip;
-
-  stage = clutter_actor_get_stage (CLUTTER_ACTOR (widget));
-  g_return_if_fail (stage != NULL);
-
-  if (widget->priv->tooltip)
-    {
-      tooltip = CLUTTER_ACTOR (widget->priv->tooltip);
-      st_widget_ensure_tooltip_parented (widget, CLUTTER_STAGE (stage));
-      clutter_actor_raise (tooltip, NULL);
-      clutter_actor_show_all (tooltip);
-    }
-}
-
-/**
- * st_widget_hide_tooltip:
- * @widget: A #StWidget
- *
- * Hide the tooltip for @widget
- *
- */
-void
-st_widget_hide_tooltip (StWidget *widget)
-{
-  g_return_if_fail (ST_IS_WIDGET (widget));
-
-  widget->priv->show_tooltip = FALSE;
-  if (CLUTTER_ACTOR_IS_MAPPED (widget))
-    st_widget_do_hide_tooltip (widget);
-}
-
-static void
-st_widget_do_hide_tooltip (StWidget *widget)
-{
-  if (widget->priv->tooltip)
-    clutter_actor_hide (CLUTTER_ACTOR (widget->priv->tooltip));
-}
-
 /**
  * st_widget_set_track_hover:
  * @widget: A #StWidget
@@ -1798,7 +1458,7 @@ st_widget_set_track_hover (StWidget *widget,
  * @widget: A #StWidget
  *
  * Returns the current value of the track-hover property. See
- * st_tooltip_set_track_hover() for more information.
+ * st_widget_set_track_hover() for more information.
  *
  * Returns: current value of track-hover on @widget
  */
@@ -1810,36 +1470,13 @@ st_widget_get_track_hover (StWidget *widget)
   return widget->priv->track_hover;
 }
 
-static gboolean
-tooltip_timeout (gpointer data)
-{
-  st_widget_show_tooltip (data);
-
-  return FALSE;
-}
-
-static void
-st_widget_start_tooltip_timeout (StWidget *widget)
-{
-  StWidgetPrivate *priv = widget->priv;
-  GtkSettings *settings = gtk_settings_get_default ();
-  guint timeout;
-
-  if (priv->tooltip_timeout_id)
-    g_source_remove (priv->tooltip_timeout_id);
-
-  g_object_get (settings, "gtk-tooltip-timeout", &timeout, NULL);
-  priv->tooltip_timeout_id = g_timeout_add (timeout, tooltip_timeout, widget);
-}
-
 /**
  * st_widget_set_hover:
  * @widget: A #StWidget
  * @hover: whether the pointer is hovering over the widget
  *
  * Sets @widget's hover property and adds or removes "hover" from its
- * pseudo class accordingly. If #StWidget:has-tooltip is %TRUE, this
- * will also show or hide the tooltip, as appropriate.
+ * pseudo class accordingly.
  *
  * If you have set #StWidget:track-hover, you should not need to call
  * this directly. You can call st_widget_sync_hover() if the hover
@@ -1859,25 +1496,9 @@ st_widget_set_hover (StWidget *widget,
     {
       priv->hover = hover;
       if (priv->hover)
-        {
-          st_widget_add_style_pseudo_class (widget, "hover");
-          if (priv->has_tooltip)
-            st_widget_start_tooltip_timeout (widget);
-        }
+        st_widget_add_style_pseudo_class (widget, "hover");
       else
-        {
-          st_widget_remove_style_pseudo_class (widget, "hover");
-          if (priv->has_tooltip)
-            {
-              if (priv->tooltip_timeout_id)
-                {
-                  g_source_remove (priv->tooltip_timeout_id);
-                  priv->tooltip_timeout_id = 0;
-                }
-
-              st_widget_hide_tooltip (widget);
-            }
-        }
+        st_widget_remove_style_pseudo_class (widget, "hover");
       g_object_notify (G_OBJECT (widget), "hover");
     }
 }
@@ -2421,74 +2042,6 @@ on_can_focus_notify (GObject    *gobject,
                                   ATK_STATE_FOCUSABLE, can_focus);
 }
 
-static GQuark
-st_ui_root_quark (void)
-{
-  static GQuark value = 0;
-  if (G_UNLIKELY (value == 0))
-    value = g_quark_from_static_string ("st-ui-root");
-  return value;
-}
-
-static void
-st_ui_root_destroyed (ClutterActor *actor,
-                      ClutterStage *stage)
-{
-  st_set_ui_root (stage, NULL);
-  g_signal_handlers_disconnect_by_func (actor, st_ui_root_destroyed, stage);
-}
-
-/**
- * st_set_ui_root:
- * @stage: a #ClutterStage
- * @container: (allow-none): the new UI root
- *
- * Sets a #ClutterContainer to be the parent of all UI in the program.
- * This container is used when St needs to add new content outside the
- * widget hierarchy, for example, when it shows a tooltip over a widget.
- */
-void
-st_set_ui_root (ClutterStage     *stage,
-                ClutterContainer *container)
-{
-  ClutterContainer *previous;
-
-  g_return_if_fail (CLUTTER_IS_STAGE (stage));
-  g_return_if_fail (CLUTTER_IS_CONTAINER (container));
-
-  previous = st_get_ui_root (stage);
-  if (previous)
-    g_signal_handlers_disconnect_by_func (container, st_ui_root_destroyed, stage);
-
-  if (container)
-    {
-      g_signal_connect (container, "destroy", G_CALLBACK (st_ui_root_destroyed), stage);
-      g_object_set_qdata_full (G_OBJECT (stage), st_ui_root_quark (), g_object_ref (container), g_object_unref);
-    }
-}
-
-/**
- * st_get_ui_root:
- * @stage: a #ClutterStage
- *
- * Returns: (transfer none): the container which should be the parent of all user interface,
- *   which can be set with st_set_ui_root(). If not set, returns @stage
- */
-ClutterContainer *
-st_get_ui_root (ClutterStage *stage)
-{
-  ClutterContainer *root;
-
-  g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
-
-  root = g_object_get_qdata (G_OBJECT (stage), st_ui_root_quark ());
-
-  if (root != NULL)
-    return root;
-  else
-    return CLUTTER_CONTAINER (stage);
-}
-
 static void
 on_label_notify (GObject    *gobject,
                  GParamSpec *pspec,
diff --git a/src/st/st-widget.h b/src/st/st-widget.h
index 2ed46b3..81dc6c6 100644
--- a/src/st/st-widget.h
+++ b/src/st/st-widget.h
@@ -117,16 +117,6 @@ void                  st_widget_set_theme                 (StWidget        *acto
                                                            StTheme         *theme);
 StTheme *             st_widget_get_theme                 (StWidget        *actor);
 
-void                  st_widget_set_has_tooltip           (StWidget        *widget,
-                                                           gboolean         has_tooltip);
-gboolean              st_widget_get_has_tooltip           (StWidget        *widget);
-void                  st_widget_set_tooltip_text          (StWidget        *widget,
-                                                           const gchar     *text);
-const gchar*          st_widget_get_tooltip_text          (StWidget        *widget);
-
-void                  st_widget_show_tooltip              (StWidget        *widget);
-void                  st_widget_hide_tooltip              (StWidget        *widget);
-
 void                  st_widget_set_track_hover           (StWidget        *widget,
                                                            gboolean         track_hover);
 gboolean              st_widget_get_track_hover           (StWidget        *widget);
@@ -166,10 +156,6 @@ char  *st_describe_actor       (ClutterActor *actor);
 void   st_set_slow_down_factor (gfloat factor);
 gfloat st_get_slow_down_factor (void);
 
-void              st_set_ui_root (ClutterStage     *stage,
-                                  ClutterContainer *container);
-ClutterContainer *st_get_ui_root (ClutterStage     *stage);
-
 G_END_DECLS
 
 #endif /* __ST_WIDGET_H__ */



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