/[beaver]/beaver/src/filesops.c
ViewVC logotype

Diff of /beaver/src/filesops.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by skypher, Fri Jul 4 11:49:21 2003 UTC revision 1.20 by mikix, Sun Aug 17 03:51:54 2003 UTC
# Line 38  Line 38 
38  #include "prefs.h"  #include "prefs.h"
39  #include "filesops.h"  #include "filesops.h"
40  #include "tools.h"  #include "tools.h"
41    #include <errno.h>
42    
43  #define OPEN_FILE       0  #define OPEN_FILE       0
44  #define SAVE_FILE_AS    1  #define SAVE_FILE_AS    1
# Line 684  void save_file_as_func (const gchar *Fil Line 685  void save_file_as_func (const gchar *Fil
685  /* actually does the work of opening a file */  /* actually does the work of opening a file */
686  void open_filename (const gchar *filename)  void open_filename (const gchar *filename)
687  {  {
 //  gint CurrentPage;  
688    struct stat Stats;    struct stat Stats;
689    gchar *dir;    gchar *dir;
690      gboolean new_file = FALSE;
691        
692    START_FCN    START_FCN
693        
694    if (stat (filename, &Stats) == -1) return;    if (stat (filename, &Stats) == -1)
695      {
696        if (errno == ENOENT) /* the file is allowed to not exist */
697        {
698          new_file = TRUE;
699        }
700        else
701        {
702          return;
703        }
704      }
705    if ((Stats.st_mode & S_IFMT) == S_IFDIR) return;    if ((Stats.st_mode & S_IFMT) == S_IFDIR) return;
706        
707    g_free (DIRECTORY);    g_free (DIRECTORY);
# Line 702  void open_filename (const gchar *filenam Line 713  void open_filename (const gchar *filenam
713    put_recent_file (filename);    put_recent_file (filename);
714    add_page_in_notebook (GTK_NOTEBOOK(MainNotebook), filename);    add_page_in_notebook (GTK_NOTEBOOK(MainNotebook), filename);
715    open_file_in_editor(GTK_WIDGET(FPROPS(OpenedFilesCnt - 1, Text)), filename, OpenedFilesCnt - 1);    open_file_in_editor(GTK_WIDGET(FPROPS(OpenedFilesCnt - 1, Text)), filename, OpenedFilesCnt - 1);
716      
717      if (new_file)
718      {
719        gtk_text_buffer_set_modified (FPROPS (OpenedFilesCnt - 1, Buffer), TRUE);
720      }
721      
722    if (FPROPS(OpenedFilesCnt - 1, ReadOnly))    if (FPROPS(OpenedFilesCnt - 1, ReadOnly))
723      print_msg (g_strdup_printf (_("Opened file \"%s\" read-only."), FPROPS(OpenedFilesCnt - 1, BaseName)));      print_msg (g_strdup_printf (_("Opened file \"%s\" read-only."), FPROPS(OpenedFilesCnt - 1, BaseName)));
724    else    else

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26