~om26er/unity/fix-778256-stable

« back to all changes in this revision

Viewing changes to services/panel-indicator-accessible.c

  • Committer: Rodrigo Moya
  • Date: 2011-02-14 16:20:53 UTC
  • mto: This revision was merged to the branch mainline in revision 859.
  • Revision ID: rodrigo.moya@canonical.com-20110214162053-3kch1hf03204ce0y
Keep track of indicator object entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
  return (AtkObject *) pia;
95
95
}
96
96
 
 
97
/* Indicator callbacks */
 
98
 
 
99
static void
 
100
on_indicator_entry_added (IndicatorObject *io, IndicatorObjectEntry *entry, gpointer user_data)
 
101
{
 
102
  AtkObject *accessible;
 
103
  PanelIndicatorAccessible *pia = PANEL_INDICATOR_ACCESSIBLE (user_data);
 
104
 
 
105
  accessible = panel_indicator_entry_accessible_new (entry);
 
106
  if (accessible != NULL)
 
107
    {
 
108
      pia->priv->a11y_children = g_slist_append (pia->priv->a11y_children, accessible);
 
109
      g_signal_emit_by_name (ATK_OBJECT (pia), "children-changed",
 
110
                             g_slist_length (pia->priv->a11y_children) - 1,
 
111
                             accessible);
 
112
    }
 
113
}
 
114
 
 
115
static void
 
116
on_indicator_entry_removed (IndicatorObject *io, IndicatorObjectEntry *entry, gpointer user_data)
 
117
{
 
118
  GSList *l;
 
119
  guint count = 0;
 
120
  PanelIndicatorAccessible *pia = PANEL_INDICATOR_ACCESSIBLE (user_data);
 
121
 
 
122
  for (l = pia->priv->a11y_children; l != NULL; l = l->next, count++)
 
123
    {
 
124
      AtkObject *accessible = ATK_OBJECT (l->data);
 
125
 
 
126
      if (entry == panel_indicator_entry_accessible_get_entry (PANEL_INDICATOR_ENTRY_ACCESSIBLE (accessible)))
 
127
        {
 
128
          pia->priv->a11y_children = g_slist_remove (pia->priv->a11y_children, accessible);
 
129
          g_signal_emit_by_name (ATK_OBJECT (pia), "children-changed",
 
130
                                 count, accessible);
 
131
 
 
132
          g_object_unref (accessible);
 
133
        }
 
134
    }
 
135
}
 
136
 
97
137
/* Implementation of AtkObject methods */
98
138
 
99
139
static void
107
147
  ATK_OBJECT_CLASS (panel_indicator_accessible_parent_class)->initialize (accessible, data);
108
148
 
109
149
  pia = PANEL_INDICATOR_ACCESSIBLE (accessible);
110
 
  pia->priv->indicator = g_object_ref (data);
111
150
  atk_object_set_name (accessible, _("An indicator")); /* FIXME */
112
151
  atk_object_set_role (accessible, ATK_ROLE_PANEL);
113
152
 
 
153
  /* Setup the indicator object */
 
154
  pia->priv->indicator = g_object_ref (data);
 
155
  g_signal_connect (G_OBJECT (pia->priv->indicator), "entry-added",
 
156
                    G_CALLBACK (on_indicator_entry_added), pia);
 
157
  g_signal_connect (G_OBJECT (pia->priv->indicator), "entry-removed",
 
158
                    G_CALLBACK (on_indicator_entry_removed), pia);
 
159
 
114
160
  /* Retrieve all entries and create their accessible objects */
115
161
  entries = indicator_object_get_entries (pia->priv->indicator);
116
162
  for (l = entries; l != NULL; l = l->next)