[gedit/wip/loader-saver: 4/16] Port to GtkSourceNewlineType
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/loader-saver: 4/16] Port to GtkSourceNewlineType
- Date: Fri, 27 Jun 2014 19:55:03 +0000 (UTC)
commit c6da26473a3141082cc62cdce2d6169ecb51542f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jun 26 22:18:32 2014 +0200
Port to GtkSourceNewlineType
And remove GeditDocumentNewlineType.
docs/reference/gedit-sections.txt | 5 -----
gedit/gedit-commands-file.c | 4 ++--
gedit/gedit-document.c | 12 ++++++------
gedit/gedit-document.h | 15 +--------------
gedit/gedit-file-chooser-dialog.c | 32 ++++++++++++++++----------------
gedit/gedit-file-chooser-dialog.h | 4 ++--
gedit/gedit-tab.c | 3 +--
gedit/gedit-tab.h | 7 ++++---
8 files changed, 32 insertions(+), 50 deletions(-)
---
diff --git a/docs/reference/gedit-sections.txt b/docs/reference/gedit-sections.txt
index 1810791..a9cbd26 100644
--- a/docs/reference/gedit-sections.txt
+++ b/docs/reference/gedit-sections.txt
@@ -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
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 290c94a..521a797 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -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));
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index fe6412f..8e17c71 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -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);
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index 70e1807..9ad568f 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -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
diff --git a/gedit/gedit-file-chooser-dialog.c b/gedit/gedit-file-chooser-dialog.c
index 5f25fcf..92f4bea 100644
--- a/gedit/gedit-file-chooser-dialog.c
+++ b/gedit/gedit-file-chooser-dialog.c
@@ -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);
diff --git a/gedit/gedit-file-chooser-dialog.h b/gedit/gedit-file-chooser-dialog.h
index d9dd875..a91b818 100644
--- a/gedit/gedit-file-chooser-dialog.h
+++ b/gedit/gedit-file-chooser-dialog.h
@@ -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
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 7128bd4..417aa1c 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -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;
diff --git a/gedit/gedit-tab.h b/gedit/gedit-tab.h
index 831418a..9206bae 100644
--- a/gedit/gedit-tab.h
+++ b/gedit/gedit-tab.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]