[gnome-software] Port to EggListBox
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Port to EggListBox
- Date: Wed, 27 Jun 2012 17:27:05 +0000 (UTC)
commit e0f708ca6f6b2accfba8bfd7eb13039da93650df
Author: Richard Hughes <richard hughsie com>
Date: Wed Jun 27 13:13:16 2012 +0100
Port to EggListBox
src/Makefile.am | 4 +
src/egg-list-box.c | 4030 +++++++++++++++++++++++++++++++++++++++++++++++++
src/egg-list-box.h | 62 +
src/gnome-software.ui | 90 +-
src/gs-app-widget.c | 309 ++++
src/gs-app-widget.h | 83 +
src/gs-main.c | 351 ++++--
7 files changed, 4774 insertions(+), 155 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 059ea94..2be2e42 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,10 @@ bin_PROGRAMS = \
gnome_software_SOURCES = \
gs-resources.c \
gs-resources.h \
+ gs-app-widget.c \
+ gs-app-widget.h \
+ egg-list-box.c \
+ egg-list-box.h \
gs-main.c
gnome_software_LDADD = \
diff --git a/src/egg-list-box.c b/src/egg-list-box.c
new file mode 100644
index 0000000..7f52e5c
--- /dev/null
+++ b/src/egg-list-box.c
@@ -0,0 +1,4030 @@
+/* egg-list-box.c generated by valac 0.17.1.22-cd59, the Vala compiler
+ * generated from egg-list-box.vala, do not modify */
+
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */
+/*
+ * Copyright (C) 2011 Alexander Larsson <alexl redhat com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <float.h>
+#include <math.h>
+#include <cairo.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+
+#define EGG_TYPE_LIST_BOX (egg_list_box_get_type ())
+#define EGG_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_LIST_BOX, EggListBox))
+#define EGG_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_LIST_BOX, EggListBoxClass))
+#define EGG_IS_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_LIST_BOX))
+#define EGG_IS_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_LIST_BOX))
+#define EGG_LIST_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_LIST_BOX, EggListBoxClass))
+
+typedef struct _EggListBox EggListBox;
+typedef struct _EggListBoxClass EggListBoxClass;
+typedef struct _EggListBoxPrivate EggListBoxPrivate;
+
+#define EGG_LIST_BOX_TYPE_CHILD_INFO (egg_list_box_child_info_get_type ())
+#define EGG_LIST_BOX_CHILD_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_LIST_BOX_TYPE_CHILD_INFO, EggListBoxChildInfo))
+#define EGG_LIST_BOX_CHILD_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_LIST_BOX_TYPE_CHILD_INFO, EggListBoxChildInfoClass))
+#define EGG_LIST_BOX_IS_CHILD_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_LIST_BOX_TYPE_CHILD_INFO))
+#define EGG_LIST_BOX_IS_CHILD_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_LIST_BOX_TYPE_CHILD_INFO))
+#define EGG_LIST_BOX_CHILD_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_LIST_BOX_TYPE_CHILD_INFO, EggListBoxChildInfoClass))
+
+typedef struct _EggListBoxChildInfo EggListBoxChildInfo;
+typedef struct _EggListBoxChildInfoClass EggListBoxChildInfoClass;
+#define _g_sequence_free0(var) ((var == NULL) ? NULL : (var = (g_sequence_free (var), NULL)))
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _EggListBoxChildInfoPrivate EggListBoxChildInfoPrivate;
+
+#define EGG_LIST_BOX_TYPE_CHILD_FLAGS (egg_list_box_child_flags_get_type ())
+typedef struct _EggListBoxChildFlags EggListBoxChildFlags;
+#define _egg_list_box_child_info_unref0(var) ((var == NULL) ? NULL : (var = (egg_list_box_child_info_unref (var), NULL)))
+typedef struct _EggListBoxParamSpecChildInfo EggListBoxParamSpecChildInfo;
+
+struct _EggListBox {
+ GtkContainer parent_instance;
+ EggListBoxPrivate * priv;
+};
+
+struct _EggListBoxClass {
+ GtkContainerClass parent_class;
+ void (*child_selected) (EggListBox* self, GtkWidget* child);
+ void (*child_activated) (EggListBox* self, GtkWidget* child);
+ void (*activate_cursor_child) (EggListBox* self);
+ void (*toggle_cursor_child) (EggListBox* self);
+ void (*move_cursor) (EggListBox* self, GtkMovementStep step, gint count);
+};
+
+typedef gboolean (*EggListBoxFilterFunc) (GtkWidget* child, void* user_data);
+typedef void (*EggListBoxUpdateSeparatorFunc) (GtkWidget** separator, GtkWidget* child, GtkWidget* before, void* user_data);
+struct _EggListBoxPrivate {
+ GSequence* children;
+ GHashTable* child_hash;
+ GHashTable* separator_hash;
+ GCompareDataFunc sort_func;
+ gpointer sort_func_target;
+ GDestroyNotify sort_func_target_destroy_notify;
+ EggListBoxFilterFunc filter_func;
+ gpointer filter_func_target;
+ GDestroyNotify filter_func_target_destroy_notify;
+ EggListBoxUpdateSeparatorFunc update_separator_func;
+ gpointer update_separator_func_target;
+ GDestroyNotify update_separator_func_target_destroy_notify;
+ EggListBoxChildInfo* selected_child;
+ EggListBoxChildInfo* prelight_child;
+ EggListBoxChildInfo* cursor_child;
+ gboolean active_child_active;
+ EggListBoxChildInfo* active_child;
+ GtkSelectionMode selection_mode;
+ GtkAdjustment* adjustment;
+ gboolean activate_single_click;
+};
+
+struct _EggListBoxChildInfo {
+ GTypeInstance parent_instance;
+ volatile int ref_count;
+ EggListBoxChildInfoPrivate * priv;
+ GtkWidget* widget;
+ GtkWidget* separator;
+ GSequenceIter* iter;
+ gint y;
+ gint height;
+};
+
+struct _EggListBoxChildInfoClass {
+ GTypeClass parent_class;
+ void (*finalize) (EggListBoxChildInfo *self);
+};
+
+struct _EggListBoxChildFlags {
+ EggListBoxChildInfo* child;
+ GtkStateFlags state;
+};
+
+struct _EggListBoxParamSpecChildInfo {
+ GParamSpec parent_instance;
+};
+
+
+static gpointer egg_list_box_parent_class = NULL;
+static void* klass;
+static gpointer egg_list_box_child_info_parent_class = NULL;
+
+GType egg_list_box_get_type (void) G_GNUC_CONST;
+static gpointer egg_list_box_child_info_ref (gpointer instance);
+static void egg_list_box_child_info_unref (gpointer instance);
+static GParamSpec* egg_list_box_param_spec_child_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED;
+static void egg_list_box_value_set_child_info (GValue* value, gpointer v_object) G_GNUC_UNUSED;
+static void egg_list_box_value_take_child_info (GValue* value, gpointer v_object) G_GNUC_UNUSED;
+static gpointer egg_list_box_value_get_child_info (const GValue* value) G_GNUC_UNUSED;
+static GType egg_list_box_child_info_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
+#define EGG_LIST_BOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_TYPE_LIST_BOX, EggListBoxPrivate))
+enum {
+ EGG_LIST_BOX_DUMMY_PROPERTY
+};
+GtkWidget* egg_list_box_get_selected_child (EggListBox* self);
+GtkWidget* egg_list_box_get_child_at_y (EggListBox* self, gint y);
+static EggListBoxChildInfo* egg_list_box_find_child_at_y (EggListBox* self, gint y);
+void egg_list_box_select_child (EggListBox* self, GtkWidget* child);
+static EggListBoxChildInfo* egg_list_box_lookup_info (EggListBox* self, GtkWidget* widget);
+static void egg_list_box_update_selected (EggListBox* self, EggListBoxChildInfo* child);
+void egg_list_box_set_adjustment (EggListBox* self, GtkAdjustment* adjustment);
+void egg_list_box_add_to_scrolled (EggListBox* self, GtkScrolledWindow* scrolled);
+void egg_list_box_set_selection_mode (EggListBox* self, GtkSelectionMode mode);
+void egg_list_box_set_filter_func (EggListBox* self, EggListBoxFilterFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
+void egg_list_box_refilter (EggListBox* self);
+void egg_list_box_set_separator_funcs (EggListBox* self, EggListBoxUpdateSeparatorFunc update_separator, void* update_separator_target, GDestroyNotify update_separator_target_destroy_notify);
+void egg_list_box_reseparate (EggListBox* self);
+static void egg_list_box_apply_filter_all (EggListBox* self);
+void egg_list_box_resort (EggListBox* self);
+static gint egg_list_box_do_sort (EggListBox* self, EggListBoxChildInfo* a, EggListBoxChildInfo* b);
+static gint _egg_list_box_do_sort_gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self);
+static void egg_list_box_update_separator (EggListBox* self, GSequenceIter* iter);
+void egg_list_box_set_sort_func (EggListBox* self, GCompareDataFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
+void egg_list_box_child_changed (EggListBox* self, GtkWidget* widget);
+static GSequenceIter* egg_list_box_get_next_visible (EggListBox* self, GSequenceIter* _iter);
+static void egg_list_box_apply_filter (EggListBox* self, GtkWidget* child);
+void egg_list_box_set_activate_on_single_click (EggListBox* self, gboolean single);
+static void egg_list_box_add_move_binding (GtkBindingSet* binding_set, guint keyval, GdkModifierType modmask, GtkMovementStep step, gint count);
+static void egg_list_box_update_cursor (EggListBox* self, EggListBoxChildInfo* child);
+static void egg_list_box_select_and_activate (EggListBox* self, EggListBoxChildInfo* child);
+static void egg_list_box_update_prelight (EggListBox* self, EggListBoxChildInfo* child);
+static void egg_list_box_update_active (EggListBox* self, EggListBoxChildInfo* child);
+static gboolean egg_list_box_real_enter_notify_event (GtkWidget* base, GdkEventCrossing* event);
+static gboolean egg_list_box_real_leave_notify_event (GtkWidget* base, GdkEventCrossing* event);
+static gboolean egg_list_box_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event);
+static gboolean egg_list_box_real_button_press_event (GtkWidget* base, GdkEventButton* event);
+static gboolean egg_list_box_real_button_release_event (GtkWidget* base, GdkEventButton* event);
+static void egg_list_box_real_show (GtkWidget* base);
+static gboolean egg_list_box_real_focus (GtkWidget* base, GtkDirectionType direction);
+static GSequenceIter* egg_list_box_get_previous_visible (EggListBox* self, GSequenceIter* _iter);
+static EggListBoxChildInfo* egg_list_box_get_first_visible (EggListBox* self);
+static EggListBoxChildInfo* egg_list_box_get_last_visible (EggListBox* self);
+static gboolean egg_list_box_real_draw (GtkWidget* base, cairo_t* cr);
+static GType egg_list_box_child_flags_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
+static EggListBoxChildFlags* egg_list_box_child_flags_dup (const EggListBoxChildFlags* self);
+static void egg_list_box_child_flags_free (EggListBoxChildFlags* self);
+static EggListBoxChildFlags* egg_list_box_child_flags_find_or_add (EggListBoxChildFlags** array, int* array_length1, EggListBoxChildInfo* to_find);
+static void egg_list_box_real_realize (GtkWidget* base);
+static void egg_list_box_real_add (GtkContainer* base, GtkWidget* widget);
+static EggListBoxChildInfo* egg_list_box_child_info_new (GtkWidget* widget);
+static EggListBoxChildInfo* egg_list_box_child_info_construct (GType object_type, GtkWidget* widget);
+static void egg_list_box_child_visibility_changed (EggListBox* self, GObject* object, GParamSpec* pspec);
+static void _egg_list_box_child_visibility_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
+static void egg_list_box_real_remove (GtkContainer* base, GtkWidget* widget);
+static void egg_list_box_real_forall_internal (GtkContainer* base, gboolean include_internals, GtkCallback callback, void* callback_target);
+static void egg_list_box_real_compute_expand_internal (GtkWidget* base, gboolean* hexpand, gboolean* vexpand);
+static GType egg_list_box_real_child_type (GtkContainer* base);
+static GtkSizeRequestMode egg_list_box_real_get_request_mode (GtkWidget* base);
+static void egg_list_box_real_get_preferred_height (GtkWidget* base, gint* minimum_height, gint* natural_height);
+static void egg_list_box_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height);
+static void egg_list_box_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width);
+static void egg_list_box_real_get_preferred_width_for_height (GtkWidget* base, gint height, gint* minimum_width, gint* natural_width);
+static void egg_list_box_real_size_allocate (GtkWidget* base, GtkAllocation* allocation);
+EggListBox* egg_list_box_new (void);
+EggListBox* egg_list_box_construct (GType object_type);
+static void egg_list_box_real_child_selected (EggListBox* self, GtkWidget* child);
+static void egg_list_box_real_child_activated (EggListBox* self, GtkWidget* child);
+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, GtkMovementStep step, gint count);
+static void g_cclosure_user_marshal_VOID__ENUM_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
+static GObject * egg_list_box_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+static void _egg_list_box_child_info_unref0_ (gpointer var);
+enum {
+ EGG_LIST_BOX_CHILD_INFO_DUMMY_PROPERTY
+};
+static void egg_list_box_child_info_finalize (EggListBoxChildInfo* obj);
+static void egg_list_box_finalize (GObject* obj);
+
+
+GtkWidget* egg_list_box_get_selected_child (EggListBox* self) {
+ GtkWidget* result = NULL;
+ EggListBoxChildInfo* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->selected_child;
+ if (_tmp0_ != NULL) {
+ EggListBoxChildInfo* _tmp1_;
+ GtkWidget* _tmp2_;
+ _tmp1_ = self->priv->selected_child;
+ _tmp2_ = _tmp1_->widget;
+ result = _tmp2_;
+ return result;
+ }
+ result = NULL;
+ return result;
+}
+
+
+GtkWidget* egg_list_box_get_child_at_y (EggListBox* self, gint y) {
+ GtkWidget* result = NULL;
+ gint _tmp0_;
+ EggListBoxChildInfo* _tmp1_ = NULL;
+ EggListBoxChildInfo* child;
+ EggListBoxChildInfo* _tmp2_;
+ EggListBoxChildInfo* _tmp3_;
+ GtkWidget* _tmp4_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = y;
+ _tmp1_ = egg_list_box_find_child_at_y (self, _tmp0_);
+ child = _tmp1_;
+ _tmp2_ = child;
+ if (_tmp2_ == NULL) {
+ result = NULL;
+ return result;
+ }
+ _tmp3_ = child;
+ _tmp4_ = _tmp3_->widget;
+ result = _tmp4_;
+ return result;
+}
+
+
+void egg_list_box_select_child (EggListBox* self, GtkWidget* child) {
+ EggListBoxChildInfo* info;
+ GtkWidget* _tmp0_;
+ EggListBoxChildInfo* _tmp3_;
+ g_return_if_fail (self != NULL);
+ info = NULL;
+ _tmp0_ = child;
+ if (_tmp0_ != NULL) {
+ GtkWidget* _tmp1_;
+ EggListBoxChildInfo* _tmp2_ = NULL;
+ _tmp1_ = child;
+ _tmp2_ = egg_list_box_lookup_info (self, _tmp1_);
+ info = _tmp2_;
+ }
+ _tmp3_ = info;
+ egg_list_box_update_selected (self, _tmp3_);
+}
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
+}
+
+
+void egg_list_box_set_adjustment (EggListBox* self, GtkAdjustment* adjustment) {
+ GtkAdjustment* _tmp0_;
+ GtkAdjustment* _tmp1_;
+ GtkAdjustment* _tmp2_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = adjustment;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->adjustment);
+ self->priv->adjustment = _tmp1_;
+ _tmp2_ = adjustment;
+ gtk_container_set_focus_vadjustment ((GtkContainer*) self, _tmp2_);
+}
+
+
+void egg_list_box_add_to_scrolled (EggListBox* self, GtkScrolledWindow* scrolled) {
+ GtkScrolledWindow* _tmp0_;
+ GtkScrolledWindow* _tmp1_;
+ GtkAdjustment* _tmp2_ = NULL;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (scrolled != NULL);
+ _tmp0_ = scrolled;
+ gtk_scrolled_window_add_with_viewport (_tmp0_, (GtkWidget*) self);
+ _tmp1_ = scrolled;
+ _tmp2_ = gtk_scrolled_window_get_vadjustment (_tmp1_);
+ egg_list_box_set_adjustment (self, _tmp2_);
+}
+
+
+void egg_list_box_set_selection_mode (EggListBox* self, GtkSelectionMode mode) {
+ GtkSelectionMode _tmp0_;
+ GtkSelectionMode _tmp1_;
+ GtkSelectionMode _tmp2_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = mode;
+ if (_tmp0_ == GTK_SELECTION_MULTIPLE) {
+ g_warning ("egg-list-box.vala:106: Multiple selections not supported");
+ return;
+ }
+ _tmp1_ = mode;
+ self->priv->selection_mode = _tmp1_;
+ _tmp2_ = mode;
+ if (_tmp2_ == GTK_SELECTION_NONE) {
+ egg_list_box_update_selected (self, NULL);
+ }
+}
+
+
+void egg_list_box_set_filter_func (EggListBox* self, EggListBoxFilterFunc f, void* f_target, GDestroyNotify f_target_destroy_notify) {
+ EggListBoxFilterFunc _tmp0_;
+ void* _tmp0__target;
+ GDestroyNotify _tmp0__target_destroy_notify;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = f;
+ _tmp0__target = f_target;
+ _tmp0__target_destroy_notify = f_target_destroy_notify;
+ f_target_destroy_notify = NULL;
+ (self->priv->filter_func_target_destroy_notify == NULL) ? NULL : (self->priv->filter_func_target_destroy_notify (self->priv->filter_func_target), NULL);
+ self->priv->filter_func = NULL;
+ self->priv->filter_func_target = NULL;
+ self->priv->filter_func_target_destroy_notify = NULL;
+ self->priv->filter_func = _tmp0_;
+ self->priv->filter_func_target = _tmp0__target;
+ self->priv->filter_func_target_destroy_notify = _tmp0__target_destroy_notify;
+ egg_list_box_refilter (self);
+ (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+ f = NULL;
+ f_target = NULL;
+ f_target_destroy_notify = NULL;
+}
+
+
+void egg_list_box_set_separator_funcs (EggListBox* self, EggListBoxUpdateSeparatorFunc update_separator, void* update_separator_target, GDestroyNotify update_separator_target_destroy_notify) {
+ EggListBoxUpdateSeparatorFunc _tmp0_;
+ void* _tmp0__target;
+ GDestroyNotify _tmp0__target_destroy_notify;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = update_separator;
+ _tmp0__target = update_separator_target;
+ _tmp0__target_destroy_notify = update_separator_target_destroy_notify;
+ update_separator_target_destroy_notify = NULL;
+ (self->priv->update_separator_func_target_destroy_notify == NULL) ? NULL : (self->priv->update_separator_func_target_destroy_notify (self->priv->update_separator_func_target), NULL);
+ self->priv->update_separator_func = NULL;
+ self->priv->update_separator_func_target = NULL;
+ self->priv->update_separator_func_target_destroy_notify = NULL;
+ self->priv->update_separator_func = _tmp0_;
+ self->priv->update_separator_func_target = _tmp0__target;
+ self->priv->update_separator_func_target_destroy_notify = _tmp0__target_destroy_notify;
+ egg_list_box_reseparate (self);
+ (update_separator_target_destroy_notify == NULL) ? NULL : (update_separator_target_destroy_notify (update_separator_target), NULL);
+ update_separator = NULL;
+ update_separator_target = NULL;
+ update_separator_target_destroy_notify = NULL;
+}
+
+
+void egg_list_box_refilter (EggListBox* self) {
+ g_return_if_fail (self != NULL);
+ egg_list_box_apply_filter_all (self);
+ egg_list_box_reseparate (self);
+ gtk_widget_queue_resize ((GtkWidget*) self);
+}
+
+
+static gint _egg_list_box_do_sort_gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self) {
+ gint result;
+ result = egg_list_box_do_sort (self, a, b);
+ return result;
+}
+
+
+void egg_list_box_resort (EggListBox* self) {
+ GSequence* _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->children;
+ g_sequence_sort (_tmp0_, _egg_list_box_do_sort_gcompare_data_func, self);
+ egg_list_box_reseparate (self);
+ gtk_widget_queue_resize ((GtkWidget*) self);
+}
+
+
+void egg_list_box_reseparate (EggListBox* self) {
+ g_return_if_fail (self != NULL);
+ {
+ GSequence* _tmp0_;
+ GSequenceIter* _tmp1_ = NULL;
+ GSequenceIter* iter;
+ _tmp0_ = self->priv->children;
+ _tmp1_ = g_sequence_get_begin_iter (_tmp0_);
+ iter = _tmp1_;
+ {
+ gboolean _tmp2_;
+ _tmp2_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp3_;
+ GSequenceIter* _tmp6_;
+ gboolean _tmp7_ = FALSE;
+ GSequenceIter* _tmp8_;
+ _tmp3_ = _tmp2_;
+ if (!_tmp3_) {
+ GSequenceIter* _tmp4_;
+ GSequenceIter* _tmp5_ = NULL;
+ _tmp4_ = iter;
+ _tmp5_ = g_sequence_iter_next (_tmp4_);
+ iter = _tmp5_;
+ }
+ _tmp2_ = FALSE;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_is_end (_tmp6_);
+ if (!(!_tmp7_)) {
+ break;
+ }
+ _tmp8_ = iter;
+ egg_list_box_update_separator (self, _tmp8_);
+ }
+ }
+ }
+ gtk_widget_queue_resize ((GtkWidget*) self);
+}
+
+
+void egg_list_box_set_sort_func (EggListBox* self, GCompareDataFunc f, void* f_target, GDestroyNotify f_target_destroy_notify) {
+ GCompareDataFunc _tmp0_;
+ void* _tmp0__target;
+ GDestroyNotify _tmp0__target_destroy_notify;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = f;
+ _tmp0__target = f_target;
+ _tmp0__target_destroy_notify = f_target_destroy_notify;
+ f_target_destroy_notify = NULL;
+ (self->priv->sort_func_target_destroy_notify == NULL) ? NULL : (self->priv->sort_func_target_destroy_notify (self->priv->sort_func_target), NULL);
+ self->priv->sort_func = NULL;
+ self->priv->sort_func_target = NULL;
+ self->priv->sort_func_target_destroy_notify = NULL;
+ self->priv->sort_func = _tmp0_;
+ self->priv->sort_func_target = _tmp0__target;
+ self->priv->sort_func_target_destroy_notify = _tmp0__target_destroy_notify;
+ egg_list_box_resort (self);
+ (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+ f = NULL;
+ f_target = NULL;
+ f_target_destroy_notify = NULL;
+}
+
+
+void egg_list_box_child_changed (EggListBox* self, GtkWidget* widget) {
+ GtkWidget* _tmp0_;
+ EggListBoxChildInfo* _tmp1_ = NULL;
+ EggListBoxChildInfo* info;
+ EggListBoxChildInfo* _tmp2_;
+ EggListBoxChildInfo* _tmp3_;
+ GSequenceIter* _tmp4_;
+ GSequenceIter* _tmp5_ = NULL;
+ GSequenceIter* prev_next;
+ GCompareDataFunc _tmp6_;
+ void* _tmp6__target;
+ EggListBoxChildInfo* _tmp10_;
+ GtkWidget* _tmp11_;
+ gboolean _tmp12_ = FALSE;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (widget != NULL);
+ _tmp0_ = widget;
+ _tmp1_ = egg_list_box_lookup_info (self, _tmp0_);
+ info = _tmp1_;
+ _tmp2_ = info;
+ if (_tmp2_ == NULL) {
+ return;
+ }
+ _tmp3_ = info;
+ _tmp4_ = _tmp3_->iter;
+ _tmp5_ = egg_list_box_get_next_visible (self, _tmp4_);
+ prev_next = _tmp5_;
+ _tmp6_ = self->priv->sort_func;
+ _tmp6__target = self->priv->sort_func_target;
+ if (_tmp6_ != NULL) {
+ GSequence* _tmp7_;
+ EggListBoxChildInfo* _tmp8_;
+ GSequenceIter* _tmp9_;
+ _tmp7_ = self->priv->children;
+ _tmp8_ = info;
+ _tmp9_ = _tmp8_->iter;
+ g_sequence_sort_changed (_tmp9_, _egg_list_box_do_sort_gcompare_data_func, self);
+ gtk_widget_queue_resize ((GtkWidget*) self);
+ }
+ _tmp10_ = info;
+ _tmp11_ = _tmp10_->widget;
+ egg_list_box_apply_filter (self, _tmp11_);
+ _tmp12_ = gtk_widget_get_visible ((GtkWidget*) self);
+ if (_tmp12_) {
+ EggListBoxChildInfo* _tmp13_;
+ GSequenceIter* _tmp14_;
+ EggListBoxChildInfo* _tmp15_;
+ GSequenceIter* _tmp16_;
+ GSequenceIter* _tmp17_ = NULL;
+ GSequenceIter* _tmp18_;
+ _tmp13_ = info;
+ _tmp14_ = _tmp13_->iter;
+ egg_list_box_update_separator (self, _tmp14_);
+ _tmp15_ = info;
+ _tmp16_ = _tmp15_->iter;
+ _tmp17_ = egg_list_box_get_next_visible (self, _tmp16_);
+ egg_list_box_update_separator (self, _tmp17_);
+ _tmp18_ = prev_next;
+ egg_list_box_update_separator (self, _tmp18_);
+ }
+}
+
+
+void egg_list_box_set_activate_on_single_click (EggListBox* self, gboolean single) {
+ gboolean _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = single;
+ self->priv->activate_single_click = _tmp0_;
+}
+
+
+/****** Implementation ***********/
+static gint egg_list_box_do_sort (EggListBox* self, EggListBoxChildInfo* a, EggListBoxChildInfo* b) {
+ gint result = 0;
+ GCompareDataFunc _tmp0_;
+ void* _tmp0__target;
+ EggListBoxChildInfo* _tmp1_;
+ GtkWidget* _tmp2_;
+ EggListBoxChildInfo* _tmp3_;
+ GtkWidget* _tmp4_;
+ gint _tmp5_ = 0;
+ g_return_val_if_fail (self != NULL, 0);
+ g_return_val_if_fail (a != NULL, 0);
+ g_return_val_if_fail (b != NULL, 0);
+ _tmp0_ = self->priv->sort_func;
+ _tmp0__target = self->priv->sort_func_target;
+ _tmp1_ = a;
+ _tmp2_ = _tmp1_->widget;
+ _tmp3_ = b;
+ _tmp4_ = _tmp3_->widget;
+ _tmp5_ = _tmp0_ (_tmp2_, _tmp4_, _tmp0__target);
+ result = _tmp5_;
+ return result;
+}
+
+
+static void egg_list_box_add_move_binding (GtkBindingSet* binding_set, guint keyval, GdkModifierType modmask, GtkMovementStep step, gint count) {
+ GtkBindingSet* _tmp0_;
+ guint _tmp1_;
+ GdkModifierType _tmp2_;
+ GtkMovementStep _tmp3_;
+ gint _tmp4_;
+ GdkModifierType _tmp5_;
+ GtkBindingSet* _tmp6_;
+ guint _tmp7_;
+ GtkMovementStep _tmp8_;
+ gint _tmp9_;
+ g_return_if_fail (binding_set != NULL);
+ _tmp0_ = binding_set;
+ _tmp1_ = keyval;
+ _tmp2_ = modmask;
+ _tmp3_ = step;
+ _tmp4_ = count;
+ gtk_binding_entry_add_signal (_tmp0_, _tmp1_, _tmp2_, "move-cursor", (guint) 2, GTK_TYPE_MOVEMENT_STEP, _tmp3_, G_TYPE_INT, _tmp4_, NULL);
+ _tmp5_ = modmask;
+ if ((_tmp5_ & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
+ return;
+ }
+ _tmp6_ = binding_set;
+ _tmp7_ = keyval;
+ _tmp8_ = step;
+ _tmp9_ = count;
+ gtk_binding_entry_add_signal (_tmp6_, _tmp7_, GDK_CONTROL_MASK, "move-cursor", (guint) 2, GTK_TYPE_MOVEMENT_STEP, _tmp8_, G_TYPE_INT, _tmp9_, NULL);
+}
+
+
+static EggListBoxChildInfo* egg_list_box_find_child_at_y (EggListBox* self, gint y) {
+ EggListBoxChildInfo* result = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp21_;
+ g_return_val_if_fail (self != NULL, NULL);
+ child_info = NULL;
+ {
+ GSequence* _tmp0_;
+ GSequenceIter* _tmp1_ = NULL;
+ GSequenceIter* iter;
+ _tmp0_ = self->priv->children;
+ _tmp1_ = g_sequence_get_begin_iter (_tmp0_);
+ iter = _tmp1_;
+ {
+ gboolean _tmp2_;
+ _tmp2_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp3_;
+ GSequenceIter* _tmp6_;
+ gboolean _tmp7_ = FALSE;
+ GSequenceIter* _tmp8_;
+ gconstpointer _tmp9_ = NULL;
+ EggListBoxChildInfo* info;
+ gboolean _tmp10_ = FALSE;
+ gint _tmp11_;
+ EggListBoxChildInfo* _tmp12_;
+ gint _tmp13_;
+ gboolean _tmp19_;
+ _tmp3_ = _tmp2_;
+ if (!_tmp3_) {
+ GSequenceIter* _tmp4_;
+ GSequenceIter* _tmp5_ = NULL;
+ _tmp4_ = iter;
+ _tmp5_ = g_sequence_iter_next (_tmp4_);
+ iter = _tmp5_;
+ }
+ _tmp2_ = FALSE;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_is_end (_tmp6_);
+ if (!(!_tmp7_)) {
+ break;
+ }
+ _tmp8_ = iter;
+ _tmp9_ = g_sequence_get (_tmp8_);
+ info = (EggListBoxChildInfo*) _tmp9_;
+ _tmp11_ = y;
+ _tmp12_ = info;
+ _tmp13_ = _tmp12_->y;
+ if (_tmp11_ >= _tmp13_) {
+ gint _tmp14_;
+ EggListBoxChildInfo* _tmp15_;
+ gint _tmp16_;
+ EggListBoxChildInfo* _tmp17_;
+ gint _tmp18_;
+ _tmp14_ = y;
+ _tmp15_ = info;
+ _tmp16_ = _tmp15_->y;
+ _tmp17_ = info;
+ _tmp18_ = _tmp17_->height;
+ _tmp10_ = _tmp14_ < (_tmp16_ + _tmp18_);
+ } else {
+ _tmp10_ = FALSE;
+ }
+ _tmp19_ = _tmp10_;
+ if (_tmp19_) {
+ EggListBoxChildInfo* _tmp20_;
+ _tmp20_ = info;
+ child_info = _tmp20_;
+ break;
+ }
+ }
+ }
+ }
+ _tmp21_ = child_info;
+ result = _tmp21_;
+ return result;
+}
+
+
+static void egg_list_box_update_cursor (EggListBox* self, EggListBoxChildInfo* child) {
+ EggListBoxChildInfo* _tmp0_;
+ gboolean _tmp1_ = FALSE;
+ EggListBoxChildInfo* _tmp2_;
+ gboolean _tmp4_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = child;
+ self->priv->cursor_child = _tmp0_;
+ gtk_widget_grab_focus ((GtkWidget*) self);
+ gtk_widget_queue_draw ((GtkWidget*) self);
+ _tmp2_ = child;
+ if (_tmp2_ != NULL) {
+ GtkAdjustment* _tmp3_;
+ _tmp3_ = self->priv->adjustment;
+ _tmp1_ = _tmp3_ != NULL;
+ } else {
+ _tmp1_ = FALSE;
+ }
+ _tmp4_ = _tmp1_;
+ if (_tmp4_) {
+ GtkAllocation allocation = {0};
+ GtkAllocation _tmp5_ = {0};
+ GtkAdjustment* _tmp6_;
+ EggListBoxChildInfo* _tmp7_;
+ gint _tmp8_;
+ GtkAllocation _tmp9_;
+ gint _tmp10_;
+ EggListBoxChildInfo* _tmp11_;
+ gint _tmp12_;
+ GtkAllocation _tmp13_;
+ gint _tmp14_;
+ EggListBoxChildInfo* _tmp15_;
+ gint _tmp16_;
+ gtk_widget_get_allocation ((GtkWidget*) self, &_tmp5_);
+ allocation = _tmp5_;
+ _tmp6_ = self->priv->adjustment;
+ _tmp7_ = self->priv->cursor_child;
+ _tmp8_ = _tmp7_->y;
+ _tmp9_ = allocation;
+ _tmp10_ = _tmp9_.y;
+ _tmp11_ = self->priv->cursor_child;
+ _tmp12_ = _tmp11_->y;
+ _tmp13_ = allocation;
+ _tmp14_ = _tmp13_.y;
+ _tmp15_ = self->priv->cursor_child;
+ _tmp16_ = _tmp15_->height;
+ gtk_adjustment_clamp_page (_tmp6_, (gdouble) (_tmp8_ + _tmp10_), (gdouble) ((_tmp12_ + _tmp14_) + _tmp16_));
+ }
+}
+
+
+static void egg_list_box_update_selected (EggListBox* self, EggListBoxChildInfo* child) {
+ gboolean _tmp0_ = FALSE;
+ EggListBoxChildInfo* _tmp1_;
+ EggListBoxChildInfo* _tmp2_;
+ gboolean _tmp7_;
+ EggListBoxChildInfo* _tmp14_;
+ g_return_if_fail (self != NULL);
+ _tmp1_ = child;
+ _tmp2_ = self->priv->selected_child;
+ if (_tmp1_ != _tmp2_) {
+ gboolean _tmp3_ = FALSE;
+ EggListBoxChildInfo* _tmp4_;
+ gboolean _tmp6_;
+ _tmp4_ = child;
+ if (_tmp4_ == NULL) {
+ _tmp3_ = TRUE;
+ } else {
+ GtkSelectionMode _tmp5_;
+ _tmp5_ = self->priv->selection_mode;
+ _tmp3_ = _tmp5_ != GTK_SELECTION_NONE;
+ }
+ _tmp6_ = _tmp3_;
+ _tmp0_ = _tmp6_;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp7_ = _tmp0_;
+ if (_tmp7_) {
+ EggListBoxChildInfo* _tmp8_;
+ GtkWidget* _tmp9_ = NULL;
+ EggListBoxChildInfo* _tmp10_;
+ GtkWidget* _tmp13_;
+ _tmp8_ = child;
+ self->priv->selected_child = _tmp8_;
+ _tmp10_ = self->priv->selected_child;
+ if (_tmp10_ != NULL) {
+ EggListBoxChildInfo* _tmp11_;
+ GtkWidget* _tmp12_;
+ _tmp11_ = self->priv->selected_child;
+ _tmp12_ = _tmp11_->widget;
+ _tmp9_ = _tmp12_;
+ } else {
+ _tmp9_ = NULL;
+ }
+ _tmp13_ = _tmp9_;
+ g_signal_emit_by_name (self, "child-selected", _tmp13_);
+ gtk_widget_queue_draw ((GtkWidget*) self);
+ }
+ _tmp14_ = child;
+ if (_tmp14_ != NULL) {
+ EggListBoxChildInfo* _tmp15_;
+ _tmp15_ = child;
+ egg_list_box_update_cursor (self, _tmp15_);
+ }
+}
+
+
+static void egg_list_box_select_and_activate (EggListBox* self, EggListBoxChildInfo* child) {
+ GtkWidget* w;
+ EggListBoxChildInfo* _tmp0_;
+ EggListBoxChildInfo* _tmp3_;
+ GtkWidget* _tmp4_;
+ g_return_if_fail (self != NULL);
+ w = NULL;
+ _tmp0_ = child;
+ if (_tmp0_ != NULL) {
+ EggListBoxChildInfo* _tmp1_;
+ GtkWidget* _tmp2_;
+ _tmp1_ = child;
+ _tmp2_ = _tmp1_->widget;
+ w = _tmp2_;
+ }
+ _tmp3_ = child;
+ egg_list_box_update_selected (self, _tmp3_);
+ _tmp4_ = w;
+ if (_tmp4_ != NULL) {
+ GtkWidget* _tmp5_;
+ _tmp5_ = w;
+ g_signal_emit_by_name (self, "child-activated", _tmp5_);
+ }
+}
+
+
+static void egg_list_box_update_prelight (EggListBox* self, EggListBoxChildInfo* child) {
+ EggListBoxChildInfo* _tmp0_;
+ EggListBoxChildInfo* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = child;
+ _tmp1_ = self->priv->prelight_child;
+ if (_tmp0_ != _tmp1_) {
+ EggListBoxChildInfo* _tmp2_;
+ _tmp2_ = child;
+ self->priv->prelight_child = _tmp2_;
+ gtk_widget_queue_draw ((GtkWidget*) self);
+ }
+}
+
+
+static void egg_list_box_update_active (EggListBox* self, EggListBoxChildInfo* child) {
+ EggListBoxChildInfo* _tmp0_;
+ EggListBoxChildInfo* _tmp1_;
+ gboolean val;
+ gboolean _tmp2_ = FALSE;
+ EggListBoxChildInfo* _tmp3_;
+ gboolean _tmp6_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->active_child;
+ _tmp1_ = child;
+ val = _tmp0_ == _tmp1_;
+ _tmp3_ = self->priv->active_child;
+ if (_tmp3_ != NULL) {
+ gboolean _tmp4_;
+ gboolean _tmp5_;
+ _tmp4_ = val;
+ _tmp5_ = self->priv->active_child_active;
+ _tmp2_ = _tmp4_ != _tmp5_;
+ } else {
+ _tmp2_ = FALSE;
+ }
+ _tmp6_ = _tmp2_;
+ if (_tmp6_) {
+ gboolean _tmp7_;
+ _tmp7_ = val;
+ self->priv->active_child_active = _tmp7_;
+ gtk_widget_queue_draw ((GtkWidget*) self);
+ }
+}
+
+
+static gboolean egg_list_box_real_enter_notify_event (GtkWidget* base, GdkEventCrossing* event) {
+ EggListBox * self;
+ gboolean result = FALSE;
+ GdkEventCrossing _tmp0_;
+ GdkWindow* _tmp1_;
+ GdkWindow* _tmp2_ = NULL;
+ GdkEventCrossing _tmp3_;
+ gdouble _tmp4_;
+ EggListBoxChildInfo* _tmp5_ = NULL;
+ EggListBoxChildInfo* child;
+ EggListBoxChildInfo* _tmp6_;
+ EggListBoxChildInfo* _tmp7_;
+ self = (EggListBox*) base;
+ g_return_val_if_fail (event != NULL, FALSE);
+ _tmp0_ = *event;
+ _tmp1_ = _tmp0_.window;
+ _tmp2_ = gtk_widget_get_window ((GtkWidget*) self);
+ if (_tmp1_ != _tmp2_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp3_ = *event;
+ _tmp4_ = _tmp3_.y;
+ _tmp5_ = egg_list_box_find_child_at_y (self, (gint) _tmp4_);
+ child = _tmp5_;
+ _tmp6_ = child;
+ egg_list_box_update_prelight (self, _tmp6_);
+ _tmp7_ = child;
+ egg_list_box_update_active (self, _tmp7_);
+ result = FALSE;
+ return result;
+}
+
+
+static gboolean egg_list_box_real_leave_notify_event (GtkWidget* base, GdkEventCrossing* event) {
+ EggListBox * self;
+ gboolean result = FALSE;
+ GdkEventCrossing _tmp0_;
+ GdkWindow* _tmp1_;
+ GdkWindow* _tmp2_ = NULL;
+ EggListBoxChildInfo* child = NULL;
+ GdkEventCrossing _tmp3_;
+ GdkNotifyType _tmp4_;
+ EggListBoxChildInfo* _tmp8_;
+ EggListBoxChildInfo* _tmp9_;
+ self = (EggListBox*) base;
+ g_return_val_if_fail (event != NULL, FALSE);
+ _tmp0_ = *event;
+ _tmp1_ = _tmp0_.window;
+ _tmp2_ = gtk_widget_get_window ((GtkWidget*) self);
+ if (_tmp1_ != _tmp2_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp3_ = *event;
+ _tmp4_ = _tmp3_.detail;
+ if (_tmp4_ != GDK_NOTIFY_INFERIOR) {
+ child = NULL;
+ } else {
+ GdkEventCrossing _tmp5_;
+ gdouble _tmp6_;
+ EggListBoxChildInfo* _tmp7_ = NULL;
+ _tmp5_ = *event;
+ _tmp6_ = _tmp5_.y;
+ _tmp7_ = egg_list_box_find_child_at_y (self, (gint) _tmp6_);
+ child = _tmp7_;
+ }
+ _tmp8_ = child;
+ egg_list_box_update_prelight (self, _tmp8_);
+ _tmp9_ = child;
+ egg_list_box_update_active (self, _tmp9_);
+ result = FALSE;
+ return result;
+}
+
+
+static gboolean egg_list_box_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event) {
+ EggListBox * self;
+ gboolean result = FALSE;
+ GdkEventMotion _tmp0_;
+ gdouble _tmp1_;
+ EggListBoxChildInfo* _tmp2_ = NULL;
+ EggListBoxChildInfo* child;
+ self = (EggListBox*) base;
+ g_return_val_if_fail (event != NULL, FALSE);
+ _tmp0_ = *event;
+ _tmp1_ = _tmp0_.y;
+ _tmp2_ = egg_list_box_find_child_at_y (self, (gint) _tmp1_);
+ child = _tmp2_;
+ egg_list_box_update_prelight (self, child);
+ egg_list_box_update_active (self, child);
+ result = FALSE;
+ return result;
+}
+
+
+static gboolean egg_list_box_real_button_press_event (GtkWidget* base, GdkEventButton* event) {
+ EggListBox * self;
+ gboolean result = FALSE;
+ GdkEventButton _tmp0_;
+ guint _tmp1_;
+ self = (EggListBox*) base;
+ g_return_val_if_fail (event != NULL, FALSE);
+ _tmp0_ = *event;
+ _tmp1_ = _tmp0_.button;
+ if (_tmp1_ == ((guint) 1)) {
+ GdkEventButton _tmp2_;
+ gdouble _tmp3_;
+ EggListBoxChildInfo* _tmp4_ = NULL;
+ EggListBoxChildInfo* child;
+ EggListBoxChildInfo* _tmp5_;
+ _tmp2_ = *event;
+ _tmp3_ = _tmp2_.y;
+ _tmp4_ = egg_list_box_find_child_at_y (self, (gint) _tmp3_);
+ child = _tmp4_;
+ _tmp5_ = child;
+ if (_tmp5_ != NULL) {
+ EggListBoxChildInfo* _tmp6_;
+ gboolean _tmp7_ = FALSE;
+ gboolean _tmp8_ = FALSE;
+ GdkEventButton _tmp9_;
+ GdkEventType _tmp10_;
+ gboolean _tmp12_;
+ gboolean _tmp15_;
+ _tmp6_ = child;
+ self->priv->active_child = _tmp6_;
+ self->priv->active_child_active = TRUE;
+ gtk_widget_queue_draw ((GtkWidget*) self);
+ _tmp9_ = *event;
+ _tmp10_ = _tmp9_.type;
+ if (_tmp10_ == GDK_2BUTTON_PRESS) {
+ gboolean _tmp11_;
+ _tmp11_ = self->priv->activate_single_click;
+ _tmp8_ = !_tmp11_;
+ } else {
+ _tmp8_ = FALSE;
+ }
+ _tmp12_ = _tmp8_;
+ if (_tmp12_) {
+ EggListBoxChildInfo* _tmp13_;
+ GtkWidget* _tmp14_;
+ _tmp13_ = child;
+ _tmp14_ = _tmp13_->widget;
+ _tmp7_ = _tmp14_ != NULL;
+ } else {
+ _tmp7_ = FALSE;
+ }
+ _tmp15_ = _tmp7_;
+ if (_tmp15_) {
+ EggListBoxChildInfo* _tmp16_;
+ GtkWidget* _tmp17_;
+ _tmp16_ = child;
+ _tmp17_ = _tmp16_->widget;
+ g_signal_emit_by_name (self, "child-activated", _tmp17_);
+ }
+ }
+ }
+ result = FALSE;
+ return result;
+}
+
+
+static gboolean egg_list_box_real_button_release_event (GtkWidget* base, GdkEventButton* event) {
+ EggListBox * self;
+ gboolean result = FALSE;
+ GdkEventButton _tmp0_;
+ guint _tmp1_;
+ self = (EggListBox*) base;
+ g_return_val_if_fail (event != NULL, FALSE);
+ _tmp0_ = *event;
+ _tmp1_ = _tmp0_.button;
+ if (_tmp1_ == ((guint) 1)) {
+ gboolean _tmp2_ = FALSE;
+ EggListBoxChildInfo* _tmp3_;
+ gboolean _tmp5_;
+ _tmp3_ = self->priv->active_child;
+ if (_tmp3_ != NULL) {
+ gboolean _tmp4_;
+ _tmp4_ = self->priv->active_child_active;
+ _tmp2_ = _tmp4_;
+ } else {
+ _tmp2_ = FALSE;
+ }
+ _tmp5_ = _tmp2_;
+ if (_tmp5_) {
+ gboolean _tmp6_;
+ _tmp6_ = self->priv->activate_single_click;
+ if (_tmp6_) {
+ EggListBoxChildInfo* _tmp7_;
+ _tmp7_ = self->priv->active_child;
+ egg_list_box_select_and_activate (self, _tmp7_);
+ } else {
+ EggListBoxChildInfo* _tmp8_;
+ _tmp8_ = self->priv->active_child;
+ egg_list_box_update_selected (self, _tmp8_);
+ }
+ }
+ self->priv->active_child = NULL;
+ self->priv->active_child_active = FALSE;
+ gtk_widget_queue_draw ((GtkWidget*) self);
+ }
+ result = FALSE;
+ return result;
+}
+
+
+static void egg_list_box_real_show (GtkWidget* base) {
+ EggListBox * self;
+ self = (EggListBox*) base;
+ egg_list_box_reseparate (self);
+ GTK_WIDGET_CLASS (egg_list_box_parent_class)->show ((GtkWidget*) GTK_CONTAINER (self));
+}
+
+
+static gboolean egg_list_box_real_focus (GtkWidget* base, GtkDirectionType direction) {
+ EggListBox * self;
+ gboolean result = FALSE;
+ gboolean had_focus = FALSE;
+ gboolean focus_into = FALSE;
+ GtkWidget* recurse_into;
+ gboolean _tmp0_ = FALSE;
+ gboolean _tmp1_;
+ EggListBoxChildInfo* current_focus_child;
+ EggListBoxChildInfo* next_focus_child;
+ gboolean _tmp2_;
+ GtkWidget* _tmp35_;
+ gboolean _tmp39_;
+ EggListBoxChildInfo* _tmp40_;
+ EggListBoxChildInfo* _tmp62_;
+ gboolean modify_selection_pressed;
+ GdkModifierType state = 0;
+ GdkModifierType _tmp67_ = 0;
+ gboolean _tmp68_ = FALSE;
+ EggListBoxChildInfo* _tmp73_;
+ gboolean _tmp74_;
+ self = (EggListBox*) base;
+ recurse_into = NULL;
+ focus_into = TRUE;
+ g_object_get ((GtkWidget*) self, "has-focus", &_tmp0_, NULL);
+ _tmp1_ = _tmp0_;
+ had_focus = _tmp1_;
+ current_focus_child = NULL;
+ next_focus_child = NULL;
+ _tmp2_ = had_focus;
+ if (_tmp2_) {
+ gboolean _tmp3_ = FALSE;
+ GtkDirectionType _tmp4_;
+ gboolean _tmp6_;
+ EggListBoxChildInfo* _tmp10_;
+ gboolean _tmp11_ = FALSE;
+ GtkDirectionType _tmp12_;
+ gboolean _tmp14_;
+ _tmp4_ = direction;
+ if (_tmp4_ == GTK_DIR_RIGHT) {
+ _tmp3_ = TRUE;
+ } else {
+ GtkDirectionType _tmp5_;
+ _tmp5_ = direction;
+ _tmp3_ = _tmp5_ == GTK_DIR_TAB_FORWARD;
+ }
+ _tmp6_ = _tmp3_;
+ if (_tmp6_) {
+ EggListBoxChildInfo* _tmp7_;
+ _tmp7_ = self->priv->cursor_child;
+ if (_tmp7_ != NULL) {
+ EggListBoxChildInfo* _tmp8_;
+ GtkWidget* _tmp9_;
+ _tmp8_ = self->priv->cursor_child;
+ _tmp9_ = _tmp8_->widget;
+ recurse_into = _tmp9_;
+ }
+ }
+ _tmp10_ = self->priv->cursor_child;
+ current_focus_child = _tmp10_;
+ _tmp12_ = direction;
+ if (_tmp12_ != GTK_DIR_UP) {
+ GtkDirectionType _tmp13_;
+ _tmp13_ = direction;
+ _tmp11_ = _tmp13_ != GTK_DIR_DOWN;
+ } else {
+ _tmp11_ = FALSE;
+ }
+ _tmp14_ = _tmp11_;
+ if (_tmp14_) {
+ focus_into = FALSE;
+ }
+ } else {
+ GtkWidget* _tmp15_ = NULL;
+ _tmp15_ = gtk_container_get_focus_child ((GtkContainer*) self);
+ if (_tmp15_ != NULL) {
+ GtkWidget* _tmp16_ = NULL;
+ GtkWidget* _tmp17_;
+ EggListBoxChildInfo* _tmp18_ = NULL;
+ gboolean _tmp19_ = FALSE;
+ GtkDirectionType _tmp20_;
+ gboolean _tmp22_;
+ gboolean _tmp23_ = FALSE;
+ GtkDirectionType _tmp24_;
+ gboolean _tmp26_;
+ _tmp16_ = gtk_container_get_focus_child ((GtkContainer*) self);
+ recurse_into = _tmp16_;
+ _tmp17_ = recurse_into;
+ _tmp18_ = egg_list_box_lookup_info (self, _tmp17_);
+ current_focus_child = _tmp18_;
+ _tmp20_ = direction;
+ if (_tmp20_ == GTK_DIR_RIGHT) {
+ _tmp19_ = TRUE;
+ } else {
+ GtkDirectionType _tmp21_;
+ _tmp21_ = direction;
+ _tmp19_ = _tmp21_ == GTK_DIR_TAB_FORWARD;
+ }
+ _tmp22_ = _tmp19_;
+ if (_tmp22_) {
+ focus_into = FALSE;
+ }
+ _tmp24_ = direction;
+ if (_tmp24_ == GTK_DIR_LEFT) {
+ _tmp23_ = TRUE;
+ } else {
+ GtkDirectionType _tmp25_;
+ _tmp25_ = direction;
+ _tmp23_ = _tmp25_ == GTK_DIR_TAB_BACKWARD;
+ }
+ _tmp26_ = _tmp23_;
+ if (_tmp26_) {
+ EggListBoxChildInfo* _tmp27_;
+ _tmp27_ = current_focus_child;
+ next_focus_child = _tmp27_;
+ }
+ } else {
+ gboolean _tmp28_ = FALSE;
+ GtkDirectionType _tmp29_;
+ gboolean _tmp31_;
+ _tmp29_ = direction;
+ if (_tmp29_ == GTK_DIR_LEFT) {
+ _tmp28_ = TRUE;
+ } else {
+ GtkDirectionType _tmp30_;
+ _tmp30_ = direction;
+ _tmp28_ = _tmp30_ == GTK_DIR_TAB_BACKWARD;
+ }
+ _tmp31_ = _tmp28_;
+ if (_tmp31_) {
+ EggListBoxChildInfo* _tmp32_;
+ _tmp32_ = self->priv->selected_child;
+ if (_tmp32_ != NULL) {
+ EggListBoxChildInfo* _tmp33_;
+ GtkWidget* _tmp34_;
+ _tmp33_ = self->priv->selected_child;
+ _tmp34_ = _tmp33_->widget;
+ recurse_into = _tmp34_;
+ }
+ }
+ }
+ }
+ _tmp35_ = recurse_into;
+ if (_tmp35_ != NULL) {
+ GtkWidget* _tmp36_;
+ GtkDirectionType _tmp37_;
+ gboolean _tmp38_ = FALSE;
+ _tmp36_ = recurse_into;
+ _tmp37_ = direction;
+ _tmp38_ = gtk_widget_child_focus (_tmp36_, _tmp37_);
+ if (_tmp38_) {
+ result = TRUE;
+ return result;
+ }
+ }
+ _tmp39_ = focus_into;
+ if (!_tmp39_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp40_ = next_focus_child;
+ if (_tmp40_ == NULL) {
+ EggListBoxChildInfo* _tmp41_;
+ _tmp41_ = current_focus_child;
+ if (_tmp41_ != NULL) {
+ GtkDirectionType _tmp42_;
+ _tmp42_ = direction;
+ if (_tmp42_ == GTK_DIR_UP) {
+ EggListBoxChildInfo* _tmp43_;
+ GSequenceIter* _tmp44_;
+ GSequenceIter* _tmp45_ = NULL;
+ GSequenceIter* i;
+ GSequenceIter* _tmp46_;
+ _tmp43_ = current_focus_child;
+ _tmp44_ = _tmp43_->iter;
+ _tmp45_ = egg_list_box_get_previous_visible (self, _tmp44_);
+ i = _tmp45_;
+ _tmp46_ = i;
+ if (_tmp46_ != NULL) {
+ GSequenceIter* _tmp47_;
+ gconstpointer _tmp48_ = NULL;
+ _tmp47_ = i;
+ _tmp48_ = g_sequence_get (_tmp47_);
+ next_focus_child = (EggListBoxChildInfo*) _tmp48_;
+ }
+ } else {
+ EggListBoxChildInfo* _tmp49_;
+ GSequenceIter* _tmp50_;
+ GSequenceIter* _tmp51_ = NULL;
+ GSequenceIter* i;
+ GSequenceIter* _tmp52_;
+ gboolean _tmp53_ = FALSE;
+ _tmp49_ = current_focus_child;
+ _tmp50_ = _tmp49_->iter;
+ _tmp51_ = egg_list_box_get_next_visible (self, _tmp50_);
+ i = _tmp51_;
+ _tmp52_ = i;
+ _tmp53_ = g_sequence_iter_is_end (_tmp52_);
+ if (!_tmp53_) {
+ GSequenceIter* _tmp54_;
+ gconstpointer _tmp55_ = NULL;
+ _tmp54_ = i;
+ _tmp55_ = g_sequence_get (_tmp54_);
+ next_focus_child = (EggListBoxChildInfo*) _tmp55_;
+ }
+ }
+ } else {
+ GtkDirectionType _tmp56_;
+ _tmp56_ = direction;
+ switch (_tmp56_) {
+ case GTK_DIR_DOWN:
+ case GTK_DIR_TAB_FORWARD:
+ {
+ EggListBoxChildInfo* _tmp57_ = NULL;
+ _tmp57_ = egg_list_box_get_first_visible (self);
+ next_focus_child = _tmp57_;
+ break;
+ }
+ case GTK_DIR_UP:
+ case GTK_DIR_TAB_BACKWARD:
+ {
+ EggListBoxChildInfo* _tmp58_ = NULL;
+ _tmp58_ = egg_list_box_get_last_visible (self);
+ next_focus_child = _tmp58_;
+ break;
+ }
+ default:
+ {
+ EggListBoxChildInfo* _tmp59_;
+ EggListBoxChildInfo* _tmp60_;
+ _tmp59_ = self->priv->selected_child;
+ next_focus_child = _tmp59_;
+ _tmp60_ = next_focus_child;
+ if (_tmp60_ == NULL) {
+ EggListBoxChildInfo* _tmp61_ = NULL;
+ _tmp61_ = egg_list_box_get_first_visible (self);
+ next_focus_child = _tmp61_;
+ }
+ break;
+ }
+ }
+ }
+ }
+ _tmp62_ = next_focus_child;
+ if (_tmp62_ == NULL) {
+ gboolean _tmp63_ = FALSE;
+ GtkDirectionType _tmp64_;
+ gboolean _tmp66_;
+ _tmp64_ = direction;
+ if (_tmp64_ == GTK_DIR_UP) {
+ _tmp63_ = TRUE;
+ } else {
+ GtkDirectionType _tmp65_;
+ _tmp65_ = direction;
+ _tmp63_ = _tmp65_ == GTK_DIR_DOWN;
+ }
+ _tmp66_ = _tmp63_;
+ if (_tmp66_) {
+ gtk_widget_error_bell ((GtkWidget*) self);
+ result = TRUE;
+ return result;
+ }
+ result = FALSE;
+ return result;
+ }
+ modify_selection_pressed = FALSE;
+ _tmp68_ = gtk_get_current_event_state (&_tmp67_);
+ state = _tmp67_;
+ if (_tmp68_) {
+ GdkModifierType _tmp69_ = 0;
+ GdkModifierType modify_mod_mask;
+ GdkModifierType _tmp70_;
+ GdkModifierType _tmp71_;
+ GdkModifierType _tmp72_;
+ _tmp69_ = gtk_widget_get_modifier_mask ((GtkWidget*) self, GDK_MODIFIER_INTENT_MODIFY_SELECTION);
+ modify_mod_mask = _tmp69_;
+ _tmp70_ = state;
+ _tmp71_ = modify_mod_mask;
+ _tmp72_ = modify_mod_mask;
+ if ((_tmp70_ & _tmp71_) == _tmp72_) {
+ modify_selection_pressed = TRUE;
+ }
+ }
+ _tmp73_ = next_focus_child;
+ egg_list_box_update_cursor (self, _tmp73_);
+ _tmp74_ = modify_selection_pressed;
+ if (!_tmp74_) {
+ EggListBoxChildInfo* _tmp75_;
+ _tmp75_ = next_focus_child;
+ egg_list_box_update_selected (self, _tmp75_);
+ }
+ result = TRUE;
+ return result;
+}
+
+
+static gboolean egg_list_box_real_draw (GtkWidget* base, cairo_t* cr) {
+ EggListBox * self;
+ gboolean result = FALSE;
+ GtkAllocation allocation = {0};
+ GtkAllocation _tmp0_ = {0};
+ GtkStyleContext* _tmp1_ = NULL;
+ GtkStyleContext* context;
+ GtkStyleContext* _tmp2_;
+ cairo_t* _tmp3_;
+ GtkAllocation _tmp4_;
+ gint _tmp5_;
+ GtkAllocation _tmp6_;
+ gint _tmp7_;
+ EggListBoxChildFlags* _tmp8_ = NULL;
+ EggListBoxChildFlags* flags;
+ gint flags_length1;
+ gint _flags_size_;
+ EggListBoxChildInfo* _tmp9_;
+ EggListBoxChildInfo* _tmp15_;
+ gboolean _tmp21_ = FALSE;
+ EggListBoxChildInfo* _tmp22_;
+ gboolean _tmp24_;
+ EggListBoxChildFlags* _tmp30_;
+ gint _tmp30__length1;
+ gboolean _tmp46_ = FALSE;
+ gboolean _tmp47_ = FALSE;
+ gboolean _tmp49_;
+ cairo_t* _tmp58_;
+ self = (EggListBox*) base;
+ g_return_val_if_fail (cr != NULL, FALSE);
+ gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
+ allocation = _tmp0_;
+ _tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
+ context = _tmp1_;
+ _tmp2_ = context;
+ _tmp3_ = cr;
+ _tmp4_ = allocation;
+ _tmp5_ = _tmp4_.width;
+ _tmp6_ = allocation;
+ _tmp7_ = _tmp6_.height;
+ gtk_render_background (_tmp2_, _tmp3_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp5_, (gdouble) _tmp7_);
+ _tmp8_ = g_new0 (EggListBoxChildFlags, 0);
+ flags = _tmp8_;
+ flags_length1 = 0;
+ _flags_size_ = flags_length1;
+ _tmp9_ = self->priv->selected_child;
+ if (_tmp9_ != NULL) {
+ EggListBoxChildInfo* _tmp10_;
+ EggListBoxChildFlags* _tmp11_ = NULL;
+ EggListBoxChildFlags* found;
+ EggListBoxChildFlags* _tmp12_;
+ EggListBoxChildFlags* _tmp13_;
+ GtkStateFlags _tmp14_;
+ _tmp10_ = self->priv->selected_child;
+ _tmp11_ = egg_list_box_child_flags_find_or_add (&flags, &flags_length1, _tmp10_);
+ found = _tmp11_;
+ _tmp12_ = found;
+ _tmp13_ = found;
+ _tmp14_ = (*_tmp13_).state;
+ (*_tmp13_).state = _tmp14_ | GTK_STATE_FLAG_SELECTED;
+ }
+ _tmp15_ = self->priv->prelight_child;
+ if (_tmp15_ != NULL) {
+ EggListBoxChildInfo* _tmp16_;
+ EggListBoxChildFlags* _tmp17_ = NULL;
+ EggListBoxChildFlags* found;
+ EggListBoxChildFlags* _tmp18_;
+ EggListBoxChildFlags* _tmp19_;
+ GtkStateFlags _tmp20_;
+ _tmp16_ = self->priv->prelight_child;
+ _tmp17_ = egg_list_box_child_flags_find_or_add (&flags, &flags_length1, _tmp16_);
+ found = _tmp17_;
+ _tmp18_ = found;
+ _tmp19_ = found;
+ _tmp20_ = (*_tmp19_).state;
+ (*_tmp19_).state = _tmp20_ | GTK_STATE_FLAG_PRELIGHT;
+ }
+ _tmp22_ = self->priv->active_child;
+ if (_tmp22_ != NULL) {
+ gboolean _tmp23_;
+ _tmp23_ = self->priv->active_child_active;
+ _tmp21_ = _tmp23_;
+ } else {
+ _tmp21_ = FALSE;
+ }
+ _tmp24_ = _tmp21_;
+ if (_tmp24_) {
+ EggListBoxChildInfo* _tmp25_;
+ EggListBoxChildFlags* _tmp26_ = NULL;
+ EggListBoxChildFlags* found;
+ EggListBoxChildFlags* _tmp27_;
+ EggListBoxChildFlags* _tmp28_;
+ GtkStateFlags _tmp29_;
+ _tmp25_ = self->priv->active_child;
+ _tmp26_ = egg_list_box_child_flags_find_or_add (&flags, &flags_length1, _tmp25_);
+ found = _tmp26_;
+ _tmp27_ = found;
+ _tmp28_ = found;
+ _tmp29_ = (*_tmp28_).state;
+ (*_tmp28_).state = _tmp29_ | GTK_STATE_FLAG_ACTIVE;
+ }
+ _tmp30_ = flags;
+ _tmp30__length1 = flags_length1;
+ {
+ EggListBoxChildFlags* flag_collection = NULL;
+ gint flag_collection_length1 = 0;
+ gint _flag_collection_size_ = 0;
+ gint flag_it = 0;
+ flag_collection = _tmp30_;
+ flag_collection_length1 = _tmp30__length1;
+ for (flag_it = 0; flag_it < _tmp30__length1; flag_it = flag_it + 1) {
+ EggListBoxChildFlags* flag = NULL;
+ flag = &flag_collection[flag_it];
+ {
+ GtkStyleContext* _tmp31_;
+ GtkStyleContext* _tmp32_;
+ EggListBoxChildFlags* _tmp33_;
+ GtkStateFlags _tmp34_;
+ GtkStyleContext* _tmp35_;
+ cairo_t* _tmp36_;
+ EggListBoxChildFlags* _tmp37_;
+ EggListBoxChildInfo* _tmp38_;
+ gint _tmp39_;
+ GtkAllocation _tmp40_;
+ gint _tmp41_;
+ EggListBoxChildFlags* _tmp42_;
+ EggListBoxChildInfo* _tmp43_;
+ gint _tmp44_;
+ GtkStyleContext* _tmp45_;
+ _tmp31_ = context;
+ gtk_style_context_save (_tmp31_);
+ _tmp32_ = context;
+ _tmp33_ = flag;
+ _tmp34_ = (*_tmp33_).state;
+ gtk_style_context_set_state (_tmp32_, _tmp34_);
+ _tmp35_ = context;
+ _tmp36_ = cr;
+ _tmp37_ = flag;
+ _tmp38_ = (*_tmp37_).child;
+ _tmp39_ = _tmp38_->y;
+ _tmp40_ = allocation;
+ _tmp41_ = _tmp40_.width;
+ _tmp42_ = flag;
+ _tmp43_ = (*_tmp42_).child;
+ _tmp44_ = _tmp43_->height;
+ gtk_render_background (_tmp35_, _tmp36_, (gdouble) 0, (gdouble) _tmp39_, (gdouble) _tmp41_, (gdouble) _tmp44_);
+ _tmp45_ = context;
+ gtk_style_context_restore (_tmp45_);
+ }
+ }
+ }
+ _tmp47_ = gtk_widget_has_visible_focus ((GtkWidget*) self);
+ if (_tmp47_) {
+ EggListBoxChildInfo* _tmp48_;
+ _tmp48_ = self->priv->cursor_child;
+ _tmp46_ = _tmp48_ != NULL;
+ } else {
+ _tmp46_ = FALSE;
+ }
+ _tmp49_ = _tmp46_;
+ if (_tmp49_) {
+ GtkStyleContext* _tmp50_;
+ cairo_t* _tmp51_;
+ EggListBoxChildInfo* _tmp52_;
+ gint _tmp53_;
+ GtkAllocation _tmp54_;
+ gint _tmp55_;
+ EggListBoxChildInfo* _tmp56_;
+ gint _tmp57_;
+ _tmp50_ = context;
+ _tmp51_ = cr;
+ _tmp52_ = self->priv->cursor_child;
+ _tmp53_ = _tmp52_->y;
+ _tmp54_ = allocation;
+ _tmp55_ = _tmp54_.width;
+ _tmp56_ = self->priv->cursor_child;
+ _tmp57_ = _tmp56_->height;
+ gtk_render_focus (_tmp50_, _tmp51_, (gdouble) 0, (gdouble) _tmp53_, (gdouble) _tmp55_, (gdouble) _tmp57_);
+ }
+ _tmp58_ = cr;
+ GTK_WIDGET_CLASS (egg_list_box_parent_class)->draw ((GtkWidget*) GTK_CONTAINER (self), _tmp58_);
+ result = TRUE;
+ flags = (g_free (flags), NULL);
+ return result;
+}
+
+
+static void egg_list_box_real_realize (GtkWidget* base) {
+ EggListBox * self;
+ GtkAllocation allocation = {0};
+ GtkAllocation _tmp0_ = {0};
+ GdkWindowAttr _tmp1_ = {0};
+ GdkWindowAttr attributes;
+ GtkAllocation _tmp2_;
+ gint _tmp3_;
+ GtkAllocation _tmp4_;
+ gint _tmp5_;
+ GtkAllocation _tmp6_;
+ gint _tmp7_;
+ GtkAllocation _tmp8_;
+ gint _tmp9_;
+ gint _tmp10_ = 0;
+ GdkWindow* _tmp11_ = NULL;
+ GdkWindowAttr _tmp12_;
+ GdkWindow* _tmp13_;
+ GdkWindow* window;
+ GtkStyleContext* _tmp14_ = NULL;
+ GdkWindow* _tmp15_;
+ self = (EggListBox*) base;
+ gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
+ allocation = _tmp0_;
+ gtk_widget_set_realized ((GtkWidget*) self, TRUE);
+ attributes = _tmp1_;
+ _tmp2_ = allocation;
+ _tmp3_ = _tmp2_.x;
+ attributes.x = _tmp3_;
+ _tmp4_ = allocation;
+ _tmp5_ = _tmp4_.y;
+ attributes.y = _tmp5_;
+ _tmp6_ = allocation;
+ _tmp7_ = _tmp6_.width;
+ attributes.width = _tmp7_;
+ _tmp8_ = allocation;
+ _tmp9_ = _tmp8_.height;
+ attributes.height = _tmp9_;
+ attributes.window_type = GDK_WINDOW_CHILD;
+ _tmp10_ = gtk_widget_get_events ((GtkWidget*) self);
+ attributes.event_mask = (((((_tmp10_ | GDK_ENTER_NOTIFY_MASK) | GDK_LEAVE_NOTIFY_MASK) | GDK_POINTER_MOTION_MASK) | GDK_EXPOSURE_MASK) | GDK_BUTTON_PRESS_MASK) | GDK_BUTTON_RELEASE_MASK;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ _tmp11_ = gtk_widget_get_parent_window ((GtkWidget*) self);
+ _tmp12_ = attributes;
+ _tmp13_ = gdk_window_new (_tmp11_, &_tmp12_, (gint) (GDK_WA_X | GDK_WA_Y));
+ window = _tmp13_;
+ _tmp14_ = gtk_widget_get_style_context ((GtkWidget*) self);
+ gtk_style_context_set_background (_tmp14_, window);
+ gdk_window_set_user_data (window, (GObject*) self);
+ _tmp15_ = _g_object_ref0 (window);
+ gtk_widget_set_window ((GtkWidget*) self, _tmp15_);
+ _g_object_unref0 (window);
+}
+
+
+static void egg_list_box_apply_filter (EggListBox* self, GtkWidget* child) {
+ gboolean do_show;
+ EggListBoxFilterFunc _tmp0_;
+ void* _tmp0__target;
+ GtkWidget* _tmp4_;
+ gboolean _tmp5_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (child != NULL);
+ do_show = TRUE;
+ _tmp0_ = self->priv->filter_func;
+ _tmp0__target = self->priv->filter_func_target;
+ if (_tmp0_ != NULL) {
+ EggListBoxFilterFunc _tmp1_;
+ void* _tmp1__target;
+ GtkWidget* _tmp2_;
+ gboolean _tmp3_ = FALSE;
+ _tmp1_ = self->priv->filter_func;
+ _tmp1__target = self->priv->filter_func_target;
+ _tmp2_ = child;
+ _tmp3_ = _tmp1_ (_tmp2_, _tmp1__target);
+ do_show = _tmp3_;
+ }
+ _tmp4_ = child;
+ _tmp5_ = do_show;
+ gtk_widget_set_child_visible (_tmp4_, _tmp5_);
+}
+
+
+static void egg_list_box_apply_filter_all (EggListBox* self) {
+ g_return_if_fail (self != NULL);
+ {
+ GSequence* _tmp0_;
+ GSequenceIter* _tmp1_ = NULL;
+ GSequenceIter* iter;
+ _tmp0_ = self->priv->children;
+ _tmp1_ = g_sequence_get_begin_iter (_tmp0_);
+ iter = _tmp1_;
+ {
+ gboolean _tmp2_;
+ _tmp2_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp3_;
+ GSequenceIter* _tmp6_;
+ gboolean _tmp7_ = FALSE;
+ GSequenceIter* _tmp8_;
+ gconstpointer _tmp9_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp10_;
+ GtkWidget* _tmp11_;
+ _tmp3_ = _tmp2_;
+ if (!_tmp3_) {
+ GSequenceIter* _tmp4_;
+ GSequenceIter* _tmp5_ = NULL;
+ _tmp4_ = iter;
+ _tmp5_ = g_sequence_iter_next (_tmp4_);
+ iter = _tmp5_;
+ }
+ _tmp2_ = FALSE;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_is_end (_tmp6_);
+ if (!(!_tmp7_)) {
+ break;
+ }
+ _tmp8_ = iter;
+ _tmp9_ = g_sequence_get (_tmp8_);
+ child_info = (EggListBoxChildInfo*) _tmp9_;
+ _tmp10_ = child_info;
+ _tmp11_ = _tmp10_->widget;
+ egg_list_box_apply_filter (self, _tmp11_);
+ }
+ }
+ }
+}
+
+
+static EggListBoxChildInfo* egg_list_box_get_first_visible (EggListBox* self) {
+ EggListBoxChildInfo* result = NULL;
+ g_return_val_if_fail (self != NULL, NULL);
+ {
+ GSequence* _tmp0_;
+ GSequenceIter* _tmp1_ = NULL;
+ GSequenceIter* iter;
+ _tmp0_ = self->priv->children;
+ _tmp1_ = g_sequence_get_begin_iter (_tmp0_);
+ iter = _tmp1_;
+ {
+ gboolean _tmp2_;
+ _tmp2_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp3_;
+ GSequenceIter* _tmp6_;
+ gboolean _tmp7_ = FALSE;
+ GSequenceIter* _tmp8_;
+ gconstpointer _tmp9_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp10_;
+ GtkWidget* _tmp11_;
+ GtkWidget* widget;
+ gboolean _tmp12_ = FALSE;
+ GtkWidget* _tmp13_;
+ gboolean _tmp14_ = FALSE;
+ gboolean _tmp17_;
+ _tmp3_ = _tmp2_;
+ if (!_tmp3_) {
+ GSequenceIter* _tmp4_;
+ GSequenceIter* _tmp5_ = NULL;
+ _tmp4_ = iter;
+ _tmp5_ = g_sequence_iter_next (_tmp4_);
+ iter = _tmp5_;
+ }
+ _tmp2_ = FALSE;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_is_end (_tmp6_);
+ if (!(!_tmp7_)) {
+ break;
+ }
+ _tmp8_ = iter;
+ _tmp9_ = g_sequence_get (_tmp8_);
+ child_info = (EggListBoxChildInfo*) _tmp9_;
+ _tmp10_ = child_info;
+ _tmp11_ = _tmp10_->widget;
+ widget = _tmp11_;
+ _tmp13_ = widget;
+ _tmp14_ = gtk_widget_get_visible (_tmp13_);
+ if (_tmp14_) {
+ GtkWidget* _tmp15_;
+ gboolean _tmp16_ = FALSE;
+ _tmp15_ = widget;
+ _tmp16_ = gtk_widget_get_child_visible (_tmp15_);
+ _tmp12_ = _tmp16_;
+ } else {
+ _tmp12_ = FALSE;
+ }
+ _tmp17_ = _tmp12_;
+ if (_tmp17_) {
+ EggListBoxChildInfo* _tmp18_;
+ _tmp18_ = child_info;
+ result = _tmp18_;
+ return result;
+ }
+ }
+ }
+ }
+ result = NULL;
+ return result;
+}
+
+
+static EggListBoxChildInfo* egg_list_box_get_last_visible (EggListBox* self) {
+ EggListBoxChildInfo* result = NULL;
+ GSequence* _tmp0_;
+ GSequenceIter* _tmp1_ = NULL;
+ GSequenceIter* iter;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->children;
+ _tmp1_ = g_sequence_get_end_iter (_tmp0_);
+ iter = _tmp1_;
+ while (TRUE) {
+ GSequenceIter* _tmp2_;
+ gboolean _tmp3_ = FALSE;
+ GSequenceIter* _tmp4_;
+ GSequenceIter* _tmp5_ = NULL;
+ GSequenceIter* _tmp6_;
+ gconstpointer _tmp7_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp8_;
+ GtkWidget* _tmp9_;
+ GtkWidget* widget;
+ gboolean _tmp10_ = FALSE;
+ GtkWidget* _tmp11_;
+ gboolean _tmp12_ = FALSE;
+ gboolean _tmp15_;
+ _tmp2_ = iter;
+ _tmp3_ = g_sequence_iter_is_begin (_tmp2_);
+ if (!(!_tmp3_)) {
+ break;
+ }
+ _tmp4_ = iter;
+ _tmp5_ = g_sequence_iter_prev (_tmp4_);
+ iter = _tmp5_;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_get (_tmp6_);
+ child_info = (EggListBoxChildInfo*) _tmp7_;
+ _tmp8_ = child_info;
+ _tmp9_ = _tmp8_->widget;
+ widget = _tmp9_;
+ _tmp11_ = widget;
+ _tmp12_ = gtk_widget_get_visible (_tmp11_);
+ if (_tmp12_) {
+ GtkWidget* _tmp13_;
+ gboolean _tmp14_ = FALSE;
+ _tmp13_ = widget;
+ _tmp14_ = gtk_widget_get_child_visible (_tmp13_);
+ _tmp10_ = _tmp14_;
+ } else {
+ _tmp10_ = FALSE;
+ }
+ _tmp15_ = _tmp10_;
+ if (_tmp15_) {
+ EggListBoxChildInfo* _tmp16_;
+ _tmp16_ = child_info;
+ result = _tmp16_;
+ return result;
+ }
+ }
+ result = NULL;
+ return result;
+}
+
+
+static GSequenceIter* egg_list_box_get_previous_visible (EggListBox* self, GSequenceIter* _iter) {
+ GSequenceIter* result = NULL;
+ GSequenceIter* _tmp0_;
+ gboolean _tmp1_ = FALSE;
+ GSequenceIter* _tmp2_;
+ GSequenceIter* iter;
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (_iter != NULL, NULL);
+ _tmp0_ = _iter;
+ _tmp1_ = g_sequence_iter_is_begin (_tmp0_);
+ if (_tmp1_) {
+ result = NULL;
+ return result;
+ }
+ _tmp2_ = _iter;
+ iter = _tmp2_;
+ {
+ gboolean _tmp3_;
+ _tmp3_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp4_;
+ GSequenceIter* _tmp7_;
+ GSequenceIter* _tmp8_ = NULL;
+ GSequenceIter* _tmp9_;
+ gconstpointer _tmp10_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp11_;
+ GtkWidget* _tmp12_;
+ GtkWidget* widget;
+ gboolean _tmp13_ = FALSE;
+ GtkWidget* _tmp14_;
+ gboolean _tmp15_ = FALSE;
+ gboolean _tmp18_;
+ _tmp4_ = _tmp3_;
+ if (!_tmp4_) {
+ GSequenceIter* _tmp5_;
+ gboolean _tmp6_ = FALSE;
+ _tmp5_ = iter;
+ _tmp6_ = g_sequence_iter_is_begin (_tmp5_);
+ if (!(!_tmp6_)) {
+ break;
+ }
+ }
+ _tmp3_ = FALSE;
+ _tmp7_ = iter;
+ _tmp8_ = g_sequence_iter_prev (_tmp7_);
+ iter = _tmp8_;
+ _tmp9_ = iter;
+ _tmp10_ = g_sequence_get (_tmp9_);
+ child_info = (EggListBoxChildInfo*) _tmp10_;
+ _tmp11_ = child_info;
+ _tmp12_ = _tmp11_->widget;
+ widget = _tmp12_;
+ _tmp14_ = widget;
+ _tmp15_ = gtk_widget_get_visible (_tmp14_);
+ if (_tmp15_) {
+ GtkWidget* _tmp16_;
+ gboolean _tmp17_ = FALSE;
+ _tmp16_ = widget;
+ _tmp17_ = gtk_widget_get_child_visible (_tmp16_);
+ _tmp13_ = _tmp17_;
+ } else {
+ _tmp13_ = FALSE;
+ }
+ _tmp18_ = _tmp13_;
+ if (_tmp18_) {
+ result = iter;
+ return result;
+ }
+ }
+ }
+ result = NULL;
+ return result;
+}
+
+
+static GSequenceIter* egg_list_box_get_next_visible (EggListBox* self, GSequenceIter* _iter) {
+ GSequenceIter* result = NULL;
+ GSequenceIter* _tmp0_;
+ gboolean _tmp1_ = FALSE;
+ GSequenceIter* _tmp3_;
+ GSequenceIter* iter;
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (_iter != NULL, NULL);
+ _tmp0_ = _iter;
+ _tmp1_ = g_sequence_iter_is_end (_tmp0_);
+ if (_tmp1_) {
+ GSequenceIter* _tmp2_;
+ _tmp2_ = _iter;
+ result = _tmp2_;
+ return result;
+ }
+ _tmp3_ = _iter;
+ iter = _tmp3_;
+ {
+ gboolean _tmp4_;
+ _tmp4_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp5_;
+ GSequenceIter* _tmp8_;
+ GSequenceIter* _tmp9_ = NULL;
+ GSequenceIter* _tmp10_;
+ gboolean _tmp11_ = FALSE;
+ _tmp5_ = _tmp4_;
+ if (!_tmp5_) {
+ GSequenceIter* _tmp6_;
+ gboolean _tmp7_ = FALSE;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_is_end (_tmp6_);
+ if (!(!_tmp7_)) {
+ break;
+ }
+ }
+ _tmp4_ = FALSE;
+ _tmp8_ = iter;
+ _tmp9_ = g_sequence_iter_next (_tmp8_);
+ iter = _tmp9_;
+ _tmp10_ = iter;
+ _tmp11_ = g_sequence_iter_is_end (_tmp10_);
+ if (!_tmp11_) {
+ GSequenceIter* _tmp12_;
+ gconstpointer _tmp13_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp14_;
+ GtkWidget* _tmp15_;
+ GtkWidget* widget;
+ gboolean _tmp16_ = FALSE;
+ GtkWidget* _tmp17_;
+ gboolean _tmp18_ = FALSE;
+ gboolean _tmp21_;
+ _tmp12_ = iter;
+ _tmp13_ = g_sequence_get (_tmp12_);
+ child_info = (EggListBoxChildInfo*) _tmp13_;
+ _tmp14_ = child_info;
+ _tmp15_ = _tmp14_->widget;
+ widget = _tmp15_;
+ _tmp17_ = widget;
+ _tmp18_ = gtk_widget_get_visible (_tmp17_);
+ if (_tmp18_) {
+ GtkWidget* _tmp19_;
+ gboolean _tmp20_ = FALSE;
+ _tmp19_ = widget;
+ _tmp20_ = gtk_widget_get_child_visible (_tmp19_);
+ _tmp16_ = _tmp20_;
+ } else {
+ _tmp16_ = FALSE;
+ }
+ _tmp21_ = _tmp16_;
+ if (_tmp21_) {
+ result = iter;
+ return result;
+ }
+ }
+ }
+ }
+ result = iter;
+ return result;
+}
+
+
+static void egg_list_box_update_separator (EggListBox* self, GSequenceIter* iter) {
+ gboolean _tmp0_ = FALSE;
+ GSequenceIter* _tmp1_;
+ gboolean _tmp4_;
+ GSequenceIter* _tmp5_;
+ gconstpointer _tmp6_ = NULL;
+ EggListBoxChildInfo* info;
+ GSequenceIter* _tmp7_;
+ GSequenceIter* _tmp8_ = NULL;
+ GSequenceIter* before_iter;
+ EggListBoxChildInfo* _tmp9_;
+ GtkWidget* _tmp10_;
+ GtkWidget* _tmp11_;
+ GtkWidget* widget;
+ GtkWidget* before_widget;
+ GSequenceIter* _tmp12_;
+ gboolean _tmp18_ = FALSE;
+ gboolean _tmp19_ = FALSE;
+ EggListBoxUpdateSeparatorFunc _tmp20_;
+ void* _tmp20__target;
+ gboolean _tmp23_;
+ gboolean _tmp26_;
+ g_return_if_fail (self != NULL);
+ _tmp1_ = iter;
+ if (_tmp1_ == NULL) {
+ _tmp0_ = TRUE;
+ } else {
+ GSequenceIter* _tmp2_;
+ gboolean _tmp3_ = FALSE;
+ _tmp2_ = iter;
+ _tmp3_ = g_sequence_iter_is_end (_tmp2_);
+ _tmp0_ = _tmp3_;
+ }
+ _tmp4_ = _tmp0_;
+ if (_tmp4_) {
+ return;
+ }
+ _tmp5_ = iter;
+ _tmp6_ = g_sequence_get (_tmp5_);
+ info = (EggListBoxChildInfo*) _tmp6_;
+ _tmp7_ = iter;
+ _tmp8_ = egg_list_box_get_previous_visible (self, _tmp7_);
+ before_iter = _tmp8_;
+ _tmp9_ = info;
+ _tmp10_ = _tmp9_->widget;
+ _tmp11_ = _g_object_ref0 (_tmp10_);
+ widget = _tmp11_;
+ before_widget = NULL;
+ _tmp12_ = before_iter;
+ if (_tmp12_ != NULL) {
+ GSequenceIter* _tmp13_;
+ gconstpointer _tmp14_ = NULL;
+ EggListBoxChildInfo* before_info;
+ EggListBoxChildInfo* _tmp15_;
+ GtkWidget* _tmp16_;
+ GtkWidget* _tmp17_;
+ _tmp13_ = before_iter;
+ _tmp14_ = g_sequence_get (_tmp13_);
+ before_info = (EggListBoxChildInfo*) _tmp14_;
+ _tmp15_ = before_info;
+ _tmp16_ = _tmp15_->widget;
+ _tmp17_ = _g_object_ref0 (_tmp16_);
+ _g_object_unref0 (before_widget);
+ before_widget = _tmp17_;
+ }
+ _tmp20_ = self->priv->update_separator_func;
+ _tmp20__target = self->priv->update_separator_func_target;
+ if (_tmp20_ != NULL) {
+ GtkWidget* _tmp21_;
+ gboolean _tmp22_ = FALSE;
+ _tmp21_ = widget;
+ _tmp22_ = gtk_widget_get_visible (_tmp21_);
+ _tmp19_ = _tmp22_;
+ } else {
+ _tmp19_ = FALSE;
+ }
+ _tmp23_ = _tmp19_;
+ if (_tmp23_) {
+ GtkWidget* _tmp24_;
+ gboolean _tmp25_ = FALSE;
+ _tmp24_ = widget;
+ _tmp25_ = gtk_widget_get_child_visible (_tmp24_);
+ _tmp18_ = _tmp25_;
+ } else {
+ _tmp18_ = FALSE;
+ }
+ _tmp26_ = _tmp18_;
+ if (_tmp26_) {
+ EggListBoxChildInfo* _tmp27_;
+ GtkWidget* _tmp28_;
+ GtkWidget* _tmp29_;
+ GtkWidget* old_separator;
+ EggListBoxUpdateSeparatorFunc _tmp30_;
+ void* _tmp30__target;
+ EggListBoxChildInfo* _tmp31_;
+ GtkWidget* _tmp32_;
+ GtkWidget* _tmp33_;
+ GtkWidget* _tmp34_;
+ EggListBoxChildInfo* _tmp35_;
+ GtkWidget* _tmp36_;
+ _tmp27_ = info;
+ _tmp28_ = _tmp27_->separator;
+ _tmp29_ = _g_object_ref0 (_tmp28_);
+ old_separator = _tmp29_;
+ _tmp30_ = self->priv->update_separator_func;
+ _tmp30__target = self->priv->update_separator_func_target;
+ _tmp31_ = info;
+ _tmp32_ = widget;
+ _tmp33_ = before_widget;
+ _tmp30_ (&_tmp31_->separator, _tmp32_, _tmp33_, _tmp30__target);
+ _tmp34_ = old_separator;
+ _tmp35_ = info;
+ _tmp36_ = _tmp35_->separator;
+ if (_tmp34_ != _tmp36_) {
+ GtkWidget* _tmp37_;
+ EggListBoxChildInfo* _tmp41_;
+ GtkWidget* _tmp42_;
+ _tmp37_ = old_separator;
+ if (_tmp37_ != NULL) {
+ GtkWidget* _tmp38_;
+ GHashTable* _tmp39_;
+ GtkWidget* _tmp40_;
+ _tmp38_ = old_separator;
+ gtk_widget_unparent (_tmp38_);
+ _tmp39_ = self->priv->separator_hash;
+ _tmp40_ = old_separator;
+ g_hash_table_remove (_tmp39_, _tmp40_);
+ }
+ _tmp41_ = info;
+ _tmp42_ = _tmp41_->separator;
+ if (_tmp42_ != NULL) {
+ GHashTable* _tmp43_;
+ EggListBoxChildInfo* _tmp44_;
+ GtkWidget* _tmp45_;
+ EggListBoxChildInfo* _tmp46_;
+ EggListBoxChildInfo* _tmp47_;
+ GtkWidget* _tmp48_;
+ EggListBoxChildInfo* _tmp49_;
+ GtkWidget* _tmp50_;
+ _tmp43_ = self->priv->separator_hash;
+ _tmp44_ = info;
+ _tmp45_ = _tmp44_->separator;
+ _tmp46_ = info;
+ g_hash_table_insert (_tmp43_, _tmp45_, _tmp46_);
+ _tmp47_ = info;
+ _tmp48_ = _tmp47_->separator;
+ gtk_widget_set_parent (_tmp48_, (GtkWidget*) self);
+ _tmp49_ = info;
+ _tmp50_ = _tmp49_->separator;
+ gtk_widget_show (_tmp50_);
+ }
+ gtk_widget_queue_resize ((GtkWidget*) self);
+ }
+ _g_object_unref0 (old_separator);
+ } else {
+ EggListBoxChildInfo* _tmp51_;
+ GtkWidget* _tmp52_;
+ _tmp51_ = info;
+ _tmp52_ = _tmp51_->separator;
+ if (_tmp52_ != NULL) {
+ GHashTable* _tmp53_;
+ EggListBoxChildInfo* _tmp54_;
+ GtkWidget* _tmp55_;
+ EggListBoxChildInfo* _tmp56_;
+ GtkWidget* _tmp57_;
+ EggListBoxChildInfo* _tmp58_;
+ _tmp53_ = self->priv->separator_hash;
+ _tmp54_ = info;
+ _tmp55_ = _tmp54_->separator;
+ g_hash_table_remove (_tmp53_, _tmp55_);
+ _tmp56_ = info;
+ _tmp57_ = _tmp56_->separator;
+ gtk_widget_unparent (_tmp57_);
+ _tmp58_ = info;
+ _g_object_unref0 (_tmp58_->separator);
+ _tmp58_->separator = NULL;
+ gtk_widget_queue_resize ((GtkWidget*) self);
+ }
+ }
+ _g_object_unref0 (before_widget);
+ _g_object_unref0 (widget);
+}
+
+
+static EggListBoxChildInfo* egg_list_box_lookup_info (EggListBox* self, GtkWidget* widget) {
+ EggListBoxChildInfo* result = NULL;
+ GHashTable* _tmp0_;
+ GtkWidget* _tmp1_;
+ gconstpointer _tmp2_ = NULL;
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (widget != NULL, NULL);
+ _tmp0_ = self->priv->child_hash;
+ _tmp1_ = widget;
+ _tmp2_ = g_hash_table_lookup (_tmp0_, _tmp1_);
+ result = (EggListBoxChildInfo*) _tmp2_;
+ return result;
+}
+
+
+static gpointer _egg_list_box_child_info_ref0 (gpointer self) {
+ return self ? egg_list_box_child_info_ref (self) : NULL;
+}
+
+
+static void _egg_list_box_child_visibility_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
+ egg_list_box_child_visibility_changed (self, _sender, pspec);
+}
+
+
+static void egg_list_box_real_add (GtkContainer* base, GtkWidget* widget) {
+ EggListBox * self;
+ GtkWidget* _tmp0_;
+ EggListBoxChildInfo* _tmp1_;
+ EggListBoxChildInfo* info;
+ GSequenceIter* iter = NULL;
+ GHashTable* _tmp2_;
+ GtkWidget* _tmp3_;
+ EggListBoxChildInfo* _tmp4_;
+ GCompareDataFunc _tmp5_;
+ void* _tmp5__target;
+ EggListBoxChildInfo* _tmp14_;
+ GSequenceIter* _tmp15_;
+ GtkWidget* _tmp16_;
+ GtkWidget* _tmp17_;
+ gboolean _tmp18_ = FALSE;
+ GtkWidget* _tmp22_;
+ self = (EggListBox*) base;
+ g_return_if_fail (widget != NULL);
+ _tmp0_ = widget;
+ _tmp1_ = egg_list_box_child_info_new (_tmp0_);
+ info = _tmp1_;
+ _tmp2_ = self->priv->child_hash;
+ _tmp3_ = widget;
+ _tmp4_ = info;
+ g_hash_table_insert (_tmp2_, _tmp3_, _tmp4_);
+ _tmp5_ = self->priv->sort_func;
+ _tmp5__target = self->priv->sort_func_target;
+ if (_tmp5_ != NULL) {
+ GSequence* _tmp6_;
+ EggListBoxChildInfo* _tmp7_;
+ EggListBoxChildInfo* _tmp8_;
+ GSequenceIter* _tmp9_ = NULL;
+ _tmp6_ = self->priv->children;
+ _tmp7_ = info;
+ _tmp8_ = _egg_list_box_child_info_ref0 (_tmp7_);
+ _tmp9_ = g_sequence_insert_sorted (_tmp6_, _tmp8_, _egg_list_box_do_sort_gcompare_data_func, self);
+ iter = _tmp9_;
+ } else {
+ GSequence* _tmp10_;
+ EggListBoxChildInfo* _tmp11_;
+ EggListBoxChildInfo* _tmp12_;
+ GSequenceIter* _tmp13_ = NULL;
+ _tmp10_ = self->priv->children;
+ _tmp11_ = info;
+ _tmp12_ = _egg_list_box_child_info_ref0 (_tmp11_);
+ _tmp13_ = g_sequence_append (_tmp10_, _tmp12_);
+ iter = _tmp13_;
+ }
+ _tmp14_ = info;
+ _tmp15_ = iter;
+ _tmp14_->iter = _tmp15_;
+ _tmp16_ = widget;
+ gtk_widget_set_parent (_tmp16_, (GtkWidget*) self);
+ _tmp17_ = widget;
+ egg_list_box_apply_filter (self, _tmp17_);
+ _tmp18_ = gtk_widget_get_visible ((GtkWidget*) self);
+ if (_tmp18_) {
+ GSequenceIter* _tmp19_;
+ GSequenceIter* _tmp20_;
+ GSequenceIter* _tmp21_ = NULL;
+ _tmp19_ = iter;
+ egg_list_box_update_separator (self, _tmp19_);
+ _tmp20_ = iter;
+ _tmp21_ = egg_list_box_get_next_visible (self, _tmp20_);
+ egg_list_box_update_separator (self, _tmp21_);
+ }
+ _tmp22_ = widget;
+ g_signal_connect_object ((GObject*) _tmp22_, "notify::visible", (GCallback) _egg_list_box_child_visibility_changed_g_object_notify, self, 0);
+ _egg_list_box_child_info_unref0 (info);
+}
+
+
+static void egg_list_box_child_visibility_changed (EggListBox* self, GObject* object, GParamSpec* pspec) {
+ gboolean _tmp0_ = FALSE;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (pspec != NULL);
+ _tmp0_ = gtk_widget_get_visible ((GtkWidget*) self);
+ if (_tmp0_) {
+ GObject* _tmp1_;
+ EggListBoxChildInfo* _tmp2_ = NULL;
+ EggListBoxChildInfo* info;
+ EggListBoxChildInfo* _tmp3_;
+ _tmp1_ = object;
+ _tmp2_ = egg_list_box_lookup_info (self, GTK_IS_WIDGET (_tmp1_) ? ((GtkWidget*) _tmp1_) : NULL);
+ info = _tmp2_;
+ _tmp3_ = info;
+ if (_tmp3_ != NULL) {
+ EggListBoxChildInfo* _tmp4_;
+ GSequenceIter* _tmp5_;
+ EggListBoxChildInfo* _tmp6_;
+ GSequenceIter* _tmp7_;
+ GSequenceIter* _tmp8_ = NULL;
+ _tmp4_ = info;
+ _tmp5_ = _tmp4_->iter;
+ egg_list_box_update_separator (self, _tmp5_);
+ _tmp6_ = info;
+ _tmp7_ = _tmp6_->iter;
+ _tmp8_ = egg_list_box_get_next_visible (self, _tmp7_);
+ egg_list_box_update_separator (self, _tmp8_);
+ }
+ }
+}
+
+
+static void egg_list_box_real_remove (GtkContainer* base, GtkWidget* widget) {
+ EggListBox * self;
+ GtkWidget* _tmp0_;
+ gboolean _tmp1_ = FALSE;
+ gboolean was_visible;
+ GtkWidget* _tmp2_;
+ guint _tmp3_ = 0U;
+ GQuark _tmp4_ = 0U;
+ GtkWidget* _tmp5_;
+ EggListBoxChildInfo* _tmp6_ = NULL;
+ EggListBoxChildInfo* info;
+ EggListBoxChildInfo* _tmp7_;
+ EggListBoxChildInfo* _tmp21_;
+ GtkWidget* _tmp22_;
+ EggListBoxChildInfo* _tmp29_;
+ EggListBoxChildInfo* _tmp30_;
+ EggListBoxChildInfo* _tmp31_;
+ EggListBoxChildInfo* _tmp32_;
+ EggListBoxChildInfo* _tmp33_;
+ EggListBoxChildInfo* _tmp34_;
+ EggListBoxChildInfo* _tmp35_;
+ EggListBoxChildInfo* _tmp36_;
+ EggListBoxChildInfo* _tmp37_;
+ GSequenceIter* _tmp38_;
+ GSequenceIter* _tmp39_ = NULL;
+ GSequenceIter* next;
+ GtkWidget* _tmp40_;
+ GHashTable* _tmp41_;
+ GtkWidget* _tmp42_;
+ GSequence* _tmp43_;
+ EggListBoxChildInfo* _tmp44_;
+ GSequenceIter* _tmp45_;
+ gboolean _tmp46_ = FALSE;
+ gboolean _tmp48_ = FALSE;
+ gboolean _tmp49_;
+ gboolean _tmp51_;
+ self = (EggListBox*) base;
+ g_return_if_fail (widget != NULL);
+ _tmp0_ = widget;
+ _tmp1_ = gtk_widget_get_visible (_tmp0_);
+ was_visible = _tmp1_;
+ _tmp2_ = widget;
+ g_signal_parse_name ("notify::visible", G_TYPE_OBJECT, &_tmp3_, &_tmp4_, TRUE);
+ g_signal_handlers_disconnect_matched ((GObject*) _tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, _tmp4_, NULL, (GCallback) _egg_list_box_child_visibility_changed_g_object_notify, self);
+ _tmp5_ = widget;
+ _tmp6_ = egg_list_box_lookup_info (self, _tmp5_);
+ info = _tmp6_;
+ _tmp7_ = info;
+ if (_tmp7_ == NULL) {
+ GHashTable* _tmp8_;
+ GtkWidget* _tmp9_;
+ gconstpointer _tmp10_ = NULL;
+ EggListBoxChildInfo* _tmp11_;
+ _tmp8_ = self->priv->separator_hash;
+ _tmp9_ = widget;
+ _tmp10_ = g_hash_table_lookup (_tmp8_, _tmp9_);
+ info = (EggListBoxChildInfo*) _tmp10_;
+ _tmp11_ = info;
+ if (_tmp11_ != NULL) {
+ GHashTable* _tmp12_;
+ GtkWidget* _tmp13_;
+ EggListBoxChildInfo* _tmp14_;
+ GtkWidget* _tmp15_;
+ gboolean _tmp16_ = FALSE;
+ gboolean _tmp17_;
+ gboolean _tmp19_;
+ _tmp12_ = self->priv->separator_hash;
+ _tmp13_ = widget;
+ g_hash_table_remove (_tmp12_, _tmp13_);
+ _tmp14_ = info;
+ _g_object_unref0 (_tmp14_->separator);
+ _tmp14_->separator = NULL;
+ _tmp15_ = widget;
+ gtk_widget_unparent (_tmp15_);
+ _tmp17_ = was_visible;
+ if (_tmp17_) {
+ gboolean _tmp18_ = FALSE;
+ _tmp18_ = gtk_widget_get_visible ((GtkWidget*) self);
+ _tmp16_ = _tmp18_;
+ } else {
+ _tmp16_ = FALSE;
+ }
+ _tmp19_ = _tmp16_;
+ if (_tmp19_) {
+ gtk_widget_queue_resize ((GtkWidget*) self);
+ }
+ } else {
+ GtkWidget* _tmp20_;
+ _tmp20_ = widget;
+ g_warning ("egg-list-box.vala:837: Tried to remove non-child %p\n", _tmp20_);
+ }
+ return;
+ }
+ _tmp21_ = info;
+ _tmp22_ = _tmp21_->separator;
+ if (_tmp22_ != NULL) {
+ GHashTable* _tmp23_;
+ EggListBoxChildInfo* _tmp24_;
+ GtkWidget* _tmp25_;
+ EggListBoxChildInfo* _tmp26_;
+ GtkWidget* _tmp27_;
+ EggListBoxChildInfo* _tmp28_;
+ _tmp23_ = self->priv->separator_hash;
+ _tmp24_ = info;
+ _tmp25_ = _tmp24_->separator;
+ g_hash_table_remove (_tmp23_, _tmp25_);
+ _tmp26_ = info;
+ _tmp27_ = _tmp26_->separator;
+ gtk_widget_unparent (_tmp27_);
+ _tmp28_ = info;
+ _g_object_unref0 (_tmp28_->separator);
+ _tmp28_->separator = NULL;
+ }
+ _tmp29_ = info;
+ _tmp30_ = self->priv->selected_child;
+ if (_tmp29_ == _tmp30_) {
+ egg_list_box_update_selected (self, NULL);
+ }
+ _tmp31_ = info;
+ _tmp32_ = self->priv->prelight_child;
+ if (_tmp31_ == _tmp32_) {
+ self->priv->prelight_child = NULL;
+ }
+ _tmp33_ = info;
+ _tmp34_ = self->priv->cursor_child;
+ if (_tmp33_ == _tmp34_) {
+ self->priv->cursor_child = NULL;
+ }
+ _tmp35_ = info;
+ _tmp36_ = self->priv->active_child;
+ if (_tmp35_ == _tmp36_) {
+ self->priv->active_child = NULL;
+ }
+ _tmp37_ = info;
+ _tmp38_ = _tmp37_->iter;
+ _tmp39_ = egg_list_box_get_next_visible (self, _tmp38_);
+ next = _tmp39_;
+ _tmp40_ = widget;
+ gtk_widget_unparent (_tmp40_);
+ _tmp41_ = self->priv->child_hash;
+ _tmp42_ = widget;
+ g_hash_table_remove (_tmp41_, _tmp42_);
+ _tmp43_ = self->priv->children;
+ _tmp44_ = info;
+ _tmp45_ = _tmp44_->iter;
+ g_sequence_remove (_tmp45_);
+ _tmp46_ = gtk_widget_get_visible ((GtkWidget*) self);
+ if (_tmp46_) {
+ GSequenceIter* _tmp47_;
+ _tmp47_ = next;
+ egg_list_box_update_separator (self, _tmp47_);
+ }
+ _tmp49_ = was_visible;
+ if (_tmp49_) {
+ gboolean _tmp50_ = FALSE;
+ _tmp50_ = gtk_widget_get_visible ((GtkWidget*) self);
+ _tmp48_ = _tmp50_;
+ } else {
+ _tmp48_ = FALSE;
+ }
+ _tmp51_ = _tmp48_;
+ if (_tmp51_) {
+ gtk_widget_queue_resize ((GtkWidget*) self);
+ }
+}
+
+
+static void egg_list_box_real_forall_internal (GtkContainer* base, gboolean include_internals, GtkCallback callback, void* callback_target) {
+ EggListBox * self;
+ GSequence* _tmp0_;
+ GSequenceIter* _tmp1_ = NULL;
+ GSequenceIter* iter;
+ self = (EggListBox*) base;
+ _tmp0_ = self->priv->children;
+ _tmp1_ = g_sequence_get_begin_iter (_tmp0_);
+ iter = _tmp1_;
+ while (TRUE) {
+ GSequenceIter* _tmp2_;
+ gboolean _tmp3_ = FALSE;
+ GSequenceIter* _tmp4_;
+ gconstpointer _tmp5_ = NULL;
+ EggListBoxChildInfo* child_info;
+ GSequenceIter* _tmp6_;
+ GSequenceIter* _tmp7_ = NULL;
+ gboolean _tmp8_ = FALSE;
+ EggListBoxChildInfo* _tmp9_;
+ GtkWidget* _tmp10_;
+ gboolean _tmp12_;
+ GtkCallback _tmp16_;
+ void* _tmp16__target;
+ EggListBoxChildInfo* _tmp17_;
+ GtkWidget* _tmp18_;
+ _tmp2_ = iter;
+ _tmp3_ = g_sequence_iter_is_end (_tmp2_);
+ if (!(!_tmp3_)) {
+ break;
+ }
+ _tmp4_ = iter;
+ _tmp5_ = g_sequence_get (_tmp4_);
+ child_info = (EggListBoxChildInfo*) _tmp5_;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_next (_tmp6_);
+ iter = _tmp7_;
+ _tmp9_ = child_info;
+ _tmp10_ = _tmp9_->separator;
+ if (_tmp10_ != NULL) {
+ gboolean _tmp11_;
+ _tmp11_ = include_internals;
+ _tmp8_ = _tmp11_;
+ } else {
+ _tmp8_ = FALSE;
+ }
+ _tmp12_ = _tmp8_;
+ if (_tmp12_) {
+ GtkCallback _tmp13_;
+ void* _tmp13__target;
+ EggListBoxChildInfo* _tmp14_;
+ GtkWidget* _tmp15_;
+ _tmp13_ = callback;
+ _tmp13__target = callback_target;
+ _tmp14_ = child_info;
+ _tmp15_ = _tmp14_->separator;
+ _tmp13_ (_tmp15_, _tmp13__target);
+ }
+ _tmp16_ = callback;
+ _tmp16__target = callback_target;
+ _tmp17_ = child_info;
+ _tmp18_ = _tmp17_->widget;
+ _tmp16_ (_tmp18_, _tmp16__target);
+ }
+}
+
+
+static void egg_list_box_real_compute_expand_internal (GtkWidget* base, gboolean* hexpand, gboolean* vexpand) {
+ EggListBox * self;
+ gboolean _vala_hexpand = FALSE;
+ gboolean _vala_vexpand = FALSE;
+ gboolean _tmp0_ = FALSE;
+ gboolean _tmp1_ = FALSE;
+ self = (EggListBox*) base;
+ GTK_WIDGET_CLASS (egg_list_box_parent_class)->compute_expand ((GtkWidget*) GTK_CONTAINER (self), &_tmp0_, &_tmp1_);
+ _vala_hexpand = _tmp0_;
+ _vala_vexpand = _tmp1_;
+ _vala_vexpand = FALSE;
+ if (hexpand) {
+ *hexpand = _vala_hexpand;
+ }
+ if (vexpand) {
+ *vexpand = _vala_vexpand;
+ }
+}
+
+
+static GType egg_list_box_real_child_type (GtkContainer* base) {
+ EggListBox * self;
+ GType result = 0UL;
+ self = (EggListBox*) base;
+ result = GTK_TYPE_WIDGET;
+ return result;
+}
+
+
+static GtkSizeRequestMode egg_list_box_real_get_request_mode (GtkWidget* base) {
+ EggListBox * self;
+ GtkSizeRequestMode result = 0;
+ self = (EggListBox*) base;
+ result = GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
+ return result;
+}
+
+
+static void egg_list_box_real_get_preferred_height (GtkWidget* base, gint* minimum_height, gint* natural_height) {
+ EggListBox * self;
+ gint _vala_minimum_height = 0;
+ gint _vala_natural_height = 0;
+ gint natural_width = 0;
+ gint _tmp0_ = 0;
+ gint _tmp1_ = 0;
+ gint _tmp2_ = 0;
+ self = (EggListBox*) base;
+ GTK_WIDGET_GET_CLASS ((GtkWidget*) self)->get_preferred_width ((GtkWidget*) self, NULL, &_tmp0_);
+ natural_width = _tmp0_;
+ GTK_WIDGET_GET_CLASS ((GtkWidget*) self)->get_preferred_height_for_width ((GtkWidget*) self, natural_width, &_tmp1_, &_tmp2_);
+ _vala_minimum_height = _tmp1_;
+ _vala_natural_height = _tmp2_;
+ if (minimum_height) {
+ *minimum_height = _vala_minimum_height;
+ }
+ if (natural_height) {
+ *natural_height = _vala_natural_height;
+ }
+}
+
+
+static void egg_list_box_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height) {
+ EggListBox * self;
+ gint _vala_minimum_height = 0;
+ gint _vala_natural_height = 0;
+ GtkStyleContext* _tmp0_ = NULL;
+ GtkStyleContext* context;
+ gint focus_width = 0;
+ gint focus_pad = 0;
+ GtkStyleContext* _tmp1_;
+ gint _tmp37_;
+ self = (EggListBox*) base;
+ _vala_minimum_height = 0;
+ _tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
+ context = _tmp0_;
+ _tmp1_ = context;
+ gtk_style_context_get_style (_tmp1_, "focus-line-width", &focus_width, "focus-padding", &focus_pad, NULL);
+ {
+ GSequence* _tmp2_;
+ GSequenceIter* _tmp3_ = NULL;
+ GSequenceIter* iter;
+ _tmp2_ = self->priv->children;
+ _tmp3_ = g_sequence_get_begin_iter (_tmp2_);
+ iter = _tmp3_;
+ {
+ gboolean _tmp4_;
+ _tmp4_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp5_;
+ GSequenceIter* _tmp8_;
+ gboolean _tmp9_ = FALSE;
+ GSequenceIter* _tmp10_;
+ gconstpointer _tmp11_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp12_;
+ GtkWidget* _tmp13_;
+ GtkWidget* widget;
+ gint child_min = 0;
+ gboolean _tmp14_ = FALSE;
+ GtkWidget* _tmp15_;
+ gboolean _tmp16_ = FALSE;
+ gboolean _tmp19_;
+ EggListBoxChildInfo* _tmp20_;
+ GtkWidget* _tmp21_;
+ GtkWidget* _tmp28_;
+ gint _tmp29_;
+ gint _tmp30_;
+ gint _tmp31_;
+ gint _tmp32_ = 0;
+ gint _tmp33_;
+ gint _tmp34_;
+ gint _tmp35_;
+ gint _tmp36_;
+ _tmp5_ = _tmp4_;
+ if (!_tmp5_) {
+ GSequenceIter* _tmp6_;
+ GSequenceIter* _tmp7_ = NULL;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_next (_tmp6_);
+ iter = _tmp7_;
+ }
+ _tmp4_ = FALSE;
+ _tmp8_ = iter;
+ _tmp9_ = g_sequence_iter_is_end (_tmp8_);
+ if (!(!_tmp9_)) {
+ break;
+ }
+ _tmp10_ = iter;
+ _tmp11_ = g_sequence_get (_tmp10_);
+ child_info = (EggListBoxChildInfo*) _tmp11_;
+ _tmp12_ = child_info;
+ _tmp13_ = _tmp12_->widget;
+ widget = _tmp13_;
+ _tmp15_ = widget;
+ _tmp16_ = gtk_widget_get_visible (_tmp15_);
+ if (!_tmp16_) {
+ _tmp14_ = TRUE;
+ } else {
+ GtkWidget* _tmp17_;
+ gboolean _tmp18_ = FALSE;
+ _tmp17_ = widget;
+ _tmp18_ = gtk_widget_get_child_visible (_tmp17_);
+ _tmp14_ = !_tmp18_;
+ }
+ _tmp19_ = _tmp14_;
+ if (_tmp19_) {
+ continue;
+ }
+ _tmp20_ = child_info;
+ _tmp21_ = _tmp20_->separator;
+ if (_tmp21_ != NULL) {
+ EggListBoxChildInfo* _tmp22_;
+ GtkWidget* _tmp23_;
+ gint _tmp24_;
+ gint _tmp25_ = 0;
+ gint _tmp26_;
+ gint _tmp27_;
+ _tmp22_ = child_info;
+ _tmp23_ = _tmp22_->separator;
+ _tmp24_ = width;
+ gtk_widget_get_preferred_height_for_width (_tmp23_, _tmp24_, &_tmp25_, NULL);
+ child_min = _tmp25_;
+ _tmp26_ = _vala_minimum_height;
+ _tmp27_ = child_min;
+ _vala_minimum_height = _tmp26_ + _tmp27_;
+ }
+ _tmp28_ = widget;
+ _tmp29_ = width;
+ _tmp30_ = focus_width;
+ _tmp31_ = focus_pad;
+ gtk_widget_get_preferred_height_for_width (_tmp28_, _tmp29_ - (2 * (_tmp30_ + _tmp31_)), &_tmp32_, NULL);
+ child_min = _tmp32_;
+ _tmp33_ = _vala_minimum_height;
+ _tmp34_ = child_min;
+ _tmp35_ = focus_width;
+ _tmp36_ = focus_pad;
+ _vala_minimum_height = _tmp33_ + (_tmp34_ + (2 * (_tmp35_ + _tmp36_)));
+ }
+ }
+ }
+ _tmp37_ = _vala_minimum_height;
+ _vala_natural_height = _tmp37_;
+ if (minimum_height) {
+ *minimum_height = _vala_minimum_height;
+ }
+ if (natural_height) {
+ *natural_height = _vala_natural_height;
+ }
+}
+
+
+static void egg_list_box_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width) {
+ EggListBox * self;
+ gint _vala_minimum_width = 0;
+ gint _vala_natural_width = 0;
+ GtkStyleContext* _tmp0_ = NULL;
+ GtkStyleContext* context;
+ gint focus_width = 0;
+ gint focus_pad = 0;
+ GtkStyleContext* _tmp1_;
+ self = (EggListBox*) base;
+ _tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
+ context = _tmp0_;
+ _tmp1_ = context;
+ gtk_style_context_get_style (_tmp1_, "focus-line-width", &focus_width, "focus-padding", &focus_pad, NULL);
+ _vala_minimum_width = 0;
+ _vala_natural_width = 0;
+ {
+ GSequence* _tmp2_;
+ GSequenceIter* _tmp3_ = NULL;
+ GSequenceIter* iter;
+ _tmp2_ = self->priv->children;
+ _tmp3_ = g_sequence_get_begin_iter (_tmp2_);
+ iter = _tmp3_;
+ {
+ gboolean _tmp4_;
+ _tmp4_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp5_;
+ GSequenceIter* _tmp8_;
+ gboolean _tmp9_ = FALSE;
+ GSequenceIter* _tmp10_;
+ gconstpointer _tmp11_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp12_;
+ GtkWidget* _tmp13_;
+ GtkWidget* widget;
+ gint child_min = 0;
+ gint child_nat = 0;
+ gboolean _tmp14_ = FALSE;
+ GtkWidget* _tmp15_;
+ gboolean _tmp16_ = FALSE;
+ gboolean _tmp19_;
+ GtkWidget* _tmp20_;
+ gint _tmp21_ = 0;
+ gint _tmp22_ = 0;
+ gint _tmp23_;
+ gint _tmp24_;
+ gint _tmp25_;
+ gint _tmp26_;
+ gint _tmp27_ = 0;
+ gint _tmp28_;
+ gint _tmp29_;
+ gint _tmp30_;
+ gint _tmp31_;
+ gint _tmp32_ = 0;
+ EggListBoxChildInfo* _tmp33_;
+ GtkWidget* _tmp34_;
+ _tmp5_ = _tmp4_;
+ if (!_tmp5_) {
+ GSequenceIter* _tmp6_;
+ GSequenceIter* _tmp7_ = NULL;
+ _tmp6_ = iter;
+ _tmp7_ = g_sequence_iter_next (_tmp6_);
+ iter = _tmp7_;
+ }
+ _tmp4_ = FALSE;
+ _tmp8_ = iter;
+ _tmp9_ = g_sequence_iter_is_end (_tmp8_);
+ if (!(!_tmp9_)) {
+ break;
+ }
+ _tmp10_ = iter;
+ _tmp11_ = g_sequence_get (_tmp10_);
+ child_info = (EggListBoxChildInfo*) _tmp11_;
+ _tmp12_ = child_info;
+ _tmp13_ = _tmp12_->widget;
+ widget = _tmp13_;
+ _tmp15_ = widget;
+ _tmp16_ = gtk_widget_get_visible (_tmp15_);
+ if (!_tmp16_) {
+ _tmp14_ = TRUE;
+ } else {
+ GtkWidget* _tmp17_;
+ gboolean _tmp18_ = FALSE;
+ _tmp17_ = widget;
+ _tmp18_ = gtk_widget_get_child_visible (_tmp17_);
+ _tmp14_ = !_tmp18_;
+ }
+ _tmp19_ = _tmp14_;
+ if (_tmp19_) {
+ continue;
+ }
+ _tmp20_ = widget;
+ gtk_widget_get_preferred_width (_tmp20_, &_tmp21_, &_tmp22_);
+ child_min = _tmp21_;
+ child_nat = _tmp22_;
+ _tmp23_ = _vala_minimum_width;
+ _tmp24_ = child_min;
+ _tmp25_ = focus_width;
+ _tmp26_ = focus_pad;
+ _tmp27_ = MAX (_tmp23_, _tmp24_ + (2 * (_tmp25_ + _tmp26_)));
+ _vala_minimum_width = _tmp27_;
+ _tmp28_ = _vala_natural_width;
+ _tmp29_ = child_nat;
+ _tmp30_ = focus_width;
+ _tmp31_ = focus_pad;
+ _tmp32_ = MAX (_tmp28_, _tmp29_ + (2 * (_tmp30_ + _tmp31_)));
+ _vala_natural_width = _tmp32_;
+ _tmp33_ = child_info;
+ _tmp34_ = _tmp33_->separator;
+ if (_tmp34_ != NULL) {
+ EggListBoxChildInfo* _tmp35_;
+ GtkWidget* _tmp36_;
+ gint _tmp37_ = 0;
+ gint _tmp38_ = 0;
+ gint _tmp39_;
+ gint _tmp40_;
+ gint _tmp41_ = 0;
+ gint _tmp42_;
+ gint _tmp43_;
+ gint _tmp44_ = 0;
+ _tmp35_ = child_info;
+ _tmp36_ = _tmp35_->separator;
+ gtk_widget_get_preferred_width (_tmp36_, &_tmp37_, &_tmp38_);
+ child_min = _tmp37_;
+ child_nat = _tmp38_;
+ _tmp39_ = _vala_minimum_width;
+ _tmp40_ = child_min;
+ _tmp41_ = MAX (_tmp39_, _tmp40_);
+ _vala_minimum_width = _tmp41_;
+ _tmp42_ = _vala_natural_width;
+ _tmp43_ = child_nat;
+ _tmp44_ = MAX (_tmp42_, _tmp43_);
+ _vala_natural_width = _tmp44_;
+ }
+ }
+ }
+ }
+ if (minimum_width) {
+ *minimum_width = _vala_minimum_width;
+ }
+ if (natural_width) {
+ *natural_width = _vala_natural_width;
+ }
+}
+
+
+static void egg_list_box_real_get_preferred_width_for_height (GtkWidget* base, gint height, gint* minimum_width, gint* natural_width) {
+ EggListBox * self;
+ gint _vala_minimum_width = 0;
+ gint _vala_natural_width = 0;
+ gint _tmp0_ = 0;
+ gint _tmp1_ = 0;
+ self = (EggListBox*) base;
+ GTK_WIDGET_GET_CLASS ((GtkWidget*) self)->get_preferred_width ((GtkWidget*) self, &_tmp0_, &_tmp1_);
+ _vala_minimum_width = _tmp0_;
+ _vala_natural_width = _tmp1_;
+ if (minimum_width) {
+ *minimum_width = _vala_minimum_width;
+ }
+ if (natural_width) {
+ *natural_width = _vala_natural_width;
+ }
+}
+
+
+static void egg_list_box_real_size_allocate (GtkWidget* base, GtkAllocation* allocation) {
+ EggListBox * self;
+ GtkAllocation _tmp0_ = {0};
+ GtkAllocation child_allocation;
+ GtkAllocation _tmp1_ = {0};
+ GtkAllocation separator_allocation;
+ GtkAllocation _tmp2_;
+ GdkWindow* _tmp3_ = NULL;
+ GdkWindow* _tmp4_;
+ GdkWindow* window;
+ GdkWindow* _tmp5_;
+ GtkStyleContext* _tmp15_ = NULL;
+ GtkStyleContext* _tmp16_;
+ GtkStyleContext* context;
+ gint focus_width = 0;
+ gint focus_pad = 0;
+ GtkStyleContext* _tmp17_;
+ gint _tmp18_;
+ gint _tmp19_;
+ GtkAllocation _tmp20_;
+ gint _tmp21_;
+ gint _tmp22_;
+ gint _tmp23_;
+ GtkAllocation _tmp24_;
+ gint _tmp25_;
+ self = (EggListBox*) base;
+ g_return_if_fail (allocation != NULL);
+ _tmp0_.x = 0;
+ _tmp0_.y = 0;
+ _tmp0_.width = 0;
+ _tmp0_.height = 0;
+ child_allocation = _tmp0_;
+ _tmp1_.x = 0;
+ _tmp1_.y = 0;
+ _tmp1_.width = 0;
+ _tmp1_.height = 0;
+ separator_allocation = _tmp1_;
+ _tmp2_ = *allocation;
+ gtk_widget_set_allocation ((GtkWidget*) self, &_tmp2_);
+ _tmp3_ = gtk_widget_get_window ((GtkWidget*) self);
+ _tmp4_ = _g_object_ref0 (_tmp3_);
+ window = _tmp4_;
+ _tmp5_ = window;
+ if (_tmp5_ != NULL) {
+ GdkWindow* _tmp6_;
+ GtkAllocation _tmp7_;
+ gint _tmp8_;
+ GtkAllocation _tmp9_;
+ gint _tmp10_;
+ GtkAllocation _tmp11_;
+ gint _tmp12_;
+ GtkAllocation _tmp13_;
+ gint _tmp14_;
+ _tmp6_ = window;
+ _tmp7_ = *allocation;
+ _tmp8_ = _tmp7_.x;
+ _tmp9_ = *allocation;
+ _tmp10_ = _tmp9_.y;
+ _tmp11_ = *allocation;
+ _tmp12_ = _tmp11_.width;
+ _tmp13_ = *allocation;
+ _tmp14_ = _tmp13_.height;
+ gdk_window_move_resize (_tmp6_, _tmp8_, _tmp10_, _tmp12_, _tmp14_);
+ }
+ _tmp15_ = gtk_widget_get_style_context ((GtkWidget*) self);
+ _tmp16_ = _g_object_ref0 (_tmp15_);
+ context = _tmp16_;
+ _tmp17_ = context;
+ gtk_style_context_get_style (_tmp17_, "focus-line-width", &focus_width, "focus-padding", &focus_pad, NULL);
+ _tmp18_ = focus_width;
+ _tmp19_ = focus_pad;
+ child_allocation.x = (0 + _tmp18_) + _tmp19_;
+ child_allocation.y = 0;
+ _tmp20_ = *allocation;
+ _tmp21_ = _tmp20_.width;
+ _tmp22_ = focus_width;
+ _tmp23_ = focus_pad;
+ child_allocation.width = _tmp21_ - (2 * (_tmp22_ + _tmp23_));
+ separator_allocation.x = 0;
+ _tmp24_ = *allocation;
+ _tmp25_ = _tmp24_.width;
+ separator_allocation.width = _tmp25_;
+ {
+ GSequence* _tmp26_;
+ GSequenceIter* _tmp27_ = NULL;
+ GSequenceIter* iter;
+ _tmp26_ = self->priv->children;
+ _tmp27_ = g_sequence_get_begin_iter (_tmp26_);
+ iter = _tmp27_;
+ {
+ gboolean _tmp28_;
+ _tmp28_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp29_;
+ GSequenceIter* _tmp32_;
+ gboolean _tmp33_ = FALSE;
+ GSequenceIter* _tmp34_;
+ gconstpointer _tmp35_ = NULL;
+ EggListBoxChildInfo* child_info;
+ EggListBoxChildInfo* _tmp36_;
+ GtkWidget* _tmp37_;
+ GtkWidget* widget;
+ gint child_min = 0;
+ gboolean _tmp38_ = FALSE;
+ GtkWidget* _tmp39_;
+ gboolean _tmp40_ = FALSE;
+ gboolean _tmp43_;
+ EggListBoxChildInfo* _tmp48_;
+ GtkWidget* _tmp49_;
+ EggListBoxChildInfo* _tmp63_;
+ GtkAllocation _tmp64_;
+ gint _tmp65_;
+ gint _tmp66_;
+ gint _tmp67_;
+ gint _tmp68_;
+ GtkWidget* _tmp69_;
+ GtkAllocation _tmp70_;
+ gint _tmp71_;
+ gint _tmp72_ = 0;
+ gint _tmp73_;
+ EggListBoxChildInfo* _tmp74_;
+ GtkAllocation _tmp75_;
+ gint _tmp76_;
+ gint _tmp77_;
+ gint _tmp78_;
+ GtkWidget* _tmp79_;
+ GtkAllocation _tmp80_;
+ gint _tmp81_;
+ gint _tmp82_;
+ gint _tmp83_;
+ gint _tmp84_;
+ _tmp29_ = _tmp28_;
+ if (!_tmp29_) {
+ GSequenceIter* _tmp30_;
+ GSequenceIter* _tmp31_ = NULL;
+ _tmp30_ = iter;
+ _tmp31_ = g_sequence_iter_next (_tmp30_);
+ iter = _tmp31_;
+ }
+ _tmp28_ = FALSE;
+ _tmp32_ = iter;
+ _tmp33_ = g_sequence_iter_is_end (_tmp32_);
+ if (!(!_tmp33_)) {
+ break;
+ }
+ _tmp34_ = iter;
+ _tmp35_ = g_sequence_get (_tmp34_);
+ child_info = (EggListBoxChildInfo*) _tmp35_;
+ _tmp36_ = child_info;
+ _tmp37_ = _tmp36_->widget;
+ widget = _tmp37_;
+ _tmp39_ = widget;
+ _tmp40_ = gtk_widget_get_visible (_tmp39_);
+ if (!_tmp40_) {
+ _tmp38_ = TRUE;
+ } else {
+ GtkWidget* _tmp41_;
+ gboolean _tmp42_ = FALSE;
+ _tmp41_ = widget;
+ _tmp42_ = gtk_widget_get_child_visible (_tmp41_);
+ _tmp38_ = !_tmp42_;
+ }
+ _tmp43_ = _tmp38_;
+ if (_tmp43_) {
+ EggListBoxChildInfo* _tmp44_;
+ GtkAllocation _tmp45_;
+ gint _tmp46_;
+ EggListBoxChildInfo* _tmp47_;
+ _tmp44_ = child_info;
+ _tmp45_ = child_allocation;
+ _tmp46_ = _tmp45_.y;
+ _tmp44_->y = _tmp46_;
+ _tmp47_ = child_info;
+ _tmp47_->height = 0;
+ continue;
+ }
+ _tmp48_ = child_info;
+ _tmp49_ = _tmp48_->separator;
+ if (_tmp49_ != NULL) {
+ EggListBoxChildInfo* _tmp50_;
+ GtkWidget* _tmp51_;
+ GtkAllocation _tmp52_;
+ gint _tmp53_;
+ gint _tmp54_ = 0;
+ gint _tmp55_;
+ GtkAllocation _tmp56_;
+ gint _tmp57_;
+ EggListBoxChildInfo* _tmp58_;
+ GtkWidget* _tmp59_;
+ GtkAllocation _tmp60_;
+ gint _tmp61_;
+ gint _tmp62_;
+ _tmp50_ = child_info;
+ _tmp51_ = _tmp50_->separator;
+ _tmp52_ = *allocation;
+ _tmp53_ = _tmp52_.width;
+ gtk_widget_get_preferred_height_for_width (_tmp51_, _tmp53_, &_tmp54_, NULL);
+ child_min = _tmp54_;
+ _tmp55_ = child_min;
+ separator_allocation.height = _tmp55_;
+ _tmp56_ = child_allocation;
+ _tmp57_ = _tmp56_.y;
+ separator_allocation.y = _tmp57_;
+ _tmp58_ = child_info;
+ _tmp59_ = _tmp58_->separator;
+ _tmp60_ = separator_allocation;
+ gtk_widget_size_allocate (_tmp59_, &_tmp60_);
+ _tmp61_ = child_allocation.y;
+ _tmp62_ = child_min;
+ child_allocation.y = _tmp61_ + _tmp62_;
+ }
+ _tmp63_ = child_info;
+ _tmp64_ = child_allocation;
+ _tmp65_ = _tmp64_.y;
+ _tmp63_->y = _tmp65_;
+ _tmp66_ = child_allocation.y;
+ _tmp67_ = focus_width;
+ _tmp68_ = focus_pad;
+ child_allocation.y = _tmp66_ + (_tmp67_ + _tmp68_);
+ _tmp69_ = widget;
+ _tmp70_ = child_allocation;
+ _tmp71_ = _tmp70_.width;
+ gtk_widget_get_preferred_height_for_width (_tmp69_, _tmp71_, &_tmp72_, NULL);
+ child_min = _tmp72_;
+ _tmp73_ = child_min;
+ child_allocation.height = _tmp73_;
+ _tmp74_ = child_info;
+ _tmp75_ = child_allocation;
+ _tmp76_ = _tmp75_.height;
+ _tmp77_ = focus_width;
+ _tmp78_ = focus_pad;
+ _tmp74_->height = _tmp76_ + (2 * (_tmp77_ + _tmp78_));
+ _tmp79_ = widget;
+ _tmp80_ = child_allocation;
+ gtk_widget_size_allocate (_tmp79_, &_tmp80_);
+ _tmp81_ = child_allocation.y;
+ _tmp82_ = child_min;
+ _tmp83_ = focus_width;
+ _tmp84_ = focus_pad;
+ child_allocation.y = _tmp81_ + ((_tmp82_ + _tmp83_) + _tmp84_);
+ }
+ }
+ }
+ _g_object_unref0 (context);
+ _g_object_unref0 (window);
+}
+
+
+EggListBox* egg_list_box_construct (GType object_type) {
+ EggListBox * self = NULL;
+ self = (EggListBox*) g_object_new (object_type, NULL);
+ return self;
+}
+
+
+EggListBox* egg_list_box_new (void) {
+ return egg_list_box_construct (EGG_TYPE_LIST_BOX);
+}
+
+
+static void egg_list_box_real_child_selected (EggListBox* self, GtkWidget* child) {
+}
+
+
+static void egg_list_box_real_child_activated (EggListBox* self, GtkWidget* child) {
+}
+
+
+static void egg_list_box_real_activate_cursor_child (EggListBox* self) {
+ EggListBoxChildInfo* _tmp0_;
+ _tmp0_ = self->priv->cursor_child;
+ egg_list_box_select_and_activate (self, _tmp0_);
+}
+
+
+static void egg_list_box_real_toggle_cursor_child (EggListBox* self) {
+ EggListBoxChildInfo* _tmp0_;
+ gboolean _tmp1_ = FALSE;
+ GtkSelectionMode _tmp2_;
+ gboolean _tmp5_;
+ _tmp0_ = self->priv->cursor_child;
+ if (_tmp0_ == NULL) {
+ return;
+ }
+ _tmp2_ = self->priv->selection_mode;
+ if (_tmp2_ == GTK_SELECTION_SINGLE) {
+ EggListBoxChildInfo* _tmp3_;
+ EggListBoxChildInfo* _tmp4_;
+ _tmp3_ = self->priv->selected_child;
+ _tmp4_ = self->priv->cursor_child;
+ _tmp1_ = _tmp3_ == _tmp4_;
+ } else {
+ _tmp1_ = FALSE;
+ }
+ _tmp5_ = _tmp1_;
+ if (_tmp5_) {
+ egg_list_box_update_selected (self, NULL);
+ } else {
+ EggListBoxChildInfo* _tmp6_;
+ _tmp6_ = self->priv->cursor_child;
+ egg_list_box_select_and_activate (self, _tmp6_);
+ }
+}
+
+
+static void egg_list_box_real_move_cursor (EggListBox* self, GtkMovementStep step, gint count) {
+ GdkModifierType state = 0;
+ gboolean modify_selection_pressed;
+ GdkModifierType _tmp0_ = 0;
+ gboolean _tmp1_ = FALSE;
+ EggListBoxChildInfo* child;
+ GtkMovementStep _tmp6_;
+ EggListBoxChildInfo* _tmp97_;
+ EggListBoxChildInfo* _tmp98_;
+ gboolean _tmp99_;
+ modify_selection_pressed = FALSE;
+ _tmp1_ = gtk_get_current_event_state (&_tmp0_);
+ state = _tmp0_;
+ if (_tmp1_) {
+ GdkModifierType _tmp2_ = 0;
+ GdkModifierType modify_mod_mask;
+ GdkModifierType _tmp3_;
+ GdkModifierType _tmp4_;
+ GdkModifierType _tmp5_;
+ _tmp2_ = gtk_widget_get_modifier_mask ((GtkWidget*) self, GDK_MODIFIER_INTENT_MODIFY_SELECTION);
+ modify_mod_mask = _tmp2_;
+ _tmp3_ = state;
+ _tmp4_ = modify_mod_mask;
+ _tmp5_ = modify_mod_mask;
+ if ((_tmp3_ & _tmp4_) == _tmp5_) {
+ modify_selection_pressed = TRUE;
+ }
+ }
+ child = NULL;
+ _tmp6_ = step;
+ switch (_tmp6_) {
+ case GTK_MOVEMENT_BUFFER_ENDS:
+ {
+ gint _tmp7_;
+ _tmp7_ = count;
+ if (_tmp7_ < 0) {
+ EggListBoxChildInfo* _tmp8_ = NULL;
+ EggListBoxChildInfo* _tmp9_;
+ _tmp8_ = egg_list_box_get_first_visible (self);
+ _tmp9_ = _egg_list_box_child_info_ref0 (_tmp8_);
+ _egg_list_box_child_info_unref0 (child);
+ child = _tmp9_;
+ } else {
+ EggListBoxChildInfo* _tmp10_ = NULL;
+ EggListBoxChildInfo* _tmp11_;
+ _tmp10_ = egg_list_box_get_last_visible (self);
+ _tmp11_ = _egg_list_box_child_info_ref0 (_tmp10_);
+ _egg_list_box_child_info_unref0 (child);
+ child = _tmp11_;
+ }
+ break;
+ }
+ case GTK_MOVEMENT_DISPLAY_LINES:
+ {
+ EggListBoxChildInfo* _tmp12_;
+ _tmp12_ = self->priv->cursor_child;
+ if (_tmp12_ != NULL) {
+ EggListBoxChildInfo* _tmp13_;
+ GSequenceIter* _tmp14_;
+ GSequenceIter* iter;
+ gboolean _tmp29_ = FALSE;
+ GSequenceIter* _tmp30_;
+ gboolean _tmp33_;
+ _tmp13_ = self->priv->cursor_child;
+ _tmp14_ = _tmp13_->iter;
+ iter = _tmp14_;
+ while (TRUE) {
+ gboolean _tmp15_ = FALSE;
+ gint _tmp16_;
+ gboolean _tmp18_;
+ GSequenceIter* _tmp19_;
+ GSequenceIter* _tmp20_ = NULL;
+ gint _tmp21_;
+ _tmp16_ = count;
+ if (_tmp16_ < 0) {
+ GSequenceIter* _tmp17_;
+ _tmp17_ = iter;
+ _tmp15_ = _tmp17_ != NULL;
+ } else {
+ _tmp15_ = FALSE;
+ }
+ _tmp18_ = _tmp15_;
+ if (!_tmp18_) {
+ break;
+ }
+ _tmp19_ = iter;
+ _tmp20_ = egg_list_box_get_previous_visible (self, _tmp19_);
+ iter = _tmp20_;
+ _tmp21_ = count;
+ count = _tmp21_ + 1;
+ }
+ while (TRUE) {
+ gboolean _tmp22_ = FALSE;
+ gint _tmp23_;
+ gboolean _tmp25_;
+ GSequenceIter* _tmp26_;
+ GSequenceIter* _tmp27_ = NULL;
+ gint _tmp28_;
+ _tmp23_ = count;
+ if (_tmp23_ > 0) {
+ GSequenceIter* _tmp24_;
+ _tmp24_ = iter;
+ _tmp22_ = _tmp24_ != NULL;
+ } else {
+ _tmp22_ = FALSE;
+ }
+ _tmp25_ = _tmp22_;
+ if (!_tmp25_) {
+ break;
+ }
+ _tmp26_ = iter;
+ _tmp27_ = egg_list_box_get_next_visible (self, _tmp26_);
+ iter = _tmp27_;
+ _tmp28_ = count;
+ count = _tmp28_ - 1;
+ }
+ _tmp30_ = iter;
+ if (_tmp30_ != NULL) {
+ GSequenceIter* _tmp31_;
+ gboolean _tmp32_ = FALSE;
+ _tmp31_ = iter;
+ _tmp32_ = g_sequence_iter_is_end (_tmp31_);
+ _tmp29_ = !_tmp32_;
+ } else {
+ _tmp29_ = FALSE;
+ }
+ _tmp33_ = _tmp29_;
+ if (_tmp33_) {
+ GSequenceIter* _tmp34_;
+ gconstpointer _tmp35_ = NULL;
+ EggListBoxChildInfo* _tmp36_;
+ _tmp34_ = iter;
+ _tmp35_ = g_sequence_get (_tmp34_);
+ _tmp36_ = _egg_list_box_child_info_ref0 ((EggListBoxChildInfo*) _tmp35_);
+ _egg_list_box_child_info_unref0 (child);
+ child = _tmp36_;
+ }
+ }
+ break;
+ }
+ case GTK_MOVEMENT_PAGES:
+ {
+ gint page_size;
+ GtkAdjustment* _tmp37_;
+ EggListBoxChildInfo* _tmp40_;
+ page_size = 100;
+ _tmp37_ = self->priv->adjustment;
+ if (_tmp37_ != NULL) {
+ GtkAdjustment* _tmp38_;
+ gdouble _tmp39_ = 0.0;
+ _tmp38_ = self->priv->adjustment;
+ _tmp39_ = gtk_adjustment_get_page_increment (_tmp38_);
+ page_size = (gint) _tmp39_;
+ }
+ _tmp40_ = self->priv->cursor_child;
+ if (_tmp40_ != NULL) {
+ EggListBoxChildInfo* _tmp41_;
+ gint _tmp42_;
+ gint start_y;
+ gint _tmp43_;
+ gint end_y;
+ EggListBoxChildInfo* _tmp44_;
+ GSequenceIter* _tmp45_;
+ GSequenceIter* iter;
+ EggListBoxChildInfo* _tmp46_;
+ EggListBoxChildInfo* _tmp47_;
+ gint _tmp48_;
+ EggListBoxChildInfo* _tmp84_;
+ gint _tmp85_;
+ gboolean _tmp86_ = FALSE;
+ gint _tmp87_;
+ gint _tmp88_;
+ gboolean _tmp90_;
+ _tmp41_ = self->priv->cursor_child;
+ _tmp42_ = _tmp41_->y;
+ start_y = _tmp42_;
+ _tmp43_ = start_y;
+ end_y = _tmp43_;
+ _tmp44_ = self->priv->cursor_child;
+ _tmp45_ = _tmp44_->iter;
+ iter = _tmp45_;
+ _tmp46_ = self->priv->cursor_child;
+ _tmp47_ = _egg_list_box_child_info_ref0 (_tmp46_);
+ _egg_list_box_child_info_unref0 (child);
+ child = _tmp47_;
+ _tmp48_ = count;
+ if (_tmp48_ < 0) {
+ while (TRUE) {
+ gboolean _tmp49_ = FALSE;
+ GSequenceIter* _tmp50_;
+ gboolean _tmp53_;
+ GSequenceIter* _tmp54_;
+ GSequenceIter* _tmp55_ = NULL;
+ GSequenceIter* _tmp56_;
+ GSequenceIter* _tmp57_;
+ gconstpointer _tmp58_ = NULL;
+ EggListBoxChildInfo* _tmp59_;
+ EggListBoxChildInfo* prev;
+ EggListBoxChildInfo* _tmp60_;
+ gint _tmp61_;
+ gint _tmp62_;
+ gint _tmp63_;
+ EggListBoxChildInfo* _tmp64_;
+ EggListBoxChildInfo* _tmp65_;
+ _tmp50_ = iter;
+ if (_tmp50_ != NULL) {
+ GSequenceIter* _tmp51_;
+ gboolean _tmp52_ = FALSE;
+ _tmp51_ = iter;
+ _tmp52_ = g_sequence_iter_is_begin (_tmp51_);
+ _tmp49_ = !_tmp52_;
+ } else {
+ _tmp49_ = FALSE;
+ }
+ _tmp53_ = _tmp49_;
+ if (!_tmp53_) {
+ break;
+ }
+ _tmp54_ = iter;
+ _tmp55_ = egg_list_box_get_previous_visible (self, _tmp54_);
+ iter = _tmp55_;
+ _tmp56_ = iter;
+ if (_tmp56_ == NULL) {
+ break;
+ }
+ _tmp57_ = iter;
+ _tmp58_ = g_sequence_get (_tmp57_);
+ _tmp59_ = _egg_list_box_child_info_ref0 ((EggListBoxChildInfo*) _tmp58_);
+ prev = _tmp59_;
+ _tmp60_ = prev;
+ _tmp61_ = _tmp60_->y;
+ _tmp62_ = start_y;
+ _tmp63_ = page_size;
+ if (_tmp61_ < (_tmp62_ - _tmp63_)) {
+ _egg_list_box_child_info_unref0 (prev);
+ break;
+ }
+ _tmp64_ = prev;
+ _tmp65_ = _egg_list_box_child_info_ref0 (_tmp64_);
+ _egg_list_box_child_info_unref0 (child);
+ child = _tmp65_;
+ _egg_list_box_child_info_unref0 (prev);
+ }
+ } else {
+ while (TRUE) {
+ gboolean _tmp66_ = FALSE;
+ GSequenceIter* _tmp67_;
+ gboolean _tmp70_;
+ GSequenceIter* _tmp71_;
+ GSequenceIter* _tmp72_ = NULL;
+ GSequenceIter* _tmp73_;
+ gboolean _tmp74_ = FALSE;
+ GSequenceIter* _tmp75_;
+ gconstpointer _tmp76_ = NULL;
+ EggListBoxChildInfo* _tmp77_;
+ EggListBoxChildInfo* next;
+ EggListBoxChildInfo* _tmp78_;
+ gint _tmp79_;
+ gint _tmp80_;
+ gint _tmp81_;
+ EggListBoxChildInfo* _tmp82_;
+ EggListBoxChildInfo* _tmp83_;
+ _tmp67_ = iter;
+ if (_tmp67_ != NULL) {
+ GSequenceIter* _tmp68_;
+ gboolean _tmp69_ = FALSE;
+ _tmp68_ = iter;
+ _tmp69_ = g_sequence_iter_is_end (_tmp68_);
+ _tmp66_ = !_tmp69_;
+ } else {
+ _tmp66_ = FALSE;
+ }
+ _tmp70_ = _tmp66_;
+ if (!_tmp70_) {
+ break;
+ }
+ _tmp71_ = iter;
+ _tmp72_ = egg_list_box_get_next_visible (self, _tmp71_);
+ iter = _tmp72_;
+ _tmp73_ = iter;
+ _tmp74_ = g_sequence_iter_is_end (_tmp73_);
+ if (_tmp74_) {
+ break;
+ }
+ _tmp75_ = iter;
+ _tmp76_ = g_sequence_get (_tmp75_);
+ _tmp77_ = _egg_list_box_child_info_ref0 ((EggListBoxChildInfo*) _tmp76_);
+ next = _tmp77_;
+ _tmp78_ = next;
+ _tmp79_ = _tmp78_->y;
+ _tmp80_ = start_y;
+ _tmp81_ = page_size;
+ if (_tmp79_ > (_tmp80_ + _tmp81_)) {
+ _egg_list_box_child_info_unref0 (next);
+ break;
+ }
+ _tmp82_ = next;
+ _tmp83_ = _egg_list_box_child_info_ref0 (_tmp82_);
+ _egg_list_box_child_info_unref0 (child);
+ child = _tmp83_;
+ _egg_list_box_child_info_unref0 (next);
+ }
+ }
+ _tmp84_ = child;
+ _tmp85_ = _tmp84_->y;
+ end_y = _tmp85_;
+ _tmp87_ = end_y;
+ _tmp88_ = start_y;
+ if (_tmp87_ != _tmp88_) {
+ GtkAdjustment* _tmp89_;
+ _tmp89_ = self->priv->adjustment;
+ _tmp86_ = _tmp89_ != NULL;
+ } else {
+ _tmp86_ = FALSE;
+ }
+ _tmp90_ = _tmp86_;
+ if (_tmp90_) {
+ GtkAdjustment* _tmp91_;
+ GtkAdjustment* _tmp92_;
+ gdouble _tmp93_;
+ gdouble _tmp94_;
+ gint _tmp95_;
+ gint _tmp96_;
+ _tmp91_ = self->priv->adjustment;
+ _tmp92_ = self->priv->adjustment;
+ _tmp93_ = gtk_adjustment_get_value (_tmp92_);
+ _tmp94_ = _tmp93_;
+ _tmp95_ = end_y;
+ _tmp96_ = start_y;
+ gtk_adjustment_set_value (_tmp92_, _tmp94_ + (_tmp95_ - _tmp96_));
+ }
+ }
+ break;
+ }
+ default:
+ {
+ _egg_list_box_child_info_unref0 (child);
+ return;
+ }
+ }
+ _tmp97_ = child;
+ if (_tmp97_ == NULL) {
+ gtk_widget_error_bell ((GtkWidget*) self);
+ _egg_list_box_child_info_unref0 (child);
+ return;
+ }
+ _tmp98_ = child;
+ egg_list_box_update_cursor (self, _tmp98_);
+ _tmp99_ = modify_selection_pressed;
+ if (!_tmp99_) {
+ EggListBoxChildInfo* _tmp100_;
+ _tmp100_ = child;
+ egg_list_box_update_selected (self, _tmp100_);
+ }
+ _egg_list_box_child_info_unref0 (child);
+}
+
+
+static void g_cclosure_user_marshal_VOID__ENUM_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+ typedef void (*GMarshalFunc_VOID__ENUM_INT) (gpointer data1, gint arg_1, gint arg_2, gpointer data2);
+ register GMarshalFunc_VOID__ENUM_INT callback;
+ register GCClosure * cc;
+ register gpointer data1;
+ register gpointer data2;
+ cc = (GCClosure *) closure;
+ g_return_if_fail (n_param_values == 3);
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = param_values->data[0].v_pointer;
+ } else {
+ data1 = param_values->data[0].v_pointer;
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__ENUM_INT) (marshal_data ? marshal_data : cc->callback);
+ callback (data1, g_value_get_enum (param_values + 1), g_value_get_int (param_values + 2), data2);
+}
+
+
+static void _egg_list_box_child_info_unref0_ (gpointer var) {
+ (var == NULL) ? NULL : (var = (egg_list_box_child_info_unref (var), NULL));
+}
+
+
+static GObject * egg_list_box_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ GObjectClass * parent_class;
+ EggListBox * self;
+ GSequence* _tmp0_;
+ GHashFunc _tmp1_;
+ GEqualFunc _tmp2_;
+ GHashTable* _tmp3_;
+ GHashFunc _tmp4_;
+ GEqualFunc _tmp5_;
+ GHashTable* _tmp6_;
+ parent_class = G_OBJECT_CLASS (egg_list_box_parent_class);
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = EGG_LIST_BOX (obj);
+ gtk_widget_set_can_focus ((GtkWidget*) self, TRUE);
+ gtk_widget_set_has_window ((GtkWidget*) self, TRUE);
+ gtk_widget_set_redraw_on_allocate ((GtkWidget*) self, TRUE);
+ self->priv->selection_mode = GTK_SELECTION_SINGLE;
+ self->priv->activate_single_click = TRUE;
+ _tmp0_ = g_sequence_new (_egg_list_box_child_info_unref0_);
+ _g_sequence_free0 (self->priv->children);
+ self->priv->children = _tmp0_;
+ _tmp1_ = g_direct_hash;
+ _tmp2_ = g_direct_equal;
+ _tmp3_ = g_hash_table_new_full (_tmp1_, _tmp2_, NULL, NULL);
+ _g_hash_table_unref0 (self->priv->child_hash);
+ self->priv->child_hash = _tmp3_;
+ _tmp4_ = g_direct_hash;
+ _tmp5_ = g_direct_equal;
+ _tmp6_ = g_hash_table_new_full (_tmp4_, _tmp5_, NULL, NULL);
+ _g_hash_table_unref0 (self->priv->separator_hash);
+ self->priv->separator_hash = _tmp6_;
+ return obj;
+}
+
+
+static EggListBoxChildInfo* egg_list_box_child_info_construct (GType object_type, GtkWidget* widget) {
+ EggListBoxChildInfo* self = NULL;
+ GtkWidget* _tmp0_;
+ GtkWidget* _tmp1_;
+ g_return_val_if_fail (widget != NULL, NULL);
+ self = (EggListBoxChildInfo*) g_type_create_instance (object_type);
+ _tmp0_ = widget;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->widget);
+ self->widget = _tmp1_;
+ return self;
+}
+
+
+static EggListBoxChildInfo* egg_list_box_child_info_new (GtkWidget* widget) {
+ return egg_list_box_child_info_construct (EGG_LIST_BOX_TYPE_CHILD_INFO, widget);
+}
+
+
+static void egg_list_box_value_child_info_init (GValue* value) {
+ value->data[0].v_pointer = NULL;
+}
+
+
+static void egg_list_box_value_child_info_free_value (GValue* value) {
+ if (value->data[0].v_pointer) {
+ egg_list_box_child_info_unref (value->data[0].v_pointer);
+ }
+}
+
+
+static void egg_list_box_value_child_info_copy_value (const GValue* src_value, GValue* dest_value) {
+ if (src_value->data[0].v_pointer) {
+ dest_value->data[0].v_pointer = egg_list_box_child_info_ref (src_value->data[0].v_pointer);
+ } else {
+ dest_value->data[0].v_pointer = NULL;
+ }
+}
+
+
+static gpointer egg_list_box_value_child_info_peek_pointer (const GValue* value) {
+ return value->data[0].v_pointer;
+}
+
+
+static gchar* egg_list_box_value_child_info_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+ if (collect_values[0].v_pointer) {
+ EggListBoxChildInfo* object;
+ object = collect_values[0].v_pointer;
+ if (object->parent_instance.g_class == NULL) {
+ return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+ } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+ return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+ }
+ value->data[0].v_pointer = egg_list_box_child_info_ref (object);
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ return NULL;
+}
+
+
+static gchar* egg_list_box_value_child_info_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+ EggListBoxChildInfo** object_p;
+ object_p = collect_values[0].v_pointer;
+ if (!object_p) {
+ return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+ }
+ if (!value->data[0].v_pointer) {
+ *object_p = NULL;
+ } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+ *object_p = value->data[0].v_pointer;
+ } else {
+ *object_p = egg_list_box_child_info_ref (value->data[0].v_pointer);
+ }
+ return NULL;
+}
+
+
+static GParamSpec* egg_list_box_param_spec_child_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
+ EggListBoxParamSpecChildInfo* spec;
+ g_return_val_if_fail (g_type_is_a (object_type, EGG_LIST_BOX_TYPE_CHILD_INFO), NULL);
+ spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+ G_PARAM_SPEC (spec)->value_type = object_type;
+ return G_PARAM_SPEC (spec);
+}
+
+
+static gpointer egg_list_box_value_get_child_info (const GValue* value) {
+ g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EGG_LIST_BOX_TYPE_CHILD_INFO), NULL);
+ return value->data[0].v_pointer;
+}
+
+
+static void egg_list_box_value_set_child_info (GValue* value, gpointer v_object) {
+ EggListBoxChildInfo* old;
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EGG_LIST_BOX_TYPE_CHILD_INFO));
+ old = value->data[0].v_pointer;
+ if (v_object) {
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, EGG_LIST_BOX_TYPE_CHILD_INFO));
+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
+ value->data[0].v_pointer = v_object;
+ egg_list_box_child_info_ref (value->data[0].v_pointer);
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ if (old) {
+ egg_list_box_child_info_unref (old);
+ }
+}
+
+
+static void egg_list_box_value_take_child_info (GValue* value, gpointer v_object) {
+ EggListBoxChildInfo* old;
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EGG_LIST_BOX_TYPE_CHILD_INFO));
+ old = value->data[0].v_pointer;
+ if (v_object) {
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, EGG_LIST_BOX_TYPE_CHILD_INFO));
+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
+ value->data[0].v_pointer = v_object;
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ if (old) {
+ egg_list_box_child_info_unref (old);
+ }
+}
+
+
+static void egg_list_box_child_info_class_init (EggListBoxChildInfoClass * klass) {
+ egg_list_box_child_info_parent_class = g_type_class_peek_parent (klass);
+ EGG_LIST_BOX_CHILD_INFO_CLASS (klass)->finalize = egg_list_box_child_info_finalize;
+}
+
+
+static void egg_list_box_child_info_instance_init (EggListBoxChildInfo * self) {
+ self->ref_count = 1;
+}
+
+
+static void egg_list_box_child_info_finalize (EggListBoxChildInfo* obj) {
+ EggListBoxChildInfo * self;
+ self = EGG_LIST_BOX_CHILD_INFO (obj);
+ _g_object_unref0 (self->widget);
+ _g_object_unref0 (self->separator);
+}
+
+
+static GType egg_list_box_child_info_get_type (void) {
+ static volatile gsize egg_list_box_child_info_type_id__volatile = 0;
+ if (g_once_init_enter (&egg_list_box_child_info_type_id__volatile)) {
+ static const GTypeValueTable g_define_type_value_table = { egg_list_box_value_child_info_init, egg_list_box_value_child_info_free_value, egg_list_box_value_child_info_copy_value, egg_list_box_value_child_info_peek_pointer, "p", egg_list_box_value_child_info_collect_value, "p", egg_list_box_value_child_info_lcopy_value };
+ static const GTypeInfo g_define_type_info = { sizeof (EggListBoxChildInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) egg_list_box_child_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EggListBoxChildInfo), 0, (GInstanceInitFunc) egg_list_box_child_info_instance_init, &g_define_type_value_table };
+ static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+ GType egg_list_box_child_info_type_id;
+ egg_list_box_child_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EggListBoxChildInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
+ g_once_init_leave (&egg_list_box_child_info_type_id__volatile, egg_list_box_child_info_type_id);
+ }
+ return egg_list_box_child_info_type_id__volatile;
+}
+
+
+static gpointer egg_list_box_child_info_ref (gpointer instance) {
+ EggListBoxChildInfo* self;
+ self = instance;
+ g_atomic_int_inc (&self->ref_count);
+ return instance;
+}
+
+
+static void egg_list_box_child_info_unref (gpointer instance) {
+ EggListBoxChildInfo* self;
+ self = instance;
+ if (g_atomic_int_dec_and_test (&self->ref_count)) {
+ EGG_LIST_BOX_CHILD_INFO_GET_CLASS (self)->finalize (self);
+ g_type_free_instance ((GTypeInstance *) self);
+ }
+}
+
+
+static EggListBoxChildFlags* egg_list_box_child_flags_find_or_add (EggListBoxChildFlags** array, int* array_length1, EggListBoxChildInfo* to_find) {
+ EggListBoxChildFlags* result = NULL;
+ EggListBoxChildFlags* _tmp12_;
+ gint _tmp12__length1;
+ gint _tmp13_ = 0;
+ EggListBoxChildFlags* _tmp14_;
+ gint _tmp14__length1;
+ EggListBoxChildFlags* _tmp15_;
+ gint _tmp15__length1;
+ EggListBoxChildInfo* _tmp16_;
+ EggListBoxChildFlags* _tmp17_;
+ gint _tmp17__length1;
+ EggListBoxChildFlags* _tmp18_;
+ gint _tmp18__length1;
+ EggListBoxChildFlags* _tmp19_;
+ gint _tmp19__length1;
+ EggListBoxChildFlags* _tmp20_;
+ gint _tmp20__length1;
+ g_return_val_if_fail (to_find != NULL, NULL);
+ {
+ gint i;
+ i = 0;
+ {
+ gboolean _tmp0_;
+ _tmp0_ = TRUE;
+ while (TRUE) {
+ gboolean _tmp1_;
+ gint _tmp3_;
+ EggListBoxChildFlags* _tmp4_;
+ gint _tmp4__length1;
+ EggListBoxChildFlags* _tmp5_;
+ gint _tmp5__length1;
+ gint _tmp6_;
+ EggListBoxChildFlags _tmp7_;
+ EggListBoxChildInfo* _tmp8_;
+ EggListBoxChildInfo* _tmp9_;
+ _tmp1_ = _tmp0_;
+ if (!_tmp1_) {
+ gint _tmp2_;
+ _tmp2_ = i;
+ i = _tmp2_ + 1;
+ }
+ _tmp0_ = FALSE;
+ _tmp3_ = i;
+ _tmp4_ = *array;
+ _tmp4__length1 = *array_length1;
+ if (!(_tmp3_ < _tmp4__length1)) {
+ break;
+ }
+ _tmp5_ = *array;
+ _tmp5__length1 = *array_length1;
+ _tmp6_ = i;
+ _tmp7_ = _tmp5_[_tmp6_];
+ _tmp8_ = _tmp7_.child;
+ _tmp9_ = to_find;
+ if (_tmp8_ == _tmp9_) {
+ EggListBoxChildFlags* _tmp10_;
+ gint _tmp10__length1;
+ gint _tmp11_;
+ _tmp10_ = *array;
+ _tmp10__length1 = *array_length1;
+ _tmp11_ = i;
+ result = &_tmp10_[_tmp11_];
+ return result;
+ }
+ }
+ }
+ }
+ _tmp12_ = *array;
+ _tmp12__length1 = *array_length1;
+ _tmp13_ = _tmp12__length1 + 1;
+ *array = g_renew (EggListBoxChildFlags, *array, _tmp12__length1 + 1);
+ (_tmp13_ > (*array_length1)) ? memset ((*array) + (*array_length1), 0, sizeof (EggListBoxChildFlags) * (_tmp13_ - (*array_length1))) : NULL;
+ *array_length1 = _tmp13_;
+ _tmp14_ = *array;
+ _tmp14__length1 = *array_length1;
+ _tmp15_ = *array;
+ _tmp15__length1 = *array_length1;
+ _tmp16_ = to_find;
+ _tmp14_[_tmp15__length1 - 1].child = _tmp16_;
+ _tmp17_ = *array;
+ _tmp17__length1 = *array_length1;
+ _tmp18_ = *array;
+ _tmp18__length1 = *array_length1;
+ _tmp17_[_tmp18__length1 - 1].state = 0;
+ _tmp19_ = *array;
+ _tmp19__length1 = *array_length1;
+ _tmp20_ = *array;
+ _tmp20__length1 = *array_length1;
+ result = &_tmp19_[_tmp20__length1 - 1];
+ return result;
+}
+
+
+static EggListBoxChildFlags* egg_list_box_child_flags_dup (const EggListBoxChildFlags* self) {
+ EggListBoxChildFlags* dup;
+ dup = g_new0 (EggListBoxChildFlags, 1);
+ memcpy (dup, self, sizeof (EggListBoxChildFlags));
+ return dup;
+}
+
+
+static void egg_list_box_child_flags_free (EggListBoxChildFlags* self) {
+ g_free (self);
+}
+
+
+static GType egg_list_box_child_flags_get_type (void) {
+ static volatile gsize egg_list_box_child_flags_type_id__volatile = 0;
+ if (g_once_init_enter (&egg_list_box_child_flags_type_id__volatile)) {
+ GType egg_list_box_child_flags_type_id;
+ egg_list_box_child_flags_type_id = g_boxed_type_register_static ("EggListBoxChildFlags", (GBoxedCopyFunc) egg_list_box_child_flags_dup, (GBoxedFreeFunc) egg_list_box_child_flags_free);
+ g_once_init_leave (&egg_list_box_child_flags_type_id__volatile, egg_list_box_child_flags_type_id);
+ }
+ return egg_list_box_child_flags_type_id__volatile;
+}
+
+
+static void egg_list_box_class_init (EggListBoxClass * klass) {
+ void* _tmp0_;
+ GtkBindingSet* _tmp1_ = NULL;
+ GtkBindingSet* binding_set;
+ GtkBindingSet* _tmp2_;
+ GtkBindingSet* _tmp3_;
+ GtkBindingSet* _tmp4_;
+ GtkBindingSet* _tmp5_;
+ GtkBindingSet* _tmp6_;
+ GtkBindingSet* _tmp7_;
+ GtkBindingSet* _tmp8_;
+ GtkBindingSet* _tmp9_;
+ GtkBindingSet* _tmp10_;
+ GtkBindingSet* _tmp11_;
+ GtkBindingSet* _tmp12_;
+ GtkBindingSet* _tmp13_;
+ GtkBindingSet* _tmp14_;
+ guint _tmp15_ = 0U;
+ egg_list_box_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (EggListBoxPrivate));
+ GTK_WIDGET_CLASS (klass)->enter_notify_event = egg_list_box_real_enter_notify_event;
+ GTK_WIDGET_CLASS (klass)->leave_notify_event = egg_list_box_real_leave_notify_event;
+ GTK_WIDGET_CLASS (klass)->motion_notify_event = egg_list_box_real_motion_notify_event;
+ GTK_WIDGET_CLASS (klass)->button_press_event = egg_list_box_real_button_press_event;
+ GTK_WIDGET_CLASS (klass)->button_release_event = egg_list_box_real_button_release_event;
+ GTK_WIDGET_CLASS (klass)->show = egg_list_box_real_show;
+ GTK_WIDGET_CLASS (klass)->focus = egg_list_box_real_focus;
+ GTK_WIDGET_CLASS (klass)->draw = egg_list_box_real_draw;
+ GTK_WIDGET_CLASS (klass)->realize = egg_list_box_real_realize;
+ GTK_CONTAINER_CLASS (klass)->add = egg_list_box_real_add;
+ GTK_CONTAINER_CLASS (klass)->remove = egg_list_box_real_remove;
+ GTK_CONTAINER_CLASS (klass)->forall = egg_list_box_real_forall_internal;
+ GTK_WIDGET_CLASS (klass)->compute_expand = egg_list_box_real_compute_expand_internal;
+ GTK_CONTAINER_CLASS (klass)->child_type = egg_list_box_real_child_type;
+ GTK_WIDGET_CLASS (klass)->get_request_mode = egg_list_box_real_get_request_mode;
+ GTK_WIDGET_CLASS (klass)->get_preferred_height = egg_list_box_real_get_preferred_height;
+ GTK_WIDGET_CLASS (klass)->get_preferred_height_for_width = egg_list_box_real_get_preferred_height_for_width;
+ GTK_WIDGET_CLASS (klass)->get_preferred_width = egg_list_box_real_get_preferred_width;
+ GTK_WIDGET_CLASS (klass)->get_preferred_width_for_height = egg_list_box_real_get_preferred_width_for_height;
+ GTK_WIDGET_CLASS (klass)->size_allocate = egg_list_box_real_size_allocate;
+ EGG_LIST_BOX_CLASS (klass)->child_selected = egg_list_box_real_child_selected;
+ EGG_LIST_BOX_CLASS (klass)->child_activated = egg_list_box_real_child_activated;
+ EGG_LIST_BOX_CLASS (klass)->activate_cursor_child = egg_list_box_real_activate_cursor_child;
+ EGG_LIST_BOX_CLASS (klass)->toggle_cursor_child = egg_list_box_real_toggle_cursor_child;
+ EGG_LIST_BOX_CLASS (klass)->move_cursor = egg_list_box_real_move_cursor;
+ G_OBJECT_CLASS (klass)->constructor = egg_list_box_constructor;
+ G_OBJECT_CLASS (klass)->finalize = egg_list_box_finalize;
+ g_signal_new ("child_selected", EGG_TYPE_LIST_BOX, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EggListBoxClass, child_selected), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
+ g_signal_new ("child_activated", EGG_TYPE_LIST_BOX, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EggListBoxClass, child_activated), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
+ g_signal_new ("activate_cursor_child", EGG_TYPE_LIST_BOX, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (EggListBoxClass, activate_cursor_child), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("toggle_cursor_child", EGG_TYPE_LIST_BOX, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (EggListBoxClass, toggle_cursor_child), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("move_cursor", EGG_TYPE_LIST_BOX, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (EggListBoxClass, move_cursor), NULL, NULL, g_cclosure_user_marshal_VOID__ENUM_INT, G_TYPE_NONE, 2, GTK_TYPE_MOVEMENT_STEP, G_TYPE_INT);
+ _tmp0_ = klass;
+ _tmp1_ = gtk_binding_set_by_class (_tmp0_);
+ binding_set = _tmp1_;
+ _tmp2_ = binding_set;
+ egg_list_box_add_move_binding (_tmp2_, (guint) GDK_KEY_Home, 0, GTK_MOVEMENT_BUFFER_ENDS, -1);
+ _tmp3_ = binding_set;
+ egg_list_box_add_move_binding (_tmp3_, (guint) GDK_KEY_KP_Home, 0, GTK_MOVEMENT_BUFFER_ENDS, -1);
+ _tmp4_ = binding_set;
+ egg_list_box_add_move_binding (_tmp4_, (guint) GDK_KEY_End, 0, GTK_MOVEMENT_BUFFER_ENDS, 1);
+ _tmp5_ = binding_set;
+ egg_list_box_add_move_binding (_tmp5_, (guint) GDK_KEY_KP_End, 0, GTK_MOVEMENT_BUFFER_ENDS, 1);
+ _tmp6_ = binding_set;
+ egg_list_box_add_move_binding (_tmp6_, (guint) GDK_KEY_Up, GDK_CONTROL_MASK, GTK_MOVEMENT_DISPLAY_LINES, -1);
+ _tmp7_ = binding_set;
+ egg_list_box_add_move_binding (_tmp7_, (guint) GDK_KEY_KP_Up, GDK_CONTROL_MASK, GTK_MOVEMENT_DISPLAY_LINES, -1);
+ _tmp8_ = binding_set;
+ egg_list_box_add_move_binding (_tmp8_, (guint) GDK_KEY_Down, GDK_CONTROL_MASK, GTK_MOVEMENT_DISPLAY_LINES, 1);
+ _tmp9_ = binding_set;
+ egg_list_box_add_move_binding (_tmp9_, (guint) GDK_KEY_KP_Down, GDK_CONTROL_MASK, GTK_MOVEMENT_DISPLAY_LINES, 1);
+ _tmp10_ = binding_set;
+ egg_list_box_add_move_binding (_tmp10_, (guint) GDK_KEY_Page_Up, 0, GTK_MOVEMENT_PAGES, -1);
+ _tmp11_ = binding_set;
+ egg_list_box_add_move_binding (_tmp11_, (guint) GDK_KEY_KP_Page_Up, 0, GTK_MOVEMENT_PAGES, -1);
+ _tmp12_ = binding_set;
+ egg_list_box_add_move_binding (_tmp12_, (guint) GDK_KEY_Page_Down, 0, GTK_MOVEMENT_PAGES, 1);
+ _tmp13_ = binding_set;
+ egg_list_box_add_move_binding (_tmp13_, (guint) GDK_KEY_KP_Page_Down, 0, GTK_MOVEMENT_PAGES, 1);
+ _tmp14_ = binding_set;
+ gtk_binding_entry_add_signal (_tmp14_, (guint) GDK_KEY_space, GDK_CONTROL_MASK, "toggle-cursor-child", (guint) 0, NULL);
+ _tmp15_ = g_signal_lookup ("activate-cursor-child", EGG_TYPE_LIST_BOX);
+ GTK_WIDGET_CLASS (klass)->activate_signal = _tmp15_;
+}
+
+
+static void egg_list_box_instance_init (EggListBox * self) {
+ self->priv = EGG_LIST_BOX_GET_PRIVATE (self);
+}
+
+
+static void egg_list_box_finalize (GObject* obj) {
+ EggListBox * self;
+ self = EGG_LIST_BOX (obj);
+ _g_sequence_free0 (self->priv->children);
+ _g_hash_table_unref0 (self->priv->child_hash);
+ _g_hash_table_unref0 (self->priv->separator_hash);
+ (self->priv->sort_func_target_destroy_notify == NULL) ? NULL : (self->priv->sort_func_target_destroy_notify (self->priv->sort_func_target), NULL);
+ self->priv->sort_func = NULL;
+ self->priv->sort_func_target = NULL;
+ self->priv->sort_func_target_destroy_notify = NULL;
+ (self->priv->filter_func_target_destroy_notify == NULL) ? NULL : (self->priv->filter_func_target_destroy_notify (self->priv->filter_func_target), NULL);
+ self->priv->filter_func = NULL;
+ self->priv->filter_func_target = NULL;
+ self->priv->filter_func_target_destroy_notify = NULL;
+ (self->priv->update_separator_func_target_destroy_notify == NULL) ? NULL : (self->priv->update_separator_func_target_destroy_notify (self->priv->update_separator_func_target), NULL);
+ self->priv->update_separator_func = NULL;
+ self->priv->update_separator_func_target = NULL;
+ self->priv->update_separator_func_target_destroy_notify = NULL;
+ _g_object_unref0 (self->priv->adjustment);
+ G_OBJECT_CLASS (egg_list_box_parent_class)->finalize (obj);
+}
+
+
+GType egg_list_box_get_type (void) {
+ static volatile gsize egg_list_box_type_id__volatile = 0;
+ if (g_once_init_enter (&egg_list_box_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (EggListBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) egg_list_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EggListBox), 0, (GInstanceInitFunc) egg_list_box_instance_init, NULL };
+ GType egg_list_box_type_id;
+ egg_list_box_type_id = g_type_register_static (GTK_TYPE_CONTAINER, "EggListBox", &g_define_type_info, 0);
+ g_once_init_leave (&egg_list_box_type_id__volatile, egg_list_box_type_id);
+ }
+ return egg_list_box_type_id__volatile;
+}
+
+
+
diff --git a/src/egg-list-box.h b/src/egg-list-box.h
new file mode 100644
index 0000000..56edcfc
--- /dev/null
+++ b/src/egg-list-box.h
@@ -0,0 +1,62 @@
+/* egg-list-box.h generated by valac 0.17.1.22-cd59, the Vala compiler, do not modify */
+
+
+#ifndef __EGG_LIST_BOX_H__
+#define __EGG_LIST_BOX_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+
+#define EGG_TYPE_LIST_BOX (egg_list_box_get_type ())
+#define EGG_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_LIST_BOX, EggListBox))
+#define EGG_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_LIST_BOX, EggListBoxClass))
+#define EGG_IS_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_LIST_BOX))
+#define EGG_IS_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_LIST_BOX))
+#define EGG_LIST_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_LIST_BOX, EggListBoxClass))
+
+typedef struct _EggListBox EggListBox;
+typedef struct _EggListBoxClass EggListBoxClass;
+typedef struct _EggListBoxPrivate EggListBoxPrivate;
+
+struct _EggListBox {
+ GtkContainer parent_instance;
+ EggListBoxPrivate * priv;
+};
+
+struct _EggListBoxClass {
+ GtkContainerClass parent_class;
+ void (*child_selected) (EggListBox* self, GtkWidget* child);
+ void (*child_activated) (EggListBox* self, GtkWidget* child);
+ void (*activate_cursor_child) (EggListBox* self);
+ void (*toggle_cursor_child) (EggListBox* self);
+ void (*move_cursor) (EggListBox* self, GtkMovementStep step, gint count);
+};
+
+typedef gboolean (*EggListBoxFilterFunc) (GtkWidget* child, void* user_data);
+typedef void (*EggListBoxUpdateSeparatorFunc) (GtkWidget** separator, GtkWidget* child, GtkWidget* before, void* user_data);
+
+GType egg_list_box_get_type (void) G_GNUC_CONST;
+GtkWidget* egg_list_box_get_selected_child (EggListBox* self);
+GtkWidget* egg_list_box_get_child_at_y (EggListBox* self, gint y);
+void egg_list_box_select_child (EggListBox* self, GtkWidget* child);
+void egg_list_box_set_adjustment (EggListBox* self, GtkAdjustment* adjustment);
+void egg_list_box_add_to_scrolled (EggListBox* self, GtkScrolledWindow* scrolled);
+void egg_list_box_set_selection_mode (EggListBox* self, GtkSelectionMode mode);
+void egg_list_box_set_filter_func (EggListBox* self, EggListBoxFilterFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
+void egg_list_box_set_separator_funcs (EggListBox* self, EggListBoxUpdateSeparatorFunc update_separator, void* update_separator_target, GDestroyNotify update_separator_target_destroy_notify);
+void egg_list_box_refilter (EggListBox* self);
+void egg_list_box_resort (EggListBox* self);
+void egg_list_box_reseparate (EggListBox* self);
+void egg_list_box_set_sort_func (EggListBox* self, GCompareDataFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
+void egg_list_box_child_changed (EggListBox* self, GtkWidget* widget);
+void egg_list_box_set_activate_on_single_click (EggListBox* self, gboolean single);
+EggListBox* egg_list_box_new (void);
+EggListBox* egg_list_box_construct (GType object_type);
+
+
+G_END_DECLS
+
+#endif
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 6185408..d3cdf1c 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -11,34 +11,6 @@
<column type="GdkPixbuf"/>
</columns>
</object>
- <object class="GtkListStore" id="liststore_installed">
- <columns>
- <!-- column-name package_id -->
- <column type="gchararray"/>
- <!-- column-name icon_name -->
- <column type="gchararray"/>
- <!-- column-name package_name -->
- <column type="gchararray"/>
- <!-- column-name package_version -->
- <column type="gchararray"/>
- <!-- column-name package_summary -->
- <column type="gchararray"/>
- </columns>
- </object>
- <object class="GtkListStore" id="liststore_updates">
- <columns>
- <!-- column-name package_id -->
- <column type="gchararray"/>
- <!-- column-name icon_name -->
- <column type="gchararray"/>
- <!-- column-name package_name -->
- <column type="gchararray"/>
- <!-- column-name package_version -->
- <column type="gchararray"/>
- <!-- column-name package_summary -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkWindow" id="window_software">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Software</property>
@@ -77,12 +49,20 @@
</style>
<child>
<object class="GtkButton" id="button_new">
- <property name="label" translatable="yes">New</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
+ <child>
+ <object class="GtkLabel" id="label_button_new">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">New</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -92,12 +72,20 @@
</child>
<child>
<object class="GtkButton" id="button_installed">
- <property name="label" translatable="yes">Installed</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
+ <child>
+ <object class="GtkLabel" id="label_button_installed">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Installed</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -107,12 +95,20 @@
</child>
<child>
<object class="GtkButton" id="button_updates">
- <property name="label" translatable="yes">Updates</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
+ <child>
+ <object class="GtkLabel" id="label_button_updates">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Updates</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -134,7 +130,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -158,7 +153,6 @@
<property name="invisible_char">â</property>
<property name="activates_default">True</property>
<property name="shadow_type">none</property>
- <property name="overwrite_mode">True</property>
<property name="invisible_char_set">True</property>
<property name="caps_lock_warning">False</property>
<property name="progress_pulse_step">0.070000000298023224</property>
@@ -328,22 +322,13 @@
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow_installed">
+ <object class="GtkScrolledWindow" id="scrolledwindow_install">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="treeview_installed">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="model">liststore_installed</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
- </child>
- </object>
+ <placeholder/>
</child>
</object>
<packing>
@@ -368,16 +353,7 @@
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="treeview_updates">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="model">liststore_updates</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection2"/>
- </child>
- </object>
+ <placeholder/>
</child>
</object>
<packing>
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
new file mode 100644
index 0000000..85eaab1
--- /dev/null
+++ b/src/gs-app-widget.c
@@ -0,0 +1,309 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2012 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "gs-app-widget.h"
+
+struct _GsAppWidgetPrivate
+{
+ gchar *id;
+ gchar *name;
+ gchar *description;
+ gchar *version;
+ GdkPixbuf *pixbuf;
+ GsAppWidgetKind kind;
+ GtkWidget *widget_name;
+ GtkWidget *widget_description;
+ GtkWidget *widget_version;
+ GtkWidget *widget_image;
+ GtkWidget *widget_button;
+};
+
+G_DEFINE_TYPE (GsAppWidget, gs_app_widget, GTK_TYPE_BOX)
+
+/**
+ * gs_app_widget_refresh:
+ **/
+static void
+gs_app_widget_refresh (GsAppWidget *app_widget)
+{
+ GsAppWidgetPrivate *priv = app_widget->priv;
+
+ gtk_label_set_label (GTK_LABEL (priv->widget_name), priv->name);
+ gtk_label_set_label (GTK_LABEL (priv->widget_description), priv->description);
+ gtk_label_set_label (GTK_LABEL (priv->widget_version), priv->version);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (priv->widget_image), priv->pixbuf);
+
+ if (app_widget->priv->kind == GS_APP_WIDGET_KIND_INSTALL) {
+ gtk_button_set_label (GTK_BUTTON (priv->widget_button),
+ _("Install"));
+ } else if (app_widget->priv->kind == GS_APP_WIDGET_KIND_REMOVE) {
+ gtk_button_set_label (GTK_BUTTON (priv->widget_button),
+ _("Remove"));
+ } else {
+ gtk_button_set_label (GTK_BUTTON (priv->widget_button),
+ _("Update"));
+ }
+}
+
+/**
+ * gs_app_widget_get_id:
+ **/
+const gchar *
+gs_app_widget_get_id (GsAppWidget *app_widget)
+{
+ g_return_val_if_fail (GS_IS_APP_WIDGET (app_widget), NULL);
+ return app_widget->priv->id;
+}
+/**
+ * gs_app_widget_get_name:
+ **/
+const gchar *
+gs_app_widget_get_name (GsAppWidget *app_widget)
+{
+ g_return_val_if_fail (GS_IS_APP_WIDGET (app_widget), NULL);
+ return app_widget->priv->name;
+}
+
+/**
+ * gs_app_widget_get_version:
+ **/
+const gchar *
+gs_app_widget_get_version (GsAppWidget *app_widget)
+{
+ g_return_val_if_fail (GS_IS_APP_WIDGET (app_widget), NULL);
+ return app_widget->priv->version;
+}
+
+/**
+ * gs_app_widget_get_description:
+ **/
+const gchar *
+gs_app_widget_get_description (GsAppWidget *app_widget)
+{
+ g_return_val_if_fail (GS_IS_APP_WIDGET (app_widget), NULL);
+ return app_widget->priv->description;
+}
+
+/**
+ * gs_app_widget_get_kind:
+ **/
+GsAppWidgetKind
+gs_app_widget_get_kind (GsAppWidget *app_widget)
+{
+ g_return_val_if_fail (GS_IS_APP_WIDGET (app_widget), 0);
+ return app_widget->priv->kind;
+}
+
+/**
+ * gs_app_widget_set_id:
+ **/
+void
+gs_app_widget_set_id (GsAppWidget *app_widget, const gchar *id)
+{
+ g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
+ g_return_if_fail (id != NULL);
+ g_free (app_widget->priv->id);
+ app_widget->priv->id = g_strdup (id);
+}
+
+/**
+ * gs_app_widget_set_name:
+ **/
+void
+gs_app_widget_set_name (GsAppWidget *app_widget, const gchar *name)
+{
+ g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
+ g_return_if_fail (name != NULL);
+ g_free (app_widget->priv->name);
+ app_widget->priv->name = g_strdup (name);
+ gs_app_widget_refresh (app_widget);
+}
+
+/**
+ * gs_app_widget_set_version:
+ **/
+void
+gs_app_widget_set_version (GsAppWidget *app_widget, const gchar *version)
+{
+ g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
+ g_return_if_fail (version != NULL);
+ g_free (app_widget->priv->version);
+ app_widget->priv->version = g_strdup (version);
+ gs_app_widget_refresh (app_widget);
+}
+
+/**
+ * gs_app_widget_set_description:
+ **/
+void
+gs_app_widget_set_description (GsAppWidget *app_widget, const gchar *description)
+{
+ g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
+ g_return_if_fail (description != NULL);
+ g_free (app_widget->priv->description);
+ app_widget->priv->description = g_strdup (description);
+ gs_app_widget_refresh (app_widget);
+}
+
+/**
+ * gs_app_widget_set_pixbuf:
+ **/
+void
+gs_app_widget_set_pixbuf (GsAppWidget *app_widget, GdkPixbuf *pixbuf)
+{
+ g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
+ if (app_widget->priv->pixbuf != NULL) {
+ g_object_unref (app_widget->priv->pixbuf);
+ app_widget->priv->pixbuf = NULL;
+ }
+ if (pixbuf != NULL)
+ app_widget->priv->pixbuf = g_object_ref (pixbuf);
+ gs_app_widget_refresh (app_widget);
+}
+
+/**
+ * gs_app_widget_set_kind:
+ **/
+void
+gs_app_widget_set_kind (GsAppWidget *app_widget, GsAppWidgetKind kind)
+{
+ g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
+ app_widget->priv->kind = kind;
+ gs_app_widget_refresh (app_widget);
+}
+
+/**
+ * gs_app_widget_destroy:
+ **/
+static void
+gs_app_widget_destroy (GtkWidget *object)
+{
+ GsAppWidget *app_widget = GS_APP_WIDGET (object);
+ GsAppWidgetPrivate *priv = app_widget->priv;
+
+ g_free (priv->id);
+ priv->id = NULL;
+
+ GTK_WIDGET_CLASS (gs_app_widget_parent_class)->destroy (object);
+}
+
+static void
+gs_app_widget_class_init (GsAppWidgetClass *class)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->destroy = gs_app_widget_destroy;
+ g_type_class_add_private (class, sizeof (GsAppWidgetPrivate));
+}
+
+/**
+ * gs_app_widget_init:
+ **/
+static void
+gs_app_widget_init (GsAppWidget *app_widget)
+{
+ GsAppWidgetPrivate *priv;
+ GtkWidget *box;
+ PangoAttrList *attr_list;
+
+ g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
+ app_widget->priv = G_TYPE_INSTANCE_GET_PRIVATE (app_widget,
+ GS_TYPE_APP_WIDGET,
+ GsAppWidgetPrivate);
+ priv = app_widget->priv;
+
+ /* set defaults */
+ gtk_box_set_spacing (GTK_BOX (app_widget), 3);
+ gtk_widget_set_margin_left (GTK_WIDGET (app_widget), 9);
+ gtk_widget_set_margin_top (GTK_WIDGET (app_widget), 9);
+ gtk_widget_set_margin_bottom (GTK_WIDGET (app_widget), 9);
+
+ /* pixbuf */
+ priv->widget_image = gtk_image_new_from_icon_name ("edit-paste",
+ GTK_ICON_SIZE_DIALOG);
+ gtk_widget_set_margin_right (GTK_WIDGET (priv->widget_image), 9);
+ gtk_box_pack_start (GTK_BOX (app_widget),
+ GTK_WIDGET (priv->widget_image),
+ FALSE, FALSE, 0);
+
+ /* name > version */
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ priv->widget_name = gtk_label_new ("name");
+ gtk_label_set_ellipsize (GTK_LABEL (priv->widget_name),
+ PANGO_ELLIPSIZE_NONE);
+ gtk_label_set_line_wrap (GTK_LABEL (priv->widget_name), TRUE);
+ gtk_label_set_max_width_chars (GTK_LABEL (priv->widget_name), 20);
+ gtk_misc_set_alignment (GTK_MISC (priv->widget_name), 0.0, 0.5);
+ gtk_widget_set_size_request (priv->widget_name, 200, -1);
+ attr_list = pango_attr_list_new ();
+ pango_attr_list_insert (attr_list,
+ pango_attr_weight_new (PANGO_WEIGHT_BOLD));
+ gtk_label_set_attributes (GTK_LABEL (priv->widget_name), attr_list);
+ pango_attr_list_unref (attr_list);
+ priv->widget_version = gtk_label_new ("version");
+ gtk_misc_set_alignment (GTK_MISC (priv->widget_version), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (box),
+ GTK_WIDGET (priv->widget_name),
+ FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (box),
+ GTK_WIDGET (priv->widget_version),
+ FALSE, FALSE, 12);
+ gtk_box_pack_start (GTK_BOX (app_widget),
+ GTK_WIDGET (box),
+ FALSE, TRUE, 0);
+
+ /* description */
+ priv->widget_description = gtk_label_new ("description");
+ gtk_misc_set_alignment (GTK_MISC (priv->widget_description), 0.0, 0.0);
+ gtk_box_pack_start (GTK_BOX (app_widget),
+ GTK_WIDGET (priv->widget_description),
+ TRUE, TRUE, 0);
+
+ /* button */
+ priv->widget_button = gtk_button_new_with_label ("button");
+ gtk_widget_set_margin_right (GTK_WIDGET (priv->widget_button), 9);
+ gtk_widget_set_size_request (priv->widget_button, 100, -1);
+ gtk_widget_set_vexpand (priv->widget_button, FALSE);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_box_pack_start (GTK_BOX (box),
+ GTK_WIDGET (priv->widget_button),
+ FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (app_widget),
+ GTK_WIDGET (box),
+ FALSE, FALSE, 0);
+
+ /* refresh */
+ gs_app_widget_refresh (app_widget);
+}
+
+/**
+ * gs_app_widget_new:
+ **/
+GtkWidget *
+gs_app_widget_new (void)
+{
+ return g_object_new (GS_TYPE_APP_WIDGET, NULL);
+}
+
diff --git a/src/gs-app-widget.h b/src/gs-app-widget.h
new file mode 100644
index 0000000..e9d9335
--- /dev/null
+++ b/src/gs-app-widget.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2012 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GS_APP_WIDGET_H
+#define GS_APP_WIDGET_H
+
+#include <gtk/gtk.h>
+
+#define GS_TYPE_APP_WIDGET (gs_app_widget_get_type())
+#define GS_APP_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GS_TYPE_APP_WIDGET, GsAppWidget))
+#define GS_APP_WIDGET_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), GS_TYPE_APP_WIDGET, GsAppWidgetClass))
+#define GS_IS_APP_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GS_TYPE_APP_WIDGET))
+#define GS_IS_APP_WIDGET_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), GS_TYPE_APP_WIDGET))
+#define GS_APP_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GS_TYPE_APP_WIDGET, GsAppWidgetClass))
+
+G_BEGIN_DECLS
+
+typedef struct _GsAppWidget GsAppWidget;
+typedef struct _GsAppWidgetClass GsAppWidgetClass;
+typedef struct _GsAppWidgetPrivate GsAppWidgetPrivate;
+
+struct _GsAppWidget
+{
+ GtkBox parent;
+
+ /*< private >*/
+ GsAppWidgetPrivate *priv;
+};
+
+struct _GsAppWidgetClass
+{
+ GtkBoxClass parent_class;
+};
+
+typedef enum {
+ GS_APP_WIDGET_KIND_INSTALL,
+ GS_APP_WIDGET_KIND_UPDATE,
+ GS_APP_WIDGET_KIND_REMOVE,
+ GS_APP_WIDGET_KIND_LAST
+} GsAppWidgetKind;
+
+GType gs_app_widget_get_type (void);
+GtkWidget *gs_app_widget_new (void);
+const gchar *gs_app_widget_get_id (GsAppWidget *app_widget);
+void gs_app_widget_set_id (GsAppWidget *app_widget,
+ const gchar *id);
+const gchar *gs_app_widget_get_name (GsAppWidget *app_widget);
+void gs_app_widget_set_name (GsAppWidget *app_widget,
+ const gchar *name);
+const gchar *gs_app_widget_get_version (GsAppWidget *app_widget);
+void gs_app_widget_set_version (GsAppWidget *app_widget,
+ const gchar *version);
+const gchar *gs_app_widget_get_description (GsAppWidget *app_widget);
+void gs_app_widget_set_description (GsAppWidget *app_widget,
+ const gchar *description);
+void gs_app_widget_set_pixbuf (GsAppWidget *app_widget,
+ GdkPixbuf *pixbuf);
+GsAppWidgetKind gs_app_widget_get_kind (GsAppWidget *app_widget);
+void gs_app_widget_set_kind (GsAppWidget *app_widget,
+ GsAppWidgetKind kind);
+
+G_END_DECLS
+
+#endif /* GS_APP_WIDGET_H */
+
diff --git a/src/gs-main.c b/src/gs-main.c
index 2771453..a73de9c 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -26,6 +26,11 @@
#include <locale.h>
#include <packagekit-glib2/packagekit.h>
+#include "egg-list-box.h"
+#include "gs-app-widget.h"
+
+#define GS_MAIN_ICON_SIZE 64
+
typedef enum {
GS_MAIN_MODE_NEW,
GS_MAIN_MODE_INSTALLED,
@@ -59,6 +64,9 @@ typedef struct {
PkDesktop *desktop;
PkTask *task;
guint waiting_tab_id;
+ EggListBox *list_box_installed;
+ EggListBox *list_box_updates;
+ GtkWidget *os_update_widget;
} GsMainPrivate;
static void gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode);
@@ -219,28 +227,38 @@ gs_main_is_pkg_installed_target (PkPackage *pkg)
static void
gs_main_installed_add_package (GsMainPrivate *priv, PkPackage *pkg)
{
+ EggListBox *list_box;
gboolean target_installed;
gchar *tmp;
- GtkListStore *list_store;
- GtkTreeIter iter;
+ GtkWidget *widget;
+ GdkPixbuf *pixbuf;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_new"));
+ pixbuf = gtk_widget_render_icon_pixbuf (widget,
+ "icon-missing",
+ priv->custom_icon_size);
+ widget = gs_app_widget_new ();
target_installed = gs_main_is_pkg_installed_target (pkg);
if (target_installed) {
- list_store = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_installed"));
+ list_box = priv->list_box_installed;
+ gs_app_widget_set_kind (GS_APP_WIDGET (widget),
+ GS_APP_WIDGET_KIND_REMOVE);
} else {
- list_store = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_updates"));
+ list_box = priv->list_box_updates;
+ gs_app_widget_set_kind (GS_APP_WIDGET (widget),
+ GS_APP_WIDGET_KIND_UPDATE);
}
- gtk_list_store_append (list_store, &iter);
tmp = gs_main_get_pretty_version (pk_package_get_version (pkg));
- gtk_list_store_set (list_store, &iter,
- COLUMN_PACKAGE_ID, pk_package_get_id (pkg),
- COLUMN_ICON_NAME, "icon-missing",
- COLUMN_PACKAGE_NAME, pk_package_get_name (pkg),
- COLUMN_PACKAGE_VERSION, tmp,
- COLUMN_PACKAGE_SUMMARY, pk_package_get_summary (pkg),
- -1);
+ gs_app_widget_set_description (GS_APP_WIDGET (widget), pk_package_get_summary (pkg));
+ gs_app_widget_set_id (GS_APP_WIDGET (widget), pk_package_get_id (pkg));
+ gs_app_widget_set_name (GS_APP_WIDGET (widget), pk_package_get_summary (pkg));
+ gs_app_widget_set_pixbuf (GS_APP_WIDGET (widget), pixbuf);
+ gs_app_widget_set_version (GS_APP_WIDGET (widget), tmp);
+ gtk_container_add (GTK_CONTAINER (list_box), widget);
+ gtk_widget_show_all (widget);
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
g_free (tmp);
}
@@ -252,16 +270,17 @@ gs_main_installed_add_desktop_file (GsMainPrivate *priv,
PkPackage *pkg,
const gchar *desktop_file)
{
+ EggListBox *list_box;
gboolean ret;
gboolean target_installed;
gchar *comment = NULL;
gchar *icon = NULL;
gchar *name = NULL;
gchar *version_tmp = NULL;
+ GdkPixbuf *pixbuf = NULL;
GError *error = NULL;
GKeyFile *key_file;
- GtkListStore *list_store;
- GtkTreeIter iter;
+ GtkWidget *widget;
/* load desktop file */
key_file = g_key_file_new ();
@@ -289,7 +308,7 @@ gs_main_installed_add_desktop_file (GsMainPrivate *priv,
G_KEY_FILE_DESKTOP_KEY_ICON,
NULL);
if (icon == NULL)
- icon = g_strdup ("icon-missing");
+ icon = g_strdup (GTK_STOCK_MISSING_IMAGE);
comment = g_key_file_get_string (key_file,
G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_COMMENT,
@@ -297,25 +316,60 @@ gs_main_installed_add_desktop_file (GsMainPrivate *priv,
if (comment == NULL)
comment = g_strdup (pk_package_get_summary (pkg));
+ /* load icon */
+ if (icon != NULL && icon[0] == '/') {
+ pixbuf = gdk_pixbuf_new_from_file_at_size (icon,
+ GS_MAIN_ICON_SIZE,
+ GS_MAIN_ICON_SIZE,
+ &error);
+ } else {
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ icon,
+ GS_MAIN_ICON_SIZE,
+ GTK_ICON_LOOKUP_USE_BUILTIN |
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ &error);
+ if (pixbuf == NULL) {
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_new"));
+ pixbuf = gtk_widget_render_icon_pixbuf (widget,
+ icon,
+ priv->custom_icon_size);
+ }
+ }
+ if (pixbuf == NULL) {
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_new"));
+ pixbuf = gtk_widget_render_icon_pixbuf (widget,
+ GTK_STOCK_MISSING_IMAGE,
+ priv->custom_icon_size);
+ g_warning ("Failed to open theme icon or builtin %s: %s",
+ icon,
+ error->message);
+ g_error_free (error);
+ }
+
/* add to list store */
+ widget = gs_app_widget_new ();
target_installed = gs_main_is_pkg_installed_target (pkg);
if (target_installed) {
- list_store = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_installed"));
+ list_box = priv->list_box_installed;
+ gs_app_widget_set_kind (GS_APP_WIDGET (widget),
+ GS_APP_WIDGET_KIND_REMOVE);
} else {
- list_store = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_updates"));
+ list_box = priv->list_box_updates;
+ gs_app_widget_set_kind (GS_APP_WIDGET (widget),
+ GS_APP_WIDGET_KIND_UPDATE);
}
- gtk_list_store_append (list_store, &iter);
version_tmp = gs_main_get_pretty_version (pk_package_get_version (pkg));
- gtk_list_store_set (list_store, &iter,
- COLUMN_PACKAGE_ID, pk_package_get_id (pkg),
- COLUMN_ICON_NAME, icon,
- COLUMN_PACKAGE_NAME, name,
- COLUMN_PACKAGE_VERSION, version_tmp,
- COLUMN_PACKAGE_SUMMARY, comment,
- -1);
+ gs_app_widget_set_description (GS_APP_WIDGET (widget), comment);
+ gs_app_widget_set_id (GS_APP_WIDGET (widget), pk_package_get_id (pkg));
+ gs_app_widget_set_name (GS_APP_WIDGET (widget), name);
+ gs_app_widget_set_pixbuf (GS_APP_WIDGET (widget), pixbuf);
+ gs_app_widget_set_version (GS_APP_WIDGET (widget), version_tmp);
+ gtk_container_add (GTK_CONTAINER (list_box), widget);
+ gtk_widget_show_all (widget);
out:
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
g_key_file_unref (key_file);
g_free (name);
g_free (comment);
@@ -324,14 +378,61 @@ out:
}
/**
+ * gs_main_installed_add_os_update:
+ **/
+static void
+gs_main_installed_add_os_update (GsMainPrivate *priv, PkPackage *pkg)
+{
+ GdkPixbuf *pixbuf = NULL;
+ GError *error = NULL;
+
+ /* try to find existing OS Update entry */
+ if (priv->os_update_widget != NULL) {
+ gs_app_widget_set_name (GS_APP_WIDGET (priv->os_update_widget), _("OS Updates"));
+ goto out;
+ }
+
+ /* add OS Update entry */
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ "software-update-available-symbolic",
+ GS_MAIN_ICON_SIZE,
+ GTK_ICON_LOOKUP_USE_BUILTIN |
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ &error);
+ if (pixbuf == NULL) {
+ g_warning ("Failed to find software-update-available-symbolic: %s",
+ error->message);
+ g_error_free (error);
+ }
+
+ priv->os_update_widget = gs_app_widget_new ();
+ gs_app_widget_set_kind (GS_APP_WIDGET (priv->os_update_widget),
+ GS_APP_WIDGET_KIND_UPDATE);
+ gs_app_widget_set_id (GS_APP_WIDGET (priv->os_update_widget), "");
+ gs_app_widget_set_name (GS_APP_WIDGET (priv->os_update_widget), _("OS Update"));
+ gs_app_widget_set_description (GS_APP_WIDGET (priv->os_update_widget),
+ _("Includes performance, stability and security improvements for all users"));
+ gs_app_widget_set_pixbuf (GS_APP_WIDGET (priv->os_update_widget), pixbuf);
+ gs_app_widget_set_version (GS_APP_WIDGET (priv->os_update_widget), "3.4.3");
+ gtk_container_add (GTK_CONTAINER (priv->list_box_updates), priv->os_update_widget);
+ gtk_widget_show_all (priv->os_update_widget);
+ g_object_add_weak_pointer (G_OBJECT (priv->os_update_widget),
+ (gpointer *) &priv->os_update_widget);
+out:
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
+}
+
+/**
* gs_main_installed_add_package:
**/
static void
gs_main_installed_add_item (GsMainPrivate *priv, PkPackage *pkg)
{
const gchar *desktop_file;
+ gboolean target_installed;
GError *error = NULL;
- GPtrArray *files;
+ GPtrArray *files = NULL;
guint i;
/* try to get the list of desktop files for this package */
@@ -346,6 +447,16 @@ gs_main_installed_add_item (GsMainPrivate *priv, PkPackage *pkg)
gs_main_installed_add_package (priv, pkg);
goto out;
}
+ if (files->len == 0) {
+ g_debug ("not an application %s",
+ pk_package_get_id (pkg));
+ target_installed = gs_main_is_pkg_installed_target (pkg);
+ if (!target_installed)
+// gs_main_installed_add_package (priv, pkg);
+// else
+ gs_main_installed_add_os_update (priv, pkg);
+ goto out;
+ }
/* add each of the desktop files */
for (i = 0; i < files->len; i++) {
@@ -360,6 +471,27 @@ out:
}
/**
+ * _gtk_container_remove_all_cb:
+ **/
+static void
+_gtk_container_remove_all_cb (GtkWidget *widget, gpointer user_data)
+{
+ GtkContainer *container = GTK_CONTAINER (user_data);
+ gtk_container_remove (container, widget);
+}
+
+/**
+ * _gtk_container_remove_all:
+ **/
+static void
+_gtk_container_remove_all (GtkContainer *container)
+{
+ gtk_container_foreach (container,
+ _gtk_container_remove_all_cb,
+ container);
+}
+
+/**
* gs_main_get_packages_cb:
**/
static void
@@ -369,7 +501,6 @@ gs_main_get_packages_cb (PkClient *client,
{
GError *error = NULL;
GPtrArray *array = NULL;
- GtkListStore *list_store;
GtkWidget *widget;
guint i;
PkError *error_code = NULL;
@@ -394,8 +525,10 @@ gs_main_get_packages_cb (PkClient *client,
}
/* get data */
- list_store = GTK_LIST_STORE (gtk_builder_get_object (priv->builder, "liststore_installed"));
- gtk_list_store_clear (list_store);
+ if (pk_results_get_role (results) == PK_ROLE_ENUM_GET_UPDATES)
+ _gtk_container_remove_all (GTK_CONTAINER (priv->list_box_updates));
+ else if (pk_results_get_role (results) == PK_ROLE_ENUM_GET_PACKAGES)
+ _gtk_container_remove_all (GTK_CONTAINER (priv->list_box_installed));
array = pk_results_get_package_array (results);
for (i=0; i<array->len; i++) {
item = g_ptr_array_index (array, i);
@@ -449,7 +582,6 @@ gs_main_get_updates (GsMainPrivate *priv)
{
PkBitfield filter;
filter = pk_bitfield_from_enums (PK_FILTER_ENUM_ARCH,
- PK_FILTER_ENUM_APPLICATION,
-1);
pk_client_get_updates_async (PK_CLIENT(priv->task),
filter,
@@ -588,61 +720,6 @@ gs_main_overview_button_cb (GtkWidget *widget, GsMainPrivate *priv)
gs_main_set_overview_mode (priv, mode);
}
-static void
-gs_main_add_columns (GsMainPrivate *priv, GtkTreeView *treeview)
-{
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
- GtkCellArea *area;
-
- /* column for images */
- column = gtk_tree_view_column_new ();
- renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (renderer, "stock-size", priv->custom_icon_size, NULL);
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_column_add_attribute (column, renderer, "icon-name", COLUMN_ICON_NAME);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for name|version */
- area = gtk_cell_area_box_new ();
- gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_VERTICAL);
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "weight", 800,
- "yalign", 0.0f,
- "ypad", 18,
- NULL);
- gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer,
- FALSE, /* expand */
- FALSE, /* align */
- FALSE); /* fixed */
- gtk_cell_area_attribute_connect (area, renderer, "markup", COLUMN_PACKAGE_NAME);
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "yalign", 0.0f,
- "ypad", 0,
- NULL);
- g_object_set (G_OBJECT (renderer), "xalign", 0.0F, NULL);
- gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer,
- TRUE, /* expand */
- FALSE, /* align */
- FALSE); /* fixed */
- gtk_cell_area_attribute_connect (area, renderer, "markup", COLUMN_PACKAGE_VERSION);
- column = gtk_tree_view_column_new_with_area (area);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for summary */
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "yalign", 0.0f,
- "ypad", 18,
- "wrap-mode", PANGO_WRAP_WORD,
- NULL);
- column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
- "markup", COLUMN_PACKAGE_SUMMARY, NULL);
- gtk_tree_view_append_column (treeview, column);
-}
-
/**
* gs_main_setup_featured:
**/
@@ -690,6 +767,58 @@ out:
}
/**
+ * gs_main_installed_filter_func:
+ **/
+static gboolean
+gs_main_installed_filter_func (GtkWidget *child, void *user_data)
+{
+ const gchar *tmp;
+ GtkWidget *widget;
+ GsMainPrivate *priv = (GsMainPrivate *) user_data;
+ GsAppWidget *app_widget = GS_APP_WIDGET (child);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "entry_search"));
+ tmp = gtk_entry_get_text (GTK_ENTRY (widget));
+ if (tmp[0] == '\0')
+ return TRUE;
+ if (g_strstr_len (gs_app_widget_get_description (app_widget), -1, tmp) != NULL)
+ return TRUE;
+ if (g_strstr_len (gs_app_widget_get_name (app_widget), -1, tmp) != NULL)
+ return TRUE;
+ if (g_strstr_len (gs_app_widget_get_version (app_widget), -1, tmp) != NULL)
+ return TRUE;
+ if (g_strstr_len (gs_app_widget_get_id (app_widget), -1, tmp) != NULL)
+ return TRUE;
+ return FALSE;
+}
+
+
+/**
+ * gs_main_filter_text_changed_cb:
+ **/
+static gboolean
+gs_main_filter_text_changed_cb (GtkEntry *entry, GsMainPrivate *priv)
+{
+ egg_list_box_refilter (priv->list_box_installed);
+ egg_list_box_refilter (priv->list_box_updates);
+ return FALSE;
+}
+
+/**
+ * gs_main_installed_sort_func:
+ **/
+static gint
+gs_main_installed_sort_func (gconstpointer a,
+ gconstpointer b,
+ gpointer user_data)
+{
+ GsAppWidget *aw1 = GS_APP_WIDGET (a);
+ GsAppWidget *aw2 = GS_APP_WIDGET (b);
+ return g_strcmp0 (gs_app_widget_get_name (aw1),
+ gs_app_widget_get_name (aw2));
+}
+
+/**
* gs_main_startup_cb:
**/
static void
@@ -697,7 +826,6 @@ gs_main_startup_cb (GApplication *application, GsMainPrivate *priv)
{
GError *error = NULL;
gint retval;
- GtkTreeView *treeview;
GtkWidget *main_window;
GtkWidget *widget;
@@ -729,12 +857,6 @@ gs_main_startup_cb (GApplication *application, GsMainPrivate *priv)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
gs_main_set_overview_mode (priv, GS_MAIN_MODE_INSTALLED);
- /* add columns to the tree view */
- treeview = GTK_TREE_VIEW (gtk_builder_get_object (priv->builder, "treeview_installed"));
- gs_main_add_columns (priv, treeview);
- treeview = GTK_TREE_VIEW (gtk_builder_get_object (priv->builder, "treeview_updates"));
- gs_main_add_columns (priv, treeview);
-
/* set up popular icon vew */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "iconview_popular"));
gtk_icon_view_set_markup_column (GTK_ICON_VIEW (widget), COLUMN_POPULAR_MARKUP);
@@ -743,6 +865,32 @@ gs_main_startup_cb (GApplication *application, GsMainPrivate *priv)
/* setup featured tiles */
gs_main_setup_featured (priv);
+ /* setup installed */
+ priv->list_box_installed = egg_list_box_new ();
+ egg_list_box_set_filter_func (priv->list_box_installed,
+ gs_main_installed_filter_func,
+ priv,
+ NULL);
+ egg_list_box_set_sort_func (priv->list_box_installed,
+ gs_main_installed_sort_func,
+ priv,
+ NULL);
+ egg_list_box_set_selection_mode (priv->list_box_installed,
+ GTK_SELECTION_NONE);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_install"));
+ egg_list_box_add_to_scrolled (priv->list_box_installed,
+ GTK_SCROLLED_WINDOW (widget));
+ gtk_widget_show (GTK_WIDGET (priv->list_box_installed));
+
+ /* setup updates */
+ priv->list_box_updates = egg_list_box_new ();
+ egg_list_box_set_selection_mode (priv->list_box_updates,
+ GTK_SELECTION_NONE);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_updates"));
+ egg_list_box_add_to_scrolled (priv->list_box_updates,
+ GTK_SCROLLED_WINDOW (widget));
+ gtk_widget_show (GTK_WIDGET (priv->list_box_updates));
+
/* setup buttons */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_new"));
g_object_set_data (G_OBJECT (widget),
@@ -763,6 +911,11 @@ gs_main_startup_cb (GApplication *application, GsMainPrivate *priv)
g_signal_connect (widget, "clicked",
G_CALLBACK (gs_main_overview_button_cb), priv);
+ /* refilter on search box changing */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "entry_search"));
+ g_signal_connect (GTK_EDITABLE (widget), "changed",
+ G_CALLBACK (gs_main_filter_text_changed_cb), priv);
+
/* show main UI */
gtk_widget_show (main_window);
out:
@@ -807,7 +960,9 @@ main (int argc, char **argv)
priv = g_new0 (GsMainPrivate, 1);
/* we want the large icon size according to the width of the window */
- priv->custom_icon_size = gtk_icon_size_register ("custom", 96, 96);
+ priv->custom_icon_size = gtk_icon_size_register ("custom",
+ GS_MAIN_ICON_SIZE,
+ GS_MAIN_ICON_SIZE);
/* ensure single instance */
priv->application = gtk_application_new ("org.gnome.Software", 0);
@@ -827,7 +982,7 @@ main (int argc, char **argv)
priv->desktop = pk_desktop_new ();
ret = pk_desktop_open_database (priv->desktop, &error);
if (!ret) {
- g_warning ("failed to parse options: %s", error->message);
+ g_warning ("failed to open database: %s", error->message);
g_error_free (error);
goto out;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]