Kaydet (Commit) 80d7aa21 authored tarafından Colomban Wendling's avatar Colomban Wendling

Allow to select None filetype in Open File dialog

Closes #483.
üst 62a82329
...@@ -80,7 +80,7 @@ filesel_state = { ...@@ -80,7 +80,7 @@ filesel_state = {
{ {
0, 0,
GEANY_ENCODINGS_MAX, /* default encoding is detect from file */ GEANY_ENCODINGS_MAX, /* default encoding is detect from file */
GEANY_FILETYPES_NONE, /* default filetype is detect from extension */ -1, /* default filetype is detect from extension */
FALSE, FALSE,
FALSE FALSE
} }
...@@ -142,7 +142,7 @@ static gboolean open_file_dialog_handle_response(GtkWidget *dialog, gint respons ...@@ -142,7 +142,7 @@ static gboolean open_file_dialog_handle_response(GtkWidget *dialog, gint respons
filesel_state.open.filetype_idx = filetype_combo_box_get_active_filetype(GTK_COMBO_BOX(filetype_combo)); filesel_state.open.filetype_idx = filetype_combo_box_get_active_filetype(GTK_COMBO_BOX(filetype_combo));
/* ignore detect from file item */ /* ignore detect from file item */
if (filesel_state.open.filetype_idx > 0) if (filesel_state.open.filetype_idx >= 0)
ft = filetypes_index(filesel_state.open.filetype_idx); ft = filetypes_index(filesel_state.open.filetype_idx);
filesel_state.open.encoding_idx = ui_encodings_combo_box_get_active_encoding(GTK_COMBO_BOX(encoding_combo)); filesel_state.open.encoding_idx = ui_encodings_combo_box_get_active_encoding(GTK_COMBO_BOX(encoding_combo));
...@@ -219,7 +219,7 @@ static GtkWidget *create_filetype_combo_box(void) ...@@ -219,7 +219,7 @@ static GtkWidget *create_filetype_combo_box(void)
store = gtk_tree_store_new(2, G_TYPE_INT, G_TYPE_STRING); store = gtk_tree_store_new(2, G_TYPE_INT, G_TYPE_STRING);
gtk_tree_store_insert_with_values(store, &iter_detect, NULL, -1, gtk_tree_store_insert_with_values(store, &iter_detect, NULL, -1,
0, GEANY_FILETYPES_NONE, 1, _("Detect from file"), -1); 0, -1 /* auto-detect */, 1, _("Detect from file"), -1);
gtk_tree_store_insert_with_values(store, &iter_compiled, NULL, -1, gtk_tree_store_insert_with_values(store, &iter_compiled, NULL, -1,
0, -1, 1, _("Programming Languages"), -1); 0, -1, 1, _("Programming Languages"), -1);
...@@ -234,9 +234,6 @@ static GtkWidget *create_filetype_combo_box(void) ...@@ -234,9 +234,6 @@ static GtkWidget *create_filetype_combo_box(void)
{ {
GeanyFiletype *ft = node->data; GeanyFiletype *ft = node->data;
if (ft->id == GEANY_FILETYPES_NONE)
continue;
switch (ft->group) switch (ft->group)
{ {
case GEANY_FILETYPE_GROUP_COMPILED: iter_parent = &iter_compiled; break; case GEANY_FILETYPE_GROUP_COMPILED: iter_parent = &iter_compiled; break;
...@@ -263,9 +260,10 @@ static GtkWidget *create_filetype_combo_box(void) ...@@ -263,9 +260,10 @@ static GtkWidget *create_filetype_combo_box(void)
} }
/* the filetype, or -1 for auto-detect */
static gint filetype_combo_box_get_active_filetype(GtkComboBox *combo) static gint filetype_combo_box_get_active_filetype(GtkComboBox *combo)
{ {
gint id = 0; gint id = -1;
GtkTreeIter iter; GtkTreeIter iter;
if (gtk_combo_box_get_active_iter(combo, &iter)) if (gtk_combo_box_get_active_iter(combo, &iter))
......
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