/* Use occurences only for Replace All */ static void text_found (PlumaWindow *window, gint occurrences) { if (occurrences > 1) { pluma_statusbar_flash_message (PLUMA_STATUSBAR (window->priv->statusbar), window->priv->generic_message_cid, ngettext("Found and replaced %d occurrence", "Found and replaced %d occurrences", occurrences), occurrences); } else { if (occurrences == 1) pluma_statusbar_flash_message (PLUMA_STATUSBAR (window->priv->statusbar), window->priv->generic_message_cid, _("Found and replaced one occurrence")); else pluma_statusbar_flash_message (PLUMA_STATUSBAR (window->priv->statusbar), window->priv->generic_message_cid, " "); } }
static void text_not_found (PlumaWindow *window, const gchar *text) { gchar *searched; searched = pluma_utils_str_end_truncate (text, MAX_MSG_LENGTH); pluma_statusbar_flash_message (PLUMA_STATUSBAR (window->priv->statusbar), window->priv->generic_message_cid, /* Translators: %s is replaced by the text entered by the user in the search box */ _("\"%s\" not found"), searched); g_free (searched); }
static void spell_cb (GtkAction *action, PlumaSpellPlugin *plugin) { PlumaSpellPluginPrivate *data; PlumaWindow *window; PlumaView *view; PlumaDocument *doc; PlumaSpellChecker *spell; GtkWidget *dlg; GtkTextIter start, end; gchar *word; gchar *data_dir; pluma_debug (DEBUG_PLUGINS); data = plugin->priv; window = PLUMA_WINDOW (data->window); view = pluma_window_get_active_view (window); g_return_if_fail (view != NULL); doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); g_return_if_fail (doc != NULL); spell = get_spell_checker_from_document (doc); g_return_if_fail (spell != NULL); if (gtk_text_buffer_get_char_count (GTK_TEXT_BUFFER (doc)) <= 0) { GtkWidget *statusbar; statusbar = pluma_window_get_statusbar (window); pluma_statusbar_flash_message (PLUMA_STATUSBAR (statusbar), data->message_cid, _("The document is empty.")); return; } if (!gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start, &end)) { /* no selection, get the whole doc */ gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &start, &end); } set_check_range (doc, &start, &end); word = get_next_misspelled_word (view); if (word == NULL) { GtkWidget *statusbar; statusbar = pluma_window_get_statusbar (window); pluma_statusbar_flash_message (PLUMA_STATUSBAR (statusbar), data->message_cid, _("No misspelled words")); return; } data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin)); dlg = pluma_spell_checker_dialog_new_from_spell_checker (spell, data_dir); g_free (data_dir); gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (window)); g_signal_connect (dlg, "ignore", G_CALLBACK (ignore_cb), view); g_signal_connect (dlg, "ignore_all", G_CALLBACK (ignore_cb), view); g_signal_connect (dlg, "change", G_CALLBACK (change_cb), view); g_signal_connect (dlg, "change_all", G_CALLBACK (change_all_cb), view); g_signal_connect (dlg, "add_word_to_personal", G_CALLBACK (add_word_cb), view); pluma_spell_checker_dialog_set_misspelled_word (PLUMA_SPELL_CHECKER_DIALOG (dlg), word, -1); g_free (word); gtk_widget_show (dlg); }