Get rid of deprecated use of GtkComboBox text functions in favour of GtkComboBoxText.
[claws.git] / src / plugins / rssyl / rssyl_feed_props.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2004 Hiroyuki Yamamoto
4  * This file (C) 2005 Andrej Kacian <andrej@kacian.sk>
5  *
6  * - Plugin preferences
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #  include "config.h"
25 #endif
26
27 /* Global includes */
28 #include <glib.h>
29 #include <glib/gi18n.h>
30 #include <gdk/gdkkeysyms.h>
31
32 /* Claws Mail includes */
33 #include <mainwindow.h>
34
35 /* Local includes */
36 #include "rssyl.h"
37 #include "rssyl_feed.h"
38 #include "rssyl_feed_props.h"
39 #include "rssyl_prefs.h"
40 #include "rssyl_update_feed.h"
41
42 static void rssyl_gtk_prop_store(RFolderItem *ritem)
43 {
44         gchar *url;
45         gint x, old_ri, old_fetch_comments;
46         gboolean use_default_ri = FALSE, keep_old = FALSE;
47         FolderItem *item;
48
49         g_return_if_fail(ritem != NULL);
50         g_return_if_fail(ritem->feedprop != NULL);
51
52         url = (gchar *)gtk_entry_get_text(GTK_ENTRY(ritem->feedprop->url));
53
54         if( strlen(url) ) {
55                 if( ritem->url ) {
56                         g_free(ritem->url);
57                 }
58                 ritem->url = g_strdup(url);
59         }
60
61         use_default_ri = gtk_toggle_button_get_active(
62                         GTK_TOGGLE_BUTTON(ritem->feedprop->default_refresh_interval));
63         ritem->default_refresh_interval = use_default_ri;
64         debug_print("store: default refresh interval is %s\n",
65                         ( use_default_ri ? "ON" : "OFF" ) );
66
67         /* Use default if checkbutton is set */
68         if( use_default_ri )
69                 x = rssyl_prefs_get()->refresh;
70         else
71                 x = gtk_spin_button_get_value_as_int(
72                                 GTK_SPIN_BUTTON(ritem->feedprop->refresh_interval) );
73
74         old_ri = ritem->refresh_interval;
75         ritem->refresh_interval = x;
76
77         /* Set timer for next automatic refresh, if needed. */
78         if( x > 0 ) {
79                 if( old_ri != x || ritem->refresh_id == 0 ) {
80                         debug_print("RSSyl: GTK - refresh interval changed to %d , updating "
81                                         "timeout\n", ritem->refresh_interval);
82                         rssyl_feed_start_refresh_timeout(ritem);
83                 }
84         } else
85                 ritem->refresh_id = 0;
86
87         old_fetch_comments = ritem->fetch_comments;
88         ritem->fetch_comments = gtk_toggle_button_get_active(
89                         GTK_TOGGLE_BUTTON(ritem->feedprop->fetch_comments));
90
91         if (!old_fetch_comments && ritem->fetch_comments) {
92                 /* reset the RFolderItem's mtime to be sure we get all 
93                  * available comments */
94                  ritem->item.mtime = 0;
95         }
96         
97         ritem->fetch_comments_max_age = gtk_spin_button_get_value_as_int(
98                         GTK_SPIN_BUTTON(ritem->feedprop->fetch_comments_max_age));
99
100         keep_old = gtk_toggle_button_get_active(
101                         GTK_TOGGLE_BUTTON(ritem->feedprop->keep_old));
102         ritem->keep_old = keep_old;
103
104         ritem->silent_update =
105                 gtk_combo_box_get_active(GTK_COMBO_BOX(ritem->feedprop->silent_update));
106
107         ritem->write_heading = gtk_toggle_button_get_active(
108                         GTK_TOGGLE_BUTTON(ritem->feedprop->write_heading));
109
110         ritem->ignore_title_rename = gtk_toggle_button_get_active(
111                         GTK_TOGGLE_BUTTON(ritem->feedprop->ignore_title_rename));
112
113         ritem->ssl_verify_peer = gtk_toggle_button_get_active(
114                         GTK_TOGGLE_BUTTON(ritem->feedprop->ssl_verify_peer));
115
116         /* Store updated properties */
117         item = &ritem->item;
118         item->folder->klass->item_get_xml(item->folder, item);
119 }
120
121 static gboolean
122 rssyl_feedprop_togglebutton_toggled_cb(GtkToggleButton *tb,
123                 gpointer data)
124 {
125         gboolean active = gtk_toggle_button_get_active(tb);
126         RFeedProp *feedprop = (RFeedProp *)data;
127         GtkWidget *sb = NULL;
128
129         if( (GtkWidget *)tb == feedprop->default_refresh_interval ) {
130                 active = !active;
131                 sb = feedprop->refresh_interval;
132         } else if( (GtkWidget *)tb == feedprop->fetch_comments ) {
133                 sb = feedprop->fetch_comments_max_age;
134         }
135
136         g_return_val_if_fail(sb != NULL, FALSE);
137
138         gtk_widget_set_sensitive(sb, active);
139
140         return FALSE;
141 }
142
143
144 static gboolean
145 rssyl_props_cancel_cb(GtkWidget *widget, gpointer data)
146 {
147         RFolderItem *ritem = (RFolderItem *)data;
148
149         debug_print("RSSyl: Cancel pressed\n");
150
151         gtk_widget_destroy(ritem->feedprop->window);
152
153         return FALSE;
154 }
155
156 static gboolean
157 rssyl_props_ok_cb(GtkWidget *widget, gpointer data)
158 {
159         RFolderItem *ritem = (RFolderItem *)data;
160
161         debug_print("RSSyl: OK pressed\n");
162         rssyl_gtk_prop_store(ritem);
163
164         gtk_widget_destroy(ritem->feedprop->window);
165
166         return FALSE;
167 }
168
169 static gboolean
170 rssyl_props_trim_cb(GtkWidget *widget, gpointer data)
171 {
172         RFolderItem *ritem = (RFolderItem *)data;
173         gboolean k = ritem->keep_old;
174
175         if( k )
176                 ritem->keep_old = FALSE;
177
178         rssyl_update_feed(ritem, FALSE);
179
180         if( k )
181                 ritem->keep_old = TRUE;
182
183         return FALSE;
184 }
185
186 static gboolean
187 rssyl_props_key_press_cb(GtkWidget *widget, GdkEventKey *event,
188                 gpointer data)
189 {
190         if (event) {
191                 switch (event->keyval) {
192                         case GDK_Escape:
193                                 rssyl_props_cancel_cb(widget, data);
194                                 return TRUE;
195                         case GDK_Return:
196                         case GDK_KP_Enter:
197                                 rssyl_props_ok_cb(widget, data);
198                                 return TRUE;
199                         default:
200                                 break;
201                 }
202         }
203
204         return FALSE;
205 }
206
207
208 void rssyl_gtk_prop(RFolderItem *ritem)
209 {
210         MainWindow *mainwin = mainwindow_get_mainwindow();
211         RFeedProp *feedprop;
212         GtkWidget *vbox, *urllabel, *urlframe, *urlalign, *table, *label,
213                                                 *hsep, *sep, *bbox, *cancel_button, *cancel_align,
214                                                 *cancel_hbox, *cancel_image, *cancel_label, *ok_button, *ok_align,
215                                                 *ok_hbox, *ok_image, *ok_label, *trim_button, *silent_update_label;
216         GtkObject *adj;
217 #if !(GTK_CHECK_VERSION(2, 12, 0))
218         GtkTooltips *tooltips;
219 #endif
220         gint refresh;
221         gint row = 0;
222
223         g_return_if_fail(ritem != NULL);
224
225         feedprop = g_new0(RFeedProp, 1);
226
227         /**** Create required widgets ****/
228
229         /* Window */
230         feedprop->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
231
232 #if !(GTK_CHECK_VERSION(2, 12, 0))
233         tooltips = gtk_tooltips_new();
234         gtk_tooltips_enable(tooltips);
235 #endif
236
237         /* URL entry */
238         feedprop->url = gtk_entry_new();
239         gtk_entry_set_text(GTK_ENTRY(feedprop->url), ritem->url);
240
241         /* "Use default refresh interval" checkbutton */
242         feedprop->default_refresh_interval = gtk_check_button_new_with_mnemonic(
243                         _("Use default refresh interval"));
244         gtk_toggle_button_set_active(
245                         GTK_TOGGLE_BUTTON(feedprop->default_refresh_interval),
246                         ritem->default_refresh_interval);
247
248         if( ritem->refresh_interval >= 0 && !ritem->default_refresh_interval )
249                 refresh = ritem->refresh_interval;
250         else
251                 refresh = rssyl_prefs_get()->refresh;
252
253         /* "Keep old items" checkbutton */
254         feedprop->keep_old = gtk_check_button_new_with_mnemonic(
255                         _("Keep old items"));
256         gtk_toggle_button_set_active(
257                         GTK_TOGGLE_BUTTON(feedprop->keep_old),
258                         ritem->keep_old);
259
260         /* "Trim" button */
261         trim_button = gtk_button_new_with_mnemonic(_("_Trim"));
262 #if !(GTK_CHECK_VERSION(2, 12, 0))
263         gtk_tooltips_set_tip(tooltips, trim_button,
264                         _("Update feed, deleting items which are no longer in the source feed"), NULL);
265 #else
266         gtk_widget_set_tooltip_text(trim_button,
267                         _("Update feed, deleting items which are no longer in the source feed"));
268 #endif
269
270         feedprop->fetch_comments = gtk_check_button_new_with_mnemonic(
271                         _("Fetch comments if possible"));
272         gtk_toggle_button_set_active(
273                         GTK_TOGGLE_BUTTON(feedprop->fetch_comments),
274                         ritem->fetch_comments);
275
276         /* Fetch comments max age spinbutton */
277         adj = gtk_adjustment_new(ritem->fetch_comments_max_age,
278                         -1, 100000, 1, 10, 0);
279         feedprop->fetch_comments_max_age = gtk_spin_button_new(GTK_ADJUSTMENT(adj),
280                         1, 0);
281
282         /* Refresh interval spinbutton */
283         adj = gtk_adjustment_new(refresh,
284                         0, 100000, 10, 100, 0);
285         feedprop->refresh_interval = gtk_spin_button_new(GTK_ADJUSTMENT(adj),
286                         1, 0);
287
288         /* Silent update - combobox */
289         feedprop->silent_update = gtk_combo_box_text_new();
290         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->silent_update),
291                         _("Always mark as new"));
292         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->silent_update),
293                         _("If only its text changed"));
294         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->silent_update),
295                         _("Never mark as new"));
296         gtk_combo_box_set_active(GTK_COMBO_BOX(feedprop->silent_update),
297                         ritem->silent_update);
298
299         feedprop->write_heading = gtk_check_button_new_with_mnemonic(
300                         _("Add item title to top of message"));
301         gtk_toggle_button_set_active(
302                         GTK_TOGGLE_BUTTON(feedprop->write_heading),
303                         ritem->write_heading);
304
305         /* Ignore title rename - checkbox */
306         feedprop->ignore_title_rename = gtk_check_button_new_with_mnemonic(
307                         _("Ignore title rename"));
308         gtk_toggle_button_set_active(
309                         GTK_TOGGLE_BUTTON(feedprop->ignore_title_rename),
310                         ritem->ignore_title_rename);
311 #if !(GTK_CHECK_VERSION(2, 12, 0))
312         gtk_tooltips_set_tip(tooltips, feedprop->ignore_title_rename,
313                         _("Enable this to keep current folder name, even if feed author changes title of the feed."), NULL);
314 #else
315         gtk_widget_set_tooltip_text(feedprop->ignore_title_rename,
316                         _("Enable this to keep current folder name, even if feed author changes title of the feed."));
317 #endif
318
319         /* Verify SSL peer certificate */
320         feedprop->ssl_verify_peer = gtk_check_button_new_with_label(
321                         _("Verify SSL certificate validity"));
322         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(feedprop->ssl_verify_peer),
323                         ritem->ssl_verify_peer);
324
325         /* === Now pack all the widgets */
326         vbox = gtk_vbox_new(FALSE, 0);
327         gtk_container_add(GTK_CONTAINER(feedprop->window), vbox);
328
329         /* URL frame */
330         urlframe = gtk_frame_new(NULL);
331         gtk_container_set_border_width(GTK_CONTAINER(urlframe), 5);
332         gtk_frame_set_label_align(GTK_FRAME(urlframe), 0.05, 0.5);
333         gtk_frame_set_shadow_type(GTK_FRAME(urlframe), GTK_SHADOW_ETCHED_OUT);
334         gtk_box_pack_start(GTK_BOX(vbox), urlframe, FALSE, FALSE, 0);
335
336         /* Label for URL frame */
337         urllabel = gtk_label_new(_("<b>Source URL:</b>"));
338         gtk_label_set_use_markup(GTK_LABEL(urllabel), TRUE);
339         gtk_misc_set_padding(GTK_MISC(urllabel), 5, 0);
340         gtk_frame_set_label_widget(GTK_FRAME(urlframe), urllabel);
341
342         /* URL entry (+ alignment in frame) */
343         urlalign = gtk_alignment_new(0, 0.5, 1, 1);
344         gtk_alignment_set_padding(GTK_ALIGNMENT(urlalign), 5, 5, 5, 5);
345         gtk_container_add(GTK_CONTAINER(urlframe), urlalign);
346
347         gtk_entry_set_activates_default(GTK_ENTRY(feedprop->url), TRUE);
348         gtk_container_add(GTK_CONTAINER(urlalign), feedprop->url);
349
350         /* Table for remaining properties */
351         table = gtk_table_new(11, 2, FALSE);
352         gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
353
354         /* Fetch comments - checkbutton */
355         gtk_table_attach(GTK_TABLE(table), feedprop->fetch_comments,
356                         0, 2, row, row+1,
357                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
358                         (GtkAttachOptions) (0), 10, 0);
359         g_signal_connect(G_OBJECT(feedprop->fetch_comments), "toggled",
360                         G_CALLBACK(rssyl_feedprop_togglebutton_toggled_cb),
361                         (gpointer)feedprop);
362
363         row++;
364         /* Fetch comments max age - label */
365         label = gtk_label_new(_("<b>Fetch comments on posts aged less than:</b>\n"
366                                 "<small>(In days; set to -1 to fetch all comments)</small>"));
367         gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
368         gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
369         gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1,
370                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
371                         (GtkAttachOptions) (0), 10, 5);
372
373         /* Fetch comments max age - spinbutton */
374         gtk_widget_set_sensitive(feedprop->fetch_comments_max_age,
375                         ritem->fetch_comments);
376         gtk_table_attach(GTK_TABLE(table), feedprop->fetch_comments_max_age,
377                         1, 2, row, row+1,
378                         (GtkAttachOptions) (0),
379                         (GtkAttachOptions) (0), 10, 5);
380
381         row++;
382         /* Separator below comments max age */
383         hsep = gtk_hseparator_new();
384         gtk_widget_set_size_request(hsep, -1, 10);
385         gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
386                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
387                         (GtkAttachOptions) (0), 10, 5);
388
389         row++;
390         /* Keep old items - checkbutton */
391         gtk_table_attach(GTK_TABLE(table), feedprop->keep_old,
392                         0, 1, row, row+1,
393                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
394                         (GtkAttachOptions) (0), 10, 0);
395
396         /* 'Trim' - button */
397         gtk_table_attach(GTK_TABLE(table), trim_button,
398                         1, 2, row, row+1,
399                         (GtkAttachOptions) (0),
400                         (GtkAttachOptions) (0), 10, 0);
401         g_signal_connect(G_OBJECT(trim_button), "clicked",
402                         G_CALLBACK(rssyl_props_trim_cb), ritem);
403
404         row++;
405         hsep = gtk_hseparator_new();
406         gtk_widget_set_size_request(hsep, -1, 10);
407         gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
408                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
409                         (GtkAttachOptions) (0), 10, 5);
410
411         row++;
412         /* Use default refresh interval - checkbutton */
413         gtk_table_attach(GTK_TABLE(table), feedprop->default_refresh_interval,
414                         0, 2, row, row+1,
415                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
416                         (GtkAttachOptions) (0), 10, 0);
417         g_signal_connect(G_OBJECT(feedprop->default_refresh_interval), "toggled",
418                         G_CALLBACK(rssyl_feedprop_togglebutton_toggled_cb),
419                         (gpointer)feedprop);
420
421         row++;
422         /* Refresh interval - label */
423         label = gtk_label_new(_("<b>Refresh interval in minutes:</b>\n"
424                         "<small>(Set to 0 to disable automatic refreshing for this feed)"
425                         "</small>"));
426         gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
427         gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
428         gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1,
429                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
430                         (GtkAttachOptions) (0), 10, 5);
431
432         /* Refresh interval - spinbutton */
433         gtk_widget_set_sensitive(feedprop->refresh_interval,
434                         !ritem->default_refresh_interval);
435         gtk_table_attach(GTK_TABLE(table), feedprop->refresh_interval, 1, 2, row, row+1,
436                         (GtkAttachOptions) (0),
437                         (GtkAttachOptions) (0), 10, 5);
438
439         row++;
440         hsep = gtk_hseparator_new();
441         gtk_widget_set_size_request(hsep, -1, 10);
442         gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
443                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
444                         (GtkAttachOptions) (0), 10, 5);
445
446         row++;
447         /* Silent update - label */
448         silent_update_label =
449                 gtk_label_new(_("<b>If an item changes, do not mark it as new:</b>"));
450         gtk_label_set_use_markup(GTK_LABEL(silent_update_label), TRUE);
451         gtk_misc_set_alignment(GTK_MISC(silent_update_label), 0, 0.5);
452         gtk_table_attach(GTK_TABLE(table), silent_update_label, 0, 1, row, row+1,
453                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
454                         (GtkAttachOptions) (0), 10, 5);
455
456         gtk_table_attach(GTK_TABLE(table), feedprop->silent_update, 1, 2, row, row+1,
457                         (GtkAttachOptions) (0),
458                         (GtkAttachOptions) (0), 10, 5);
459
460         row++;
461         hsep = gtk_hseparator_new();
462         gtk_widget_set_size_request(hsep, -1, 10);
463         gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
464                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
465                         (GtkAttachOptions) (0), 10, 5);
466
467         row++;
468
469         /* Write heading - checkbox */
470         gtk_table_attach(GTK_TABLE(table), feedprop->write_heading,
471                         0, 2, row, row+1,
472                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
473                         (GtkAttachOptions) (0), 10, 0);
474
475
476         row++;
477
478         /* Ignore title rename - checkbutton */
479         gtk_table_attach(GTK_TABLE(table), feedprop->ignore_title_rename,
480                         0, 1, row, row+1,
481                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
482                         (GtkAttachOptions) (0), 10, 0);
483
484         row++;
485
486         /* Verify SSL peer certificate - checkbutton */
487         gtk_table_attach(GTK_TABLE(table), feedprop->ssl_verify_peer,
488                         0, 1, row, row+1,
489                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
490                         (GtkAttachOptions) (0), 10, 0);
491
492         row++;
493
494         /* Separator above the button box */
495         sep = gtk_hseparator_new();
496         gtk_widget_set_size_request(sep, -1, 10);
497         gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
498
499         /* Buttonbox */
500         bbox = gtk_hbutton_box_new();
501         gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
502         gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
503         gtk_box_set_spacing(GTK_BOX(bbox), 5);
504         gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
505
506         /* Cancel button */
507         cancel_button = gtk_button_new();
508         gtk_container_add(GTK_CONTAINER(bbox), cancel_button);
509
510         cancel_align = gtk_alignment_new(0.5, 0.5, 0, 0);
511         gtk_container_add(GTK_CONTAINER(cancel_button), cancel_align);
512
513         cancel_hbox = gtk_hbox_new(FALSE, 2);
514         gtk_container_add(GTK_CONTAINER(cancel_align), cancel_hbox);
515
516         cancel_image = gtk_image_new_from_stock(GTK_STOCK_CANCEL,
517                         GTK_ICON_SIZE_BUTTON);
518         gtk_box_pack_start(GTK_BOX(cancel_hbox), cancel_image, FALSE, FALSE, 0);
519
520         cancel_label = gtk_label_new_with_mnemonic(_("_Cancel"));
521         gtk_box_pack_end(GTK_BOX(cancel_hbox), cancel_label, FALSE, FALSE, 0);
522
523         g_signal_connect(G_OBJECT(cancel_button), "clicked",
524                         G_CALLBACK(rssyl_props_cancel_cb), ritem);
525
526         /* OK button */
527         ok_button = gtk_button_new();
528         gtk_container_add(GTK_CONTAINER(bbox), ok_button);
529         GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT );
530
531         ok_align = gtk_alignment_new(0.5, 0.5, 0, 0);
532         gtk_container_add(GTK_CONTAINER(ok_button), ok_align);
533
534         ok_hbox = gtk_hbox_new(FALSE, 2);
535         gtk_container_add(GTK_CONTAINER(ok_align), ok_hbox);
536
537         ok_image = gtk_image_new_from_stock(GTK_STOCK_OK,
538                         GTK_ICON_SIZE_BUTTON);
539         gtk_box_pack_start(GTK_BOX(ok_hbox), ok_image, FALSE, FALSE, 0);
540
541         ok_label = gtk_label_new_with_mnemonic(_("_OK"));
542         gtk_box_pack_end(GTK_BOX(ok_hbox), ok_label, FALSE, FALSE, 0);
543
544         g_signal_connect(G_OBJECT(ok_button), "clicked",
545                         G_CALLBACK(rssyl_props_ok_cb), ritem);
546
547         /* Set some misc. stuff */
548         gtk_window_set_title(GTK_WINDOW(feedprop->window),
549                         g_strdup(_("Set feed properties")) );
550         gtk_window_set_modal(GTK_WINDOW(feedprop->window), TRUE);
551         gtk_window_set_transient_for(GTK_WINDOW(feedprop->window),
552                         GTK_WINDOW(mainwin->window) );
553
554         /* Attach callbacks to handle Enter and Escape keys */
555         g_signal_connect(G_OBJECT(feedprop->window), "key_press_event",
556                         G_CALLBACK(rssyl_props_key_press_cb), ritem);
557
558         /* ...and voila! */
559         gtk_widget_show_all(feedprop->window);
560         gtk_widget_grab_default(ok_button);
561
562         /* Unselect the text in URL entry */
563         gtk_editable_select_region(GTK_EDITABLE(feedprop->url), 0, 0);
564
565         ritem->feedprop = feedprop;
566 }