1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Dialog to view/edit document node properties
7
////////////////////////////////////////////////////////////////////////////
9
#include "NodePropertiesDlg.h"
11
#include "gui/FileDialog.h"
13
const char *InternalIcon_Index2Name(int nIndex);
14
const char **InternalIcon_GetFromIdx(int);
15
int InternalIcon_Name2Index(const char *);
17
static void on_icon_none_clicked(GtkMenuItem *menuitem, gpointer user_data);
18
static void on_icon_internal_clicked(GtkMenuItem *menuitem, gpointer user_data);
19
static void on_icon_custom_clicked(GtkMenuItem *menuitem, gpointer user_data);
20
static void on_xpm_select_clicked(GtkMenuItem *menuitem, gpointer user_data);
21
static void on_internal_combo_selected (GtkComboBox *widget, gpointer user_data);
23
NodePropertiesDlg::NodePropertiesDlg()
27
NodePropertiesDlg::~NodePropertiesDlg()
32
void NodePropertiesDlg::Create()
34
m_pDialog = create_node_properties_dialog ();
37
if(m_strTitle.c_str())
39
GtkWidget *entry = lookup_widget(m_pDialog, "entry_node_title");
40
gtk_entry_set_text(GTK_ENTRY(entry), m_strTitle.c_str());
43
//fill internal icons combo
44
GtkWidget *cbo2 = lookup_widget(m_pDialog, "comboboxentry2");
45
for (int i=ICON_INTERNAL_FIRST; i<=ICON_INTERNAL_LAST; i++)
46
gtk_combo_box_append_text(GTK_COMBO_BOX(cbo2), InternalIcon_Index2Name(i));
48
//select first entry in combo (must not be empty selection)
49
gtk_combo_box_set_active(GTK_COMBO_BOX(cbo2), 0);
52
const char *NodePropertiesDlg::GetNodeTitle()
54
GtkWidget *entry = lookup_widget(m_pDialog, "entry_node_title");
55
return gtk_entry_get_text(GTK_ENTRY(entry));
58
int NodePropertiesDlg::GetIconType()
60
GtkWidget *radio_ico_none = lookup_widget(m_pDialog, "radio_ico_none");
61
GtkWidget *radio_ico_internal = lookup_widget(m_pDialog, "radio_ico_internal");
63
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_none)))
65
else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_internal)))
70
const char *NodePropertiesDlg::GetIconValue()
72
GtkWidget *cbo2 = lookup_widget(m_pDialog, "comboboxentry2");
73
GtkWidget *entry4 = lookup_widget(m_pDialog, "entry4");
75
switch (GetIconType())
79
#if GTK_CHECK_VERSION(2,6,0) //new API //TOFIX set proper version//
80
return gtk_combo_box_get_active_text(GTK_COMBO_BOX(cbo2));
82
int nPos = gtk_combo_box_get_active(GTK_COMBO_BOX(cbo2));
85
GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbo2));
88
sprintf(szPath, "%d", nPos);
89
GtkTreePath *path1 = gtk_tree_path_new_from_string (szPath);
90
if(gtk_tree_model_get_iter(model, &iter, path1))
93
gtk_tree_model_get (model, &iter, 0, &value, -1);
101
case ICON_CUSTOM: return gtk_entry_get_text(GTK_ENTRY(entry4));
106
void NodePropertiesDlg::SetIconType(int nType)
108
GtkWidget *radio_ico_none = lookup_widget(m_pDialog, "radio_ico_none");
109
GtkWidget *radio_ico_internal = lookup_widget(m_pDialog, "radio_ico_internal");
110
GtkWidget *radio_ico_custom = lookup_widget(m_pDialog, "radio_ico_custom");
111
GtkWidget *cbo2 = lookup_widget(m_pDialog, "comboboxentry2");
113
if(ICON_NONE == nType)
115
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_ico_none), TRUE);
116
on_icon_none_clicked(NULL, this);
118
else if(ICON_CUSTOM == nType)
119
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_ico_custom), TRUE);
122
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_ico_internal), TRUE);
123
gtk_combo_box_set_active(GTK_COMBO_BOX(cbo2), nType);
129
void NodePropertiesDlg::SetIconValue(const char *szValue)
131
GtkWidget *entry4 = lookup_widget(m_pDialog, "entry4");
132
gtk_entry_set_text(GTK_ENTRY(entry4), szValue);
137
GtkWidget* NodePropertiesDlg::create_node_properties_dialog ()
139
GtkWidget *node_properties_dialog;
140
GtkWidget *dialog_vbox5;
143
GtkWidget *entry_node_title;
148
GtkWidget *radio_ico_none;
149
GSList *radio_ico_none_group = NULL;
150
GtkWidget *radio_ico_internal;
151
GtkWidget *radio_ico_custom;
155
GtkWidget *button_xpm_select;
156
GtkWidget *comboboxentry2;
157
GtkWidget *dialog_action_area5;
158
GtkWidget *cancelbutton5;
159
GtkWidget *okbutton5;
161
node_properties_dialog = gtk_dialog_new ();
162
gtk_window_set_title (GTK_WINDOW (node_properties_dialog), _("Node Properties"));
163
gtk_window_set_type_hint (GTK_WINDOW (node_properties_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
165
dialog_vbox5 = GTK_DIALOG (node_properties_dialog)->vbox;
166
gtk_widget_show (dialog_vbox5);
168
table4 = gtk_table_new (2, 2, FALSE);
169
gtk_widget_show (table4);
170
gtk_box_pack_start (GTK_BOX (dialog_vbox5), table4, TRUE, TRUE, 0);
172
label21 = gtk_label_new (_("Title:"));
173
gtk_widget_show (label21);
174
gtk_table_attach (GTK_TABLE (table4), label21, 0, 1, 0, 1,
175
(GtkAttachOptions) (GTK_FILL),
176
(GtkAttachOptions) (0), 0, 0);
177
gtk_misc_set_alignment (GTK_MISC (label21), 0, 0.5);
179
entry_node_title = gtk_entry_new ();
180
gtk_widget_show (entry_node_title);
181
gtk_table_attach (GTK_TABLE (table4), entry_node_title, 1, 2, 0, 1,
182
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
183
(GtkAttachOptions) (0), 0, 0);
185
label22 = gtk_label_new (_("Icon:"));
186
gtk_widget_show (label22);
187
gtk_table_attach (GTK_TABLE (table4), label22, 0, 1, 1, 2,
188
(GtkAttachOptions) (GTK_FILL),
189
(GtkAttachOptions) (0), 0, 0);
190
gtk_misc_set_alignment (GTK_MISC (label22), 0, 0);
192
vbox10 = gtk_vbox_new (FALSE, 0);
193
gtk_widget_show (vbox10);
194
gtk_table_attach (GTK_TABLE (table4), vbox10, 1, 2, 1, 2,
195
(GtkAttachOptions) (GTK_FILL),
196
(GtkAttachOptions) (GTK_FILL), 0, 0);
198
hbox2 = gtk_hbox_new (FALSE, 0);
199
gtk_widget_show (hbox2);
200
gtk_box_pack_start (GTK_BOX (vbox10), hbox2, FALSE, FALSE, 0);
202
table6 = gtk_table_new (4, 3, FALSE);
203
gtk_widget_show (table6);
204
gtk_box_pack_start (GTK_BOX (hbox2), table6, TRUE, TRUE, 0);
206
radio_ico_none = gtk_radio_button_new_with_mnemonic (NULL, _("None"));
207
gtk_widget_show (radio_ico_none);
208
gtk_table_attach (GTK_TABLE (table6), radio_ico_none, 0, 1, 0, 1,
209
(GtkAttachOptions) (GTK_FILL),
210
(GtkAttachOptions) (0), 0, 0);
211
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_ico_none), radio_ico_none_group);
212
radio_ico_none_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_ico_none));
214
radio_ico_internal = gtk_radio_button_new_with_mnemonic (NULL, _("Internal"));
215
gtk_widget_show (radio_ico_internal);
216
gtk_table_attach (GTK_TABLE (table6), radio_ico_internal, 0, 1, 1, 2,
217
(GtkAttachOptions) (GTK_FILL),
218
(GtkAttachOptions) (0), 0, 0);
219
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_ico_internal), radio_ico_none_group);
220
radio_ico_none_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_ico_internal));
222
radio_ico_custom = gtk_radio_button_new_with_mnemonic (NULL, _("Custom"));
223
gtk_widget_show (radio_ico_custom);
224
gtk_table_attach (GTK_TABLE (table6), radio_ico_custom, 0, 1, 2, 3,
225
(GtkAttachOptions) (GTK_FILL),
226
(GtkAttachOptions) (0), 0, 0);
227
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_ico_custom), radio_ico_none_group);
228
radio_ico_none_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_ico_custom));
230
entry4 = gtk_entry_new ();
231
gtk_entry_set_editable (GTK_ENTRY(entry4), FALSE);
232
gtk_widget_show (entry4);
233
gtk_table_attach (GTK_TABLE (table6), entry4, 1, 2, 2, 3,
234
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
235
(GtkAttachOptions) (0), 0, 0);
237
label23 = gtk_label_new (_("Preview:"));
238
gtk_widget_show (label23);
239
gtk_table_attach (GTK_TABLE (table6), label23, 0, 1, 3, 4,
240
(GtkAttachOptions) (GTK_FILL),
241
(GtkAttachOptions) (0), 0, 0);
242
gtk_misc_set_alignment (GTK_MISC (label23), 0, 0.5);
244
image1 = gtk_image_new ();
245
gtk_widget_show (image1);
246
gtk_widget_set_size_request(image1, -1, 20);
247
gtk_table_attach (GTK_TABLE (table6), image1, 1, 2, 3, 4,
248
(GtkAttachOptions) (GTK_FILL),
249
(GtkAttachOptions) (GTK_FILL), 0, 0);
251
button_xpm_select = gtk_button_new_with_mnemonic ("...");
252
gtk_widget_show (button_xpm_select);
253
gtk_table_attach (GTK_TABLE (table6), button_xpm_select, 2, 3, 2, 3,
254
(GtkAttachOptions) (GTK_FILL),
255
(GtkAttachOptions) (0), 0, 0);
257
comboboxentry2 = gtk_combo_box_new_text ();
258
gtk_widget_show (comboboxentry2);
259
gtk_table_attach (GTK_TABLE (table6), comboboxentry2, 1, 2, 1, 2,
260
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
261
(GtkAttachOptions) (GTK_FILL), 0, 0);
263
dialog_action_area5 = GTK_DIALOG (node_properties_dialog)->action_area;
264
gtk_widget_show (dialog_action_area5);
265
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area5), GTK_BUTTONBOX_END);
267
cancelbutton5 = gtk_button_new_from_stock ("gtk-cancel");
268
gtk_widget_show (cancelbutton5);
269
gtk_dialog_add_action_widget (GTK_DIALOG (node_properties_dialog), cancelbutton5, GTK_RESPONSE_CANCEL);
270
GTK_WIDGET_SET_FLAGS (cancelbutton5, GTK_CAN_DEFAULT);
272
okbutton5 = gtk_button_new_from_stock ("gtk-ok");
273
gtk_widget_show (okbutton5);
274
gtk_dialog_add_action_widget (GTK_DIALOG (node_properties_dialog), okbutton5, GTK_RESPONSE_OK);
275
GTK_WIDGET_SET_FLAGS (okbutton5, GTK_CAN_DEFAULT);
277
g_signal_connect (radio_ico_none, "clicked", G_CALLBACK (on_icon_none_clicked), this);
278
g_signal_connect (radio_ico_internal, "clicked", G_CALLBACK (on_icon_internal_clicked), this);
279
g_signal_connect (radio_ico_custom, "clicked", G_CALLBACK (on_icon_custom_clicked), this);
280
g_signal_connect (button_xpm_select, "clicked", G_CALLBACK (on_xpm_select_clicked), this);
281
g_signal_connect (comboboxentry2, "changed", G_CALLBACK (on_internal_combo_selected), this);
283
/* Store pointers to all widgets, for use by lookup_widget(). */
284
GLADE_HOOKUP_OBJECT_NO_REF (node_properties_dialog, node_properties_dialog, "node_properties_dialog");
285
GLADE_HOOKUP_OBJECT_NO_REF (node_properties_dialog, dialog_vbox5, "dialog_vbox5");
286
GLADE_HOOKUP_OBJECT (node_properties_dialog, table4, "table4");
287
GLADE_HOOKUP_OBJECT (node_properties_dialog, label21, "label21");
288
GLADE_HOOKUP_OBJECT (node_properties_dialog, entry_node_title, "entry_node_title");
289
GLADE_HOOKUP_OBJECT (node_properties_dialog, label22, "label22");
290
GLADE_HOOKUP_OBJECT (node_properties_dialog, vbox10, "vbox10");
291
GLADE_HOOKUP_OBJECT (node_properties_dialog, hbox2, "hbox2");
292
GLADE_HOOKUP_OBJECT (node_properties_dialog, table6, "table6");
293
GLADE_HOOKUP_OBJECT (node_properties_dialog, radio_ico_none, "radio_ico_none");
294
GLADE_HOOKUP_OBJECT (node_properties_dialog, radio_ico_internal, "radio_ico_internal");
295
GLADE_HOOKUP_OBJECT (node_properties_dialog, radio_ico_custom, "radio_ico_custom");
296
GLADE_HOOKUP_OBJECT (node_properties_dialog, entry4, "entry4");
297
GLADE_HOOKUP_OBJECT (node_properties_dialog, label23, "label23");
298
GLADE_HOOKUP_OBJECT (node_properties_dialog, image1, "image1");
299
GLADE_HOOKUP_OBJECT (node_properties_dialog, button_xpm_select, "button_xpm_select");
300
GLADE_HOOKUP_OBJECT (node_properties_dialog, comboboxentry2, "comboboxentry2");
301
GLADE_HOOKUP_OBJECT_NO_REF (node_properties_dialog, dialog_action_area5, "dialog_action_area5");
302
GLADE_HOOKUP_OBJECT (node_properties_dialog, cancelbutton5, "cancelbutton5");
303
GLADE_HOOKUP_OBJECT (node_properties_dialog, okbutton5, "okbutton5");
305
return node_properties_dialog;
308
void on_icon_none_clicked(GtkMenuItem *menuitem, gpointer user_data)
310
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
312
GtkWidget *radio_ico_none = lookup_widget(pDlg->m_pDialog, "radio_ico_none");
313
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_none)))
315
GtkWidget *cbo2 = lookup_widget(pDlg->m_pDialog, "comboboxentry2");
316
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
317
GtkWidget *button = lookup_widget(pDlg->m_pDialog, "button_xpm_select");
319
gtk_widget_set_sensitive(cbo2, FALSE);
320
gtk_widget_set_sensitive(entry4, FALSE);
321
gtk_widget_set_sensitive(button, FALSE);
323
pDlg->UpdatePreview();
327
void on_icon_internal_clicked(GtkMenuItem *menuitem, gpointer user_data)
329
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
331
GtkWidget *radio_ico_internal = lookup_widget(pDlg->m_pDialog, "radio_ico_internal");
332
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_internal)))
334
GtkWidget *cbo2 = lookup_widget(pDlg->m_pDialog, "comboboxentry2");
335
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
336
GtkWidget *button = lookup_widget(pDlg->m_pDialog, "button_xpm_select");
338
gtk_widget_set_sensitive(cbo2, TRUE);
339
gtk_widget_set_sensitive(entry4, FALSE);
340
gtk_widget_set_sensitive(button, FALSE);
342
pDlg->UpdatePreview();
346
void on_icon_custom_clicked(GtkMenuItem *menuitem, gpointer user_data)
348
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
350
GtkWidget *radio_ico_custom = lookup_widget(pDlg->m_pDialog, "radio_ico_custom");
351
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_custom)))
353
GtkWidget *cbo2 = lookup_widget(pDlg->m_pDialog, "comboboxentry2");
354
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
355
GtkWidget *button = lookup_widget(pDlg->m_pDialog, "button_xpm_select");
357
gtk_widget_set_sensitive(cbo2, FALSE);
358
gtk_widget_set_sensitive(entry4, TRUE);
359
gtk_widget_set_sensitive(button, TRUE);
361
pDlg->UpdatePreview();
365
void on_xpm_select_clicked(GtkMenuItem *menuitem, gpointer user_data)
368
dlg.AddFilter(_("XPM icon file (*.xpm)"), "*.xpm");
371
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
372
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
373
gtk_entry_set_text(GTK_ENTRY(entry4), dlg.GetFilename());
375
pDlg->UpdatePreview();
379
void NodePropertiesDlg::UpdatePreview()
381
GtkWidget *image1 = lookup_widget(m_pDialog, "image1");
383
int nType = GetIconType();
384
if(ICON_INTERNAL == nType)
386
int nIcoIdx = InternalIcon_Name2Index(GetIconValue());
389
const char **szIconData = InternalIcon_GetFromIdx(nIcoIdx);
390
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (szIconData);
391
GdkPixbuf *destpix = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_NEAREST);
392
g_object_unref (G_OBJECT (pixbuf));
393
gtk_image_set_from_pixbuf (GTK_IMAGE(image1), destpix);
394
g_object_unref (G_OBJECT (destpix));
398
gtk_image_set_from_file(GTK_IMAGE(image1), NULL); //clear image
401
else if(ICON_CUSTOM == nType)
403
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(GetIconValue(), 16, 16, NULL);
405
gtk_image_set_from_pixbuf (GTK_IMAGE(image1), pixbuf);
406
g_object_unref (G_OBJECT (pixbuf));
410
gtk_image_set_from_file(GTK_IMAGE(image1), NULL); //clear image
414
gtk_image_set_from_file(GTK_IMAGE(image1), NULL); //clear image
417
void on_internal_combo_selected (GtkComboBox *widget, gpointer user_data)
419
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
420
pDlg->UpdatePreview();
1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Dialog to view/edit document node properties
7
////////////////////////////////////////////////////////////////////////////
9
#include "NodePropertiesDlg.h"
11
#include "callbacks.h"
12
#include "gui/FileDialog.h"
13
#include "lib/debug.h"
18
#define snprintf _snprintf
22
extern GtkWidget *g_pNodePropWidget;
23
extern GtkWidget *window1;
25
const char *InternalIcon_Index2Name(int nIndex);
26
const char **InternalIcon_GetFromIdx(int);
27
int InternalIcon_Name2Index(const char *);
28
int gtkMessageBox(const char *szText, int nButtons = GTK_BUTTONS_OK, int nIcon = GTK_MESSAGE_INFO);
29
const char *combo_get_text(GtkWidget *cbo3);
31
static void on_icon_none_clicked (GtkMenuItem *menuitem, gpointer user_data);
32
static void on_icon_internal_clicked (GtkMenuItem *menuitem, gpointer user_data);
33
static void on_icon_custom_clicked (GtkMenuItem *menuitem, gpointer user_data);
34
static void on_xpm_select_clicked (GtkMenuItem *menuitem, gpointer user_data);
35
static void on_internal_combo_selected (GtkComboBox *widget, gpointer user_data);
36
static void on_keyword_add_selected (GtkMenuItem *menuitem, gpointer user_data);
37
static void on_keyword_remove_selected (GtkMenuItem *menuitem, gpointer user_data);
38
static void on_finished_checked (GtkMenuItem *menuitem, gpointer user_data);
39
static void FormatTime(time_t nTime, std::string& strTxt);
41
NodePropertiesDlg::NodePropertiesDlg()
46
NodePropertiesDlg::~NodePropertiesDlg()
48
g_pNodePropWidget = NULL;
50
gtk_window_present(GTK_WINDOW(window1)); //activate main window
53
void NodePropertiesDlg::Create()
55
m_pDialog = create_node_properties_dialog ();
56
g_pNodePropWidget = m_pDialog;
59
if(m_strTitle.c_str())
61
GtkWidget *entry = lookup_widget(m_pDialog, "entry_node_title");
62
gtk_entry_set_text(GTK_ENTRY(entry), m_strTitle.c_str());
65
//fill internal icons combo
66
GtkWidget *cbo2 = lookup_widget(m_pDialog, "comboboxentry2");
67
for (int i=ICON_INTERNAL_FIRST; i<=ICON_INTERNAL_LAST; i++)
68
gtk_combo_box_append_text(GTK_COMBO_BOX(cbo2), InternalIcon_Index2Name(i));
70
//select first entry in combo (must not be empty selection)
71
gtk_combo_box_set_active(GTK_COMBO_BOX(cbo2), 0);
74
GtkWidget *cbo3 = lookup_widget(m_pDialog, "comboboxentry3");
75
std::string::size_type nPos = m_strKeywords.find(';');
76
while(nPos != std::string::npos){
77
std::string strWord = m_strKeywords.substr(0, nPos);
78
m_strKeywords = m_strKeywords.substr(nPos+1);
80
gtk_combo_box_append_text(GTK_COMBO_BOX(cbo3), strWord.c_str());
81
nPos = m_strKeywords.find(';');
83
if(m_strKeywords.size()>0)
84
gtk_combo_box_append_text(GTK_COMBO_BOX(cbo3), m_strKeywords.c_str());
85
//select first entry in combo
86
gtk_combo_box_set_active(GTK_COMBO_BOX(cbo3), 0);
88
//set dates (read only)
89
GtkWidget *label_created = lookup_widget(m_pDialog, "label_created");
90
GtkWidget *label_modified = lookup_widget(m_pDialog, "label_modified");
94
FormatTime(m_nCreated, strTxt);
95
gtk_label_set_text(GTK_LABEL(label_created), strTxt.c_str());
96
FormatTime(m_nModified, strTxt);
97
gtk_label_set_text(GTK_LABEL(label_modified), strTxt.c_str());
100
GtkWidget *chk_finished = lookup_widget(m_pDialog, "chk_finished");
101
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_finished), m_bFinished);
104
const char *NodePropertiesDlg::GetNodeTitle()
106
GtkWidget *entry = lookup_widget(m_pDialog, "entry_node_title");
107
return gtk_entry_get_text(GTK_ENTRY(entry));
110
void NodePropertiesDlg::RefreshKeywords()
112
GtkWidget *cbo3 = lookup_widget(m_pDialog, "comboboxentry3");
113
GtkTreeModel* model = gtk_combo_box_get_model (GTK_COMBO_BOX(cbo3));
116
gint nSize = gtk_tree_model_iter_n_children (model, NULL);
117
for(int i=0; i<nSize; i++)
120
gtk_tree_model_iter_nth_child (model, &iter, NULL, i);
123
gtk_tree_model_get (model, &iter, 0, &value, -1);
125
m_strKeywords += ";";
126
m_strKeywords += value;
131
m_strKeywords += ";"; //terminate list with delimiter
134
int NodePropertiesDlg::GetIconType()
136
GtkWidget *radio_ico_none = lookup_widget(m_pDialog, "radio_ico_none");
137
GtkWidget *radio_ico_internal = lookup_widget(m_pDialog, "radio_ico_internal");
139
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_none)))
141
else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_internal)))
142
return ICON_INTERNAL;
146
const char *NodePropertiesDlg::GetIconValue()
148
GtkWidget *cbo2 = lookup_widget(m_pDialog, "comboboxentry2");
149
GtkWidget *entry4 = lookup_widget(m_pDialog, "entry4");
151
switch (GetIconType())
153
case ICON_INTERNAL: return combo_get_text(cbo2);
154
case ICON_CUSTOM: return gtk_entry_get_text(GTK_ENTRY(entry4));
159
void NodePropertiesDlg::SetIconType(int nType)
161
GtkWidget *radio_ico_none = lookup_widget(m_pDialog, "radio_ico_none");
162
GtkWidget *radio_ico_internal = lookup_widget(m_pDialog, "radio_ico_internal");
163
GtkWidget *radio_ico_custom = lookup_widget(m_pDialog, "radio_ico_custom");
164
GtkWidget *cbo2 = lookup_widget(m_pDialog, "comboboxentry2");
166
if(ICON_NONE == nType)
168
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_ico_none), TRUE);
169
on_icon_none_clicked(NULL, this);
171
else if(ICON_CUSTOM == nType)
172
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_ico_custom), TRUE);
175
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_ico_internal), TRUE);
176
gtk_combo_box_set_active(GTK_COMBO_BOX(cbo2), nType);
182
void NodePropertiesDlg::SetIconValue(const char *szValue)
184
GtkWidget *entry4 = lookup_widget(m_pDialog, "entry4");
185
gtk_entry_set_text(GTK_ENTRY(entry4), szValue);
190
void NodePropertiesDlg::KeywordAdd()
192
GtkWidget *cbo3 = lookup_widget(m_pDialog, "comboboxentry3");
193
ASSERT(NULL != cbo3);
195
std::string strWord = combo_get_text(cbo3);
196
if(strWord.size() > 0)
198
TRACE("Add tag: %s\n", strWord.c_str());
200
//check if valid keyword
201
if(std::string::npos != strWord.find(';')){
202
gtkMessageBox(_("Keyword must not contain \";\" character!"));
206
//check if keyword already exists
207
GtkTreeModel* model = gtk_combo_box_get_model (GTK_COMBO_BOX(cbo3));
208
gint nSize = gtk_tree_model_iter_n_children (model, NULL);
209
for(int i=0; i<nSize; i++)
212
gtk_tree_model_iter_nth_child (model, &iter, NULL, i);
214
gtk_tree_model_get (model, &iter, 0, &value, -1);
216
if(value && 0 == strcmp(strWord.c_str(), value))
218
gtkMessageBox(_("This keyword was already added for this node!"));
225
TRACE("Append tag\n");
228
gtk_combo_box_append_text(GTK_COMBO_BOX(cbo3), strWord.c_str());
232
void NodePropertiesDlg::KeywordRemove()
234
GtkWidget *cbo3 = lookup_widget(m_pDialog, "comboboxentry3");
236
std::string strWord = combo_get_text(cbo3);
237
if(strWord.size() > 0)
239
//search for the keyword in the combo
240
GtkTreeModel* model = gtk_combo_box_get_model (GTK_COMBO_BOX(cbo3));
241
gint nSize = gtk_tree_model_iter_n_children (model, NULL);
242
for(int i=0; i<nSize; i++)
245
gtk_tree_model_iter_nth_child (model, &iter, NULL, i);
247
gtk_tree_model_get (model, &iter, 0, &value, -1);
249
if(0 == strcmp(strWord.c_str(), value))
252
gtk_combo_box_remove_text(GTK_COMBO_BOX(cbo3), i);
260
//TOFIX how to clear entry part of the combo
261
//gtk_combo_box_set_active(GTK_COMBO_BOX(cbo3), -1);
264
GtkWidget* NodePropertiesDlg::create_node_properties_dialog ()
266
GtkWidget *node_properties_dialog;
267
GtkWidget *dialog_vbox5;
270
GtkWidget *entry_node_title;
275
GtkWidget *radio_ico_none;
276
GSList *radio_ico_none_group = NULL;
277
GtkWidget *radio_ico_internal;
278
GtkWidget *radio_ico_custom;
281
GtkWidget *comboboxentry3;
286
GtkWidget *removebtn;
287
GtkWidget *button_xpm_select;
288
GtkWidget *comboboxentry2;
289
GtkWidget *dialog_action_area5;
290
GtkWidget *cancelbutton5;
291
GtkWidget *okbutton5;
293
GtkWidget *label_created;
295
GtkWidget *label_modified;
296
GtkWidget *chk_finished;
298
node_properties_dialog = gtk_dialog_new ();
299
gtk_window_set_title (GTK_WINDOW (node_properties_dialog), _("Node Properties"));
300
gtk_window_set_type_hint (GTK_WINDOW (node_properties_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
302
dialog_vbox5 = GTK_DIALOG (node_properties_dialog)->vbox;
303
gtk_widget_show (dialog_vbox5);
305
table4 = gtk_table_new (2, 2, FALSE);
306
gtk_widget_show (table4);
307
gtk_box_pack_start (GTK_BOX (dialog_vbox5), table4, TRUE, TRUE, 0);
309
label21 = gtk_label_new (_("Title:"));
310
gtk_widget_show (label21);
311
gtk_table_attach (GTK_TABLE (table4), label21, 0, 1, 0, 1,
312
(GtkAttachOptions) (GTK_FILL),
313
(GtkAttachOptions) (0), 0, 0);
314
gtk_misc_set_alignment (GTK_MISC (label21), 0, 0.5);
316
entry_node_title = gtk_entry_new ();
317
gtk_widget_show (entry_node_title);
318
gtk_table_attach (GTK_TABLE (table4), entry_node_title, 1, 2, 0, 1,
319
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
320
(GtkAttachOptions) (0), 0, 0);
323
GtkAccelGroup *accel_group = gtk_accel_group_new ();
324
GClosure *closure = g_cclosure_new (G_CALLBACK (on_menu_insert_date_time), NULL, NULL);
325
gtk_accel_group_connect (accel_group, 'T', (GdkModifierType)(GDK_CONTROL_MASK|GDK_SHIFT_MASK), GTK_ACCEL_VISIBLE, closure);
326
g_closure_unref (closure);
327
gtk_window_add_accel_group (GTK_WINDOW (node_properties_dialog), accel_group);
329
label25 = gtk_label_new (_("Created:"));
330
gtk_widget_show (label25);
331
gtk_table_attach (GTK_TABLE (table4), label25, 0, 1, 1, 2,
332
(GtkAttachOptions) (GTK_FILL),
333
(GtkAttachOptions) (0), 0, 0);
334
gtk_misc_set_alignment (GTK_MISC (label25), 0, 0.5);
336
label_created = gtk_label_new (_("unknown"));
337
gtk_widget_show (label_created);
338
gtk_table_attach (GTK_TABLE (table4), label_created, 1, 2, 1, 2,
339
(GtkAttachOptions) (GTK_FILL),
340
(GtkAttachOptions) (0), 0, 0);
341
gtk_misc_set_alignment (GTK_MISC (label_created), 0, 0.5);
343
label26 = gtk_label_new (_("Modified:"));
344
gtk_widget_show (label26);
345
gtk_table_attach (GTK_TABLE (table4), label26, 0, 1, 2, 3,
346
(GtkAttachOptions) (GTK_FILL),
347
(GtkAttachOptions) (0), 0, 0);
348
gtk_misc_set_alignment (GTK_MISC (label26), 0, 0.5);
350
label_modified = gtk_label_new (_("unknown"));
351
gtk_widget_show (label_modified);
352
gtk_table_attach (GTK_TABLE (table4), label_modified, 1, 2, 2, 3,
353
(GtkAttachOptions) (GTK_FILL),
354
(GtkAttachOptions) (0), 0, 0);
355
gtk_misc_set_alignment (GTK_MISC (label_modified), 0, 0.5);
357
label22 = gtk_label_new (_("Icon:"));
358
gtk_widget_show (label22);
359
gtk_table_attach (GTK_TABLE (table4), label22, 0, 1, 3, 4,
360
(GtkAttachOptions) (GTK_FILL),
361
(GtkAttachOptions) (0), 0, 0);
362
gtk_misc_set_alignment (GTK_MISC (label22), 0, 0);
364
vbox10 = gtk_vbox_new (FALSE, 0);
365
gtk_widget_show (vbox10);
366
gtk_table_attach (GTK_TABLE (table4), vbox10, 1, 2, 3, 4,
367
(GtkAttachOptions) (GTK_FILL),
368
(GtkAttachOptions) (GTK_FILL), 0, 0);
370
hbox2 = gtk_hbox_new (FALSE, 0);
371
gtk_widget_show (hbox2);
372
gtk_box_pack_start (GTK_BOX (vbox10), hbox2, FALSE, FALSE, 0);
374
table6 = gtk_table_new (4, 3, FALSE);
375
gtk_widget_show (table6);
376
gtk_box_pack_start (GTK_BOX (hbox2), table6, TRUE, TRUE, 0);
378
radio_ico_none = gtk_radio_button_new_with_mnemonic (NULL, _("None"));
379
gtk_widget_show (radio_ico_none);
380
gtk_table_attach (GTK_TABLE (table6), radio_ico_none, 0, 1, 0, 1,
381
(GtkAttachOptions) (GTK_FILL),
382
(GtkAttachOptions) (0), 0, 0);
383
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_ico_none), radio_ico_none_group);
384
radio_ico_none_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_ico_none));
386
radio_ico_internal = gtk_radio_button_new_with_mnemonic (NULL, _("Internal"));
387
gtk_widget_show (radio_ico_internal);
388
gtk_table_attach (GTK_TABLE (table6), radio_ico_internal, 0, 1, 1, 2,
389
(GtkAttachOptions) (GTK_FILL),
390
(GtkAttachOptions) (0), 0, 0);
391
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_ico_internal), radio_ico_none_group);
392
radio_ico_none_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_ico_internal));
394
radio_ico_custom = gtk_radio_button_new_with_mnemonic (NULL, _("Custom"));
395
gtk_widget_show (radio_ico_custom);
396
gtk_table_attach (GTK_TABLE (table6), radio_ico_custom, 0, 1, 2, 3,
397
(GtkAttachOptions) (GTK_FILL),
398
(GtkAttachOptions) (0), 0, 0);
399
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_ico_custom), radio_ico_none_group);
400
radio_ico_none_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_ico_custom));
402
comboboxentry2 = gtk_combo_box_new_text ();
403
gtk_widget_show (comboboxentry2);
404
gtk_table_attach (GTK_TABLE (table6), comboboxentry2, 1, 2, 1, 2,
405
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
406
(GtkAttachOptions) (GTK_FILL), 0, 0);
408
entry4 = gtk_entry_new ();
409
gtk_entry_set_editable (GTK_ENTRY(entry4), FALSE);
410
gtk_widget_show (entry4);
411
gtk_table_attach (GTK_TABLE (table6), entry4, 1, 2, 2, 3,
412
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
413
(GtkAttachOptions) (0), 0, 0);
415
button_xpm_select = gtk_button_new_with_mnemonic ("...");
416
gtk_widget_show (button_xpm_select);
417
gtk_table_attach (GTK_TABLE (table6), button_xpm_select, 2, 3, 2, 3,
418
(GtkAttachOptions) (GTK_FILL),
419
(GtkAttachOptions) (0), 0, 0);
421
label23 = gtk_label_new (_("Preview:"));
422
gtk_widget_show (label23);
423
gtk_table_attach (GTK_TABLE (table6), label23, 0, 1, 4, 5,
424
(GtkAttachOptions) (GTK_FILL),
425
(GtkAttachOptions) (0), 0, 0);
426
gtk_misc_set_alignment (GTK_MISC (label23), 0, 0.5);
428
image1 = gtk_image_new ();
429
gtk_widget_show (image1);
430
gtk_widget_set_size_request(image1, -1, 20);
431
gtk_table_attach (GTK_TABLE (table6), image1, 1, 2, 4, 5,
432
(GtkAttachOptions) (GTK_FILL),
433
(GtkAttachOptions) (GTK_FILL), 0, 0);
435
label24 = gtk_label_new (_("Tags:"));
436
gtk_widget_show (label24);
437
gtk_table_attach (GTK_TABLE (table4), label24, 0, 1, 5, 6,
438
(GtkAttachOptions) (GTK_FILL),
439
(GtkAttachOptions) (0), 0, 0);
440
gtk_misc_set_alignment (GTK_MISC (label24), 0, 0.5);
442
hbox3 = gtk_hbox_new (FALSE, 0);
443
gtk_widget_show (hbox3);
444
gtk_table_attach (GTK_TABLE (table4), hbox3, 1, 2, 5, 6,
445
(GtkAttachOptions) (GTK_FILL),
446
(GtkAttachOptions) (0), 0, 0);
448
comboboxentry3 = gtk_combo_box_entry_new_text ();
449
gtk_widget_show (comboboxentry3);
450
gtk_box_pack_start (GTK_BOX (hbox3), comboboxentry3, TRUE, TRUE, 0);
452
addbtn = gtk_button_new_with_mnemonic (_("Add"));
453
gtk_widget_show (addbtn);
454
gtk_box_pack_start (GTK_BOX (hbox3), addbtn, TRUE, TRUE, 0);
456
removebtn = gtk_button_new_with_mnemonic (_("Remove"));
457
gtk_widget_show (removebtn);
458
gtk_box_pack_start (GTK_BOX (hbox3), removebtn, TRUE, TRUE, 0);
460
chk_finished = gtk_check_button_new_with_mnemonic (_("Mark node as finished"));
461
gtk_widget_show (chk_finished);
462
gtk_table_attach (GTK_TABLE (table4), chk_finished, 0, 2, 6, 7,
463
(GtkAttachOptions) (GTK_FILL),
464
(GtkAttachOptions) (0), 0, 0);
466
dialog_action_area5 = GTK_DIALOG (node_properties_dialog)->action_area;
467
gtk_widget_show (dialog_action_area5);
468
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area5), GTK_BUTTONBOX_END);
470
cancelbutton5 = gtk_button_new_from_stock ("gtk-cancel");
471
gtk_widget_show (cancelbutton5);
472
gtk_dialog_add_action_widget (GTK_DIALOG (node_properties_dialog), cancelbutton5, GTK_RESPONSE_CANCEL);
473
GTK_WIDGET_SET_FLAGS (cancelbutton5, GTK_CAN_DEFAULT);
475
okbutton5 = gtk_button_new_from_stock ("gtk-ok");
476
gtk_widget_show (okbutton5);
477
gtk_dialog_add_action_widget (GTK_DIALOG (node_properties_dialog), okbutton5, GTK_RESPONSE_OK);
478
GTK_WIDGET_SET_FLAGS (okbutton5, GTK_CAN_DEFAULT);
480
g_signal_connect (radio_ico_none, "clicked", G_CALLBACK (on_icon_none_clicked), this);
481
g_signal_connect (radio_ico_internal, "clicked", G_CALLBACK (on_icon_internal_clicked), this);
482
g_signal_connect (radio_ico_custom, "clicked", G_CALLBACK (on_icon_custom_clicked), this);
483
g_signal_connect (button_xpm_select, "clicked", G_CALLBACK (on_xpm_select_clicked), this);
484
g_signal_connect (comboboxentry2, "changed", G_CALLBACK (on_internal_combo_selected), this);
485
g_signal_connect (addbtn, "clicked", G_CALLBACK (on_keyword_add_selected), this);
486
g_signal_connect (removebtn, "clicked", G_CALLBACK (on_keyword_remove_selected), this);
487
g_signal_connect (chk_finished, "clicked", G_CALLBACK (on_finished_checked), this);
489
/* Store pointers to all widgets, for use by lookup_widget(). */
490
GLADE_HOOKUP_OBJECT_NO_REF (node_properties_dialog, node_properties_dialog, "node_properties_dialog");
491
GLADE_HOOKUP_OBJECT_NO_REF (node_properties_dialog, dialog_vbox5, "dialog_vbox5");
492
GLADE_HOOKUP_OBJECT (node_properties_dialog, table4, "table4");
493
GLADE_HOOKUP_OBJECT (node_properties_dialog, label21, "label21");
494
GLADE_HOOKUP_OBJECT (node_properties_dialog, entry_node_title, "entry_node_title");
495
GLADE_HOOKUP_OBJECT (node_properties_dialog, label22, "label22");
496
GLADE_HOOKUP_OBJECT (node_properties_dialog, vbox10, "vbox10");
497
GLADE_HOOKUP_OBJECT (node_properties_dialog, hbox2, "hbox2");
498
GLADE_HOOKUP_OBJECT (node_properties_dialog, table6, "table6");
499
GLADE_HOOKUP_OBJECT (node_properties_dialog, radio_ico_none, "radio_ico_none");
500
GLADE_HOOKUP_OBJECT (node_properties_dialog, radio_ico_internal, "radio_ico_internal");
501
GLADE_HOOKUP_OBJECT (node_properties_dialog, radio_ico_custom, "radio_ico_custom");
502
GLADE_HOOKUP_OBJECT (node_properties_dialog, entry4, "entry4");
503
GLADE_HOOKUP_OBJECT (node_properties_dialog, label23, "label23");
504
GLADE_HOOKUP_OBJECT (node_properties_dialog, hbox3, "hbox3");
505
GLADE_HOOKUP_OBJECT (node_properties_dialog, label24, "label24");
506
GLADE_HOOKUP_OBJECT (node_properties_dialog, comboboxentry3, "comboboxentry3");
507
GLADE_HOOKUP_OBJECT (node_properties_dialog, addbtn, "addbtn");
508
GLADE_HOOKUP_OBJECT (node_properties_dialog, removebtn, "removebtn");
509
GLADE_HOOKUP_OBJECT (node_properties_dialog, image1, "image1");
510
GLADE_HOOKUP_OBJECT (node_properties_dialog, button_xpm_select, "button_xpm_select");
511
GLADE_HOOKUP_OBJECT (node_properties_dialog, comboboxentry2, "comboboxentry2");
512
GLADE_HOOKUP_OBJECT_NO_REF (node_properties_dialog, dialog_action_area5, "dialog_action_area5");
513
GLADE_HOOKUP_OBJECT (node_properties_dialog, cancelbutton5, "cancelbutton5");
514
GLADE_HOOKUP_OBJECT (node_properties_dialog, okbutton5, "okbutton5");
515
GLADE_HOOKUP_OBJECT (node_properties_dialog, label_created, "label_created");
516
GLADE_HOOKUP_OBJECT (node_properties_dialog, label_modified, "label_modified");
517
GLADE_HOOKUP_OBJECT (node_properties_dialog, chk_finished, "chk_finished");
520
return node_properties_dialog;
523
void on_icon_none_clicked(GtkMenuItem *menuitem, gpointer user_data)
525
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
527
GtkWidget *radio_ico_none = lookup_widget(pDlg->m_pDialog, "radio_ico_none");
528
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_none)))
530
GtkWidget *cbo2 = lookup_widget(pDlg->m_pDialog, "comboboxentry2");
531
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
532
GtkWidget *button = lookup_widget(pDlg->m_pDialog, "button_xpm_select");
534
gtk_widget_set_sensitive(cbo2, FALSE);
535
gtk_widget_set_sensitive(entry4, FALSE);
536
gtk_widget_set_sensitive(button, FALSE);
538
pDlg->UpdatePreview();
542
void on_icon_internal_clicked(GtkMenuItem *menuitem, gpointer user_data)
544
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
546
GtkWidget *radio_ico_internal = lookup_widget(pDlg->m_pDialog, "radio_ico_internal");
547
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_internal)))
549
GtkWidget *cbo2 = lookup_widget(pDlg->m_pDialog, "comboboxentry2");
550
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
551
GtkWidget *button = lookup_widget(pDlg->m_pDialog, "button_xpm_select");
553
gtk_widget_set_sensitive(cbo2, TRUE);
554
gtk_widget_set_sensitive(entry4, FALSE);
555
gtk_widget_set_sensitive(button, FALSE);
557
pDlg->UpdatePreview();
561
void on_icon_custom_clicked(GtkMenuItem *menuitem, gpointer user_data)
563
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
565
GtkWidget *radio_ico_custom = lookup_widget(pDlg->m_pDialog, "radio_ico_custom");
566
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_ico_custom)))
568
GtkWidget *cbo2 = lookup_widget(pDlg->m_pDialog, "comboboxentry2");
569
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
570
GtkWidget *button = lookup_widget(pDlg->m_pDialog, "button_xpm_select");
572
gtk_widget_set_sensitive(cbo2, FALSE);
573
gtk_widget_set_sensitive(entry4, TRUE);
574
gtk_widget_set_sensitive(button, TRUE);
576
pDlg->UpdatePreview();
580
void on_xpm_select_clicked(GtkMenuItem *menuitem, gpointer user_data)
583
dlg.AddFilter(_("XPM icon file (*.xpm)"), "*.xpm");
586
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
587
GtkWidget *entry4 = lookup_widget(pDlg->m_pDialog, "entry4");
588
gtk_entry_set_text(GTK_ENTRY(entry4), dlg.GetFilename());
590
pDlg->UpdatePreview();
594
void NodePropertiesDlg::UpdatePreview()
596
GtkWidget *image1 = lookup_widget(m_pDialog, "image1");
598
int nType = GetIconType();
599
if(ICON_INTERNAL == nType)
601
int nIcoIdx = InternalIcon_Name2Index(GetIconValue());
604
const char **szIconData = InternalIcon_GetFromIdx(nIcoIdx);
605
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (szIconData);
606
GdkPixbuf *destpix = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
607
g_object_unref (G_OBJECT (pixbuf));
608
gtk_image_set_from_pixbuf (GTK_IMAGE(image1), destpix);
609
g_object_unref (G_OBJECT (destpix));
613
gtk_image_set_from_file(GTK_IMAGE(image1), NULL); //clear image
616
else if(ICON_CUSTOM == nType)
618
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(GetIconValue(), 16, 16, NULL);
620
gtk_image_set_from_pixbuf (GTK_IMAGE(image1), pixbuf);
621
g_object_unref (G_OBJECT (pixbuf));
625
gtk_image_set_from_file(GTK_IMAGE(image1), NULL); //clear image
629
gtk_image_set_from_file(GTK_IMAGE(image1), NULL); //clear image
632
void on_internal_combo_selected (GtkComboBox *widget, gpointer user_data)
634
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
635
pDlg->UpdatePreview();
638
void on_keyword_add_selected (GtkMenuItem *menuitem, gpointer user_data)
640
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
644
void on_keyword_remove_selected (GtkMenuItem *menuitem, gpointer user_data)
646
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
647
pDlg->KeywordRemove();
650
void on_finished_checked (GtkMenuItem *menuitem, gpointer user_data)
652
NodePropertiesDlg *pDlg = (NodePropertiesDlg *)user_data;
653
GtkWidget *chk_finished = lookup_widget(pDlg->m_pDialog, "chk_finished");
654
if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(chk_finished)))
655
pDlg->m_bFinished = true;
657
pDlg->m_bFinished = false;
660
void FormatTime(time_t nTime, std::string& strTxt)
662
struct tm *pTM = localtime(&nTime);
665
snprintf(szTime, sizeof(szTime), "%d.%02d.%02d %02d:%02d:%02d", pTM->tm_year+1900, pTM->tm_mon+1, pTM->tm_mday, pTM->tm_hour, pTM->tm_min, pTM->tm_sec);
670
const char *combo_get_text(GtkWidget *cbo3)
672
//FIX: gtk_combo_box_get_active_text API crashes on Zaurus
674
return gtk_entry_get_text(GTK_ENTRY(GTK_BIN(cbo3)->child));
676
#if GTK_CHECK_VERSION(2,6,0) //new API //TOFIX set proper version//
677
return gtk_combo_box_get_active_text (GTK_COMBO_BOX(cbo3));
679
int nPos = gtk_combo_box_get_active(GTK_COMBO_BOX(cbo3));
682
GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbo3));
685
sprintf(szPath, "%d", nPos);
686
GtkTreePath *path1 = gtk_tree_path_new_from_string (szPath);
687
if(gtk_tree_model_get_iter(model, &iter, path1))
690
gtk_tree_model_get (model, &iter, 0, &value, -1);
695
else //TOFIX get text from entry