Commit b6f9e380 authored by Sébastien Wilmet's avatar Sébastien Wilmet

Port to GtkSourceNewlineType

And remove GeditDocumentNewlineType.
parent 5f6ac722
......@@ -43,11 +43,6 @@ gedit_app_activatable_get_type
GeditDocumentPrivate
<TITLE>GeditDocument</TITLE>
GeditDocument
GeditDocumentSaveFlags
GeditDocumentNewlineType
GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT
GEDIT_DOCUMENT_ERROR
gedit_document_error_quark
gedit_document_new
gedit_document_get_file
gedit_document_get_location
......
......@@ -697,7 +697,7 @@ save_dialog_response_cb (GeditFileChooserDialog *dialog,
GFile *file;
GeditDocument *doc;
gchar *parse_name;
GeditDocumentNewlineType newline_type;
GtkSourceNewlineType newline_type;
GtkSourceCompressionType compression_type;
GtkSourceCompressionType current_compression_type;
const GtkSourceEncoding *encoding;
......@@ -833,7 +833,7 @@ _gedit_cmd_file_save_as_tab (GeditTab *tab,
GeditDocument *doc;
GFile *file;
const GtkSourceEncoding *encoding;
GeditDocumentNewlineType newline_type;
GtkSourceNewlineType newline_type;
g_return_if_fail (GEDIT_IS_TAB (tab));
g_return_if_fail (GEDIT_IS_WINDOW (window));
......
......@@ -74,7 +74,7 @@ struct _GeditDocumentPrivate
*/
GtkSourceSearchContext *search_context;
GeditDocumentNewlineType newline_type;
GtkSourceNewlineType newline_type;
GtkSourceCompressionType compression_type;
/* Temp data while loading */
......@@ -161,8 +161,8 @@ release_untitled_number (gint n)
}
static void
set_newline_type (GeditDocument *doc,
GeditDocumentNewlineType newline_type)
set_newline_type (GeditDocument *doc,
GtkSourceNewlineType newline_type)
{
if (doc->priv->newline_type != newline_type)
{
......@@ -470,8 +470,8 @@ gedit_document_class_init (GeditDocumentClass *klass)
g_param_spec_enum ("newline-type",
"Newline type",
"The accepted types of line ending",
GEDIT_TYPE_DOCUMENT_NEWLINE_TYPE,
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
GTK_SOURCE_TYPE_NEWLINE_TYPE,
GTK_SOURCE_NEWLINE_TYPE_LF,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_NAME |
......@@ -1537,7 +1537,7 @@ _gedit_document_get_seconds_since_last_save_or_load (GeditDocument *doc)
return (current_time.tv_sec - doc->priv->time_of_last_save_or_load.tv_sec);
}
GeditDocumentNewlineType
GtkSourceNewlineType
gedit_document_get_newline_type (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), 0);
......
......@@ -50,19 +50,6 @@ typedef struct _GeditDocumentPrivate GeditDocumentPrivate;
#define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "metadata::gedit-language"
#endif
typedef enum
{
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
GEDIT_DOCUMENT_NEWLINE_TYPE_CR,
GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF
} GeditDocumentNewlineType;
#ifdef G_OS_WIN32
#define GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF
#else
#define GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT GEDIT_DOCUMENT_NEWLINE_TYPE_LF
#endif
struct _GeditDocument
{
GtkSourceBuffer buffer;
......@@ -138,7 +125,7 @@ GtkSourceLanguage
const GeditEncoding
*gedit_document_get_encoding (GeditDocument *doc);
GeditDocumentNewlineType
GtkSourceNewlineType
gedit_document_get_newline_type (GeditDocument *doc);
GtkSourceCompressionType
......
......@@ -112,16 +112,16 @@ update_newline_visibility (GeditFileChooserDialog *dialog)
}
static void
newline_combo_append (GtkComboBox *combo,
GtkListStore *store,
GtkTreeIter *iter,
const gchar *label,
GeditDocumentNewlineType newline_type)
newline_combo_append (GtkComboBox *combo,
GtkListStore *store,
GtkTreeIter *iter,
const gchar *label,
GtkSourceNewlineType newline_type)
{
gtk_list_store_append (store, iter);
gtk_list_store_set (store, iter, 0, label, 1, newline_type, -1);
if (newline_type == GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT)
if (newline_type == GTK_SOURCE_NEWLINE_TYPE_DEFAULT)
{
gtk_combo_box_set_active_iter (combo, iter);
}
......@@ -138,7 +138,7 @@ create_newline_combo (GeditFileChooserDialog *dialog)
label = gtk_label_new_with_mnemonic (_("L_ine Ending:"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
store = gtk_list_store_new (2, G_TYPE_STRING, GEDIT_TYPE_DOCUMENT_NEWLINE_TYPE);
store = gtk_list_store_new (2, G_TYPE_STRING, GTK_SOURCE_TYPE_NEWLINE_TYPE);
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
renderer = gtk_cell_renderer_text_new ();
......@@ -155,19 +155,19 @@ create_newline_combo (GeditFileChooserDialog *dialog)
store,
&iter,
_("Unix/Linux"),
GEDIT_DOCUMENT_NEWLINE_TYPE_LF);
GTK_SOURCE_NEWLINE_TYPE_LF);
newline_combo_append (GTK_COMBO_BOX (combo),
store,
&iter,
_("Mac OS Classic"),
GEDIT_DOCUMENT_NEWLINE_TYPE_CR);
GTK_SOURCE_NEWLINE_TYPE_CR);
newline_combo_append (GTK_COMBO_BOX (combo),
store,
&iter,
_("Windows"),
GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF);
GTK_SOURCE_NEWLINE_TYPE_CR_LF);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
......@@ -531,8 +531,8 @@ set_enum_combo (GtkComboBox *combo,
}
void
gedit_file_chooser_dialog_set_newline_type (GeditFileChooserDialog *dialog,
GeditDocumentNewlineType newline_type)
gedit_file_chooser_dialog_set_newline_type (GeditFileChooserDialog *dialog,
GtkSourceNewlineType newline_type)
{
g_return_if_fail (GEDIT_IS_FILE_CHOOSER_DIALOG (dialog));
g_return_if_fail (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) == GTK_FILE_CHOOSER_ACTION_SAVE);
......@@ -541,15 +541,15 @@ gedit_file_chooser_dialog_set_newline_type (GeditFileChooserDialog *dialog,
newline_type);
}
GeditDocumentNewlineType
GtkSourceNewlineType
gedit_file_chooser_dialog_get_newline_type (GeditFileChooserDialog *dialog)
{
GtkTreeIter iter;
GeditDocumentNewlineType newline_type;
GtkSourceNewlineType newline_type;
g_return_val_if_fail (GEDIT_IS_FILE_CHOOSER_DIALOG (dialog), GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT);
g_return_val_if_fail (GEDIT_IS_FILE_CHOOSER_DIALOG (dialog), GTK_SOURCE_NEWLINE_TYPE_DEFAULT);
g_return_val_if_fail (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) == GTK_FILE_CHOOSER_ACTION_SAVE,
GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT);
GTK_SOURCE_NEWLINE_TYPE_DEFAULT);
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->priv->newline_combo),
&iter);
......
......@@ -67,9 +67,9 @@ const GtkSourceEncoding
*gedit_file_chooser_dialog_get_encoding (GeditFileChooserDialog *dialog);
void gedit_file_chooser_dialog_set_newline_type (GeditFileChooserDialog *dialog,
GeditDocumentNewlineType newline_type);
GtkSourceNewlineType newline_type);
GeditDocumentNewlineType
GtkSourceNewlineType
gedit_file_chooser_dialog_get_newline_type (GeditFileChooserDialog *dialog);
G_END_DECLS
......
......@@ -2315,12 +2315,11 @@ gedit_tab_auto_save (GeditTab *tab)
return G_SOURCE_REMOVE;
}
/* TODO port to GtkSourceNewlineType */
void
_gedit_tab_save_as (GeditTab *tab,
GFile *location,
const GtkSourceEncoding *encoding,
GeditDocumentNewlineType newline_type,
GtkSourceNewlineType newline_type,
GtkSourceCompressionType compression_type)
{
GeditDocument *doc;
......
......@@ -136,10 +136,11 @@ void _gedit_tab_load_stream (GeditTab *tab,
void _gedit_tab_revert (GeditTab *tab);
void _gedit_tab_save (GeditTab *tab);
void _gedit_tab_save_as (GeditTab *tab,
GFile *location,
void _gedit_tab_save_as (GeditTab *tab,
GFile *location,
const GtkSourceEncoding *encoding,
GeditDocumentNewlineType newline_type,
GtkSourceNewlineType newline_type,
GtkSourceCompressionType compression_type);
void _gedit_tab_print (GeditTab *tab);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment