Skip to content

Commit

Permalink
Added check for existing syntax language in sourceview_guess to preve…
Browse files Browse the repository at this point in the history
…nt clearing manually set highlight on save.
  • Loading branch information
David C. Rankin committed Mar 10, 2017
1 parent 6bd58d6 commit c71fe39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 5 additions & 0 deletions gtk_filebuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ void file_get_stats (const gchar *filename, kwinst *app)

void sourceview_guess_language (kwinst *app)
{
if (app->language) return; /* prevent changing manually applied language */

gboolean result_uncertain;
gchar *content_type;

Expand Down Expand Up @@ -141,6 +143,9 @@ void buffer_clear (kwinst *app)
app->filemode = 0;
app->fileuid = 0;
app->filegid = 0;
#ifdef HAVESOURCEVIEW
app->language = NULL; /* reset syntax language */
#endif

/* reset values to default */
status_set_default (app);
Expand Down
17 changes: 7 additions & 10 deletions gtk_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,22 +691,18 @@ GtkWidget *create_menubar (kwinst *app, GtkAccelGroup *mainaccel)
* _File menu
*/
void menu_file_new_activate (GtkMenuItem *menuitem, kwinst *app)
{
buffer_clear (app);
{ /* TODO: fork/execv, create new window and process */

/* reset values to default */
status_set_default (app);
buffer_clear (app); /* check for save and clear */
status_set_default (app); /* statusbard default values */

if (menuitem) {}
}

void menu_file_open_activate (GtkMenuItem *menuitem, kwinst *app)
{
/* check for save and clear */
buffer_clear (app);

/* insert file */
buffer_file_open_dlg (app, NULL);
buffer_clear (app); /* check for save and clear */
buffer_file_open_dlg (app, NULL); /* insert file */

if (menuitem) {}
}
Expand Down Expand Up @@ -823,8 +819,9 @@ void menu_file_print_activate (GtkMenuItem *menuitem, kwinst *app)

void menu_file_close_activate (GtkMenuItem *menuitem, kwinst *app)
{
buffer_clear (app); /* check for save and clear */

if (menuitem) {}
if (app) {}
}

void menu_file_quit_activate (GtkMenuItem *menuitem, kwinst *app)
Expand Down

0 comments on commit c71fe39

Please sign in to comment.