[gnome-contacts: 12/29] Clean up the Block1Data thing
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts: 12/29] Clean up the Block1Data thing
- Date: Thu, 16 Aug 2012 18:40:22 +0000 (UTC)
commit e92003be61e12ede9777232b16aa6588abb25de9
Author: Alexander Larsson <alexl redhat com>
Date: Thu Aug 16 15:01:56 2012 +0200
Clean up the Block1Data thing
egg-list-box.c | 73 +++++++++++++++++---------------------------------------
1 files changed, 22 insertions(+), 51 deletions(-)
---
diff --git a/egg-list-box.c b/egg-list-box.c
index 1cd4e58..080dbe7 100644
--- a/egg-list-box.c
+++ b/egg-list-box.c
@@ -62,7 +62,6 @@ static void g_cclosure_user_marshal_VOID__ENUM_INT (GClosure * closure, GValue *
}
typedef struct _EggListBoxChildInfo EggListBoxChildInfo;
-typedef struct _Block1Data Block1Data;
struct _EggListBoxPrivate
{
@@ -108,13 +107,6 @@ struct _EggListBoxChildInfo
gint height;
};
-struct _Block1Data
-{
- int _ref_count_;
- EggListBox *self;
- gint move;
-};
-
enum {
CHILD_SELECTED,
CHILD_ACTIVATED,
@@ -223,10 +215,6 @@ GdkDragContext *context,
gint x,
gint y,
guint time_);
-static Block1Data* block1_data_ref (Block1Data *_data1_);
-static void block1_data_unref (void *_userdata_);
-static gboolean __lambda2_ (Block1Data *_data1_);
-static gboolean ___lambda2__gsource_func (gpointer self);
static void egg_list_box_real_activate_cursor_child (EggListBox *self);
static void egg_list_box_real_toggle_cursor_child (EggListBox *self);
static void egg_list_box_real_move_cursor (EggListBox *self,
@@ -1541,49 +1529,36 @@ egg_list_box_real_drag_leave (GtkWidget *base, GdkDragContext *context, guint ti
}
}
-static Block1Data*
-block1_data_ref (Block1Data *_data1_)
+typedef struct
{
- g_atomic_int_inc (&_data1_->_ref_count_);
- return _data1_;
-}
+ EggListBox *self;
+ gint move;
+} MoveData;
static void
-block1_data_unref (void *_userdata_)
-{
- Block1Data *_data1_;
- _data1_ = (Block1Data*) _userdata_;
- if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
- EggListBox *self;
- self = _data1_->self;
- _g_object_unref0 (self);
- g_slice_free (Block1Data, _data1_);
- }
+move_data_free (MoveData *data)
+{
+ g_slice_free (MoveData, data);
}
static gboolean
-__lambda2_ (Block1Data *_data1_)
+drag_motion_timeout (MoveData *data)
{
- EggListBox *self;
- self = _data1_->self;
+ EggListBox *self = data->self;
+
gtk_adjustment_set_value (self->priv->adjustment,
gtk_adjustment_get_value (self->priv->adjustment) +
- gtk_adjustment_get_step_increment (self->priv->adjustment) * _data1_->move);
+ gtk_adjustment_get_step_increment (self->priv->adjustment) * data->move);
return TRUE;
}
static gboolean
-___lambda2__gsource_func (gpointer self)
-{
- return __lambda2_ (self);
-}
-
-static gboolean
egg_list_box_real_drag_motion (GtkWidget *base, GdkDragContext *context,
gint x, gint y, guint time_)
{
EggListBox *self = EGG_LIST_BOX (base);
- Block1Data *_data1_;
+ int move;
+ MoveData *data;
gdouble size;
/* Auto-scroll during Dnd if cursor is moving into the top/bottom portion of the
@@ -1597,35 +1572,31 @@ egg_list_box_real_drag_motion (GtkWidget *base, GdkDragContext *context,
if (self->priv->adjustment == NULL)
return FALSE;
- _data1_ = g_slice_new0 (Block1Data);
- _data1_->_ref_count_ = 1;
- _data1_->self = g_object_ref (self);
-
/* Part of the view triggering auto-scroll */
size = 30;
- _data1_->move = 0;
+ move = 0;
if (y < (gtk_adjustment_get_value (self->priv->adjustment) + size))
{
/* Scroll up */
- _data1_->move = -1;
+ move = -1;
}
else if (y > ((gtk_adjustment_get_value (self->priv->adjustment) + gtk_adjustment_get_page_size (self->priv->adjustment)) - size))
{
/* Scroll down */
- _data1_->move = 1;
+ move = 1;
}
- if (_data1_->move == 0) {
- block1_data_unref (_data1_);
+ if (move == 0)
return FALSE;
- }
+
+ data = g_slice_new0 (MoveData);
+ data->self = self;
self->priv->auto_scroll_timeout_id =
- g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 150,
- ___lambda2__gsource_func, block1_data_ref (_data1_), block1_data_unref);
+ g_timeout_add_full (G_PRIORITY_DEFAULT, 150, (GSourceFunc)drag_motion_timeout,
+ data, (GDestroyNotify) move_data_free);
- block1_data_unref (_data1_);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]