[libgd/wip/rishi/main-box: 8/9] Add GdMainBox
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/rishi/main-box: 8/9] Add GdMainBox
- Date: Wed, 7 Dec 2016 19:45:50 +0000 (UTC)
commit 87ab31d3c43aa1debc5c3f8ba88ce144b1f29da5
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Nov 23 14:43:21 2016 +0100
Add GdMainBox
https://bugzilla.gnome.org/show_bug.cgi?id=774914
libgd/gd-main-box.c | 727 +++++++++++++++++++++++++++++++++++++++++++++++++++
libgd/gd-main-box.h | 63 +++++
2 files changed, 790 insertions(+), 0 deletions(-)
---
diff --git a/libgd/gd-main-box.c b/libgd/gd-main-box.c
new file mode 100644
index 0000000..6283d5c
--- /dev/null
+++ b/libgd/gd-main-box.c
@@ -0,0 +1,727 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Debarshi Ray <debarshir gnome org>
+ *
+ */
+
+#include "gd-main-box.h"
+#include "gd-main-box-child.h"
+#include "gd-main-box-generic.h"
+#include "gd-main-box-item.h"
+#include "gd-main-icon-box.h"
+
+#define MAIN_BOX_TYPE_INITIAL -1
+
+typedef struct _GdMainBoxPrivate GdMainBoxPrivate;
+
+struct _GdMainBoxPrivate
+{
+ GListModel *model;
+ GdMainBoxType current_type;
+ GtkWidget *current_box;
+ gboolean selection_mode;
+ gboolean inside_child_activated;
+ gboolean selected_children_changed;
+ gchar *last_selected_id;
+};
+
+enum
+{
+ PROP_BOX_TYPE = 1,
+ PROP_SELECTION_MODE,
+ PROP_MODEL,
+ NUM_PROPERTIES
+};
+
+enum
+{
+ ITEM_ACTIVATED,
+ SELECTION_MODE_REQUEST,
+ VIEW_SELECTION_CHANGED,
+ NUM_SIGNALS
+};
+
+static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
+static guint signals[NUM_SIGNALS] = { 0, };
+
+G_DEFINE_TYPE_WITH_PRIVATE (GdMainBox, gd_main_box, GTK_TYPE_BIN)
+
+static void
+gd_main_box_activate_item_for_child (GdMainBox *self, GdMainBoxChild *child)
+{
+ GdMainBoxPrivate *priv;
+ GdMainBoxItem *item;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ if (priv->model == NULL)
+ return;
+
+ item = gd_main_box_child_get_item (child);
+ if (item == NULL)
+ return;
+
+ g_signal_emit (self, signals[ITEM_ACTIVATED], 0, item);
+}
+
+static void
+gd_main_box_apply_selection_mode (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ gd_main_box_generic_set_selection_mode (GD_MAIN_BOX_GENERIC (priv->current_box), priv->selection_mode);
+
+ if (!priv->selection_mode)
+ {
+ g_clear_pointer (&priv->last_selected_id, g_free);
+ if (priv->model != NULL)
+ gd_main_box_unselect_all (self);
+ }
+}
+
+static void
+gd_main_box_mark_range_as_selected (GdMainBox *self, gint first_element, gint last_element)
+{
+ GdMainBoxPrivate *priv;
+ gint i;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ if (first_element > last_element)
+ {
+ gint tmp;
+
+ tmp = first_element;
+ first_element = last_element;
+ last_element = tmp;
+ }
+
+ for (i = first_element; i <= last_element; i++)
+ {
+ GdMainBoxChild *child;
+
+ child = gd_main_box_generic_get_child_at_index (GD_MAIN_BOX_GENERIC (priv->current_box), i);
+ gd_main_box_generic_select_child (GD_MAIN_BOX_GENERIC (priv->current_box), child);
+ }
+}
+
+static void
+gd_main_box_select_range (GdMainBox *self, GdMainBoxChild *child)
+{
+ GdMainBoxPrivate *priv;
+ gint index;
+ gint other_index = -1;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ index = gd_main_box_child_get_index (child);
+
+ if (priv->last_selected_id != NULL)
+ {
+ guint i;
+ guint n_items;
+
+ n_items = g_list_model_get_n_items (priv->model);
+ for (i = 0; i < n_items && other_index == -1; i++)
+ {
+ GdMainBoxItem *item;
+ const gchar *id;
+
+ item = GD_MAIN_BOX_ITEM (g_list_model_get_object (priv->model, i));
+ id = gd_main_box_item_get_id (item);
+ if (g_strcmp0 (id, priv->last_selected_id) == 0)
+ other_index = (gint) i;
+
+ g_object_unref (item);
+ }
+ }
+
+ if (other_index == -1)
+ {
+ gint i;
+
+ for (i = index - 1; i >= 0; i--)
+ {
+ GdMainBoxChild *other;
+
+ other = gd_main_box_generic_get_child_at_index (GD_MAIN_BOX_GENERIC (priv->current_box), i);
+ if (gd_main_box_child_get_selected (other))
+ {
+ other_index = i;
+ break;
+ }
+ }
+ }
+
+ if (other_index == -1)
+ {
+ gint i = index + 1;
+
+ while (i++)
+ {
+ GdMainBoxChild *other;
+
+ other = gd_main_box_generic_get_child_at_index (GD_MAIN_BOX_GENERIC (priv->current_box), i);
+ if (other == NULL)
+ break;
+
+ if (gd_main_box_child_get_selected (other))
+ {
+ other_index = i;
+ break;
+ }
+ }
+ }
+
+ if (other_index == -1)
+ gd_main_box_generic_select_child (GD_MAIN_BOX_GENERIC (priv->current_box), child);
+ else
+ gd_main_box_mark_range_as_selected (self, index, other_index);
+
+ g_signal_emit (self, signals[VIEW_SELECTION_CHANGED], 0);
+}
+
+static void
+gd_main_box_toggle_selection_for_child (GdMainBox *self, GdMainBoxChild *child, gboolean select_range)
+{
+ GdMainBoxPrivate *priv;
+ gboolean selected;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ if (priv->model == NULL)
+ return;
+
+ selected = gd_main_box_child_get_selected (child);
+ g_message ("gd_main_box_toggle_selection_for_child: %p, %d", child, selected);
+
+ if (selected)
+ {
+ gd_main_box_generic_unselect_child (GD_MAIN_BOX_GENERIC (priv->current_box), child);
+ }
+ else
+ {
+ if (select_range)
+ {
+ gd_main_box_select_range (self, child);
+ }
+ else
+ {
+ GdMainBoxItem *item;
+ const gchar *id;
+
+ item = gd_main_box_child_get_item (child);
+ id = gd_main_box_item_get_id (item);
+
+ g_free (priv->last_selected_id);
+ priv->last_selected_id = g_strdup (id);
+
+ gd_main_box_generic_select_child (GD_MAIN_BOX_GENERIC (priv->current_box), child);
+ }
+ }
+
+ g_signal_emit (self, signals[VIEW_SELECTION_CHANGED], 0);
+}
+
+static gboolean
+gd_main_box_button_release_event_cb (GdMainBox *self, GdkEventButton *event)
+{
+ GdMainBoxPrivate *priv;
+ GdMainBoxChild *child;
+ gboolean res;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ /* eat double/triple click events */
+ if (event->type != GDK_BUTTON_RELEASE)
+ {
+ res = GDK_EVENT_STOP;
+ goto out;
+ }
+
+ g_message ("gd_main_box_button_release_event_cb");
+
+ if (event->button != 3)
+ {
+ res = GDK_EVENT_PROPAGATE;
+ goto out;
+ }
+
+ child = gd_main_box_generic_get_child_for_event (GD_MAIN_BOX_GENERIC (priv->current_box), (GdkEvent *)
event);
+ g_return_val_if_fail (GD_IS_MAIN_BOX_CHILD (child), GDK_EVENT_PROPAGATE);
+
+ if (!priv->selection_mode)
+ {
+ g_signal_emit (self, signals[SELECTION_MODE_REQUEST], 0);
+ if (!priv->selection_mode)
+ {
+ res = GDK_EVENT_PROPAGATE;
+ goto out;
+ }
+ }
+
+ if (priv->selection_mode)
+ gd_main_box_toggle_selection_for_child (self, child, ((event->state & GDK_SHIFT_MASK) != 0));
+
+ res = GDK_EVENT_PROPAGATE;
+
+ out:
+ priv->inside_child_activated = FALSE;
+ return res;
+}
+
+static void
+gd_main_box_child_activated_cb (GdMainBox *self, GdMainBoxChild *child)
+{
+ GdMainBoxPrivate *priv;
+ GdkModifierType state;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ g_message ("gd_main_box_child_activated_cb");
+ gtk_get_current_event_state (&state);
+
+ if (priv->selection_mode)
+ {
+ if (gd_main_box_child_get_selected (child) && !priv->selected_children_changed)
+ gd_main_box_toggle_selection_for_child (self, child, ((state & GDK_SHIFT_MASK) != 0));
+ }
+ else
+ {
+ if ((state & GDK_CONTROL_MASK) != 0)
+ {
+ g_signal_emit (self, signals[SELECTION_MODE_REQUEST], 0);
+ if (!priv->selection_mode)
+ goto out;
+
+ gd_main_box_toggle_selection_for_child (self, child, ((state & GDK_SHIFT_MASK) != 0));
+ }
+ else
+ {
+ gd_main_box_activate_item_for_child (self, child);
+ }
+ }
+
+ out:
+ priv->inside_child_activated = TRUE;
+ priv->selected_children_changed = FALSE;
+}
+
+static void
+gd_main_box_model_items_changed_cb (GdMainBox *self, guint position, guint removed, guint added)
+{
+ if (removed == 0)
+ return;
+
+ g_signal_emit (self, signals[VIEW_SELECTION_CHANGED], 0);
+}
+
+static void
+gd_main_box_selected_children_changed_cb (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+ GdkEvent *event;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ priv->selected_children_changed = FALSE;
+
+ event = gtk_get_current_event ();
+ if (event->type == GDK_BUTTON_RELEASE)
+ {
+ if (event->button.button == 1)
+ priv->selected_children_changed = TRUE;
+ }
+
+ g_signal_emit (self, signals[VIEW_SELECTION_CHANGED], 0);
+
+ g_clear_pointer (&event, (GDestroyNotify) gdk_event_free);
+}
+
+static void
+gd_main_box_rebuild (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+ GtkStyleContext *context;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ if (priv->current_box != NULL)
+ gtk_widget_destroy (priv->current_box);
+
+ switch (priv->current_type)
+ {
+ case GD_MAIN_BOX_ICON:
+ priv->current_box = gd_main_icon_box_new ();
+ break;
+
+ case GD_MAIN_BOX_LIST:
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ context = gtk_widget_get_style_context (priv->current_box);
+ gtk_style_context_add_class (context, "content-view");
+
+ gtk_container_add (GTK_CONTAINER (self), priv->current_box);
+
+ g_signal_connect_swapped (priv->current_box,
+ "button-release-event",
+ G_CALLBACK (gd_main_box_button_release_event_cb),
+ self);
+ g_signal_connect_swapped (priv->current_box,
+ "child-activated",
+ G_CALLBACK (gd_main_box_child_activated_cb),
+ self);
+ g_signal_connect_swapped (priv->current_box,
+ "selected-children-changed",
+ G_CALLBACK (gd_main_box_selected_children_changed_cb),
+ self);
+
+ gd_main_box_generic_set_model (GD_MAIN_BOX_GENERIC (priv->current_box), priv->model);
+ gd_main_box_apply_selection_mode (self);
+
+ gtk_widget_show_all (GTK_WIDGET (self));
+}
+
+static void
+gd_main_box_dispose (GObject *obj)
+{
+ GdMainBox *self = GD_MAIN_BOX (obj);
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ g_clear_object (&priv->model);
+
+ G_OBJECT_CLASS (gd_main_box_parent_class)->dispose (obj);
+}
+
+static void
+gd_main_box_finalize (GObject *obj)
+{
+ GdMainBox *self = GD_MAIN_BOX (obj);
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ g_free (priv->last_selected_id);
+
+ G_OBJECT_CLASS (gd_main_box_parent_class)->finalize (obj);
+}
+
+static void
+gd_main_box_init (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ /* so that we get constructed with the right view even at startup */
+ priv->current_type = MAIN_BOX_TYPE_INITIAL;
+}
+
+static void
+gd_main_box_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GdMainBox *self = GD_MAIN_BOX (object);
+
+ switch (property_id)
+ {
+ case PROP_BOX_TYPE:
+ g_value_set_int (value, gd_main_box_get_box_type (self));
+ break;
+ case PROP_SELECTION_MODE:
+ g_value_set_boolean (value, gd_main_box_get_selection_mode (self));
+ break;
+ case PROP_MODEL:
+ g_value_set_object (value, gd_main_box_get_model (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gd_main_box_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GdMainBox *self = GD_MAIN_BOX (object);
+
+ switch (property_id)
+ {
+ case PROP_BOX_TYPE:
+ gd_main_box_set_box_type (self, g_value_get_int (value));
+ break;
+ case PROP_SELECTION_MODE:
+ gd_main_box_set_selection_mode (self, g_value_get_boolean (value));
+ break;
+ case PROP_MODEL:
+ gd_main_box_set_model (self, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gd_main_box_class_init (GdMainBoxClass *klass)
+{
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+ oclass->get_property = gd_main_box_get_property;
+ oclass->set_property = gd_main_box_set_property;
+ oclass->dispose = gd_main_box_dispose;
+ oclass->finalize = gd_main_box_finalize;
+
+ properties[PROP_BOX_TYPE] = g_param_spec_int ("box-type",
+ "Box type",
+ "Box type",
+ GD_MAIN_BOX_ICON,
+ GD_MAIN_BOX_LIST,
+ GD_MAIN_BOX_ICON,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_SELECTION_MODE] = g_param_spec_boolean ("selection-mode",
+ "Selection mode",
+ "Whether the view is in selection mode",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_MODEL] = g_param_spec_object ("model",
+ "Model",
+ "The GListModel",
+ G_TYPE_LIST_MODEL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS);
+
+ signals[ITEM_ACTIVATED] = g_signal_new ("item-activated",
+ GD_TYPE_MAIN_BOX,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 1,
+ GD_TYPE_MAIN_BOX_ITEM);
+
+ signals[SELECTION_MODE_REQUEST] = g_signal_new ("selection-mode-request",
+ GD_TYPE_MAIN_BOX,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 0);
+
+ signals[VIEW_SELECTION_CHANGED] = g_signal_new ("view-selection-changed",
+ GD_TYPE_MAIN_BOX,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 0);
+
+ g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
+}
+
+GtkWidget *
+gd_main_box_new (GdMainBoxType type)
+{
+ return g_object_new (GD_TYPE_MAIN_BOX, "box-type", type, NULL);
+}
+
+GdMainBoxType
+gd_main_box_get_box_type (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+ return priv->current_type;
+}
+
+void
+gd_main_box_set_box_type (GdMainBox *self, GdMainBoxType type)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ if (type == priv->current_type)
+ return;
+
+ priv->current_type = type;
+ gd_main_box_rebuild (self);
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BOX_TYPE]);
+}
+
+gboolean
+gd_main_box_get_selection_mode (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+ return priv->selection_mode;
+}
+
+void
+gd_main_box_set_selection_mode (GdMainBox *self, gboolean selection_mode)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ if (selection_mode == priv->selection_mode)
+ return;
+
+ priv->selection_mode = selection_mode;
+ gd_main_box_apply_selection_mode (self);
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTION_MODE]);
+}
+
+/**
+ * gd_main_box_get_model:
+ * @self:
+ *
+ * Returns: (transfer none):
+ */
+GListModel *
+gd_main_box_get_model (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+ return priv->model;
+}
+
+/**
+ * gd_main_box_set_model:
+ * @self:
+ * @model: (allow-none):
+ *
+ */
+void
+gd_main_box_set_model (GdMainBox *self, GListModel *model)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ if (model == priv->model)
+ return;
+
+ if (priv->model)
+ g_signal_handlers_disconnect_by_func (priv->model, gd_main_box_model_items_changed_cb, self);
+
+ g_clear_object (&priv->model);
+
+ if (model != NULL)
+ {
+ priv->model = g_object_ref (model);
+ g_signal_connect_object (priv->model,
+ "items-changed",
+ G_CALLBACK (gd_main_box_model_items_changed_cb),
+ self,
+ G_CONNECT_SWAPPED);
+ }
+
+ gd_main_box_generic_set_model (GD_MAIN_BOX_GENERIC (priv->current_box), priv->model);
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODEL]);
+}
+
+/**
+ * gd_main_box_get_generic_box:
+ * @self:
+ *
+ * Returns: (transfer none):
+ */
+GtkWidget *
+gd_main_box_get_generic_box (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+ return priv->current_box;
+}
+
+/**
+ * gd_main_box_get_selection:
+ * @self:
+ *
+ * Returns: (element-type GdMainBoxItem) (transfer full):
+ */
+GList *
+gd_main_box_get_selection (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+ GList *l;
+ GList *selected_children;
+ GList *selection = NULL;
+
+ priv = gd_main_box_get_instance_private (self);
+
+ selected_children = gd_main_box_generic_get_selected_children (GD_MAIN_BOX_GENERIC (priv->current_box));
+ for (l = selected_children; l != NULL; l = l->next)
+ {
+ GdMainBoxChild *child = GD_MAIN_BOX_CHILD (l->data);
+ GdMainBoxItem *item;
+
+ item = gd_main_box_child_get_item (GD_MAIN_BOX_CHILD (child));
+ selection = g_list_prepend (selection, g_object_ref (item));
+ }
+
+ selection = g_list_reverse (selection);
+ return selection;
+}
+
+void
+gd_main_box_select_all (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+ gd_main_box_generic_select_all (GD_MAIN_BOX_GENERIC (priv->current_box));
+}
+
+void
+gd_main_box_unselect_all (GdMainBox *self)
+{
+ GdMainBoxPrivate *priv;
+
+ priv = gd_main_box_get_instance_private (self);
+ gd_main_box_generic_unselect_all (GD_MAIN_BOX_GENERIC (priv->current_box));
+}
diff --git a/libgd/gd-main-box.h b/libgd/gd-main-box.h
new file mode 100644
index 0000000..edd541d
--- /dev/null
+++ b/libgd/gd-main-box.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Debarshi Ray <debarshir gnome org>
+ *
+ */
+
+#ifndef __GD_MAIN_BOX_H__
+#define __GD_MAIN_BOX_H__
+
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GD_TYPE_MAIN_BOX gd_main_box_get_type()
+G_DECLARE_DERIVABLE_TYPE (GdMainBox, gd_main_box, GD, MAIN_BOX, GtkBin)
+
+typedef enum
+{
+ GD_MAIN_BOX_ICON,
+ GD_MAIN_BOX_LIST
+} GdMainBoxType;
+
+struct _GdMainBoxClass
+{
+ GtkBinClass parent_class;
+};
+
+GtkWidget * gd_main_box_new (GdMainBoxType type);
+GdMainBoxType gd_main_box_get_box_type (GdMainBox *self);
+void gd_main_box_set_box_type (GdMainBox *self, GdMainBoxType type);
+
+gboolean gd_main_box_get_selection_mode (GdMainBox *self);
+void gd_main_box_set_selection_mode (GdMainBox *self, gboolean selection_mode);
+
+GList * gd_main_box_get_selection (GdMainBox *self);
+
+void gd_main_box_select_all (GdMainBox *self);
+void gd_main_box_unselect_all (GdMainBox *self);
+
+GListModel * gd_main_box_get_model (GdMainBox *self);
+void gd_main_box_set_model (GdMainBox *self, GListModel *model);
+
+GtkWidget * gd_main_box_get_generic_box (GdMainBox *self);
+
+G_END_DECLS
+
+#endif /* __GD_MAIN_BOX_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]