1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
#include <config.h>
#include <gnome.h>
#include <bonobo.h>
#include "Evolution.h"
#include "evolution-storage.h"
#include "evolution-shell-component.h"
#include "e-util/e-gui-utils.h"
#define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Notes_shellComponentFactory"
static const EvolutionShellComponentFolderType folder_types[] = {
{ "notes", "evolution-notes.png", TRUE, NULL, NULL },
{ NULL, NULL }
};
static void
new_note_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
g_print ("new note!\n");
}
static GnomeUIInfo gnome_toolbar [] = {
GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new note"), new_note_cb, GNOME_STOCK_PIXMAP_NEW),
GNOMEUIINFO_END
};
#ifdef THIS_NEEDS_UPDATING_FOR_NEW_BONOBOS
static void
control_deactivate (BonoboControl *control, BonoboUIComponent *uih)
{
bonobo_ui_handler_dock_remove (uih, "/Toolbar");
}
static void
control_activate (BonoboControl *control, BonoboUIComponent *uih)
{
Bonobo_UIContainer remote_uih;
GtkWidget *toolbar, *toolbar_frame;
BonoboControl *toolbar_control ;
remote_uih = bonobo_control_get_remote_ui_handler (control);
bonobo_ui_handler_set_container (uih, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
GTK_TOOLBAR_BOTH);
gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar),
gnome_toolbar,
NULL, NULL);
toolbar_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (toolbar_frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (toolbar_frame), toolbar);
gtk_widget_show (toolbar_frame);
gtk_widget_show_all (toolbar_frame);
toolbar_control = bonobo_control_new (toolbar_frame);
bonobo_ui_handler_dock_add (
uih, "/Toolbar",
bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)),
GNOME_DOCK_ITEM_BEH_EXCLUSIVE,
GNOME_DOCK_TOP,
1, 1, 0);
}
static void
control_activate_cb (BonoboControl *control,
gboolean activate)
{
BonoboUIComponent *uih;
uih = bonobo_control_get_ui_handler (control);
g_assert (uih);
if (activate)
control_activate (control, uih);
else
control_deactivate (control, uih);
}
#endif
static BonoboControl *
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
void *closure)
{
BonoboControl * control;
control = notes_factory_new_control ();
#ifdef THIS_CODE_IS_TOTALY_DEAD
g_signal_connect((control), "activate",
control_activate_cb, NULL);
#endif
return control;
}
static void
owner_set_cb (EvolutionShellComponent *shell_component,
EvolutionShellClient shell_client,
gpointer user_data)
{
g_print ("evolution-notes: Yeeeh! We have an owner!\n"); /* FIXME */
}
static void
owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
{
g_print ("No owner anymore\n");
}
/* The factory function */
static BonoboObject *
notes_component_factory (BonoboGenericFactory *factory,
void *closure)
{
EvolutionShellComponent *shell_component;
shell_component = evolution_shell_component_new (folder_types, create_view, NULL);
g_signal_connect((shell_component), "owner_set",
G_CALLBACK (owner_set_cb), NULL);
g_signal_connect((shell_component), "owner_unset",
G_CALLBACK (owner_unset_cb), NULL);
return BONOBO_OBJECT (shell_component);
}
void
component_factory_init (void)
{
static BonoboGenericFactory *factory = NULL;
if (factory != NULL)
return;
factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, notes_component_factory, NULL);
if (factory == NULL) {
e_notice (NULL, GTK_MESSAGE_ERROR,
_("Cannot initialize Evolution's notes component."));
exit (1);
}
}
|