1 /* 2 * biji-item.h 3 * 4 * Copyright 2013 Pierre-Yves Luyten <py@luyten.fr> 5 * 6 * Bijiben is free software: you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the 8 * Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * bijiben is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 * See the GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License along 17 * with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 21 #pragma once 22 23 #include <cairo-gobject.h> 24 #include <glib-object.h> 25 #include <gtk/gtk.h> 26 27 G_BEGIN_DECLS 28 29 #define BIJI_TYPE_ITEM (biji_item_get_type ()) 30 31 G_DECLARE_DERIVABLE_TYPE (BijiItem, biji_item, BIJI, ITEM, GObject) 32 33 /* Icon */ 34 #define BIJI_ICON_WIDTH 200 35 #define BIJI_ICON_HEIGHT 200 36 #define BIJI_ICON_FONT "Purusa 10" 37 38 /* a cute baby icon without txt. squared. */ 39 #define BIJI_EMBLEM_WIDTH BIJI_ICON_WIDTH / 6 40 #define BIJI_EMBLEM_HEIGHT BIJI_EMBLEM_WIDTH 41 42 struct _BijiItemClass 43 { 44 GObjectClass parent_class; 45 46 const gchar * (*get_title) (BijiItem *item); 47 const gchar * (*get_uuid) (BijiItem *item); 48 cairo_surface_t * (*get_icon) (BijiItem *item, 49 gint scale); 50 cairo_surface_t * (*get_emblem) (BijiItem *item, 51 gint scale); 52 cairo_surface_t * (*get_pristine) (BijiItem *item, 53 gint scale); 54 55 /* Just return some provider information */ 56 const gchar * (*get_place) (BijiItem *item); 57 58 gint64 (*get_mtime) (BijiItem *item); 59 gboolean (*has_color) (BijiItem *item); 60 61 gboolean (*trash) (BijiItem *item); 62 gboolean (*restore) (BijiItem *item, gchar **old_uuid); 63 gboolean (*delete) (BijiItem *item); 64 65 gboolean (*is_collectable) (BijiItem *item); 66 gboolean (*has_notebook) (BijiItem *item, gchar *coll); 67 gboolean (*add_notebook) (BijiItem *item, BijiItem *coll, gchar *title); 68 gboolean (*remove_notebook) (BijiItem *item, BijiItem *coll); 69 }; 70 71 /* Do not create a generic items, it's rather an iface 72 * but i just need common stuff */ 73 74 75 /* - note uuid is a location (as in GFile) 76 * - notebook uuid is urn */ 77 78 const gchar * biji_item_get_title (BijiItem *item); 79 80 81 const gchar * biji_item_get_uuid (BijiItem *item); 82 83 84 gpointer biji_item_get_manager (BijiItem *item); 85 86 87 gboolean biji_item_has_color (BijiItem *item); 88 89 90 cairo_surface_t * biji_item_get_icon (BijiItem *item, 91 gint scale); 92 93 94 cairo_surface_t * biji_item_get_emblem (BijiItem *item, 95 gint scale); 96 97 98 cairo_surface_t * biji_item_get_pristine (BijiItem *item, 99 gint scale); 100 101 102 const gchar * biji_item_get_place (BijiItem *item); 103 104 105 gint64 biji_item_get_mtime (BijiItem *item); 106 107 108 gboolean biji_item_trash (BijiItem *item); 109 110 111 gboolean biji_item_restore (BijiItem *item); 112 113 114 gboolean biji_item_delete (BijiItem *item); 115 116 117 gboolean biji_item_is_collectable (BijiItem *item); 118 119 120 gboolean biji_item_has_notebook (BijiItem *item, 121 gchar *collection); 122 123 124 /* Add Collection: 125 * either provide an existing notebook object 126 * or a title, in which case it's considered not on user action 127 * and no notifiy happens */ 128 129 gboolean biji_item_add_notebook (BijiItem *item, BijiItem *collection, gchar *title); 130 131 132 /* Remove Collection: 133 * always on user action. */ 134 135 gboolean biji_item_remove_notebook (BijiItem *item, BijiItem *collection); 136 137 G_END_DECLS 138