/* * A callback for Save */ void gtr_save_current_file_dialog (GtkWidget * widget, GtrWindow * window) { GError *error = NULL; GtrTab *current; GtrPo *po; GtrStatusbar *status; current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); gtr_po_save_file (po, &error); if (error) { GtkWidget *dialog; dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "%s", error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); g_clear_error (&error); return; } /* We have to change the state of the tab */ gtr_po_set_state (po, GTR_PO_STATE_SAVED); /* Flash a message */ status = GTR_STATUSBAR (gtr_window_get_statusbar (window)); gtr_statusbar_flash_message (status, 0, _("File saved.")); }
void gtr_message_go_to_prev_untranslated (GtkAction * action, GtrWindow * window) { GtrTab *current; current = gtr_window_get_active_tab (window); gtr_tab_go_to_prev_untrans (current); }
void gtr_message_go_to_next_fuzzy (GtkAction * action, GtrWindow * window) { GtrTab *current; current = gtr_window_get_active_tab (window); gtr_tab_go_to_next_fuzzy (current); }
void gtr_message_go_to_previous (GtkAction * action, GtrWindow * window) { GtrTab *current; current = gtr_window_get_active_tab (window); gtr_tab_go_to_prev (current); }
/* * Use the untranslated message as the translation. */ void gtr_message_copy_to_translation (GtkAction * action, GtrWindow * window) { GtrTab *current; current = gtr_window_get_active_tab (window); gtr_tab_copy_to_translation (current); }
void gtr_file_close (GtkAction * widget, GtrWindow * window) { GtrTab *tab; tab = gtr_window_get_active_tab (window); gtr_close_tab (tab, window); }
void gtr_actions_edit_clear (GtkAction * action, GtrWindow * window) { GtrTab *tab; g_return_if_fail (GTR_IS_WINDOW (window)); tab = gtr_window_get_active_tab (window); gtr_tab_clear_msgstr_views (tab); }
/* * "Save as" dialog. */ void gtr_save_file_as_dialog (GtkAction * action, GtrWindow * window) { GtkWidget *dialog = NULL; GtrTab *current_page; GtrPo *po; GFile *location; gchar *uri = NULL; if (dialog != NULL) { gtk_window_present (GTK_WINDOW (dialog)); return; } current_page = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current_page); dialog = gtr_file_chooser_new (GTK_WINDOW (window), FILESEL_SAVE, _("Save file as..."), _gtr_application_get_last_dir (GTR_APP)); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); g_signal_connect (dialog, "confirm-overwrite", G_CALLBACK (confirm_overwrite_callback), NULL); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); /*Set the suggested file */ location = gtr_po_get_location (po); uri = g_file_get_uri (location); g_object_unref (location); if (uri) gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog), uri); g_free (uri); /* * FIXME: If we can't set the uri we should add a default path and name */ g_object_set_data (G_OBJECT (dialog), GTR_TAB_SAVE_AS, current_page); g_signal_connect (dialog, "response", G_CALLBACK (save_dialog_response_cb), window); gtk_widget_show (GTK_WIDGET (dialog)); }
void gtr_actions_view_context (GtkAction * action, GtrWindow * window) { GtrTab *tab; GtkWidget *context; tab = gtr_window_get_active_tab (window); context = GTK_WIDGET (gtr_tab_get_context_panel (tab)); gtr_tab_show_widget (tab, context); }
void gtr_message_go_to_prev_fuzzy (GtkAction * action, GtrWindow * window) { GtrTab *current; GtrPo *po; current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); if (gtr_tab_go_to_prev_fuzzy (current)) _gtr_window_set_sensitive_according_to_message (window, po); }
/* * Toggle the sticky status */ void gtr_message_status_toggle_fuzzy (GtkAction * action, GtrWindow * window) { GtrTab *current; GtrPo *po; GList *msg; current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); msg = gtr_po_get_current_message (po); if (gtr_msg_is_fuzzy (msg->data)) gtr_msg_set_fuzzy (msg->data, FALSE); else gtr_msg_set_fuzzy (msg->data, TRUE); /* * Emit that message was changed. */ g_signal_emit_by_name (current, "message_changed", msg->data); }