Commit 9a4dda25 authored by Jesse van den Kieboom's avatar Jesse van den Kieboom

Factor out newline type names in utils

parent b87dd7e8
......@@ -35,6 +35,7 @@
#include "gedit-debug.h"
#include "gedit-enum-types.h"
#include "gedit-settings.h"
#include "gedit-utils.h"
#define ALL_FILES _("All Files")
#define ALL_TEXT_FILES _("All Text Files")
......@@ -341,19 +342,19 @@ create_newline_combo (GeditFileChooserDialogGtk *dialog)
newline_combo_append (GTK_COMBO_BOX (combo),
store,
&iter,
_("Unix/Linux"),
gedit_utils_newline_type_to_string (GTK_SOURCE_NEWLINE_TYPE_LF),
GTK_SOURCE_NEWLINE_TYPE_LF);
newline_combo_append (GTK_COMBO_BOX (combo),
store,
&iter,
_("Mac OS Classic"),
gedit_utils_newline_type_to_string (GTK_SOURCE_NEWLINE_TYPE_CR),
GTK_SOURCE_NEWLINE_TYPE_CR);
newline_combo_append (GTK_COMBO_BOX (combo),
store,
&iter,
_("Windows"),
gedit_utils_newline_type_to_string (GTK_SOURCE_NEWLINE_TYPE_CR_LF),
GTK_SOURCE_NEWLINE_TYPE_CR_LF);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
......
......@@ -29,6 +29,7 @@
#include "gedit-file-chooser-dialog-osx.h"
#include "gedit-encoding-items.h"
#include "gedit-encodings-dialog.h"
#include "gedit-utils.h"
struct _GeditFileChooserDialogOSXPrivate
{
......@@ -71,18 +72,7 @@ G_DEFINE_TYPE_EXTENDED (GeditFileChooserDialogOSX,
{
NSString *title;
switch (type)
{
case GTK_SOURCE_NEWLINE_TYPE_LF:
title = [NSString stringWithUTF8String:_("Unix/Linux")];
break;
case GTK_SOURCE_NEWLINE_TYPE_CR:
title = [NSString stringWithUTF8String:_("Mac OS Classic")];
break;
case GTK_SOURCE_NEWLINE_TYPE_CR_LF:
title = [NSString stringWithUTF8String:_("Windows")];
break;
}
title = [NSString stringWithUTF8String:gedit_utils_newline_type_to_string (type)];
self = [super initWithTitle:title action:nil keyEquivalent:@""];
......
......@@ -1444,6 +1444,22 @@ gedit_utils_set_direct_save_filename (GdkDragContext *context)
return uri;
}
const gchar *
gedit_utils_newline_type_to_string (GtkSourceNewlineType newline_type)
{
switch (newline_type)
{
case GTK_SOURCE_NEWLINE_TYPE_LF:
return _("Unix/Linux");
case GTK_SOURCE_NEWLINE_TYPE_CR:
return _("Mac OS Classic");
case GTK_SOURCE_NEWLINE_TYPE_CR_LF:
return _("Windows");
}
return NULL;
}
static gboolean
data_exists (GSList *list,
const gpointer data)
......
......@@ -129,6 +129,8 @@ GtkSourceCompressionType
gchar *gedit_utils_set_direct_save_filename (GdkDragContext *context);
const gchar *gedit_utils_newline_type_to_string (GtkSourceNewlineType newline_type);
/* Private */
GSList *_gedit_utils_encoding_strv_to_list (const gchar * const *enc_str);
......
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