static void action_calendar_memopad_forward_cb (GtkAction *action, ECalShellView *cal_shell_view) { ECalShellContent *cal_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; ECalComponent *comp; GSList *list; cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); list = e_memo_table_get_selected (memo_table); g_return_if_fail (list != NULL); comp_data = list->data; g_slist_free (list); /* XXX We only forward the first selected memo. */ comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (comp_data->icalcomp)); g_return_if_fail (comp != NULL); itip_send_component_with_model (e_memo_table_get_model (memo_table), E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE, FALSE, TRUE); g_object_unref (comp); }
static void action_calendar_memopad_print_cb (GtkAction *action, ECalShellView *cal_shell_view) { ECalShellContent *cal_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; ECalComponent *comp; ECalModel *model; icalcomponent *clone; GSList *list; cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); model = e_memo_table_get_model (memo_table); list = e_memo_table_get_selected (memo_table); g_return_if_fail (list != NULL); comp_data = list->data; g_slist_free (list); /* XXX We only print the first selected memo. */ comp = e_cal_component_new (); clone = icalcomponent_new_clone (comp_data->icalcomp); e_cal_component_set_icalcomponent (comp, clone); print_comp ( comp, comp_data->client, e_cal_model_get_timezone (model), e_cal_model_get_use_24_hour_format (model), GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); g_object_unref (comp); }
static void memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content, gint row, gint col, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time) { EMemoTable *memo_table; GdkAtom target; struct { ECalModel *model; GSList *list; } foreach_data; /* Sanity check the selection target. */ target = gtk_selection_data_get_target (selection_data); if (!e_targets_include_calendar (&target, 1)) return; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); foreach_data.model = e_memo_table_get_model (memo_table); foreach_data.list = NULL; e_table_selected_row_foreach ( E_TABLE (memo_table), memo_shell_content_table_foreach_cb, &foreach_data); if (foreach_data.list != NULL) { cal_comp_selection_set_string_list ( selection_data, foreach_data.list); g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL); g_slist_free (foreach_data.list); } }
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); }