From 8a072ffc7c0ddcde472877a51ace0bb14f86fb0a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 11:45:21 +0200 Subject: GN-bug #572348 - Removed deprecated Gtk+ symbols Some still left, because those gone in kill-bonobo branch. --- plugins/calendar-http/calendar-http.c | 56 +++++++++++++++-------------------- 1 file changed, 24 insertions(+), 32 deletions(-) (limited to 'plugins/calendar-http/calendar-http.c') diff --git a/plugins/calendar-http/calendar-http.c b/plugins/calendar-http/calendar-http.c index 273a8264e3..7814ef5ea0 100644 --- a/plugins/calendar-http/calendar-http.c +++ b/plugins/calendar-http/calendar-http.c @@ -140,7 +140,7 @@ e_calendar_http_url (EPlugin *epl, EConfigHookItemFactoryData *data) } static void -set_refresh_time (ESource *source, GtkWidget *spin, GtkWidget *option) +set_refresh_time (ESource *source, GtkWidget *spin, GtkWidget *combobox) { int time; int item_num = 0; @@ -160,15 +160,15 @@ set_refresh_time (ESource *source, GtkWidget *spin, GtkWidget *option) item_num = 1; time /= 60; } - gtk_option_menu_set_history (GTK_OPTION_MENU (option), item_num); + gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), item_num); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time); } static char * -get_refresh_minutes (GtkWidget *spin, GtkWidget *option) +get_refresh_minutes (GtkWidget *spin, GtkWidget *combobox) { int setting = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)); - switch (gtk_option_menu_get_history (GTK_OPTION_MENU (option))) { + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combobox))) { case 0: /* minutes */ break; @@ -196,24 +196,24 @@ static void spin_changed (GtkSpinButton *spin, ECalConfigTargetSource *t) { char *refresh_str; - GtkWidget *option; + GtkWidget *combobox; - option = g_object_get_data (G_OBJECT (spin), "option"); + combobox = g_object_get_data (G_OBJECT (spin), "combobox"); - refresh_str = get_refresh_minutes ((GtkWidget *) spin, option); + refresh_str = get_refresh_minutes ((GtkWidget *) spin, combobox); e_source_set_property (t->source, "refresh", refresh_str); g_free (refresh_str); } static void -option_changed (GtkOptionMenu *option, ECalConfigTargetSource *t) +combobox_changed (GtkComboBox *combobox, ECalConfigTargetSource *t) { char *refresh_str; GtkWidget *spin; - spin = g_object_get_data (G_OBJECT (option), "spin"); + spin = g_object_get_data (G_OBJECT (combobox), "spin"); - refresh_str = get_refresh_minutes (spin, (GtkWidget *) option); + refresh_str = get_refresh_minutes (spin, (GtkWidget *) combobox); e_source_set_property (t->source, "refresh", refresh_str); g_free (refresh_str); } @@ -231,9 +231,8 @@ GtkWidget * e_calendar_http_refresh (EPlugin *epl, EConfigHookItemFactoryData *data) { static GtkWidget *label; - GtkWidget *option, *spin, *menu, *hbox, *parent; - GtkWidget *times[4]; - int row, i; + GtkWidget *combobox, *spin, *hbox, *parent; + int row; ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; ESource *source = t->source; EUri *uri; @@ -274,25 +273,18 @@ e_calendar_http_refresh (EPlugin *epl, EConfigHookItemFactoryData *data) gtk_widget_show (spin); gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, TRUE, 0); - option = gtk_option_menu_new (); - gtk_widget_show (option); - times[0] = gtk_menu_item_new_with_label (_("minutes")); - times[1] = gtk_menu_item_new_with_label (_("hours")); - times[2] = gtk_menu_item_new_with_label (_("days")); - times[3] = gtk_menu_item_new_with_label (_("weeks")); - menu = gtk_menu_new (); - gtk_widget_show (menu); - for (i = 0; i < 4; i++) { - gtk_widget_show (times[i]); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), times[i]); - } - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - set_refresh_time (source, spin, option); - gtk_box_pack_start (GTK_BOX (hbox), option, FALSE, TRUE, 0); - - g_object_set_data (G_OBJECT (option), "spin", spin); - g_signal_connect (G_OBJECT (option), "changed", G_CALLBACK (option_changed), t); - g_object_set_data (G_OBJECT (spin), "option", option); + combobox = gtk_combo_box_new_text (); + gtk_widget_show (combobox); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("minutes")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("hours")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("days")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("weeks")); + set_refresh_time (source, spin, combobox); + gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, TRUE, 0); + + g_object_set_data (G_OBJECT (combobox), "spin", spin); + g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (combobox_changed), t); + g_object_set_data (G_OBJECT (spin), "combobox", combobox); g_signal_connect (G_OBJECT (spin), "value-changed", G_CALLBACK (spin_changed), t); gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); -- cgit v1.2.3