1 /* -*- Mode: C; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- */
2 
3 /*
4  * GImageView
5  * Copyright (C) 2001 Takuro Ashie
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  * $Id: gimv_comment.h,v 1.3 2004/03/07 11:53:30 makeinu Exp $
22  */
23 
24 #ifndef __GIMV_COMMENT_H__
25 #define __GIMV_COMMENT_H__
26 
27 #include "gimageview.h"
28 
29 #define GIMV_TYPE_COMMENT            (gimv_comment_get_type ())
30 #define GIMV_COMMENT(obj)            (GTK_CHECK_CAST ((obj), GIMV_TYPE_COMMENT, GimvComment))
31 #define GIMV_COMMENT_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), TYPE_COMMENT, GimvCommentClass))
32 #define GIMV_IS_COMMENT(obj)         (GTK_CHECK_TYPE ((obj), GIMV_TYPE_COMMENT))
33 #define GIMV_IS_COMMENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMV_TYPE_COMMENT))
34 
35 typedef struct GimvCommentClass_Tag GimvCommentClass;
36 
37 struct GimvComment_Tag
38 {
39    GtkObject      parent;
40 
41    gchar         *filename;
42    GimvImageInfo *info;        /* 1:1 relation */
43 
44    GList         *data_list;   /* comment data list */
45    gchar         *note;
46 };
47 
48 struct GimvCommentClass_Tag {
49    GtkObjectClass parent_class;
50 
51    /* -- Signals -- */
52    void (*file_saved)   (GimvComment   *comment,
53                          GimvImageInfo *info);
54    void (*file_deleted) (GimvComment   *comment,
55                          GimvImageInfo *info);
56 };
57 
58 
59 typedef gchar *(*GimvCommentDataGetDefValFn) (GimvImageInfo *info, gpointer data);
60 
61 
62 typedef struct GimvCommentDataEntry_Tag
63 {
64    gchar *key;
65    gchar *display_name;
66    gchar *value;
67    gboolean enable;
68    gboolean auto_val;
69    gboolean display;
70    gboolean userdef;
71    GimvCommentDataGetDefValFn def_val_fn;
72 } GimvCommentDataEntry;
73 
74 
75 GtkType      gimv_comment_get_type                 (void);
76 
77 GimvComment *gimv_comment_get_from_image_info      (GimvImageInfo *info);
78 
79 GimvComment *gimv_comment_ref                      (GimvComment *comment);
80 void         gimv_comment_unref                    (GimvComment *comment);
81 
82 void         gimv_comment_update_data_entry_list   (void);
83 GList       *gimv_comment_get_data_entry_list      (void);
84 
85 gchar       *gimv_comment_get_path                 (const gchar *img_path);
86 gchar       *gimv_comment_find_file                (const gchar *img_path);
87 GimvCommentDataEntry
88             *gimv_comment_data_entry_find_template_by_key (const gchar *key);
89 GimvCommentDataEntry
90             *gimv_comment_find_data_entry_by_key   (GimvComment *comment,
91                                                     const gchar *key);
92 GimvCommentDataEntry
93             *gimv_comment_append_data              (GimvComment *comment,
94                                                     const gchar *key,
95                                                     const gchar *value);
96 void         gimv_comment_data_entry_remove        (GimvComment *comment,
97                                                     GimvCommentDataEntry *entry);
98 void         gimv_comment_data_entry_remove_by_key (GimvComment *comment,
99                                                     const gchar *key);
100 GimvCommentDataEntry
101              *gimv_comment_data_entry_dup           (GimvCommentDataEntry *src);
102 void          gimv_comment_data_entry_delete        (GimvCommentDataEntry *entry);
103 gboolean      gimv_comment_update_note              (GimvComment *comment,
104                                                      gchar       *note);
105 gboolean      gimv_comment_save_file                (GimvComment *comment);
106 void          gimv_comment_delete_file              (GimvComment *comment);
107 
108 #endif /* __GIMV_COMMENT_H__ */
109