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. --- calendar/ChangeLog | 25 ++ calendar/gui/dialogs/Makefile.am | 1 - calendar/gui/dialogs/alarm-dialog.c | 151 ++++++---- calendar/gui/dialogs/alarm-dialog.glade | 182 ++---------- calendar/gui/dialogs/event-page.c | 141 +++++----- calendar/gui/dialogs/event-page.glade | 108 ++----- calendar/gui/dialogs/meeting-page.glade | 407 --------------------------- calendar/gui/dialogs/memo-page.c | 32 ++- calendar/gui/dialogs/memo-page.glade | 60 ++-- calendar/gui/dialogs/recurrence-page.c | 326 ++++++++++----------- calendar/gui/dialogs/recurrence-page.glade | 141 ++++------ calendar/gui/dialogs/task-details-page.c | 44 +-- calendar/gui/dialogs/task-details-page.glade | 190 ++++++------- calendar/gui/dialogs/task-page.c | 36 ++- calendar/gui/dialogs/task-page.glade | 33 +-- calendar/gui/e-itip-control.c | 144 +++++----- calendar/gui/goto-dialog.glade | 129 ++------- calendar/gui/goto.c | 19 +- 18 files changed, 714 insertions(+), 1455 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 306e5bda37..285c5ce9db 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,28 @@ +2009-04-24 Milan Crha + + ** Fix for bug #572348 + + * gui/dialogs/task-page.glade: + * gui/dialogs/task-page.c: + * gui/dialogs/task-details-page.glade: + * gui/dialogs/task-details-page.c: + * gui/dialogs/recurrence-page.glade: + * gui/dialogs/recurrence-page.c: + * gui/dialogs/alarm-dialog.glade: + * gui/dialogs/alarm-dialog.c: + * gui/dialogs/event-page.glade: + * gui/dialogs/event-page.c: + * gui/dialogs/memo-page.glade: + * gui/dialogs/memo-page.c: + * gui/goto-dialog.glade: + * gui/goto.c: + * gui/e-itip-control.c: + Remove deprecated Gtk+ symbols. + + * gui/dialogs/Makefile.am: + * gui/dialogs/meeting-page.glade: + Remove death files. + 2009-04-13 Chenthill Palanisamy Fixes #561312 diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index 6dd8a4cd77..c6d61101a8 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -89,7 +89,6 @@ glade_DATA = \ cal-prefs-dialog.glade \ e-delegate-dialog.glade \ event-page.glade \ - meeting-page.glade \ memo-page.glade \ recurrence-page.glade \ schedule-page.glade \ diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 984c1b756f..3881c85106 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -60,18 +60,18 @@ typedef struct { /* Toplevel */ GtkWidget *toplevel; - GtkWidget *action; + GtkWidget *action_combo; GtkWidget *interval_value; - GtkWidget *value_units; - GtkWidget *relative; - GtkWidget *time; + GtkWidget *value_units_combo; + GtkWidget *relative_combo; + GtkWidget *time_combo; /* Alarm repeat widgets */ GtkWidget *repeat_toggle; GtkWidget *repeat_group; GtkWidget *repeat_quantity; GtkWidget *repeat_value; - GtkWidget *repeat_unit; + GtkWidget *repeat_unit_combo; GtkWidget *option_notebook; @@ -118,7 +118,7 @@ enum { DAYS }; -/* Option menu maps */ +/* Combo box maps */ static const int action_map[] = { E_CAL_COMPONENT_ALARM_DISPLAY, E_CAL_COMPONENT_ALARM_AUDIO, @@ -167,18 +167,18 @@ static const int duration_units_map[] = { }; static void populate_widgets_from_alarm (Dialog *dialog); -static void action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data); +static void action_changed_cb (GtkWidget *action_combo, gpointer data); /* Fills the widgets with default values */ static void clear_widgets (Dialog *dialog) { /* Sane defaults */ - e_dialog_option_menu_set (dialog->action, E_CAL_COMPONENT_ALARM_DISPLAY, action_map); + e_dialog_combo_box_set (dialog->action_combo, E_CAL_COMPONENT_ALARM_DISPLAY, action_map); e_dialog_spin_set (dialog->interval_value, 15); - e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); - e_dialog_option_menu_set (dialog->relative, BEFORE, relative_map); - e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); + e_dialog_combo_box_set (dialog->value_units_combo, MINUTES, value_map); + e_dialog_combo_box_set (dialog->relative_combo, BEFORE, relative_map); + e_dialog_combo_box_set (dialog->time_combo, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); gtk_widget_set_sensitive (dialog->repeat_group, FALSE); gtk_widget_set_sensitive (dialog->dalarm_group, FALSE); @@ -192,8 +192,9 @@ clear_widgets (Dialog *dialog) static void alarm_to_dialog (Dialog *dialog) { - GtkWidget *menu; - GList *l; + GtkTreeModel *model; + GtkTreeIter iter; + gboolean valid; gboolean repeat; ECalComponentAlarmAction action; char *email; @@ -203,12 +204,15 @@ alarm_to_dialog (Dialog *dialog) clear_widgets (dialog); /* Alarm types */ - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action)); - for (i = 0, l = GTK_MENU_SHELL (menu)->children; action_map[i] != -1; i++, l = l->next) { - if (e_cal_get_static_capability (dialog->ecal, action_map_cap[i])) - gtk_widget_set_sensitive (l->data, FALSE); - else - gtk_widget_set_sensitive (l->data, TRUE); + model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->action_combo)); + valid = gtk_tree_model_get_iter_first (model, &iter); + for (i = 0; valid && action_map[i] != -1; i++) { + gtk_list_store_set ( + GTK_LIST_STORE (model), &iter, + 1, !e_cal_get_static_capability (dialog->ecal, action_map_cap[i]), + -1); + + valid = gtk_tree_model_iter_next (model, &iter); } /* Set a default address if possible */ @@ -255,17 +259,17 @@ alarm_to_repeat_widgets (Dialog *dialog, ECalComponentAlarm *alarm) return; if ( repeat.duration.minutes ) { - e_dialog_option_menu_set (dialog->repeat_unit, DUR_MINUTES, duration_units_map); + e_dialog_combo_box_set (dialog->repeat_unit_combo, DUR_MINUTES, duration_units_map); e_dialog_spin_set (dialog->repeat_value, repeat.duration.minutes); } if ( repeat.duration.hours ) { - e_dialog_option_menu_set (dialog->repeat_unit, DUR_HOURS, duration_units_map); + e_dialog_combo_box_set (dialog->repeat_unit_combo, DUR_HOURS, duration_units_map); e_dialog_spin_set (dialog->repeat_value, repeat.duration.hours); } if ( repeat.duration.days ) { - e_dialog_option_menu_set (dialog->repeat_unit, DUR_DAYS, duration_units_map); + e_dialog_combo_box_set (dialog->repeat_unit_combo, DUR_DAYS, duration_units_map); e_dialog_spin_set (dialog->repeat_value, repeat.duration.days); } } @@ -285,7 +289,7 @@ repeat_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) repeat.repetitions = e_dialog_spin_get_int (dialog->repeat_quantity); memset (&repeat.duration, 0, sizeof (repeat.duration)); - switch (e_dialog_option_menu_get (dialog->repeat_unit, duration_units_map)) { + switch (e_dialog_combo_box_get (dialog->repeat_unit_combo, duration_units_map)) { case DUR_MINUTES: repeat.duration.minutes = e_dialog_spin_get_int (dialog->repeat_value); break; @@ -609,11 +613,11 @@ populate_widgets_from_alarm (Dialog *dialog) /* Alarm Types */ switch ( trigger->type ) { case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START: - e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); + e_dialog_combo_box_set (dialog->time_combo, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); break; case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END: - e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END, time_map); + e_dialog_combo_box_set (dialog->time_combo, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END, time_map); break; default: g_warning ("%s: Unexpected alarm type (%d)", G_STRLOC, trigger->type); @@ -621,25 +625,25 @@ populate_widgets_from_alarm (Dialog *dialog) switch ( trigger->u.rel_duration.is_neg ){ case 1: - e_dialog_option_menu_set (dialog->relative, BEFORE, relative_map); + e_dialog_combo_box_set (dialog->relative_combo, BEFORE, relative_map); break; case 0: - e_dialog_option_menu_set (dialog->relative, AFTER, relative_map); + e_dialog_combo_box_set (dialog->relative_combo, AFTER, relative_map); break; } if ( trigger->u.rel_duration.days ) { - e_dialog_option_menu_set (dialog->value_units, DAYS, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, DAYS, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.days); } else if ( trigger->u.rel_duration.hours ) { - e_dialog_option_menu_set (dialog->value_units, HOURS, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, HOURS, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.hours); } else if ( trigger->u.rel_duration.minutes ) { - e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, MINUTES, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.minutes); } else { - e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, MINUTES, value_map); e_dialog_spin_set (dialog->interval_value, 0); } @@ -647,8 +651,8 @@ populate_widgets_from_alarm (Dialog *dialog) alarm_to_repeat_widgets (dialog, dialog->alarm); /* Alarm options */ - e_dialog_option_menu_set (dialog->action, *action, action_map); - action_selection_done_cb (GTK_MENU_SHELL (gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action))), dialog); + e_dialog_combo_box_set (dialog->action_combo, *action, action_map); + action_changed_cb (dialog->action_combo, dialog); switch (*action) { case E_CAL_COMPONENT_ALARM_AUDIO: @@ -680,13 +684,13 @@ dialog_to_alarm (Dialog *dialog) /* Fill out the alarm */ memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger)); - trigger.type = e_dialog_option_menu_get (dialog->time, time_map); - if (e_dialog_option_menu_get (dialog->relative, relative_map) == BEFORE) + trigger.type = e_dialog_combo_box_get (dialog->time_combo, time_map); + if (e_dialog_combo_box_get (dialog->relative_combo, relative_map) == BEFORE) trigger.u.rel_duration.is_neg = 1; else trigger.u.rel_duration.is_neg = 0; - switch (e_dialog_option_menu_get (dialog->value_units, value_map)) { + switch (e_dialog_combo_box_get (dialog->value_units_combo, value_map)) { case MINUTES: trigger.u.rel_duration.minutes = e_dialog_spin_get_int (dialog->interval_value); @@ -707,7 +711,7 @@ dialog_to_alarm (Dialog *dialog) } e_cal_component_alarm_set_trigger (dialog->alarm, trigger); - action = e_dialog_option_menu_get (dialog->action, action_map); + action = e_dialog_combo_box_get (dialog->action_combo, action_map); e_cal_component_alarm_set_action (dialog->alarm, action); /* Repeat stuff */ @@ -753,17 +757,17 @@ get_widgets (Dialog *dialog) if (!dialog->toplevel) return FALSE; - dialog->action = GW ("action"); + dialog->action_combo = GW ("action-combobox"); dialog->interval_value = GW ("interval-value"); - dialog->value_units = GW ("value-units"); - dialog->relative = GW ("relative"); - dialog->time = GW ("time"); + dialog->value_units_combo = GW ("value-units-combobox"); + dialog->relative_combo = GW ("relative-combobox"); + dialog->time_combo = GW ("time-combobox"); dialog->repeat_toggle = GW ("repeat-toggle"); dialog->repeat_group = GW ("repeat-group"); dialog->repeat_quantity = GW ("repeat-quantity"); dialog->repeat_value = GW ("repeat-value"); - dialog->repeat_unit = GW ("repeat-unit"); + dialog->repeat_unit_combo = GW ("repeat-unit-combobox"); dialog->option_notebook = GW ("option-notebook"); @@ -787,16 +791,57 @@ get_widgets (Dialog *dialog) #undef GW - return (dialog->action + if (dialog->action_combo) { + const char *actions[] = { + N_("Pop up an alert"), + N_("Play a sound"), + N_("Run a program"), + N_("Send an email") + }; + + GtkComboBox *combo = (GtkComboBox*)dialog->action_combo; + GtkCellRenderer *cell; + GtkListStore *store; + gint i; + + g_return_val_if_fail (combo != NULL, FALSE); + g_return_val_if_fail (GTK_IS_COMBO_BOX (combo), FALSE); + + store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); + gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store)); + g_object_unref (store); + + gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo)); + + cell = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, + "text", 0, + "sensitive", 1, + NULL); + + for (i = 0; i < G_N_ELEMENTS (actions); i++) { + GtkTreeIter iter; + + gtk_list_store_append (store, &iter); + gtk_list_store_set ( + store, &iter, + 0, _(actions[i]), + 1, TRUE, + -1); + } + } + + return (dialog->action_combo && dialog->interval_value - && dialog->value_units - && dialog->relative - && dialog->time + && dialog->value_units_combo + && dialog->relative_combo + && dialog->time_combo && dialog->repeat_toggle && dialog->repeat_group && dialog->repeat_quantity && dialog->repeat_value - && dialog->repeat_unit + && dialog->repeat_unit_combo && dialog->option_notebook && dialog->dalarm_group && dialog->dalarm_message @@ -823,7 +868,7 @@ show_options (Dialog *dialog) char *email; e_cal_component_alarm_set_action (dialog->alarm, - e_dialog_option_menu_get (dialog->action, action_map)); + e_dialog_combo_box_get (dialog->action_combo, action_map)); repeat = !e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT); @@ -1052,14 +1097,14 @@ malarm_description_changed_cb (GtkWidget *widget, gpointer data) } static void -action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) +action_changed_cb (GtkWidget *action_combo, gpointer data) { Dialog *dialog = data; char *dir; ECalComponentAlarmAction action; int page = 0, i; - action = e_dialog_option_menu_get (dialog->action, action_map); + action = e_dialog_combo_box_get (dialog->action_combo, action_map); for (i = 0; action_map[i] != -1 ; i++) { if (action == action_map[i]) { page = i; @@ -1102,12 +1147,10 @@ action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) static void init_widgets (Dialog *dialog) { - GtkWidget *menu; GtkTextBuffer *text_buffer; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action)); - g_signal_connect (menu, "selection_done", - G_CALLBACK (action_selection_done_cb), + g_signal_connect (dialog->action_combo, "changed", + G_CALLBACK (action_changed_cb), dialog); g_signal_connect (G_OBJECT (dialog->repeat_toggle), "toggled", diff --git a/calendar/gui/dialogs/alarm-dialog.glade b/calendar/gui/dialogs/alarm-dialog.glade index 5a5d4ef291..91b23c5e6d 100644 --- a/calendar/gui/dialogs/alarm-dialog.glade +++ b/calendar/gui/dialogs/alarm-dialog.glade @@ -137,48 +137,10 @@ 6 - + True - True - 0 - - - - True - - - - True - Pop up an alert - True - - - - - - True - Play a sound - True - - - - - - True - Run a program - True - - - - - - True - Send an email - True - - - - + False + True 0 @@ -207,40 +169,13 @@ - + True - True - 0 - - - - True - - - - True - minute(s) - True - - - - - - True - hour(s) - True - - - - - - True - day(s) - True - - - - + minute(s) +hour(s) +day(s) + False + True 0 @@ -250,32 +185,12 @@ - + True - True - 0 - - - - True - - - - True - before - True - - - - - - True - after - True - - - - + before +after + False + True 0 @@ -285,32 +200,12 @@ - + True - True - 0 - - - - True - - - - True - start of appointment - True - - - - - - True - end of appointment - True - - - - + start of appointment +end of appointment + False + True 0 @@ -485,40 +380,13 @@ - + True - True - 0 - - - - True - - - - True - minutes - True - - - - - - True - hours - True - - - - - - True - days - True - - - - + minutes +hours +days + False + True 0 diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 03447bf3a2..2644afb05b 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -98,7 +98,7 @@ struct _EventPagePrivate { GtkWidget *start_time; GtkWidget *end_time; - GtkWidget *end_time_selector; + GtkWidget *end_time_combo; GtkWidget *time_hour; GtkWidget *hour_selector; GtkWidget *minute_selector; @@ -115,7 +115,7 @@ struct _EventPagePrivate { gboolean show_time_as_busy; GtkWidget *alarm_dialog; - GtkWidget *alarm_time; + GtkWidget *alarm_time_combo; GtkWidget *alarm_warning; GtkWidget *alarm_box; @@ -174,7 +174,7 @@ static void set_attendees (ECalComponent *comp, const GPtrArray *attendees); static void hour_sel_changed ( GtkSpinButton *widget, EventPage *epage); static void minute_sel_changed ( GtkSpinButton *widget, EventPage *epage); static void hour_minute_changed ( EventPage *epage); -static void update_end_time_selector( EventPage *epage); +static void update_end_time_combo ( EventPage *epage); static void event_page_select_organizer (EventPage *epage, const char *backend_address); static void set_subscriber_info_string (EventPage *epage, const char *backend_address); @@ -354,8 +354,8 @@ set_all_day (EventPage *epage, gboolean all_day) /* TODO implement for in end time selector */ if (all_day) - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); - gtk_widget_set_sensitive (priv->end_time_selector, !all_day); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); + gtk_widget_set_sensitive (priv->end_time_combo, !all_day); e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day); e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day); @@ -450,7 +450,7 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD priv->sync_timezones = TRUE; - update_end_time_selector (epage); + update_end_time_combo (epage); } /* Fills the widgets with default values */ @@ -488,7 +488,7 @@ clear_widgets (EventPage *epage) set_busy_time_menu (epage, TRUE); /* Alarm */ - e_dialog_option_menu_set (priv->alarm_time, ALARM_NONE, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, alarm_map); /* Categories */ e_dialog_editable_set (priv->categories, NULL); @@ -728,9 +728,9 @@ sensitize_widgets (EventPage *epage) sensitize = !read_only && sens; - alarm = e_dialog_option_menu_get (priv->alarm_time, alarm_map) != ALARM_NONE; + alarm = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE; custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL) || - e_dialog_option_menu_get (priv->alarm_time, alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; + e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; if (alarm && !priv->alarm_icon) { priv->alarm_icon = create_image_event_box ("stock_bell", _("This event has alarms")); @@ -740,7 +740,7 @@ sensitize_widgets (EventPage *epage) /* The list of organizers is set to be non-editable. Otherwise any * change in the displayed list causes an 'Account not found' error. */ - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); gtk_editable_set_editable (GTK_EDITABLE (priv->summary), !read_only); gtk_editable_set_editable (GTK_EDITABLE (priv->location), sensitize); @@ -750,16 +750,16 @@ sensitize_widgets (EventPage *epage) gtk_widget_set_sensitive (priv->end_time, sensitize); gtk_widget_set_sensitive (priv->end_timezone, sensitize); gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->description), !read_only); - gtk_widget_set_sensitive (priv->alarm_time, !read_only); + gtk_widget_set_sensitive (priv->alarm_time_combo, !read_only); gtk_widget_set_sensitive (priv->categories_btn, !read_only); /*TODO implement the for portion of the end time selector */ if (flags & COMP_EDITOR_NEW_ITEM) { if (priv->all_day_event) - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); else - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 0); } else - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); gtk_widget_set_sensitive (priv->hour_selector, sensitize); gtk_widget_set_sensitive (priv->minute_selector, sensitize); @@ -856,7 +856,7 @@ get_current_account (EventPage *epage) priv = epage->priv; - str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry)); + str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer)))); if (!str) return NULL; @@ -960,7 +960,6 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) if (organizer.value != NULL) { const gchar *strip = itip_strip_mailto (organizer.value); gchar *string; - GList *list = NULL; if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { if (e_cal_get_static_capability ( @@ -986,13 +985,15 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) string = g_strdup (strip); if (!priv->user_org) { - list = g_list_append (list, string); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), list); - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), string); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); + } else { + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), string); } g_free (string); - g_list_free (list); priv->existing = TRUE; } } else { @@ -1039,7 +1040,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_cal_component_free_datetime (&start_date); e_cal_component_free_datetime (&end_date); - update_end_time_selector (epage); + update_end_time_combo (epage); /* Classification */ e_cal_component_get_classification (comp, &cl); comp_editor_set_classification (editor, cl); @@ -1064,7 +1065,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) enable_busy_time_menu (epage, TRUE); /* Alarms */ - g_signal_handlers_block_matched (priv->alarm_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); + g_signal_handlers_block_matched (priv->alarm_time_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_block_matched (priv->alarm_list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); if (e_cal_component_has_alarms (comp)) { @@ -1073,9 +1074,9 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) alarms = e_cal_component_get_alarm_uids (comp); if (!is_custom_alarm_uid_list (comp, alarms, priv->old_summary, priv->alarm_units, priv->alarm_interval, &alarm_type)) - e_dialog_option_menu_set (priv->alarm_time, alarm_type, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, alarm_type, alarm_map); else - e_dialog_option_menu_set (priv->alarm_time, ALARM_CUSTOM, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_CUSTOM, alarm_map); for (list = alarms; list != NULL; list = list->next) { ECalComponentAlarm *ca; @@ -1087,9 +1088,9 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) cal_obj_uid_list_free (alarms); } else { - e_dialog_option_menu_set (priv->alarm_time, ALARM_NONE, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, alarm_map); } - g_signal_handlers_unblock_matched (priv->alarm_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); + g_signal_handlers_unblock_matched (priv->alarm_time_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_unblock_matched (priv->alarm_list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); /* Categories */ @@ -1281,8 +1282,8 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* Alarm */ e_cal_component_remove_all_alarms (comp); - if (e_dialog_option_menu_get (priv->alarm_time, alarm_map) != ALARM_NONE) { - if (e_dialog_option_menu_get (priv->alarm_time, alarm_map) == ALARM_CUSTOM) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) == ALARM_CUSTOM) { GtkTreeModel *model; GtkTreeIter iter; gboolean valid_iter; @@ -1349,7 +1350,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; trigger.u.rel_duration.is_neg = 1; - alarm_type = e_dialog_option_menu_get (priv->alarm_time, alarm_map); + alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map); switch (alarm_type) { case ALARM_15_MINUTES: trigger.u.rel_duration.minutes = 15; @@ -1512,10 +1513,10 @@ event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) static void -time_sel_changed (GtkOptionMenu *widget, EventPage *epage) +time_sel_changed (GtkComboBox *combo, EventPage *epage) { EventPagePrivate *priv; - int selection = gtk_option_menu_get_history (widget); + int selection = gtk_combo_box_get_active (combo); priv = epage->priv; @@ -1528,12 +1529,12 @@ time_sel_changed (GtkOptionMenu *widget, EventPage *epage) gtk_widget_show (priv->time_hour); gtk_widget_hide (priv->end_time); - update_end_time_selector ( epage); + update_end_time_combo ( epage); } } static -void update_end_time_selector (EventPage *epage) +void update_end_time_combo (EventPage *epage) { EventPagePrivate *priv; struct icaltimetype start_tt = icaltime_null_time(); @@ -2024,11 +2025,11 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) g_return_if_fail (date_set); /* TODO implement the for portion in end time selector */ - gtk_widget_set_sensitive (priv->end_time_selector, !all_day); + gtk_widget_set_sensitive (priv->end_time_combo, !all_day); if (all_day) - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); else - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 0); action = comp_editor_get_action (editor, "view-time-zone"); gtk_action_set_sensitive (action, !all_day); @@ -2181,7 +2182,7 @@ get_widgets (EventPage *epage) page->accel_group = g_object_ref (accel_groups->data); priv->alarm_dialog = GW ("alarm-dialog"); priv->alarm_box = GW ("custom_box"); - priv->alarm_time = GW ("alarm-time"); + priv->alarm_time_combo = GW ("alarm-time-combobox"); priv->timezone_label = GW ("timezone-label"); priv->start_timezone = GW ("start-timezone"); @@ -2204,7 +2205,10 @@ get_widgets (EventPage *epage) priv->categories = GW ("categories"); priv->categories_btn = GW ("categories-button"); + priv->organizer = GW ("organizer"); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + priv->summary = GW ("summary"); priv->summary_label = GW ("summary-label"); priv->location = GW ("location"); @@ -2241,7 +2245,7 @@ get_widgets (EventPage *epage) priv->time_hour = GW ("time-hour"); priv->hour_selector = GW ("hour_selector"); priv->minute_selector = GW ("minute_selector"); - priv->end_time_selector = GW ("end-time-selector"); + priv->end_time_combo = GW ("end-time-combobox"); priv->end_time = GW ("end-time"); gtk_widget_show_all (priv->time_hour); @@ -2656,7 +2660,7 @@ alarm_changed_cb (GtkWidget *widget, gpointer data) epage = EVENT_PAGE (data); priv = epage->priv; - if (e_dialog_option_menu_get (priv->alarm_time, alarm_map) != ALARM_NONE) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE) { ECalComponentAlarm *ca; ECalComponentAlarmTrigger trigger; icalcomponent *icalcomp; @@ -2671,7 +2675,7 @@ alarm_changed_cb (GtkWidget *widget, gpointer data) trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; trigger.u.rel_duration.is_neg = 1; - alarm_type = e_dialog_option_menu_get (priv->alarm_time, alarm_map); + alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map); switch (alarm_type) { case ALARM_15_MINUTES: e_alarm_list_clear (priv->alarm_list_store); @@ -2795,9 +2799,8 @@ init_widgets (EventPage *epage) CompEditor *editor; GtkTextBuffer *text_buffer; icaltimezone *zone; - char *menu_label = NULL; + char *combo_label = NULL; GtkTreeSelection *selection; - GtkWidget *cus_item, *menu; ECal *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2903,11 +2906,11 @@ init_widgets (EventPage *epage) } /* End time selector */ - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); gtk_widget_hide (priv->time_hour); gtk_widget_show (priv->end_time); - g_signal_connect (priv->end_time_selector, "changed", G_CALLBACK (time_sel_changed), epage); - update_end_time_selector ( epage); + g_signal_connect (priv->end_time_combo, "changed", G_CALLBACK (time_sel_changed), epage); + update_end_time_combo ( epage); /* Hour and Minute selector */ gtk_spin_button_set_range( (GtkSpinButton*) priv->hour_selector, 0, G_MAXINT); @@ -2918,50 +2921,40 @@ init_widgets (EventPage *epage) priv->alarm_units = calendar_config_get_default_reminder_units (); priv->alarm_interval = calendar_config_get_default_reminder_interval (); - menu_label = ""; + combo_label = NULL; switch (priv->alarm_units) { case CAL_DAYS: if (priv->alarm_interval != 1) { - menu_label = g_strdup_printf (ngettext("%d day before appointment", "%d days before appointment", priv->alarm_interval), priv->alarm_interval); + combo_label = g_strdup_printf (ngettext("%d day before appointment", "%d days before appointment", priv->alarm_interval), priv->alarm_interval); } break; case CAL_HOURS: if (priv->alarm_interval != 1) { - menu_label = g_strdup_printf (ngettext("%d hour before appointment", "%d hours before appointment", priv->alarm_interval), priv->alarm_interval); + combo_label = g_strdup_printf (ngettext("%d hour before appointment", "%d hours before appointment", priv->alarm_interval), priv->alarm_interval); } break; case CAL_MINUTES: if (priv->alarm_interval != 15) { - menu_label = g_strdup_printf (ngettext("%d minute before appointment", "%d minutes before appointment", priv->alarm_interval), priv->alarm_interval); + combo_label = g_strdup_printf (ngettext("%d minute before appointment", "%d minutes before appointment", priv->alarm_interval), priv->alarm_interval); } break; } - cus_item = gtk_menu_item_new_with_label (menu_label); - if(menu_label[0] != '\0') { - gtk_widget_show (cus_item); + if (combo_label) { + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), combo_label); + g_free (combo_label); } - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), cus_item); - - cus_item = gtk_menu_item_new_with_label (_("Customize")); - gtk_widget_show (cus_item); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), cus_item); - - cus_item = gtk_menu_item_new_with_label (_("None")); - gtk_widget_show (cus_item); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time)); - gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), cus_item); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), _("Customize")); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), _("None")); g_signal_connect_swapped ( - priv->alarm_time, "changed", + priv->alarm_time_combo, "changed", G_CALLBACK (comp_editor_page_changed), epage); g_signal_connect ( - priv->alarm_time, "changed", + priv->alarm_time_combo, "changed", G_CALLBACK (alarm_changed_cb), epage); /* Belongs to priv->description */ @@ -3046,9 +3039,8 @@ event_page_select_organizer (EventPage *epage, const char *backend_address) if (default_address) { if (!priv->comp || !e_cal_component_has_organizer (priv->comp)) { - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), default_address); - /* FIXME: Use accessor functions to access private members of a GtkCombo widget */ - gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), !subscribed_cal); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), default_address); + gtk_widget_set_sensitive (priv->organizer, !subscribed_cal); } } else g_warning ("No potential organizers!"); @@ -3114,9 +3106,14 @@ event_page_construct (EventPage *epage, EMeetingStore *model) g_object_unref(it); - if (priv->address_strings) - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - else + if (priv->address_strings) { + GList *l; + + for (l = priv->address_strings; l; l = l->next) + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), l->data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + } else g_warning ("No potential organizers!"); if (!init_widgets (epage)) { diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index c7d00dda94..7a57f6b716 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -198,7 +198,6 @@ 0.5 0 0 - organizer-entry PANGO_ELLIPSIZE_NONE -1 False @@ -392,34 +391,12 @@ 0 - - 24 + True - True - 0 - - - - - - - True - for - True - - - - - - - True - until - True - - - - - + for +until + False + True 12 @@ -756,34 +733,13 @@ 0 - + True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + a +b + False + True + True 0 @@ -1090,7 +1046,6 @@ 0.5 0 0 - alarm-time PANGO_ELLIPSIZE_NONE -1 False @@ -1104,42 +1059,13 @@ - + True - True - 0 - - - - - - - True - 15 minutes before appointment - True - - - - - - - True - 1 hour before appointment - True - - - - - - - True - 1 day before appointment - True - - - - - + 15 minutes before appointment +1 hour before appointment +1 day before appointment + False + True 4 diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade index c332d081ca..e69de29bb2 100644 --- a/calendar/gui/dialogs/meeting-page.glade +++ b/calendar/gui/dialogs/meeting-page.glade @@ -1,407 +0,0 @@ - - - - - - - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - - - - 12 - True - False - 6 - - - - True - False - 6 - - - - True - False - 12 - - - - True - Or_ganizer: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - organizer-entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - False - False - True - False - - Organizer - - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - False - 12 - - - - True - Organizer: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - organizer-entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - None - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - C_hange Organizer - True - GTK_RELIEF_NORMAL - True - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - False - False - - - - - - True - <b>Att_endees</b> - True - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - GTK_BUTTONBOX_START - 6 - - - - True - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-jump-to - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Co_ntacts... - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - True - True - - - - - - - diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 9277a3c111..4f8c37c0a3 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -255,7 +255,6 @@ memo_page_fill_widgets (CompEditorPage *page, if (organizer.value != NULL) { const gchar *strip = itip_strip_mailto (organizer.value); gchar *string; - GList *list = NULL; if ( organizer.cn != NULL) string = g_strdup_printf ("%s <%s>", organizer.cn, strip); @@ -263,14 +262,14 @@ memo_page_fill_widgets (CompEditorPage *page, string = g_strdup (strip); if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry), string); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), string); } else { - list = g_list_append (list, string); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->org_combo), list); - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->org_combo)->entry), FALSE); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo)))); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->org_combo), string); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->org_combo))), FALSE); } g_free (string); - g_list_free (list); } } @@ -344,7 +343,7 @@ sensitize_widgets (MemoPage *mpage) /* The list of organizers is set to be non-editable. Otherwise any * change in the displayed list causes an 'Account not found' error. */ - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->org_combo)->entry), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->org_combo))), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->memo_content), sensitize); gtk_widget_set_sensitive (priv->start_date, sensitize); @@ -515,7 +514,7 @@ get_current_account (MemoPage *page) EIterator *it; const char *str; - str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry)); + str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo)))); if (!str) return NULL; @@ -778,6 +777,7 @@ get_widgets (MemoPage *mpage) priv->org_label = GW ("org-label"); priv->org_combo = GW ("org-combo"); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo)))); priv->to_button = GW ("to-button"); priv->to_hbox = GW ("to-hbox"); @@ -1062,9 +1062,8 @@ memo_page_select_organizer (MemoPage *mpage, const char *backend_address) if (default_address) { if (flags & COMP_EDITOR_NEW_ITEM) { - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry), default_address); - /* FIXME: Use accessor functions to access private members of a GtkCombo widget */ - gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->org_combo)->button), !subscribed_cal); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), default_address); + gtk_widget_set_sensitive (priv->org_combo, !subscribed_cal); } } else g_warning ("No potential organizers!"); @@ -1132,9 +1131,14 @@ memo_page_construct (MemoPage *mpage) g_object_unref(it); - if (priv->address_strings) - gtk_combo_set_popdown_strings (GTK_COMBO (priv->org_combo), priv->address_strings); - else + if (priv->address_strings) { + GList *l; + + for (l = priv->address_strings; l; l = l->next) + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->org_combo), l->data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0); + } else g_warning ("No potential organizers!"); gtk_widget_show (priv->org_label); diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade index 6b65a053d5..b1ff10f3f4 100644 --- a/calendar/gui/dialogs/memo-page.glade +++ b/calendar/gui/dialogs/memo-page.glade @@ -159,7 +159,6 @@ True _Description: - memo_content True False GTK_JUSTIFY_CENTER @@ -169,6 +168,7 @@ 0 0 0 + memo_content PANGO_ELLIPSIZE_NONE -1 False @@ -285,7 +285,6 @@ 0.5 0 0 - combo-entry1 PANGO_ELLIPSIZE_NONE -1 False @@ -427,44 +426,6 @@ - - - False - True - False - True - False - - - - True - True - True - True - 0 - - True - - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 1 - 2 - 0 - 1 - - - - False @@ -485,6 +446,25 @@ fill + + + + True + a +b + False + True + True + + + 1 + 2 + 0 + 1 + fill + fill + + 0 diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 15171d52ed..c85a0ae0f2 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -145,9 +145,9 @@ struct _RecurrencePagePrivate { GtkWidget *params; GtkWidget *interval_value; - GtkWidget *interval_unit; + GtkWidget *interval_unit_combo; GtkWidget *special; - GtkWidget *ending_menu; + GtkWidget *ending_combo; GtkWidget *ending_special; GtkWidget *custom_warning_bin; @@ -159,10 +159,10 @@ struct _RecurrencePagePrivate { /* For monthly recurrences, created by hand */ int month_index; - GtkWidget *month_day_menu; + GtkWidget *month_day_combo; enum month_day_options month_day; - GtkWidget *month_num_menu; + GtkWidget *month_num_combo; enum month_num_options month_num; /* For ending date, created by hand */ @@ -343,11 +343,11 @@ recurrence_page_finalize (GObject *object) preview_date_range_changed_cb, NULL); g_signal_handlers_disconnect_matched ( - priv->interval_unit, G_SIGNAL_MATCH_DATA, + priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); g_signal_handlers_disconnect_matched ( - priv->ending_menu, G_SIGNAL_MATCH_DATA, + priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); /* Chain up to parent's finalize() method. */ @@ -410,7 +410,6 @@ clear_widgets (RecurrencePage *rpage) { RecurrencePagePrivate *priv; GtkAdjustment *adj; - GtkWidget *menu; priv = rpage->priv; @@ -431,22 +430,20 @@ clear_widgets (RecurrencePage *rpage) e_dialog_spin_set (priv->interval_value, 1); g_signal_handlers_unblock_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_DAILY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); priv->ending_date_tt = icaltime_today (); priv->ending_count = 1; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->ending_menu, + g_signal_handlers_block_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->ending_combo, ENDING_FOR, ending_types_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); make_ending_special (rpage); /* Exceptions list */ e_date_time_list_clear (priv->exception_list_store); @@ -668,7 +665,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) /* Frequency, interval, week start */ - r.freq = e_dialog_option_menu_get (priv->interval_unit, freq_map); + r.freq = e_dialog_combo_box_get (priv->interval_unit_combo, freq_map); r.interval = e_dialog_spin_get_int (priv->interval_value); r.week_start = ICAL_SUNDAY_WEEKDAY + calendar_config_get_week_start_day (); @@ -721,14 +718,14 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) enum month_day_options month_day; g_return_if_fail (GTK_BIN (priv->special)->child != NULL); - g_return_if_fail (priv->month_day_menu != NULL); - g_return_if_fail (GTK_IS_OPTION_MENU (priv->month_day_menu)); - g_return_if_fail (priv->month_num_menu != NULL); - g_return_if_fail (GTK_IS_OPTION_MENU (priv->month_num_menu)); + g_return_if_fail (priv->month_day_combo != NULL); + g_return_if_fail (GTK_IS_COMBO_BOX (priv->month_day_combo)); + g_return_if_fail (priv->month_num_combo != NULL); + g_return_if_fail (GTK_IS_COMBO_BOX (priv->month_num_combo)); - month_num = e_dialog_option_menu_get (priv->month_num_menu, + month_num = e_dialog_combo_box_get (priv->month_num_combo, month_num_options_map ); - month_day = e_dialog_option_menu_get (priv->month_day_menu, + month_day = e_dialog_combo_box_get (priv->month_day_combo, month_day_options_map); if (month_num == MONTH_NUM_LAST) @@ -799,8 +796,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) /* Ending date */ - ending_type = e_dialog_option_menu_get (priv->ending_menu, - ending_types_map); + ending_type = e_dialog_combo_box_get (priv->ending_combo, ending_types_map); switch (ending_type) { case ENDING_FOR: @@ -903,8 +899,8 @@ fill_component (RecurrencePage *rpage, ECalComponent *comp) e_cal_component_set_exdate_list (comp, list); e_cal_component_free_exdate_list (list); - if (GTK_WIDGET_VISIBLE (priv->ending_menu) && GTK_WIDGET_IS_SENSITIVE (priv->ending_menu) && - e_dialog_option_menu_get (priv->ending_menu, ending_types_map) == ENDING_UNTIL) { + if (GTK_WIDGET_VISIBLE (priv->ending_combo) && GTK_WIDGET_IS_SENSITIVE (priv->ending_combo) && + e_dialog_combo_box_get (priv->ending_combo, ending_types_map) == ENDING_UNTIL) { /* check whether the "until" date is in the future */ struct icaltimetype tt; gboolean ok = TRUE; @@ -978,44 +974,37 @@ make_weekly_special (RecurrencePage *rpage) G_CALLBACK (comp_editor_page_changed), rpage); } - +/* Creates the subtree for the monthly recurrence number */ static void -month_num_submenu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - GtkWidget *item; - int month_index; - - item = gtk_menu_get_active (GTK_MENU (menu_shell)); - item = gtk_menu_get_active (GTK_MENU (gtk_menu_item_get_submenu (GTK_MENU_ITEM (item)))); - - month_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data")); - g_object_set_data (G_OBJECT (data), "data", GINT_TO_POINTER (month_index)); -} - -/* Creates the option menu for the monthly recurrence number */ -static GtkWidget * -make_recur_month_num_submenu (const char *title, int start, int end) +make_recur_month_num_subtree (GtkTreeStore *store, GtkTreeIter *par, const char *title, int start, int end) { - GtkWidget *submenu, *item; + GtkTreeIter iter, parent; int i; - submenu = gtk_menu_new (); + gtk_tree_store_append (store, &parent, par); + gtk_tree_store_set (store, &parent, 0, _(title), 1, -1, -1); + for (i = start; i < end; i++) { - item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); - g_object_set_data (G_OBJECT (item), "data", GINT_TO_POINTER (i + 1)); - gtk_widget_show (item); + gtk_tree_store_append (store, &iter, &parent); + gtk_tree_store_set (store, &iter, 0, _(e_cal_recur_nth[i]), 1, i + 1, -1); } +} +static void +only_leaf_sensitive (GtkCellLayout *cell_layout, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gpointer data) +{ + gboolean sensitive; - item = gtk_menu_item_new_with_label (_(title)); - gtk_widget_show (item); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu); + sensitive = !gtk_tree_model_iter_has_child (tree_model, iter); - return item; + g_object_set (cell, "sensitive", sensitive, NULL); } static GtkWidget * -make_recur_month_num_menu (int month_index) +make_recur_month_num_combo (int month_index) { static const char *options[] = { /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the [first] [Monday] [forever]' @@ -1046,67 +1035,65 @@ make_recur_month_num_menu (int month_index) N_("last") }; - GtkWidget *menu, *submenu, *item, *submenu_item; - GtkWidget *omenu; int i; + GtkTreeStore *store; + GtkTreeIter iter; + GtkWidget *combo; + GtkCellRenderer *cell; - menu = gtk_menu_new (); + store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT); /* Relation */ for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) { - item = gtk_menu_item_new_with_label (_(options[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); + gtk_tree_store_append (store, &iter, NULL); + gtk_tree_store_set (store, &iter, 0, _(options [i]), 1, month_num_options_map [i], -1); } /* Current date */ - item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[month_index - 1])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); - - /* Other Submenu */ - submenu = gtk_menu_new (); + gtk_tree_store_append (store, &iter, NULL); + gtk_tree_store_set (store, &iter, 0, _(e_cal_recur_nth[month_index - 1]), 1, MONTH_NUM_DAY, -1); + gtk_tree_store_append (store, &iter, NULL); /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the [Other date] [11th to 20th] [17th] [forever]' * (dropdown menu options are in [square brackets]). */ - submenu_item = gtk_menu_item_new_with_label (_("Other Date")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), submenu_item); - gtk_widget_show (submenu_item); + gtk_tree_store_set (store, &iter, 0, _("Other Date"), 1, MONTH_NUM_OTHER, -1); /* TRANSLATORS: This is a submenu option string to split the date range into three submenus to choose the exact day of * the month to setup an appointment recurrence. The entire string is for example: This appointment recurs/Every [x] month(s) * on the [Other date] [1st to 10th] [7th] [forever]' (dropdown menu options are in [square brackets]). */ - item = make_recur_month_num_submenu (_("1st to 10th"), 0, 10); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); + make_recur_month_num_subtree (store, &iter, _("1st to 10th"), 0, 10); + /* TRANSLATORS: This is a submenu option string to split the date range into three submenus to choose the exact day of * the month to setup an appointment recurrence. The entire string is for example: This appointment recurs/Every [x] month(s) * on the [Other date] [11th to 20th] [17th] [forever]' (dropdown menu options are in [square brackets]). */ - item = make_recur_month_num_submenu (_("11th to 20th"), 10, 20); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); + make_recur_month_num_subtree (store, &iter, _("11th to 20th"), 10, 20); + /* TRANSLATORS: This is a submenu option string to split the date range into three submenus to choose the exact day of * the month to setup an appointment recurrence. The entire string is for example: This appointment recurs/Every [x] month(s) * on the [Other date] [21th to 31th] [27th] [forever]' (dropdown menu options are in [square brackets]). */ - item = make_recur_month_num_submenu (_("21st to 31st"), 20, 31); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); + make_recur_month_num_subtree (store, &iter, _("21st to 31st"), 20, 31); + + combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); + g_object_unref (store); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (submenu_item), submenu); - g_object_set_data (G_OBJECT (submenu_item), "data", GINT_TO_POINTER (month_index)); - g_signal_connect((submenu), "selection_done", - G_CALLBACK (month_num_submenu_selection_done_cb), - submenu_item); + cell = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", 0, NULL); - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); + gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), + cell, + only_leaf_sensitive, + NULL, NULL); - return omenu; + return combo; } -/* Creates the option menu for the monthly recurrence days */ +/* Creates the combo box for the monthly recurrence days */ static GtkWidget * -make_recur_month_menu (void) +make_recur_month_combobox (void) { static const char *options[] = { /* For Translator : 'day' is part of the sentence of the form 'appointment recurs/Every [x] month(s) on the [first] [day] [forever]' @@ -1122,76 +1109,80 @@ make_recur_month_menu (void) N_("Sunday") }; - GtkWidget *menu; - GtkWidget *omenu; + GtkWidget *combo; int i; - menu = gtk_menu_new (); + combo = gtk_combo_box_new_text (); for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) { - GtkWidget *item; - - item = gtk_menu_item_new_with_label (_(options[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(options[i])); } - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - - return omenu; + return combo; } static void -month_num_menu_selection_done_cb (GtkMenuShell *menu_shell, - RecurrencePage *rpage) +month_num_combo_changed_cb (GtkComboBox *combo, RecurrencePage *rpage) { + GtkTreeIter iter; RecurrencePagePrivate *priv; enum month_num_options month_num; enum month_day_options month_day; priv = rpage->priv; - month_num = e_dialog_option_menu_get (priv->month_num_menu, - month_num_options_map); - month_day = e_dialog_option_menu_get (priv->month_day_menu, + month_day = e_dialog_combo_box_get (priv->month_day_combo, month_day_options_map); - if (month_num == MONTH_NUM_OTHER) { - GtkWidget *label, *item; + if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->month_num_combo), &iter)) { + gint value; + GtkTreeIter parent; + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->month_num_combo)); + + gtk_tree_model_get (model, &iter, 1, &value, -1); - item = gtk_menu_get_active (GTK_MENU (menu_shell)); - priv->month_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data")); + if (value == -1) { + return; + } + + if (gtk_tree_model_iter_parent (model, &parent, &iter)) { + /* it's a leaf, thus the day number */ + month_num = MONTH_NUM_DAY; + priv->month_index = value; - month_num = MONTH_NUM_DAY; - e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map); + g_return_if_fail (gtk_tree_model_iter_nth_child (model, &iter, NULL, month_num)); - label = GTK_BIN (priv->month_num_menu)->child; - gtk_label_set_text (GTK_LABEL (label), _(e_cal_recur_nth[priv->month_index - 1])); + gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, _(e_cal_recur_nth[priv->month_index - 1]), -1); + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->month_num_combo), &iter); + } else { + /* top level node */ + month_num = value; - e_dialog_option_menu_set (priv->month_num_menu, 0, month_num_options_map); - e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map); + if (month_num == MONTH_NUM_OTHER) + month_num = MONTH_NUM_DAY; + } + } else { + month_num = 0; } if (month_num == MONTH_NUM_DAY && month_day != MONTH_DAY_NTH) - e_dialog_option_menu_set (priv->month_day_menu, + e_dialog_combo_box_set (priv->month_day_combo, MONTH_DAY_NTH, month_day_options_map); else if (month_num != MONTH_NUM_DAY && month_num != MONTH_NUM_LAST && month_day == MONTH_DAY_NTH) - e_dialog_option_menu_set (priv->month_day_menu, + e_dialog_combo_box_set (priv->month_day_combo, MONTH_DAY_MON, month_num_options_map); comp_editor_page_changed (COMP_EDITOR_PAGE (rpage)); } -/* Callback used when the monthly day selection menu changes. We need +/* Callback used when the monthly day selection changes. We need * to change the valid range of the day index spin button; e.g. days * are 1-31 while a Sunday is the 1st through 5th. */ static void -month_day_menu_selection_done_cb (GtkMenuShell *menu_shell, - RecurrencePage *rpage) +month_day_combo_changed_cb (GtkComboBox *combo, RecurrencePage *rpage) { RecurrencePagePrivate *priv; enum month_num_options month_num; @@ -1199,16 +1190,16 @@ month_day_menu_selection_done_cb (GtkMenuShell *menu_shell, priv = rpage->priv; - month_num = e_dialog_option_menu_get (priv->month_num_menu, + month_num = e_dialog_combo_box_get (priv->month_num_combo, month_num_options_map); - month_day = e_dialog_option_menu_get (priv->month_day_menu, + month_day = e_dialog_combo_box_get (priv->month_day_combo, month_day_options_map); if (month_day == MONTH_DAY_NTH && month_num != MONTH_NUM_LAST && month_num != MONTH_NUM_DAY) - e_dialog_option_menu_set (priv->month_num_menu, + e_dialog_combo_box_set (priv->month_num_combo, MONTH_NUM_DAY, month_num_options_map); else if (month_day != MONTH_DAY_NTH && month_num == MONTH_NUM_DAY) - e_dialog_option_menu_set (priv->month_num_menu, + e_dialog_combo_box_set (priv->month_num_combo, MONTH_NUM_FIRST, month_num_options_map); @@ -1223,12 +1214,11 @@ make_monthly_special (RecurrencePage *rpage) GtkWidget *hbox; GtkWidget *label; GtkAdjustment *adj; - GtkWidget *menu; priv = rpage->priv; g_return_if_fail (GTK_BIN (priv->special)->child == NULL); - g_return_if_fail (priv->month_day_menu == NULL); + g_return_if_fail (priv->month_day_combo == NULL); /* Create the widgets */ @@ -1243,21 +1233,21 @@ make_monthly_special (RecurrencePage *rpage) adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 31, 1, 10, 10)); - priv->month_num_menu = make_recur_month_num_menu (priv->month_index); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_num_menu, + priv->month_num_combo = make_recur_month_num_combo (priv->month_index); + gtk_box_pack_start (GTK_BOX (hbox), priv->month_num_combo, FALSE, FALSE, 6); - priv->month_day_menu = make_recur_month_menu (); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_day_menu, + priv->month_day_combo = make_recur_month_combobox (); + gtk_box_pack_start (GTK_BOX (hbox), priv->month_day_combo, FALSE, FALSE, 6); gtk_widget_show_all (hbox); /* Set the options */ - e_dialog_option_menu_set (priv->month_num_menu, + e_dialog_combo_box_set (priv->month_num_combo, priv->month_num, month_num_options_map); - e_dialog_option_menu_set (priv->month_day_menu, + e_dialog_combo_box_set (priv->month_day_combo, priv->month_day, month_day_options_map); @@ -1265,14 +1255,8 @@ make_monthly_special (RecurrencePage *rpage) adj, "value-changed", G_CALLBACK (comp_editor_page_changed), rpage); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->month_num_menu)); - g_signal_connect((menu), "selection_done", - G_CALLBACK (month_num_menu_selection_done_cb), - rpage); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->month_day_menu)); - g_signal_connect((menu), "selection_done", - G_CALLBACK (month_day_menu_selection_done_cb), - rpage); + g_signal_connect (priv->month_num_combo, "changed", G_CALLBACK (month_num_combo_changed_cb), rpage); + g_signal_connect (priv->month_day_combo, "changed", G_CALLBACK (month_day_combo_changed_cb), rpage); } /* Changes the recurrence-special widget to match the interval units. @@ -1290,18 +1274,18 @@ make_recurrence_special (RecurrencePage *rpage) priv = rpage->priv; - if (priv->month_num_menu != NULL) { - gtk_widget_destroy (priv->month_num_menu); - priv->month_num_menu = NULL; + if (priv->month_num_combo != NULL) { + gtk_widget_destroy (priv->month_num_combo); + priv->month_num_combo = NULL; } if (GTK_BIN (priv->special)->child != NULL) { gtk_widget_destroy (GTK_BIN (priv->special)->child); priv->weekday_picker = NULL; - priv->month_day_menu = NULL; + priv->month_day_combo = NULL; } - frequency = e_dialog_option_menu_get (priv->interval_unit, freq_map); + frequency = e_dialog_combo_box_get (priv->interval_unit_combo, freq_map); switch (frequency) { case ICAL_DAILY_RECURRENCE: @@ -1449,8 +1433,7 @@ make_ending_special (RecurrencePage *rpage) priv->ending_count_spin = NULL; } - ending_type = e_dialog_option_menu_get (priv->ending_menu, - ending_types_map); + ending_type = e_dialog_combo_box_get (priv->ending_combo, ending_types_map); switch (ending_type) { case ENDING_FOR: @@ -1480,20 +1463,18 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; - GtkWidget *menu; ECal *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); client = comp_editor_get_client (editor); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_block_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); if (r->count == 0) { if (r->until.year == 0) { /* Forever */ - e_dialog_option_menu_set (priv->ending_menu, + e_dialog_combo_box_set (priv->ending_combo, ENDING_FOREVER, ending_types_map); } else { @@ -1526,7 +1507,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) } priv->ending_date_tt = r->until; - e_dialog_option_menu_set (priv->ending_menu, + e_dialog_combo_box_set (priv->ending_combo, ENDING_UNTIL, ending_types_map); } @@ -1534,12 +1515,12 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) /* Count of occurrences */ priv->ending_count = r->count; - e_dialog_option_menu_set (priv->ending_menu, + e_dialog_combo_box_set (priv->ending_combo, ENDING_FOR, ending_types_map); } - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); make_ending_special (rpage); } @@ -1564,7 +1545,6 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) int n_by_second, n_by_minute, n_by_hour; int n_by_day, n_by_month_day, n_by_year_day; int n_by_week_no, n_by_month, n_by_set_pos; - GtkWidget *menu; GtkAdjustment *adj; rpage = RECURRENCE_PAGE (page); @@ -1673,12 +1653,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) || n_by_set_pos != 0) goto custom; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_DAILY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; case ICAL_WEEKLY_RECURRENCE: { @@ -1740,12 +1719,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) priv->weekday_day_mask = day_mask; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_WEEKLY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; } @@ -1840,12 +1818,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } else goto custom; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_MONTHLY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; case ICAL_YEARLY_RECURRENCE: @@ -1857,12 +1834,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) || n_by_set_pos != 0) goto custom; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_YEARLY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; default: @@ -2019,9 +1995,9 @@ get_widgets (RecurrencePage *rpage) priv->params = GW ("params"); priv->interval_value = GW ("interval-value"); - priv->interval_unit = GW ("interval-unit"); + priv->interval_unit_combo = GW ("interval-unit-combobox"); priv->special = GW ("special"); - priv->ending_menu = GW ("ending-menu"); + priv->ending_combo = GW ("ending-combobox"); priv->ending_special = GW ("ending-special"); priv->custom_warning_bin = GW ("custom-warning-bin"); @@ -2037,9 +2013,9 @@ get_widgets (RecurrencePage *rpage) return (priv->recurs && priv->params && priv->interval_value - && priv->interval_unit + && priv->interval_unit_combo && priv->special - && priv->ending_menu + && priv->ending_combo && priv->ending_special && priv->custom_warning_bin && priv->exception_list @@ -2296,19 +2272,19 @@ init_widgets (RecurrencePage *rpage) /* Recurrence units */ g_signal_connect_swapped ( - priv->interval_unit, "changed", + priv->interval_unit_combo, "changed", G_CALLBACK (comp_editor_page_changed), rpage); g_signal_connect_swapped ( - priv->interval_unit, "changed", + priv->interval_unit_combo, "changed", G_CALLBACK (make_recurrence_special), rpage); /* Recurrence ending */ g_signal_connect_swapped ( - priv->ending_menu, "changed", + priv->ending_combo, "changed", G_CALLBACK (comp_editor_page_changed), rpage); g_signal_connect_swapped ( - priv->ending_menu, "changed", + priv->ending_combo, "changed", G_CALLBACK (make_ending_special), rpage); /* Exception buttons */ diff --git a/calendar/gui/dialogs/recurrence-page.glade b/calendar/gui/dialogs/recurrence-page.glade index 14d6c2fa04..5cec3f8494 100644 --- a/calendar/gui/dialogs/recurrence-page.glade +++ b/calendar/gui/dialogs/recurrence-page.glade @@ -4,7 +4,7 @@ - window1 + window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -15,6 +15,8 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + True + False @@ -36,6 +38,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -63,6 +69,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -81,8 +91,7 @@ True True - This appointment rec_urs + This appointment rec_urs True GTK_RELIEF_NORMAL True @@ -112,8 +121,7 @@ True - Every + Every False False GTK_JUSTIFY_CENTER @@ -123,6 +131,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -151,52 +163,15 @@ - + True - True - 0 - - - - True - - - - True - day(s) - True - - - - - - True - week(s) - True - - - - - - True - month(s) - True - - - - - - True - year(s) - True - - - - + day(s) +week(s) +month(s) +year(s) + False + True 0 @@ -229,43 +204,14 @@ - + True - True - 0 - - - - True - - - - True - for - True - - - - - - True - until - True - - - - - - True - forever - True - - - - + for +until +forever + False + True 0 @@ -361,6 +307,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -388,6 +338,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -418,6 +372,9 @@ False False True + False + False + False @@ -502,6 +459,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -562,6 +523,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -589,6 +554,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index a2be1381a6..959c275443 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -52,8 +52,8 @@ struct _TaskDetailsPagePrivate { /* Widgets from the Glade file */ GtkWidget *main; - GtkWidget *status; - GtkWidget *priority; + GtkWidget *status_combo; + GtkWidget *priority_combo; GtkWidget *percent_complete; GtkWidget *date_completed_label; @@ -165,7 +165,7 @@ task_details_page_focus_main_widget (CompEditorPage *page) tdpage = TASK_DETAILS_PAGE (page); priv = tdpage->priv; - gtk_widget_grab_focus (priv->status); + gtk_widget_grab_focus (priv->status_combo); } @@ -241,8 +241,8 @@ sensitize_widgets (TaskDetailsPage *tdpage) if (!e_cal_is_read_only (client, &read_only, NULL)) read_only = TRUE; - gtk_widget_set_sensitive (priv->status, !read_only); - gtk_widget_set_sensitive (priv->priority, !read_only); + gtk_widget_set_sensitive (priv->status_combo, !read_only); + gtk_widget_set_sensitive (priv->priority_combo, !read_only); gtk_widget_set_sensitive (priv->percent_complete, !read_only); gtk_widget_set_sensitive (priv->completed_date, !read_only); gtk_widget_set_sensitive (priv->url_label, !read_only); @@ -290,7 +290,7 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } else status = ICAL_STATUS_NONE; } - e_dialog_option_menu_set (priv->status, status, status_map); + e_dialog_combo_box_set (priv->status_combo, status, status_map); if (percent) e_cal_component_free_percent (percent); @@ -325,7 +325,7 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } else { priority = PRIORITY_UNDEFINED; } - e_dialog_option_menu_set (priv->priority, priority, priority_map); + e_dialog_combo_box_set (priv->priority_combo, priority, priority_map); /* URL */ e_cal_component_get_url (comp, &url); @@ -358,11 +358,11 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp) e_cal_component_set_percent (comp, &percent); /* Status. */ - status = e_dialog_option_menu_get (priv->status, status_map); + status = e_dialog_combo_box_get (priv->status_combo, status_map); e_cal_component_set_status (comp, status); /* Priority. */ - priority = e_dialog_option_menu_get (priv->priority, priority_map); + priority = e_dialog_combo_box_get (priv->priority_combo, priority_map); priority_value = priority_index_to_value (priority); e_cal_component_set_priority (comp, &priority_value); @@ -465,8 +465,8 @@ get_widgets (TaskDetailsPage *tdpage) g_object_ref (priv->main); gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - priv->status = GW ("status"); - priv->priority = GW ("priority"); + priv->status_combo = GW ("status-combobox"); + priv->priority_combo = GW ("priority-combobox"); priv->percent_complete = GW ("percent-complete"); priv->date_completed_label = GW ("date_completed_label"); @@ -483,8 +483,8 @@ get_widgets (TaskDetailsPage *tdpage) #undef GW - return (priv->status - && priv->priority + return (priv->status_combo + && priv->priority_combo && priv->percent_complete && priv->date_completed_label && priv->completed_date @@ -542,19 +542,19 @@ date_changed_cb (EDateEdit *dedit, gpointer data) &completed_tt.hour, &completed_tt.minute); - status = e_dialog_option_menu_get (priv->status, status_map); + status = e_dialog_combo_box_get (priv->status_combo, status_map); if (!date_set) { completed_tt = icaltime_null_time (); if (status == ICAL_STATUS_COMPLETED) { - e_dialog_option_menu_set (priv->status, + e_dialog_combo_box_set (priv->status_combo, ICAL_STATUS_NONE, status_map); e_dialog_spin_set (priv->percent_complete, 0); } } else { if (status != ICAL_STATUS_COMPLETED) { - e_dialog_option_menu_set (priv->status, + e_dialog_combo_box_set (priv->status_combo, ICAL_STATUS_COMPLETED, status_map); } @@ -569,7 +569,7 @@ date_changed_cb (EDateEdit *dedit, gpointer data) } static void -status_changed (GtkMenu *menu, TaskDetailsPage *tdpage) +status_changed (GtkWidget *combo, TaskDetailsPage *tdpage) { TaskDetailsPagePrivate *priv; icalproperty_status status; @@ -585,7 +585,7 @@ status_changed (GtkMenu *menu, TaskDetailsPage *tdpage) comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), TRUE); - status = e_dialog_option_menu_get (priv->status, status_map); + status = e_dialog_combo_box_get (priv->status_combo, status_map); if (status == ICAL_STATUS_NONE) { e_dialog_spin_set (priv->percent_complete, 0); e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); @@ -642,7 +642,7 @@ percent_complete_changed (GtkAdjustment *adj, TaskDetailsPage *tdpage) status = ICAL_STATUS_INPROCESS; } - e_dialog_option_menu_set (priv->status, status, status_map); + e_dialog_combo_box_set (priv->status_combo, status, status_map); e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); complete_date_changed (tdpage, ctime, complete); @@ -672,8 +672,8 @@ init_widgets (TaskDetailsPage *tdpage) /* Connect signals. The Status, Percent Complete & Date Completed properties are closely related so whenever one changes we may need to update the other 2. */ - g_signal_connect((GTK_OPTION_MENU (priv->status)->menu), - "deactivate", + g_signal_connect (GTK_COMBO_BOX (priv->status_combo), + "changed", G_CALLBACK (status_changed), tdpage); g_signal_connect((GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), @@ -682,7 +682,7 @@ init_widgets (TaskDetailsPage *tdpage) /* Priority */ g_signal_connect_swapped ( - GTK_OPTION_MENU (priv->priority)->menu, "deactivate", + GTK_COMBO_BOX (priv->priority_combo), "changed", G_CALLBACK (comp_editor_page_changed), tdpage); /* Completed Date */ diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade index aac90876ed..44fc3b2fbb 100644 --- a/calendar/gui/dialogs/task-details-page.glade +++ b/calendar/gui/dialogs/task-details-page.glade @@ -4,7 +4,7 @@ - window1 + window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -15,6 +15,8 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + True + False @@ -36,6 +38,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -63,6 +69,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -93,7 +103,10 @@ 0.5 0 0 - status + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -119,6 +132,10 @@ 0 0 percent-complete + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -143,7 +160,10 @@ 0.5 0 0 - priority + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -168,6 +188,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -179,114 +203,6 @@ - - - True - True - 0 - - - - True - - - - True - High - True - - - - - - True - Normal - True - - - - - - True - Low - True - - - - - - True - Undefined - True - - - - - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - True - 0 - - - - True - - - - True - Not Started - True - - - - - - True - In Progress - True - - - - - - True - Completed - True - - - - - - True - Canceled - True - - - - - - - 1 - 2 - 0 - 1 - fill - - - - True @@ -329,6 +245,46 @@ + + + + True + High +Normal +Low +Undefined + False + True + + + 1 + 2 + 2 + 3 + fill + fill + + + + + + True + Not Started +In Progress +Completed +Canceled + False + True + + + 1 + 2 + 0 + 1 + fill + fill + + 0 @@ -357,6 +313,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -384,6 +344,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -415,6 +379,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index d9078c61b7..c3a8e34ba0 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -332,7 +332,7 @@ sensitize_widgets (TaskPage *tpage) /* The list of organizers is set to be non-editable. Otherwise any * change in the displayed list causes an 'Account not found' error. */ - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); gtk_editable_set_editable (GTK_EDITABLE (priv->summary), !read_only); gtk_widget_set_sensitive (priv->due_date, !read_only); @@ -371,7 +371,7 @@ sensitize_widgets (TaskPage *tpage) gtk_widget_show (priv->attendee_box); gtk_widget_show (priv->organizer); gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->org_cal_label), _("Organi_zer:")); - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), GTK_COMBO (priv->organizer)->entry); + gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), priv->organizer); } } void @@ -418,7 +418,7 @@ get_current_account (TaskPage *page) priv = page->priv; - str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry)); + str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer)))); if (!str) return NULL; @@ -614,7 +614,6 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) if (organizer.value != NULL) { const gchar *strip = itip_strip_mailto (organizer.value); gchar *string; - GList *list = NULL; if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { if (e_cal_get_static_capability ( @@ -640,13 +639,15 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) string = g_strdup (strip); if (!priv->user_org) { - list = g_list_append (list, string); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), list); - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), string); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); + } else { + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), string); } g_free (string); - g_list_free (list); priv->existing = TRUE; } } else { @@ -1425,7 +1426,10 @@ get_widgets (TaskPage *tpage) priv->description = GW ("description"); priv->categories_btn = GW ("categories-button"); priv->categories = GW ("categories"); + priv->organizer = GW ("organizer"); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + priv->invite = GW ("invite"); priv->add = GW ("add-attendee"); priv->edit = GW ("edit-attendee"); @@ -2000,9 +2004,8 @@ task_page_select_organizer (TaskPage *tpage, const char *backend_address) if (default_address) { if (!priv->comp || !e_cal_component_has_organizer (priv->comp)) { - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), default_address); - /* FIXME: Use accessor functions to access private members of a GtkCombo widget */ - gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), !subscribed_cal); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), default_address); + gtk_widget_set_sensitive (priv->organizer, !subscribed_cal); } } else g_warning ("No potential organizers!"); @@ -2069,9 +2072,14 @@ task_page_construct (TaskPage *tpage, EMeetingStore *model, ECal *client) g_object_unref(it); - if (priv->address_strings) - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - else + if (priv->address_strings) { + GList *l; + + for (l = priv->address_strings; l; l = l->next) + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), l->data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + } else g_warning ("No potential organizers!"); if (!init_widgets (tpage)) { diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index d106381f8f..72beb68f21 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -600,34 +600,13 @@ 6 - + True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + a +b + False + True + True 0 diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 157afc6018..c5a483ea8e 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -101,8 +101,6 @@ struct _EItipControlPrivate { gint view_only; }; -#define ACTION_DATA "EItipControl:Action" - /* HTML Strings */ #define HTML_BODY_START "" #define HTML_SEP "
" @@ -2199,28 +2197,66 @@ url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpoint close (fd); } +static GtkWidget * +create_combo_box (void) +{ + GtkComboBox *combo; + GtkCellRenderer *cell; + GtkListStore *store; + + combo = GTK_COMBO_BOX (gtk_combo_box_new ()); + + store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); + gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store)); + g_object_unref (store); + + gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo)); + + cell = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, + "text", 0, + NULL); + + return GTK_WIDGET (combo); +} + static void option_activated_cb (GtkWidget *widget, gpointer data) { EItipControl *itip = E_ITIP_CONTROL (data); EItipControlPrivate *priv; + GtkTreeIter iter; + gint act; priv = itip->priv; - priv->action = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), ACTION_DATA)); + g_return_if_fail (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)); + + gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (widget)), &iter, 1, &act, -1); + + priv->action = act; } static void -add_option (EItipControl *itip, GtkWidget *menu, const char *text, char action) +add_option (EItipControl *itip, GtkWidget *combo, const char *text, char action) { - GtkWidget *item; + GtkTreeIter iter; + GtkListStore *store; + + store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo))); - item = gtk_menu_item_new_with_label (text); - g_signal_connect (item, "activate", G_CALLBACK (option_activated_cb), itip); - g_object_set_data (G_OBJECT (item), ACTION_DATA, GINT_TO_POINTER ((int)action)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show (item); + gtk_list_store_append (store, &iter); + gtk_list_store_set ( + store, &iter, + 0, text, + 1, (gint) action, + -1); + if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo)) == -1) { + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); + g_signal_connect (combo, "changed", G_CALLBACK (option_activated_cb), itip); + } } static void @@ -2308,24 +2344,20 @@ static gboolean publish_options_object (EItipControl *itip, GtkHTML *html, GtkHTMLEmbedded *eb) { EItipControlPrivate *priv; - GtkWidget *option, *menu; + GtkWidget *combo; priv = itip->priv; insert_boxes (eb, itip); insert_label (priv->hbox.widget); - option = gtk_option_menu_new (); + combo = create_combo_box (); - menu = gtk_menu_new (); - - add_option (itip, menu, _("Update"), 'U'); + add_option (itip, combo, _("Update"), 'U'); priv->action = 'U'; - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - - gtk_box_pack_start (GTK_BOX (priv->hbox.widget), option, FALSE, TRUE, 0); - gtk_widget_show (option); + gtk_box_pack_start (GTK_BOX (priv->hbox.widget), combo, FALSE, TRUE, 0); + gtk_widget_show (combo); insert_ok (priv->hbox.widget, itip); @@ -2336,26 +2368,22 @@ static gboolean request_options_object (EItipControl *itip, GtkHTML *html, GtkHTMLEmbedded *eb) { EItipControlPrivate *priv; - GtkWidget *option, *menu; + GtkWidget *combo; priv = itip->priv; insert_boxes (eb, itip); insert_label (priv->hbox.widget); - option = gtk_option_menu_new (); - - menu = gtk_menu_new (); + combo = create_combo_box (); - add_option (itip, menu, _("Accept"), 'A'); - add_option (itip, menu, _("Tentatively accept"), 'T'); - add_option (itip, menu, _("Decline"), 'D'); + add_option (itip, combo, _("Accept"), 'A'); + add_option (itip, combo, _("Tentatively accept"), 'T'); + add_option (itip, combo, _("Decline"), 'D'); priv->action = 'A'; - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - - gtk_box_pack_start (GTK_BOX (priv->hbox.widget), option, FALSE, TRUE, 0); - gtk_widget_show (option); + gtk_box_pack_start (GTK_BOX (priv->hbox.widget), combo, FALSE, TRUE, 0); + gtk_widget_show (combo); insert_rsvp (priv->hbox.widget, itip); insert_ok (priv->hbox.widget, itip); @@ -2367,24 +2395,20 @@ static gboolean freebusy_options_object (EItipControl *itip, GtkHTML *html, GtkHTMLEmbedded *eb) { EItipControlPrivate *priv; - GtkWidget *option, *menu; + GtkWidget *combo; priv = itip->priv; insert_boxes (eb, itip); insert_label (priv->hbox.widget); - option = gtk_option_menu_new (); - - menu = gtk_menu_new (); + combo = create_combo_box (); - add_option (itip, menu, _("Send Free/Busy Information"), 'F'); + add_option (itip, combo, _("Send Free/Busy Information"), 'F'); priv->action = 'F'; - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - - gtk_container_add (GTK_CONTAINER (priv->hbox.widget), option); - gtk_widget_show (option); + gtk_container_add (GTK_CONTAINER (priv->hbox.widget), combo); + gtk_widget_show (combo); insert_ok (priv->hbox.widget, itip); @@ -2395,24 +2419,20 @@ static gboolean reply_options_object (EItipControl *itip, GtkHTML *html, GtkHTMLEmbedded *eb) { EItipControlPrivate *priv; - GtkWidget *option, *menu; + GtkWidget *combo; priv = itip->priv; insert_boxes (eb, itip); insert_label (priv->hbox.widget); - option = gtk_option_menu_new (); + combo = create_combo_box (); - menu = gtk_menu_new (); - - add_option (itip, menu, _("Update respondent status"), 'R'); + add_option (itip, combo, _("Update respondent status"), 'R'); priv->action = 'R'; - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - - gtk_container_add (GTK_CONTAINER (priv->hbox.widget), option); - gtk_widget_show (option); + gtk_container_add (GTK_CONTAINER (priv->hbox.widget), combo); + gtk_widget_show (combo); insert_ok (priv->hbox.widget, itip); @@ -2423,24 +2443,20 @@ static gboolean refresh_options_object (EItipControl *itip, GtkHTML *html, GtkHTMLEmbedded *eb) { EItipControlPrivate *priv; - GtkWidget *option, *menu; + GtkWidget *combo; priv = itip->priv; insert_boxes (eb, itip); insert_label (priv->hbox.widget); - option = gtk_option_menu_new (); - - menu = gtk_menu_new (); + combo = create_combo_box (); - add_option (itip, menu, _("Send Latest Information"), 'S'); + add_option (itip, combo, _("Send Latest Information"), 'S'); priv->action = 'S'; - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - - gtk_container_add (GTK_CONTAINER (priv->hbox.widget), option); - gtk_widget_show (option); + gtk_container_add (GTK_CONTAINER (priv->hbox.widget), combo); + gtk_widget_show (combo); insert_ok (priv->hbox.widget, itip); @@ -2451,24 +2467,20 @@ static gboolean cancel_options_object (EItipControl *itip, GtkHTML *html, GtkHTMLEmbedded *eb) { EItipControlPrivate *priv; - GtkWidget *option, *menu; + GtkWidget *combo; priv = itip->priv; insert_boxes (eb, itip); insert_label (priv->hbox.widget); - option = gtk_option_menu_new (); - - menu = gtk_menu_new (); + combo = create_combo_box (); - add_option (itip, menu, _("Cancel"), 'C'); + add_option (itip, combo, _("Cancel"), 'C'); priv->action = 'C'; - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - - gtk_container_add (GTK_CONTAINER (priv->hbox.widget), option); - gtk_widget_show (option); + gtk_container_add (GTK_CONTAINER (priv->hbox.widget), combo); + gtk_widget_show (combo); insert_ok (priv->hbox.widget, itip); diff --git a/calendar/gui/goto-dialog.glade b/calendar/gui/goto-dialog.glade index ab832f335d..aeed7ae70d 100644 --- a/calendar/gui/goto-dialog.glade +++ b/calendar/gui/goto-dialog.glade @@ -10,6 +10,13 @@ False True False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False True @@ -31,6 +38,7 @@ _Select Today True GTK_RELIEF_NORMAL + True 0
@@ -43,6 +51,7 @@ gtk-cancel True GTK_RELIEF_NORMAL + True -6 @@ -68,112 +77,22 @@ 4 - + True - True - 0 - - - - True - - - - True - January - True - - - - - - True - February - True - - - - - - True - March - True - - - - - - True - April - True - - - - - - True - May - True - - - - - - True - June - True - - - - - - True - July - True - - - - - - True - August - True - - - - - - True - September - True - - - - - - True - October - True - - - - - - True - November - True - - - - - - True - December - True - - - - + January +February +March +April +May +June +July +August +September +October +November +December + False + True 0 diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c index 200cc0134b..ac4100160a 100644 --- a/calendar/gui/goto.c +++ b/calendar/gui/goto.c @@ -38,7 +38,7 @@ typedef struct GladeXML *xml; GtkWidget *dialog; - GtkWidget *month; + GtkWidget *month_combobox; GtkWidget *year; ECalendar *ecal; GtkWidget *vbox; @@ -67,11 +67,8 @@ static void month_changed (GtkToggleButton *toggle, gpointer data) { GoToDialog *dlg = data; - GtkWidget *menu, *active; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dlg->month)); - active = gtk_menu_get_active (GTK_MENU (menu)); - dlg->month_val = g_list_index (GTK_MENU_SHELL (menu)->children, active); + dlg->month_val = gtk_combo_box_get_active (GTK_COMBO_BOX (dlg->month_combobox)); e_calendar_item_set_first_month (dlg->ecal->calitem, dlg->year_val, dlg->month_val); } @@ -174,14 +171,14 @@ get_widgets (GoToDialog *dlg) dlg->dialog = GW ("goto-dialog"); - dlg->month = GW ("month"); + dlg->month_combobox = GW ("month-combobox"); dlg->year = GW ("year"); dlg->vbox = GW ("vbox"); #undef GW return (dlg->dialog - && dlg->month + && dlg->month_combobox && dlg->year && dlg->vbox); } @@ -189,13 +186,9 @@ get_widgets (GoToDialog *dlg) static void goto_dialog_init_widgets (GoToDialog *dlg) { - GtkWidget *menu; GtkAdjustment *adj; - GList *l; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dlg->month)); - for (l = GTK_MENU_SHELL (menu)->children; l != NULL; l = l->next) - g_signal_connect (menu, "selection_done", G_CALLBACK (month_changed), dlg); + g_signal_connect (dlg->month_combobox, "changed", G_CALLBACK (month_changed), dlg); adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (dlg->year)); g_signal_connect (adj, "value_changed", G_CALLBACK (year_changed), dlg); @@ -244,7 +237,7 @@ goto_dialog (GnomeCalendar *gcal) dlg->month_val = tt.month - 1; dlg->day_val = tt.day; - gtk_option_menu_set_history (GTK_OPTION_MENU (dlg->month), dlg->month_val); + gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->month_combobox), dlg->month_val); gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->year), dlg->year_val); create_ecal (dlg); -- cgit