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>
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.
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.
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.
29 #include <glib/gi18n.h>
30 #include <gdk/gdkkeysyms.h>
32 /* Claws Mail includes */
33 #include <mainwindow.h>
37 #include "rssyl_feed.h"
38 #include "rssyl_feed_props.h"
39 #include "rssyl_prefs.h"
40 #include "rssyl_update_feed.h"
42 static void rssyl_gtk_prop_store(RFolderItem *ritem)
44 gchar *url, *auth_user, *auth_pass;
45 gint x, old_ri, old_fetch_comments;
46 gboolean use_default_ri = FALSE, keep_old = FALSE;
49 g_return_if_fail(ritem != NULL);
50 g_return_if_fail(ritem->feedprop != NULL);
52 url = (gchar *)gtk_entry_get_text(GTK_ENTRY(ritem->feedprop->url));
58 ritem->url = g_strdup(url);
61 ritem->auth->type = gtk_combo_box_get_active(GTK_COMBO_BOX(ritem->feedprop->auth_type));
63 auth_user = (gchar *)gtk_entry_get_text(GTK_ENTRY(ritem->feedprop->auth_username));
64 if (auth_user != NULL) {
65 if (ritem->auth->username) {
66 g_free(ritem->auth->username);
68 ritem->auth->username = g_strdup(auth_user);
71 auth_pass = (gchar *)gtk_entry_get_text(GTK_ENTRY(ritem->feedprop->auth_password));
72 if (auth_pass != NULL) {
73 if (ritem->auth->password) {
74 g_free(ritem->auth->password);
76 ritem->auth->password = g_strdup(auth_pass);
79 use_default_ri = gtk_toggle_button_get_active(
80 GTK_TOGGLE_BUTTON(ritem->feedprop->default_refresh_interval));
81 ritem->default_refresh_interval = use_default_ri;
82 debug_print("store: default refresh interval is %s\n",
83 ( use_default_ri ? "ON" : "OFF" ) );
85 /* Use default if checkbutton is set */
87 x = rssyl_prefs_get()->refresh;
89 x = gtk_spin_button_get_value_as_int(
90 GTK_SPIN_BUTTON(ritem->feedprop->refresh_interval) );
92 old_ri = ritem->refresh_interval;
93 ritem->refresh_interval = x;
95 /* Set timer for next automatic refresh, if needed. */
97 if( old_ri != x || ritem->refresh_id == 0 ) {
98 debug_print("RSSyl: GTK - refresh interval changed to %d , updating "
99 "timeout\n", ritem->refresh_interval);
100 rssyl_feed_start_refresh_timeout(ritem);
103 ritem->refresh_id = 0;
105 old_fetch_comments = ritem->fetch_comments;
106 ritem->fetch_comments = gtk_toggle_button_get_active(
107 GTK_TOGGLE_BUTTON(ritem->feedprop->fetch_comments));
109 if (!old_fetch_comments && ritem->fetch_comments) {
110 /* reset the RFolderItem's mtime to be sure we get all
111 * available comments */
112 ritem->item.mtime = 0;
115 ritem->fetch_comments_max_age = gtk_spin_button_get_value_as_int(
116 GTK_SPIN_BUTTON(ritem->feedprop->fetch_comments_max_age));
118 keep_old = gtk_toggle_button_get_active(
119 GTK_TOGGLE_BUTTON(ritem->feedprop->keep_old));
120 ritem->keep_old = keep_old;
122 ritem->silent_update =
123 gtk_combo_box_get_active(GTK_COMBO_BOX(ritem->feedprop->silent_update));
125 ritem->write_heading = gtk_toggle_button_get_active(
126 GTK_TOGGLE_BUTTON(ritem->feedprop->write_heading));
128 ritem->ignore_title_rename = gtk_toggle_button_get_active(
129 GTK_TOGGLE_BUTTON(ritem->feedprop->ignore_title_rename));
131 ritem->ssl_verify_peer = gtk_toggle_button_get_active(
132 GTK_TOGGLE_BUTTON(ritem->feedprop->ssl_verify_peer));
134 /* Store updated properties */
136 item->folder->klass->item_get_xml(item->folder, item);
140 rssyl_feedprop_togglebutton_toggled_cb(GtkToggleButton *tb,
143 gboolean active = gtk_toggle_button_get_active(tb);
144 RFeedProp *feedprop = (RFeedProp *)data;
145 GtkWidget *sb = NULL;
147 if( (GtkWidget *)tb == feedprop->default_refresh_interval ) {
149 sb = feedprop->refresh_interval;
150 } else if( (GtkWidget *)tb == feedprop->fetch_comments ) {
151 sb = feedprop->fetch_comments_max_age;
154 g_return_val_if_fail(sb != NULL, FALSE);
156 gtk_widget_set_sensitive(sb, active);
162 rssyl_feedprop_auth_type_changed_cb(GtkComboBox *cb, gpointer data)
164 RFeedProp *feedprop = (RFeedProp *)data;
165 gboolean enable = (FEED_AUTH_NONE != gtk_combo_box_get_active(cb));
166 gtk_widget_set_sensitive(GTK_WIDGET(feedprop->auth_username), enable);
167 gtk_widget_set_sensitive(GTK_WIDGET(feedprop->auth_password), enable);
171 rssyl_props_cancel_cb(GtkWidget *widget, gpointer data)
173 RFolderItem *ritem = (RFolderItem *)data;
175 debug_print("RSSyl: Cancel pressed\n");
177 gtk_widget_destroy(ritem->feedprop->window);
183 rssyl_props_ok_cb(GtkWidget *widget, gpointer data)
185 RFolderItem *ritem = (RFolderItem *)data;
187 debug_print("RSSyl: OK pressed\n");
188 rssyl_gtk_prop_store(ritem);
190 gtk_widget_destroy(ritem->feedprop->window);
196 rssyl_props_trim_cb(GtkWidget *widget, gpointer data)
198 RFolderItem *ritem = (RFolderItem *)data;
199 gboolean k = ritem->keep_old;
202 ritem->keep_old = FALSE;
204 rssyl_update_feed(ritem, FALSE);
207 ritem->keep_old = TRUE;
213 rssyl_props_key_press_cb(GtkWidget *widget, GdkEventKey *event,
217 switch (event->keyval) {
219 rssyl_props_cancel_cb(widget, data);
223 rssyl_props_ok_cb(widget, data);
234 void rssyl_gtk_prop(RFolderItem *ritem)
236 MainWindow *mainwin = mainwindow_get_mainwindow();
238 GtkWidget *vbox, *urllabel, *urlframe, *urlalign, *table, *label,
239 *inner_vbox, *auth_hbox, *auth_user_label, *auth_pass_label,
240 *hsep, *sep, *bbox, *cancel_button, *cancel_align,
241 *cancel_hbox, *cancel_image, *cancel_label, *ok_button, *ok_align,
242 *ok_hbox, *ok_image, *ok_label, *trim_button, *silent_update_label;
247 g_return_if_fail(ritem != NULL);
249 feedprop = g_new0(RFeedProp, 1);
251 /**** Create required widgets ****/
254 feedprop->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
257 feedprop->url = gtk_entry_new();
258 gtk_entry_set_text(GTK_ENTRY(feedprop->url), ritem->url);
260 /* URL auth type combo */
261 #if !GTK_CHECK_VERSION(2, 24, 0)
262 feedprop->auth_type = gtk_combo_box_new_text();
263 gtk_combo_box_append_text(GTK_COMBO_BOX(feedprop->auth_type),
265 feedprop->auth_type = gtk_combo_box_text_new();
266 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->auth_type),
268 _("No authentication"));
269 #if !GTK_CHECK_VERSION(2, 24, 0)
270 gtk_combo_box_append_text(GTK_COMBO_BOX(feedprop->auth_type),
272 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->auth_type),
274 _("HTTP Basic authentication"));
275 gtk_combo_box_set_active(GTK_COMBO_BOX(feedprop->auth_type),
279 feedprop->auth_username = gtk_entry_new();
280 gtk_entry_set_text(GTK_ENTRY(feedprop->auth_username),
281 ritem->auth->username);
284 feedprop->auth_password = gtk_entry_new();
285 gtk_entry_set_visibility(GTK_ENTRY(feedprop->auth_password), FALSE);
286 gtk_entry_set_text(GTK_ENTRY(feedprop->auth_password),
287 ritem->auth->password);
289 /* "Use default refresh interval" checkbutton */
290 feedprop->default_refresh_interval = gtk_check_button_new_with_mnemonic(
291 _("Use default refresh interval"));
292 gtk_toggle_button_set_active(
293 GTK_TOGGLE_BUTTON(feedprop->default_refresh_interval),
294 ritem->default_refresh_interval);
296 if( ritem->refresh_interval >= 0 && !ritem->default_refresh_interval )
297 refresh = ritem->refresh_interval;
299 refresh = rssyl_prefs_get()->refresh;
301 /* "Keep old items" checkbutton */
302 feedprop->keep_old = gtk_check_button_new_with_mnemonic(
303 _("Keep old items"));
304 gtk_toggle_button_set_active(
305 GTK_TOGGLE_BUTTON(feedprop->keep_old),
309 trim_button = gtk_button_new_with_mnemonic(_("_Trim"));
310 gtk_widget_set_tooltip_text(trim_button,
311 _("Update feed, deleting items which are no longer in the source feed"));
313 feedprop->fetch_comments = gtk_check_button_new_with_mnemonic(
314 _("Fetch comments if possible"));
315 gtk_toggle_button_set_active(
316 GTK_TOGGLE_BUTTON(feedprop->fetch_comments),
317 ritem->fetch_comments);
319 /* Fetch comments max age spinbutton */
320 adj = gtk_adjustment_new(ritem->fetch_comments_max_age,
321 -1, 100000, 1, 10, 0);
322 feedprop->fetch_comments_max_age = gtk_spin_button_new(GTK_ADJUSTMENT(adj),
325 /* Refresh interval spinbutton */
326 adj = gtk_adjustment_new(refresh,
327 0, 100000, 10, 100, 0);
328 feedprop->refresh_interval = gtk_spin_button_new(GTK_ADJUSTMENT(adj),
331 /* Silent update - combobox */
332 #if !GTK_CHECK_VERSION(2, 24, 0)
333 feedprop->silent_update = gtk_combo_box_new_text();
334 gtk_combo_box_append_text(GTK_COMBO_BOX(feedprop->silent_update),
336 feedprop->silent_update = gtk_combo_box_text_new();
337 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->silent_update),
339 _("Always mark as new"));
340 #if !GTK_CHECK_VERSION(2, 24, 0)
341 gtk_combo_box_append_text(GTK_COMBO_BOX(feedprop->silent_update),
343 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->silent_update),
345 _("If only its text changed"));
346 #if !GTK_CHECK_VERSION(2, 24, 0)
347 gtk_combo_box_append_text(GTK_COMBO_BOX(feedprop->silent_update),
349 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(feedprop->silent_update),
351 _("Never mark as new"));
352 gtk_combo_box_set_active(GTK_COMBO_BOX(feedprop->silent_update),
353 ritem->silent_update);
355 feedprop->write_heading = gtk_check_button_new_with_mnemonic(
356 _("Add item title to top of message"));
357 gtk_toggle_button_set_active(
358 GTK_TOGGLE_BUTTON(feedprop->write_heading),
359 ritem->write_heading);
361 /* Ignore title rename - checkbox */
362 feedprop->ignore_title_rename = gtk_check_button_new_with_mnemonic(
363 _("Ignore title rename"));
364 gtk_toggle_button_set_active(
365 GTK_TOGGLE_BUTTON(feedprop->ignore_title_rename),
366 ritem->ignore_title_rename);
367 gtk_widget_set_tooltip_text(feedprop->ignore_title_rename,
368 _("Enable this to keep current folder name, even if feed author changes title of the feed."));
370 /* Verify SSL peer certificate */
371 feedprop->ssl_verify_peer = gtk_check_button_new_with_label(
372 _("Verify SSL certificate validity"));
373 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(feedprop->ssl_verify_peer),
374 ritem->ssl_verify_peer);
376 /* === Now pack all the widgets */
377 vbox = gtk_vbox_new(FALSE, 0);
378 gtk_container_add(GTK_CONTAINER(feedprop->window), vbox);
381 urlframe = gtk_frame_new(NULL);
382 gtk_container_set_border_width(GTK_CONTAINER(urlframe), 5);
383 gtk_frame_set_label_align(GTK_FRAME(urlframe), 0.05, 0.5);
384 gtk_frame_set_shadow_type(GTK_FRAME(urlframe), GTK_SHADOW_ETCHED_OUT);
385 gtk_box_pack_start(GTK_BOX(vbox), urlframe, FALSE, FALSE, 0);
387 /* Label for URL frame */
388 urllabel = gtk_label_new(g_strconcat("<b>",_("Source URL:"),"</b>", NULL));
389 gtk_label_set_use_markup(GTK_LABEL(urllabel), TRUE);
390 gtk_misc_set_padding(GTK_MISC(urllabel), 5, 0);
391 gtk_frame_set_label_widget(GTK_FRAME(urlframe), urllabel);
393 /* URL entry (+ alignment in frame) */
394 urlalign = gtk_alignment_new(0, 0.5, 1, 1);
395 gtk_alignment_set_padding(GTK_ALIGNMENT(urlalign), 5, 5, 5, 5);
396 gtk_container_add(GTK_CONTAINER(urlframe), urlalign);
398 inner_vbox = gtk_vbox_new(FALSE, 5);
399 gtk_box_pack_start(GTK_BOX(inner_vbox), feedprop->url, FALSE, FALSE, 0);
400 gtk_entry_set_activates_default(GTK_ENTRY(feedprop->url), TRUE);
401 gtk_container_add(GTK_CONTAINER(urlalign), inner_vbox);
403 /* Auth combo + user (label + entry) + pass (label + entry) */
404 auth_hbox = gtk_hbox_new(FALSE, 5);
405 gtk_box_pack_start(GTK_BOX(auth_hbox), feedprop->auth_type, FALSE, FALSE, 0);
406 g_signal_connect(G_OBJECT(feedprop->auth_type), "changed",
407 G_CALLBACK(rssyl_feedprop_auth_type_changed_cb),
408 (gpointer) feedprop);
409 g_signal_emit_by_name(G_OBJECT(feedprop->auth_type), "changed");
410 auth_user_label = gtk_label_new(_("User name"));
411 gtk_box_pack_start(GTK_BOX(auth_hbox), auth_user_label, FALSE, FALSE, 0);
412 gtk_box_pack_start(GTK_BOX(auth_hbox), feedprop->auth_username, FALSE, FALSE, 0);
413 auth_pass_label = gtk_label_new(_("Password"));
414 gtk_box_pack_start(GTK_BOX(auth_hbox), auth_pass_label, FALSE, FALSE, 0);
415 gtk_box_pack_start(GTK_BOX(auth_hbox), feedprop->auth_password, FALSE, FALSE, 0);
416 gtk_box_pack_start(GTK_BOX(inner_vbox), auth_hbox, FALSE, FALSE, 0);
418 /* Table for remaining properties */
419 table = gtk_table_new(11, 2, FALSE);
420 gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
422 /* Fetch comments - checkbutton */
423 gtk_table_attach(GTK_TABLE(table), feedprop->fetch_comments,
425 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
426 (GtkAttachOptions) (0), 10, 0);
427 g_signal_connect(G_OBJECT(feedprop->fetch_comments), "toggled",
428 G_CALLBACK(rssyl_feedprop_togglebutton_toggled_cb),
432 /* Fetch comments max age - label */
433 label = gtk_label_new(g_strconcat("<b>",_("Fetch comments on posts aged less than:"),"</b>\n"
434 "<small>",_("(In days; set to -1 to fetch all comments)"), "</small>",
436 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
437 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
438 gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1,
439 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
440 (GtkAttachOptions) (0), 10, 5);
442 /* Fetch comments max age - spinbutton */
443 gtk_widget_set_sensitive(feedprop->fetch_comments_max_age,
444 ritem->fetch_comments);
445 gtk_table_attach(GTK_TABLE(table), feedprop->fetch_comments_max_age,
447 (GtkAttachOptions) (0),
448 (GtkAttachOptions) (0), 10, 5);
451 /* Separator below comments max age */
452 hsep = gtk_hseparator_new();
453 gtk_widget_set_size_request(hsep, -1, 10);
454 gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
455 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
456 (GtkAttachOptions) (0), 10, 5);
459 /* Keep old items - checkbutton */
460 gtk_table_attach(GTK_TABLE(table), feedprop->keep_old,
462 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
463 (GtkAttachOptions) (0), 10, 0);
465 /* 'Trim' - button */
466 gtk_table_attach(GTK_TABLE(table), trim_button,
468 (GtkAttachOptions) (0),
469 (GtkAttachOptions) (0), 10, 0);
470 g_signal_connect(G_OBJECT(trim_button), "clicked",
471 G_CALLBACK(rssyl_props_trim_cb), ritem);
474 hsep = gtk_hseparator_new();
475 gtk_widget_set_size_request(hsep, -1, 10);
476 gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
477 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
478 (GtkAttachOptions) (0), 10, 5);
481 /* Use default refresh interval - checkbutton */
482 gtk_table_attach(GTK_TABLE(table), feedprop->default_refresh_interval,
484 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
485 (GtkAttachOptions) (0), 10, 0);
486 g_signal_connect(G_OBJECT(feedprop->default_refresh_interval), "toggled",
487 G_CALLBACK(rssyl_feedprop_togglebutton_toggled_cb),
491 /* Refresh interval - label */
492 label = gtk_label_new(g_strconcat("<b>",_("Refresh interval in minutes:"),"</b>\n"
493 "<small>",_("(Set to 0 to disable automatic refreshing for this feed)"),
495 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
496 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
497 gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1,
498 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
499 (GtkAttachOptions) (0), 10, 5);
501 /* Refresh interval - spinbutton */
502 gtk_widget_set_sensitive(feedprop->refresh_interval,
503 !ritem->default_refresh_interval);
504 gtk_table_attach(GTK_TABLE(table), feedprop->refresh_interval, 1, 2, row, row+1,
505 (GtkAttachOptions) (0),
506 (GtkAttachOptions) (0), 10, 5);
509 hsep = gtk_hseparator_new();
510 gtk_widget_set_size_request(hsep, -1, 10);
511 gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
512 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
513 (GtkAttachOptions) (0), 10, 5);
516 /* Silent update - label */
517 silent_update_label =
518 gtk_label_new(g_strconcat("<b>",_("If an item changes, do not mark it as new:"),"</b>", NULL));
519 gtk_label_set_use_markup(GTK_LABEL(silent_update_label), TRUE);
520 gtk_misc_set_alignment(GTK_MISC(silent_update_label), 0, 0.5);
521 gtk_table_attach(GTK_TABLE(table), silent_update_label, 0, 1, row, row+1,
522 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
523 (GtkAttachOptions) (0), 10, 5);
525 gtk_table_attach(GTK_TABLE(table), feedprop->silent_update, 1, 2, row, row+1,
526 (GtkAttachOptions) (0),
527 (GtkAttachOptions) (0), 10, 5);
530 hsep = gtk_hseparator_new();
531 gtk_widget_set_size_request(hsep, -1, 10);
532 gtk_table_attach(GTK_TABLE(table), hsep, 0, 2, row, row+1,
533 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
534 (GtkAttachOptions) (0), 10, 5);
538 /* Write heading - checkbox */
539 gtk_table_attach(GTK_TABLE(table), feedprop->write_heading,
541 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
542 (GtkAttachOptions) (0), 10, 0);
547 /* Ignore title rename - checkbutton */
548 gtk_table_attach(GTK_TABLE(table), feedprop->ignore_title_rename,
550 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
551 (GtkAttachOptions) (0), 10, 0);
555 /* Verify SSL peer certificate - checkbutton */
556 gtk_table_attach(GTK_TABLE(table), feedprop->ssl_verify_peer,
558 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
559 (GtkAttachOptions) (0), 10, 0);
563 /* Separator above the button box */
564 sep = gtk_hseparator_new();
565 gtk_widget_set_size_request(sep, -1, 10);
566 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
569 bbox = gtk_hbutton_box_new();
570 gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
571 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
572 gtk_box_set_spacing(GTK_BOX(bbox), 5);
573 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
576 cancel_button = gtk_button_new();
577 gtk_container_add(GTK_CONTAINER(bbox), cancel_button);
579 cancel_align = gtk_alignment_new(0.5, 0.5, 0, 0);
580 gtk_container_add(GTK_CONTAINER(cancel_button), cancel_align);
582 cancel_hbox = gtk_hbox_new(FALSE, 2);
583 gtk_container_add(GTK_CONTAINER(cancel_align), cancel_hbox);
585 cancel_image = gtk_image_new_from_stock(GTK_STOCK_CANCEL,
586 GTK_ICON_SIZE_BUTTON);
587 gtk_box_pack_start(GTK_BOX(cancel_hbox), cancel_image, FALSE, FALSE, 0);
589 cancel_label = gtk_label_new_with_mnemonic(_("_Cancel"));
590 gtk_box_pack_end(GTK_BOX(cancel_hbox), cancel_label, FALSE, FALSE, 0);
592 g_signal_connect(G_OBJECT(cancel_button), "clicked",
593 G_CALLBACK(rssyl_props_cancel_cb), ritem);
596 ok_button = gtk_button_new();
597 gtk_container_add(GTK_CONTAINER(bbox), ok_button);
598 GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT );
600 ok_align = gtk_alignment_new(0.5, 0.5, 0, 0);
601 gtk_container_add(GTK_CONTAINER(ok_button), ok_align);
603 ok_hbox = gtk_hbox_new(FALSE, 2);
604 gtk_container_add(GTK_CONTAINER(ok_align), ok_hbox);
606 ok_image = gtk_image_new_from_stock(GTK_STOCK_OK,
607 GTK_ICON_SIZE_BUTTON);
608 gtk_box_pack_start(GTK_BOX(ok_hbox), ok_image, FALSE, FALSE, 0);
610 ok_label = gtk_label_new_with_mnemonic(_("_OK"));
611 gtk_box_pack_end(GTK_BOX(ok_hbox), ok_label, FALSE, FALSE, 0);
613 g_signal_connect(G_OBJECT(ok_button), "clicked",
614 G_CALLBACK(rssyl_props_ok_cb), ritem);
616 /* Set some misc. stuff */
617 gtk_window_set_title(GTK_WINDOW(feedprop->window),
618 g_strdup(_("Set feed properties")) );
619 gtk_window_set_modal(GTK_WINDOW(feedprop->window), TRUE);
620 gtk_window_set_transient_for(GTK_WINDOW(feedprop->window),
621 GTK_WINDOW(mainwin->window) );
623 /* Attach callbacks to handle Enter and Escape keys */
624 g_signal_connect(G_OBJECT(feedprop->window), "key_press_event",
625 G_CALLBACK(rssyl_props_key_press_cb), ritem);
628 gtk_widget_show_all(feedprop->window);
629 gtk_widget_grab_default(ok_button);
631 /* Unselect the text in URL entry */
632 gtk_editable_select_region(GTK_EDITABLE(feedprop->url), 0, 0);
634 ritem->feedprop = feedprop;