1 /* Sticky Notes
2  * Copyright (C) 2002-2003 Loban A Rahman
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  */
19 
20 #ifndef __STICKYNOTES_APPLET_H__
21 #define __STICKYNOTES_APPLET_H__
22 
23 #include <glib/gi18n.h>
24 #include <gdk/gdk.h>
25 #include <gtk/gtk.h>
26 #include <gio/gio.h>
27 #include <mate-panel-applet.h>
28 
29 #define STICKYNOTES_SCHEMA            "org.mate.stickynotes"
30 
31 #define STICKYNOTES_STOCK_LOCKED      "stickynotes-stock-locked"
32 #define STICKYNOTES_STOCK_UNLOCKED    "stickynotes-stock-unlocked"
33 #define STICKYNOTES_STOCK_CLOSE       "stickynotes-stock-close"
34 #define STICKYNOTES_STOCK_RESIZE_SE   "stickynotes-stock-resize-se"
35 #define STICKYNOTES_STOCK_RESIZE_SW   "stickynotes-stock-resize-sw"
36 
37 /* Global Sticky Notes instance */
38 typedef struct
39 {
40     GtkBuilder *builder;
41 
42     GtkWidget *w_prefs;    /* The prefs dialog */
43     GtkAdjustment *w_prefs_width;
44     GtkAdjustment *w_prefs_height;
45     GtkWidget *w_prefs_color;
46     GtkWidget *w_prefs_font_color;
47     GtkWidget *w_prefs_sys_color;
48     GtkWidget *w_prefs_font;
49     GtkWidget *w_prefs_sys_font;
50     GtkWidget *w_prefs_sticky;
51     GtkWidget *w_prefs_force;
52     GtkWidget *w_prefs_desktop;
53 
54     GList *notes;     /* Linked-List of all the sticky notes */
55     GList *applets;   /* Linked-List of all the applets */
56 
57     cairo_surface_t *icon_normal;      /* Normal applet icon */
58     cairo_surface_t *icon_prelight;    /* Prelighted applet icon */
59 
60     GSettings *settings;    /* Shared GSettings */
61 
62     gint max_height;
63     guint last_timeout_data;
64 
65     gboolean visible;    /* Toggle show/hide notes */
66 } StickyNotes;
67 
68 /* Sticky Notes Applet */
69 typedef struct
70 {
71     GtkWidget *w_applet;    /* The applet */
72     GtkWidget *w_image;     /* The applet icon */
73 
74     GtkWidget *destroy_all_dialog;    /* The applet it's destroy all dialog */
75 
76     gboolean prelighted;    /* Whether applet is prelighted */
77 
78     gint panel_size;
79     MatePanelAppletOrient panel_orient;
80 
81     GtkActionGroup *action_group;
82     GtkWidget *menu_tip;
83 } StickyNotesApplet;
84 
85 typedef enum
86 {
87     STICKYNOTES_NEW = 0,
88     STICKYNOTES_SET_VISIBLE,
89     STICKYNOTES_SET_LOCKED
90 
91 } StickyNotesDefaultAction;
92 
93 extern StickyNotes *stickynotes;
94 
95 void stickynotes_applet_init (MatePanelApplet *mate_panel_applet);
96 void stickynotes_applet_init_prefs (void);
97 
98 StickyNotesApplet * stickynotes_applet_new (MatePanelApplet *mate_panel_applet);
99 
100 void stickynotes_applet_update_icon (StickyNotesApplet *applet);
101 void stickynotes_applet_update_prefs (void);
102 void stickynotes_applet_update_menus (void);
103 void stickynotes_applet_update_tooltips (void);
104 
105 void stickynotes_applet_do_default_action (GdkScreen *screen);
106 
107 void stickynotes_applet_panel_icon_get_geometry (int *x,
108                                                  int *y,
109                                                  int *width,
110                                                  int *height);
111 
112 #endif /* __STICKYNOTES_APPLET_H__ */
113