1 /*
2  * Copyright (C) 2011 Collabora Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation; either version 2.1 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
16  *
17  * Author: Stef Walter <stefw@collabora.co.uk>
18  */
19 
20 #if !defined (__GCR_INSIDE_HEADER__) && !defined (GCR_COMPILATION)
21 #error "Only <gcr/gcr.h> or <gcr/gcr-base.h> can be included directly."
22 #endif
23 
24 #ifndef __GCR_UNLOCK_RENDERER_H__
25 #define __GCR_UNLOCK_RENDERER_H__
26 
27 #include <glib-object.h>
28 #include <gtk/gtk.h>
29 
30 #include "gcr/gcr-types.h"
31 
32 #include "gcr-renderer.h"
33 
34 G_BEGIN_DECLS
35 
36 #define GCR_TYPE_UNLOCK_RENDERER               (_gcr_unlock_renderer_get_type ())
37 #define GCR_UNLOCK_RENDERER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_UNLOCK_RENDERER, GcrUnlockRenderer))
38 #define GCR_UNLOCK_RENDERER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_UNLOCK_RENDERER, GcrUnlockRendererClass))
39 #define GCR_IS_UNLOCK_RENDERER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_UNLOCK_RENDERER))
40 #define GCR_IS_UNLOCK_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_UNLOCK_RENDERER))
41 #define GCR_UNLOCK_RENDERER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_UNLOCK_RENDERER, GcrUnlockRendererClass))
42 
43 typedef struct _GcrUnlockRenderer GcrUnlockRenderer;
44 typedef struct _GcrUnlockRendererClass GcrUnlockRendererClass;
45 typedef struct _GcrUnlockRendererPrivate GcrUnlockRendererPrivate;
46 
47 struct _GcrUnlockRenderer {
48 	/*< private >*/
49 	GtkBin parent;
50 	GcrUnlockRendererPrivate *pv;
51 };
52 
53 struct _GcrUnlockRendererClass {
54 	GtkBinClass parent_class;
55 
56 	/* signals */
57 	void       (*unlock_clicked)        (GcrUnlockRenderer *unlock);
58 };
59 
60 GType                  _gcr_unlock_renderer_get_type          (void);
61 
62 GcrUnlockRenderer *    _gcr_unlock_renderer_new               (const gchar *label,
63                                                                GBytes *locked_data);
64 
65 GcrUnlockRenderer *    _gcr_unlock_renderer_new_for_parsed    (GcrParser *parser);
66 
67 const gchar *          _gcr_unlock_renderer_get_password      (GcrUnlockRenderer *self);
68 
69 void                   _gcr_unlock_renderer_set_password      (GcrUnlockRenderer *self,
70                                                                const gchar *text);
71 
72 void                   _gcr_unlock_renderer_focus_password    (GcrUnlockRenderer *self);
73 
74 void                   _gcr_unlock_renderer_show_warning      (GcrUnlockRenderer *self,
75                                                                const gchar *message);
76 
77 GBytes *               _gcr_unlock_renderer_get_locked_data   (GcrUnlockRenderer *self);
78 
79 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrUnlockRenderer, g_object_unref)
80 
81 G_END_DECLS
82 
83 #endif /* __GCR_UNLOCK_RENDERER_H__ */
84