~karl-qdh/ido/select-activate-set-date

« back to all changes in this revision

Viewing changes to src/idogesturemanager.c

  • Committer: Cody Russell
  • Date: 2010-09-24 14:46:19 UTC
  • Revision ID: crussell@canonical.com-20100924144619-iadiipwgghzksk61
Cleanup, and update to latest geis API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
  GtkWindow         *window;
51
51
  GList             *bindings;
52
52
  GeisInstance       instance;
 
53
  GIOChannel        *iochannel;
53
54
};
54
55
 
55
56
static void gesture_added (void              *cookie,
103
104
  if (priv->hash != NULL)
104
105
    {
105
106
      g_hash_table_unref (priv->hash);
 
107
      priv->hash = NULL;
106
108
    }
107
109
}
108
110
 
 
111
static void
 
112
ido_gesture_manager_finalize (GObject *object)
 
113
{
 
114
}
 
115
 
109
116
static GObject *
110
117
ido_gesture_manager_constructor (GType                  type,
111
118
                                 guint                  n_params,
143
150
 
144
151
  gobject_class->constructor = ido_gesture_manager_constructor;
145
152
  gobject_class->dispose     = ido_gesture_manager_dispose;
 
153
  gobject_class->finalize    = ido_gesture_manager_finalize;
146
154
}
147
155
 
148
156
/*
183
191
 
184
192
  for (i = 0; i < attr_count; ++i)
185
193
    {
186
 
      if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FINGERS) == 0 &&
 
194
      if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_TOUCHES) == 0 &&
187
195
          attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
188
196
        {
189
197
          touches = attrs[i].integer_val;
233
241
 
234
242
  for (i = 0; i < attr_count; ++i)
235
243
    {
236
 
      if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FINGERS) == 0 &&
 
244
      if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_TOUCHES) == 0 &&
237
245
          attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
238
246
        {
239
247
          touches = attrs[i].integer_val;
298
306
 
299
307
  for (i = 0; i < attr_count; ++i)
300
308
    {
301
 
      if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FINGERS) == 0 &&
 
309
      if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_TOUCHES) == 0 &&
302
310
          attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
303
311
        {
304
312
          touches = attrs[i].integer_val;
585
593
  return TRUE;
586
594
}
587
595
 
 
596
static void
 
597
window_destroyed_cb (GtkObject *object,
 
598
                     gpointer   user_data)
 
599
{
 
600
  IdoGestureManager *manager = (IdoGestureManager *)user_data;
 
601
  IdoGestureManagerPrivate *priv = manager->priv;
 
602
  IdoGestureRegistration *reg = g_hash_table_lookup (priv->hash, object);
 
603
  GList *list;
 
604
 
 
605
  for (list = reg->bindings; list != NULL; list = list->next)
 
606
    {
 
607
      IdoGestureBinding *binding = (IdoGestureBinding *)list->data;
 
608
 
 
609
      g_free (binding);
 
610
    }
 
611
 
 
612
  g_list_free (reg->bindings);
 
613
 
 
614
  g_io_channel_shutdown (reg->iochannel, TRUE, NULL);
 
615
 
 
616
  geis_finish (reg->instance);
 
617
 
 
618
  g_hash_table_remove (priv->hash, object);
 
619
  g_free (reg);
 
620
}
 
621
 
 
622
 
588
623
/* Public API */
589
624
IdoGestureManager *
590
625
ido_gesture_manager_get (void)
666
701
      reg->window   = window;
667
702
      reg->instance = instance;
668
703
 
 
704
      g_signal_connect (window,
 
705
                        "destroy",
 
706
                        G_CALLBACK (window_destroyed_cb),
 
707
                        manager);
 
708
 
669
709
      geis_subscribe (reg->instance,
670
710
                      GEIS_ALL_INPUT_DEVICES,
671
711
                      GEIS_ALL_GESTURES,
677
717
                      G_IO_IN,
678
718
                      io_callback,
679
719
                      reg);
 
720
 
 
721
      reg->iochannel = iochannel;
680
722
    }
681
723
 
682
724
  /* XXX - check for duplicates in reg->bindings first */