[libgd/wip/rishi/main-box: 4/8] Add GdMainBoxItem



commit db27b44d916696034fabeda28a5daf11a26269b8
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Nov 23 14:43:08 2016 +0100

    Add GdMainBoxItem
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774914

 libgd/gd-main-box-item.c |   77 ++++++++++++++++++++++++++++++++++++++++++++++
 libgd/gd-main-box-item.h |   59 +++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+), 0 deletions(-)
---
diff --git a/libgd/gd-main-box-item.c b/libgd/gd-main-box-item.c
new file mode 100644
index 0000000..9ff23ae
--- /dev/null
+++ b/libgd/gd-main-box-item.c
@@ -0,0 +1,77 @@
+/*
+ * 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-item.c"
+
+G_DEFINE_INTERFACE (GdMainBoxItem, gd_main_box_item, G_TYPE_OBJECT)
+
+static void
+gd_main_box_item_default_init (GdMainBoxItemInterface *iface)
+{
+}
+
+/**
+ * gd_main_box_item_get_id:
+ * @self:
+ *
+ * Returns: (transfer none): The ID
+ */
+const gchar *
+gd_main_box_item_get_id (GdMainBoxItem *self)
+{
+  GdMainBoxItemInterface *iface;
+
+  iface = GD_MAIN_BOX_ITEM_GET_IFACE (self);
+
+  return (* iface->get_id) (self);
+}
+
+/**
+ * gd_main_box_item_get_uri:
+ * @self:
+ *
+ * Returns: (transfer none): The URI
+ */
+const gchar *
+gd_main_box_item_get_uri (GdMainBoxItem *self)
+{
+  GdMainBoxItemInterface *iface;
+
+  iface = GD_MAIN_BOX_ITEM_GET_IFACE (self);
+
+  return (* iface->get_uri) (self);
+}
+
+/**
+ * gd_main_box_item_get_primary_text:
+ * @self:
+ *
+ * Returns: (transfer none): The primary text
+ */
+const gchar *
+gd_main_box_item_get_primary_text (GdMainBoxItem *self)
+{
+  GdMainBoxItemInterface *iface;
+
+  iface = GD_MAIN_BOX_ITEM_GET_IFACE (self);
+
+  return (* iface->get_primary_text) (self);
+}
diff --git a/libgd/gd-main-box-item.h b/libgd/gd-main-box-item.h
new file mode 100644
index 0000000..179af76
--- /dev/null
+++ b/libgd/gd-main-box-item.h
@@ -0,0 +1,59 @@
+/*
+ * 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_ITEM_H__
+#define __GD_MAIN_BOX_ITEM_H__
+
+#include <cairo.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GD_TYPE_MAIN_VIEW_GENERIC gd_main_view_generic_get_type()
+G_DEFINE_INTERFACE (GdMainBoxItem, gd_main_box_item, GD, MAIN_BOX_ITEM, GObject)
+
+struct _GdMainBoxItemInterface
+{
+  GTypeInterface base_iface;
+
+  /* vtable */
+  const gchar      * (* get_id)              (GdMainBoxItem *self);
+  const gchar      * (* get_uri)             (GdMainBoxItem *self);
+  const gchar      * (* get_primary_text)    (GdMainBoxItem *self);
+  const gchar      * (* get_secondary_text)  (GdMainBoxItem *self);
+  cairo_surface_t  * (* get_icon)            (GdMainBoxItem *self);
+  gint64             (* get_mtime)           (GdMainBoxItem *self);
+  gboolean           (* get_selected)        (GdMainBoxItem *self);
+  guint              (* get_pulse)           (GdMainBoxItem *self);
+};
+
+const gchar      * gd_main_box_item_get_id              (GdMainBoxItem *self);
+const gchar      * gd_main_box_item_get_uri             (GdMainBoxItem *self);
+const gchar      * gd_main_box_item_get_primary_text    (GdMainBoxItem *self);
+const gchar      * gd_main_box_item_get_secondary_text  (GdMainBoxItem *self);
+cairo_surface_t  * gd_main_box_item_get_icon            (GdMainBoxItem *self);
+guint64            gd_main_box_item_get_mtime           (GdMainBoxItem *self);
+gboolean           gd_main_box_item_get_selected        (GdMainBoxItem *self);
+guint              gd_main_box_item_get_pulse           (GdMainBoxItem *self);
+
+G_END_DECLS
+
+#endif /* __GD_MAIN_BOX_ITEM_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]