static EMailDisplay * mail_browser_get_mail_display (EMailReader *reader) { EPreviewPane *preview_pane; EWebView *web_view; preview_pane = e_mail_reader_get_preview_pane (reader); web_view = e_preview_pane_get_web_view (preview_pane); return E_MAIL_DISPLAY (web_view); }
static void task_shell_content_selection_change_cb (ETaskShellContent *task_shell_content, ETable *table) { ECalComponentPreview *task_preview; EPreviewPane *preview_pane; EWebView *web_view; preview_pane = e_task_shell_content_get_preview_pane (task_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); task_preview = E_CAL_COMPONENT_PREVIEW (web_view); if (e_table_selected_count (table) != 1) e_cal_component_preview_clear (task_preview); }
static void memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content, gint row, ETable *table) { ECalComponentPreview *memo_preview; ECalModel *memo_model; ECalModelComponent *comp_data; EPreviewPane *preview_pane; EWebView *web_view; const gchar *uid; memo_model = e_memo_shell_content_get_memo_model (memo_shell_content); preview_pane = e_memo_shell_content_get_preview_pane (memo_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); memo_preview = E_CAL_COMPONENT_PREVIEW (web_view); if (e_table_selected_count (table) != 1) { if (memo_shell_content->priv->preview_visible) e_cal_component_preview_clear (memo_preview); return; } row = e_table_get_cursor_row (table); comp_data = e_cal_model_get_component_at (memo_model, row); if (memo_shell_content->priv->preview_visible) { ECalComponent *comp; comp = e_cal_component_new_from_icalcomponent ( icalcomponent_new_clone (comp_data->icalcomp)); e_cal_component_preview_display ( memo_preview, comp_data->client, comp, e_cal_model_get_timezone (memo_model), e_cal_model_get_use_24_hour_format (memo_model)); g_object_unref (comp); } uid = icalcomponent_get_uid (comp_data->icalcomp); g_free (memo_shell_content->priv->current_uid); memo_shell_content->priv->current_uid = g_strdup (uid); }
static void memo_shell_content_selection_change_cb (EMemoShellContent *memo_shell_content, ETable *table) { ECalComponentPreview *memo_preview; EPreviewPane *preview_pane; EWebView *web_view; preview_pane = e_memo_shell_content_get_preview_pane (memo_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); memo_preview = E_CAL_COMPONENT_PREVIEW (web_view); /* XXX Old code emits a "selection-changed" signal here. */ if (e_table_selected_count (table) != 1) e_cal_component_preview_clear (memo_preview); }
void e_task_shell_view_actions_init (ETaskShellView *task_shell_view) { ETaskShellContent *task_shell_content; EShellView *shell_view; EShellWindow *shell_window; EShellSearchbar *searchbar; EPreviewPane *preview_pane; EWebView *web_view; GtkActionGroup *action_group; GSettings *settings; GtkAction *action; shell_view = E_SHELL_VIEW (task_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); task_shell_content = task_shell_view->priv->task_shell_content; searchbar = e_task_shell_content_get_searchbar (task_shell_content); preview_pane = e_task_shell_content_get_preview_pane (task_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); /* Task Actions */ action_group = ACTION_GROUP (TASKS); gtk_action_group_add_actions ( action_group, task_entries, G_N_ELEMENTS (task_entries), task_shell_view); e_action_group_add_popup_actions ( action_group, task_popup_entries, G_N_ELEMENTS (task_popup_entries)); gtk_action_group_add_toggle_actions ( action_group, task_toggle_entries, G_N_ELEMENTS (task_toggle_entries), task_shell_view); gtk_action_group_add_radio_actions ( action_group, task_view_entries, G_N_ELEMENTS (task_view_entries), -1, G_CALLBACK (action_task_view_cb), task_shell_view); gtk_action_group_add_radio_actions ( action_group, task_search_entries, G_N_ELEMENTS (task_search_entries), -1, NULL, NULL); /* Advanced Search Action */ action = ACTION (TASK_SEARCH_ADVANCED_HIDDEN); gtk_action_set_visible (action, FALSE); e_shell_searchbar_set_search_option ( searchbar, GTK_RADIO_ACTION (action)); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); gtk_action_group_add_actions ( action_group, lockdown_printing_entries, G_N_ELEMENTS (lockdown_printing_entries), task_shell_view); e_action_group_add_popup_actions ( action_group, lockdown_printing_popup_entries, G_N_ELEMENTS (lockdown_printing_popup_entries)); /* Lockdown Save-to-Disk Actions */ action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); gtk_action_group_add_actions ( action_group, lockdown_save_to_disk_entries, G_N_ELEMENTS (lockdown_save_to_disk_entries), task_shell_view); e_action_group_add_popup_actions ( action_group, lockdown_save_to_disk_popup_entries, G_N_ELEMENTS (lockdown_save_to_disk_popup_entries)); /* Bind GObject properties to settings keys. */ settings = g_settings_new ("org.gnome.evolution.calendar"); g_settings_bind ( settings, "show-task-preview", ACTION (TASK_PREVIEW), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind ( settings, "task-layout", ACTION (TASK_VIEW_VERTICAL), "current-value", G_SETTINGS_BIND_DEFAULT); g_object_unref (settings); /* Fine tuning. */ g_object_bind_property ( ACTION (TASK_PREVIEW), "active", ACTION (TASK_VIEW_CLASSIC), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( ACTION (TASK_PREVIEW), "active", ACTION (TASK_VIEW_VERTICAL), "sensitive", G_BINDING_SYNC_CREATE); e_web_view_set_open_proxy (web_view, ACTION (TASK_OPEN)); e_web_view_set_print_proxy (web_view, ACTION (TASK_PRINT)); e_web_view_set_save_as_proxy (web_view, ACTION (TASK_SAVE_AS)); }
void e_book_shell_view_actions_init (EBookShellView *book_shell_view) { EBookShellContent *book_shell_content; EShellView *shell_view; EShellWindow *shell_window; EShellSearchbar *searchbar; EPreviewPane *preview_pane; EWebView *web_view; GtkActionGroup *action_group; GConfBridge *bridge; GtkAction *action; GObject *object; const gchar *key; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); book_shell_content = book_shell_view->priv->book_shell_content; searchbar = e_book_shell_content_get_searchbar (book_shell_content); preview_pane = e_book_shell_content_get_preview_pane (book_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); /* Contact Actions */ action_group = ACTION_GROUP (CONTACTS); gtk_action_group_add_actions ( action_group, contact_entries, G_N_ELEMENTS (contact_entries), book_shell_view); e_action_group_add_popup_actions ( action_group, contact_popup_entries, G_N_ELEMENTS (contact_popup_entries)); gtk_action_group_add_toggle_actions ( action_group, contact_toggle_entries, G_N_ELEMENTS (contact_toggle_entries), book_shell_view); gtk_action_group_add_radio_actions ( action_group, contact_view_entries, G_N_ELEMENTS (contact_view_entries), -1, G_CALLBACK (action_contact_view_cb), book_shell_view); gtk_action_group_add_radio_actions ( action_group, contact_search_entries, G_N_ELEMENTS (contact_search_entries), -1, NULL, NULL); /* Advanced Search Action */ action = ACTION (CONTACT_SEARCH_ADVANCED_HIDDEN); gtk_action_set_visible (action, FALSE); e_shell_searchbar_set_search_option ( searchbar, GTK_RADIO_ACTION (action)); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); gtk_action_group_add_actions ( action_group, lockdown_printing_entries, G_N_ELEMENTS (lockdown_printing_entries), book_shell_view); e_action_group_add_popup_actions ( action_group, lockdown_printing_popup_entries, G_N_ELEMENTS (lockdown_printing_popup_entries)); /* Lockdown Save-to-Disk Actions */ action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); gtk_action_group_add_actions ( action_group, lockdown_save_to_disk_entries, G_N_ELEMENTS (lockdown_save_to_disk_entries), book_shell_view); e_action_group_add_popup_actions ( action_group, lockdown_save_to_disk_popup_entries, G_N_ELEMENTS (lockdown_save_to_disk_popup_entries)); /* Bind GObject properties to GConf keys. */ bridge = gconf_bridge_get (); object = G_OBJECT (ACTION (CONTACT_PREVIEW)); key = "/apps/evolution/addressbook/display/show_preview"; gconf_bridge_bind_property (bridge, key, object, "active"); object = G_OBJECT (ACTION (CONTACT_VIEW_VERTICAL)); key = "/apps/evolution/addressbook/display/layout"; gconf_bridge_bind_property (bridge, key, object, "current-value"); object = G_OBJECT (ACTION (CONTACT_PREVIEW_SHOW_MAPS)); key = "/apps/evolution/addressbook/display/preview_show_maps"; gconf_bridge_bind_property (bridge, key, object, "active"); /* Fine tuning. */ g_signal_connect ( ACTION (GAL_SAVE_CUSTOM_VIEW), "activate", G_CALLBACK (action_gal_save_custom_view_cb), book_shell_view); g_object_bind_property ( ACTION (CONTACT_PREVIEW), "active", ACTION (CONTACT_VIEW_CLASSIC), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( ACTION (CONTACT_PREVIEW), "active", ACTION (CONTACT_VIEW_VERTICAL), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( ACTION (CONTACT_PREVIEW), "active", ACTION (CONTACT_PREVIEW_SHOW_MAPS), "sensitive", G_BINDING_SYNC_CREATE); e_web_view_set_open_proxy (web_view, ACTION (CONTACT_OPEN)); e_web_view_set_print_proxy (web_view, ACTION (CONTACT_PRINT)); e_web_view_set_save_as_proxy (web_view, ACTION (CONTACT_SAVE_AS)); #ifndef WITH_CONTACT_MAPS gtk_action_set_visible (ACTION (CONTACT_PREVIEW_SHOW_MAPS), FALSE); gtk_action_set_visible (ACTION (ADDRESS_BOOK_MAP), FALSE); gtk_action_set_visible (ACTION (ADDRESS_BOOK_POPUP_MAP), FALSE); #endif }
void e_book_shell_view_actions_init (EBookShellView *book_shell_view) { EBookShellContent *book_shell_content; EShellView *shell_view; EShellWindow *shell_window; EShellSearchbar *searchbar; EPreviewPane *preview_pane; EWebView *web_view; GtkActionGroup *action_group; GSettings *settings; GtkAction *action; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); book_shell_content = book_shell_view->priv->book_shell_content; searchbar = e_book_shell_content_get_searchbar (book_shell_content); preview_pane = e_book_shell_content_get_preview_pane (book_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); /* Contact Actions */ action_group = ACTION_GROUP (CONTACTS); gtk_action_group_add_actions ( action_group, contact_entries, G_N_ELEMENTS (contact_entries), book_shell_view); e_action_group_add_popup_actions ( action_group, contact_popup_entries, G_N_ELEMENTS (contact_popup_entries)); gtk_action_group_add_toggle_actions ( action_group, contact_toggle_entries, G_N_ELEMENTS (contact_toggle_entries), book_shell_view); gtk_action_group_add_radio_actions ( action_group, contact_view_entries, G_N_ELEMENTS (contact_view_entries), -1, G_CALLBACK (action_contact_view_cb), book_shell_view); gtk_action_group_add_radio_actions ( action_group, contact_search_entries, G_N_ELEMENTS (contact_search_entries), -1, NULL, NULL); /* Advanced Search Action */ action = ACTION (CONTACT_SEARCH_ADVANCED_HIDDEN); gtk_action_set_visible (action, FALSE); e_shell_searchbar_set_search_option ( searchbar, GTK_RADIO_ACTION (action)); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); gtk_action_group_add_actions ( action_group, lockdown_printing_entries, G_N_ELEMENTS (lockdown_printing_entries), book_shell_view); e_action_group_add_popup_actions ( action_group, lockdown_printing_popup_entries, G_N_ELEMENTS (lockdown_printing_popup_entries)); /* Lockdown Save-to-Disk Actions */ action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); gtk_action_group_add_actions ( action_group, lockdown_save_to_disk_entries, G_N_ELEMENTS (lockdown_save_to_disk_entries), book_shell_view); e_action_group_add_popup_actions ( action_group, lockdown_save_to_disk_popup_entries, G_N_ELEMENTS (lockdown_save_to_disk_popup_entries)); /* Bind GObject properties to GSettings keys. */ settings = e_util_ref_settings ("org.gnome.evolution.addressbook"); g_settings_bind ( settings, "show-preview", ACTION (CONTACT_PREVIEW), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind ( settings, "layout", ACTION (CONTACT_VIEW_VERTICAL), "current-value", G_SETTINGS_BIND_DEFAULT); g_settings_bind ( settings, "preview-show-maps", ACTION (CONTACT_PREVIEW_SHOW_MAPS), "active", G_SETTINGS_BIND_DEFAULT); g_object_unref (settings); /* Fine tuning. */ e_binding_bind_property ( ACTION (CONTACT_PREVIEW), "active", ACTION (CONTACT_VIEW_CLASSIC), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( ACTION (CONTACT_PREVIEW), "active", ACTION (CONTACT_VIEW_VERTICAL), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( ACTION (CONTACT_PREVIEW), "active", ACTION (CONTACT_PREVIEW_SHOW_MAPS), "sensitive", G_BINDING_SYNC_CREATE); e_web_view_set_open_proxy (web_view, ACTION (CONTACT_OPEN)); e_web_view_set_print_proxy (web_view, ACTION (CONTACT_PRINT)); e_web_view_set_save_as_proxy (web_view, ACTION (CONTACT_SAVE_AS)); #ifndef WITH_CONTACT_MAPS gtk_action_set_visible (ACTION (CONTACT_PREVIEW_SHOW_MAPS), FALSE); gtk_action_set_visible (ACTION (ADDRESS_BOOK_MAP), FALSE); gtk_action_set_visible (ACTION (ADDRESS_BOOK_POPUP_MAP), FALSE); #endif }
static void memo_shell_view_execute_search (EShellView *shell_view) { EMemoShellContent *memo_shell_content; EShellWindow *shell_window; EShellContent *shell_content; EShellSearchbar *searchbar; EActionComboBox *combo_box; GtkRadioAction *action; ECalComponentPreview *memo_preview; EPreviewPane *preview_pane; EMemoTable *memo_table; EWebView *web_view; ECalModel *model; gchar *query; gchar *temp; gint value; shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); searchbar = e_memo_shell_content_get_searchbar (memo_shell_content); action = GTK_RADIO_ACTION (ACTION (MEMO_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); if (value == MEMO_SEARCH_ADVANCED) { query = e_shell_view_get_search_query (shell_view); if (!query) query = g_strdup (""); } else { const gchar *format; const gchar *text; GString *string; text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { text = ""; value = MEMO_SEARCH_SUMMARY_CONTAINS; } switch (value) { default: text = ""; /* fall through */ case MEMO_SEARCH_SUMMARY_CONTAINS: format = "(contains? \"summary\" %s)"; break; case MEMO_SEARCH_DESCRIPTION_CONTAINS: format = "(contains? \"description\" %s)"; break; case MEMO_SEARCH_ANY_FIELD_CONTAINS: format = "(contains? \"any\" %s)"; break; } /* Build the query. */ string = g_string_new (""); e_sexp_encode_string (string, text); query = g_strdup_printf (format, string->str); g_string_free (string, TRUE); } /* Apply selected filter. */ combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); value = e_action_combo_box_get_current_value (combo_box); switch (value) { case MEMO_FILTER_ANY_CATEGORY: break; case MEMO_FILTER_UNMATCHED: temp = g_strdup_printf ( "(and (has-categories? #f) %s", query); g_free (query); query = temp; break; default: { GList *categories; const gchar *category_name; categories = e_util_dup_searchable_categories (); category_name = g_list_nth_data (categories, value); g_list_free_full (categories, g_free); temp = g_strdup_printf ( "(and (has-categories? \"%s\") %s)", category_name, query); g_free (query); query = temp; } } /* Submit the query. */ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); model = e_memo_table_get_model (memo_table); e_cal_model_set_search_query (model, query); g_free (query); preview_pane = e_memo_shell_content_get_preview_pane (memo_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); memo_preview = E_CAL_COMPONENT_PREVIEW (web_view); e_cal_component_preview_clear (memo_preview); }
static void task_shell_view_execute_search (EShellView *shell_view) { ETaskShellContent *task_shell_content; EShellWindow *shell_window; EShellContent *shell_content; EShellSearchbar *searchbar; EActionComboBox *combo_box; GtkRadioAction *action; ECalComponentPreview *task_preview; EPreviewPane *preview_pane; ETaskTable *task_table; EWebView *web_view; ECalModel *model; ECalDataModel *data_model; icaltimezone *timezone; struct icaltimetype current_time; time_t start_range; time_t end_range; time_t now_time; gchar *start, *end; gchar *query; gchar *temp; gint value; shell_window = e_shell_view_get_shell_window (shell_view); shell_content = e_shell_view_get_shell_content (shell_view); task_shell_content = E_TASK_SHELL_CONTENT (shell_content); searchbar = e_task_shell_content_get_searchbar (task_shell_content); task_shell_content = E_TASK_SHELL_CONTENT (shell_content); task_table = e_task_shell_content_get_task_table (task_shell_content); model = e_task_table_get_model (task_table); data_model = e_cal_model_get_data_model (model); timezone = e_cal_model_get_timezone (model); current_time = icaltime_current_time_with_zone (timezone); now_time = time_day_begin (icaltime_as_timet (current_time)); action = GTK_RADIO_ACTION (ACTION (TASK_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); if (value == TASK_SEARCH_ADVANCED) { query = e_shell_view_get_search_query (shell_view); if (!query) query = g_strdup (""); } else { const gchar *format; const gchar *text; GString *string; text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { text = ""; value = TASK_SEARCH_SUMMARY_CONTAINS; } switch (value) { default: text = ""; /* fall through */ case TASK_SEARCH_SUMMARY_CONTAINS: format = "(contains? \"summary\" %s)"; break; case TASK_SEARCH_DESCRIPTION_CONTAINS: format = "(contains? \"description\" %s)"; break; case TASK_SEARCH_ANY_FIELD_CONTAINS: format = "(contains? \"any\" %s)"; break; } /* Build the query. */ string = g_string_new (""); e_sexp_encode_string (string, text); query = g_strdup_printf (format, string->str); g_string_free (string, TRUE); } /* Apply selected filter. */ combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); value = e_action_combo_box_get_current_value (combo_box); switch (value) { case TASK_FILTER_ANY_CATEGORY: break; case TASK_FILTER_UNMATCHED: temp = g_strdup_printf ( "(and (has-categories? #f) %s)", query); g_free (query); query = temp; break; case TASK_FILTER_NEXT_7_DAYS_TASKS: start_range = now_time; end_range = time_day_end (time_add_day (start_range, 7)); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); temp = g_strdup_printf ( "(and %s (due-in-time-range? " "(make-time \"%s\") (make-time \"%s\")))", query, start, end); g_free (query); query = temp; break; case TASK_FILTER_ACTIVE_TASKS: start_range = now_time; end_range = time_day_end (time_add_day (start_range, 365)); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); temp = g_strdup_printf ( "(and %s (due-in-time-range? " "(make-time \"%s\") (make-time \"%s\")) " "(not (is-completed?)))", query, start, end); g_free (query); query = temp; break; case TASK_FILTER_OVERDUE_TASKS: start_range = 0; end_range = time_day_end (now_time); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); temp = g_strdup_printf ( "(and %s (due-in-time-range? " "(make-time \"%s\") (make-time \"%s\")) " "(not (is-completed?)))", query, start, end); g_free (query); query = temp; break; case TASK_FILTER_COMPLETED_TASKS: temp = g_strdup_printf ( "(and (is-completed?) %s)", query); g_free (query); query = temp; break; case TASK_FILTER_TASKS_WITH_ATTACHMENTS: temp = g_strdup_printf ( "(and (has-attachments?) %s)", query); g_free (query); query = temp; break; default: { GList *categories; const gchar *category_name; categories = e_util_dup_searchable_categories (); category_name = g_list_nth_data (categories, value); temp = g_strdup_printf ( "(and (has-categories? \"%s\") %s)", category_name, query); g_free (query); query = temp; g_list_free_full (categories, g_free); break; } } /* Honor the user's preference to hide completed tasks. */ temp = calendar_config_get_hide_completed_tasks_sexp (FALSE); if (temp != NULL) { gchar *temp2; temp2 = g_strdup_printf ("(and %s %s)", temp, query); g_free (query); g_free (temp); query = temp2; } /* Submit the query. */ e_cal_data_model_set_filter (data_model, query); g_free (query); preview_pane = e_task_shell_content_get_preview_pane (task_shell_content); web_view = e_preview_pane_get_web_view (preview_pane); task_preview = E_CAL_COMPONENT_PREVIEW (web_view); e_cal_component_preview_clear (task_preview); }