Changeset e20be4a7bb7f7ce258435a7e11766c564c2abbc0


Ignore:
Timestamp:
11/05/10 23:44:37 (3 years ago)
Author:
Matias De la Puente <mfpuente.ar@…>
Children:
e172a31dcdd83fd6284b46e00609da847eb596bf
Parents:
fed76872db57be25180c04c6856972ef1e8ef8ff
git-committer:
Matias De la Puente <mfpuente.ar@…> (11/05/10 23:44:37)
Message:

Fix several vala warnings

Files:
16 edited

Legend:

Unmodified
Added
Removed
  • libi4uc/i4ucaddprofiledialogpresenter.vala

    r4b2dcca re20be4a  
    6161                { 
    6262                        var import_project = new Project (); 
    63                         import_project.open (project_uri); 
     63                        try 
     64                        { 
     65                                import_project.open (project_uri); 
     66                        } 
     67                        catch (GLib.Error e) 
     68                        { 
     69                                print (_("Error trying to open %s: %s\n").printf (project_uri, e.message)); 
     70                        } 
    6471                        if (_project.folder_uri != import_project.folder_uri) 
    6572                        { 
     
    146153                { 
    147154                        var import_project = new Project (); 
    148                         if (!import_project.open (_view.project_uri)) 
     155                        try 
     156                        { 
     157                                if (!import_project.open (_view.project_uri)) 
     158                                { 
     159                                        _view.warning_message = _("Can't open the project"); 
     160                                        _view.warning_message_visible = true; 
     161                                        return; 
     162                                } 
     163                        } 
     164                        catch (GLib.Error e) 
    149165                        { 
    150166                                _view.warning_message = _("Can't open the project"); 
  • libi4uc/i4ucbuilder.vala

    r917df8d re20be4a  
    3131        public Gee.Map<string, BuilderDeviceType> device_types { get { return _device_types; } } 
    3232         
    33         public bool open (string uri) 
     33        public bool open (string uri) throws GLib.Error, GLib.KeyFileError 
    3434        { 
    3535                var builder_content = _builder_file.load_contents (uri); 
     
    4848        } 
    4949         
    50         public void save (string? uri = null) 
     50        public void save (string? uri = null) throws GLib.Error 
    5151        { 
    5252                var key_file = new KeyFile (); 
  • libi4uc/i4ucbuilderdevicetype.vala

    r0b4fc3c re20be4a  
    3333        public Gee.Map<string, BuilderSourceType> source_types { get { return _source_types; } } 
    3434         
    35         public BuilderDeviceType.from_key_file (KeyFile key_file, string group) 
     35        public BuilderDeviceType.from_key_file (KeyFile key_file, string group) throws GLib.Error, GLib.KeyFileError 
    3636        { 
    3737                _device_type = key_file.get_string (group, "device_type"); 
  • libi4uc/i4ucbuildersourcetype.vala

    r917df8d re20be4a  
    3030        public Gee.List<string> clean_types { get { return _clean_types; } } 
    3131         
    32         public BuilderSourceType.from_key_file (KeyFile key_file, string group) 
     32        public BuilderSourceType.from_key_file (KeyFile key_file, string group) throws GLib.Error, GLib.KeyFileError 
    3333        { 
    3434                _source_type = key_file.get_string (group, "source_type"); 
  • libi4uc/i4ucdocumentpagepresenter.vala

    reed29f7 re20be4a  
    7171        public void open (string uri) 
    7272        { 
    73                 _view.title = uri; 
    74                 var contents = _document.load_contents (uri); 
    75                 _view.tab_title = _document.display_name; 
    76                 _view.tab_tooltip = "<b>%s</b> %s".printf (_("Name:"), _document.parse_name); 
    77                 _view.content = contents; 
    78                 _view.tab_mark = false; 
    79                 _view.guess_language_id (_document.content_type); 
     73                try 
     74                { 
     75                        _view.title = uri; 
     76                        var contents = _document.load_contents (uri); 
     77                        _view.tab_title = _document.display_name; 
     78                        _view.tab_tooltip = "<b>%s</b> %s".printf (_("Name:"), _document.parse_name); 
     79                        _view.content = contents; 
     80                        _view.tab_mark = false; 
     81                        _view.guess_language_id (_document.content_type); 
     82                } 
     83                catch (GLib.Error e) 
     84                { 
     85                        _view.show_error_message (_("Error trying to open %s: %s").printf (_document.uri, e.message)); 
     86                } 
    8087        } 
    8188         
     
    8693                else if (_view.tab_mark) 
    8794                { 
    88                         _document.save_contents (_view.content); 
    89                         _view.tab_mark = false; 
     95                        try 
     96                        { 
     97                                _document.save_contents (_view.content); 
     98                                _view.tab_mark = false; 
     99                        } 
     100                        catch (GLib.Error e) 
     101                        { 
     102                                _view.show_error_message (_("Error trying to save %s: %s").printf (_document.uri, e.message)); 
     103                        } 
    90104                } 
    91105        } 
     
    111125                        catch (GLib.Error e) 
    112126                        { 
    113                                 _view.show_error_message (e.message); 
     127                                _view.show_error_message (_("Error trying to save as %s:%s").printf (_document.uri, e.message)); 
    114128                        } 
    115129                } 
  • libi4uc/i4ucdocumentpageview.vala

    reed29f7 re20be4a  
    216216                }); 
    217217                 
    218                 operation.run (PrintOperationAction.PRINT_DIALOG, null); 
     218                try 
     219                { 
     220                        operation.run (PrintOperationAction.PRINT_DIALOG, null); 
     221                } 
     222                catch (GLib.Error e) 
     223                { 
     224                        show_error_message (e.message); 
     225                } 
    219226        } 
    220227         
  • libi4uc/i4ucdocumentsview.vala

    r4bb5472 re20be4a  
    129129                 
    130130                _ui_manager.insert_action_group (_action_group, -1); 
    131                 _ui_manager.add_ui_from_string (_UI, -1); 
     131                 
     132                try 
     133                { 
     134                        _ui_manager.add_ui_from_string (_UI, -1); 
     135                } 
     136                catch (GLib.Error e) 
     137                { 
     138                        warning (e.message); 
     139                } 
    132140                 
    133141                _save_action = _action_group.get_action ("SaveDocumentAction"); 
  • libi4uc/i4ucmainwindowview.vala

    rb7c312b re20be4a  
    6666                this.delete_event.connect (() => { return this.exit_clicked (); }); 
    6767                 
    68                 this.icon = new Gdk.Pixbuf.from_file (Path.build_filename (Config.PIXMAPS_DIR, "icon.png")); 
    69                  
    7068                _action_group = new ActionGroup ("I4ucMainWindowActions"); 
    7169                _action_group.add_actions (_action_entries, this); 
     
    7371 
    7472                _ui_manager.insert_action_group (_action_group, 0); 
    75                 _ui_manager.add_ui_from_string (_UI, -1); 
     73                 
     74                try 
     75                { 
     76                        _ui_manager.add_ui_from_string (_UI, -1); 
     77                        this.icon = new Gdk.Pixbuf.from_file (Path.build_filename (Config.PIXMAPS_DIR, "icon.png")); 
     78                } 
     79                catch (GLib.Error e) 
     80                { 
     81                        warning (e.message); 
     82                } 
    7683 
    7784                _show_side_panel_action = _action_group.get_action ("ShowSidePanelAction") as ToggleAction; 
  • libi4uc/i4ucprofilebuilder.vala

    rc69cac3 re20be4a  
    4747        } 
    4848 
    49         public void build () 
     49        public void build () throws GLib.Error 
    5050        { 
    5151                if (_is_building) 
     
    103103        } 
    104104         
    105         public void clean () 
     105        public void clean () throws GLib.Error 
    106106        { 
    107107                if (_is_building) 
     
    168168        } 
    169169 
    170         private bool check_mtime (string newer_uri, string older_uri) 
     170        private bool check_mtime (string newer_uri, string older_uri) throws GLib.Error 
    171171        { 
    172172                var newer_file = File.new_for_uri (newer_uri); 
  • libi4uc/i4ucprogrammer.vala

    r381478a re20be4a  
    5252        public Gee.List<string> devices { get { return _devices; } } 
    5353         
    54         public bool open (string uri) 
     54        public bool open (string uri) throws GLib.Error, GLib.KeyFileError 
    5555        { 
    5656                var programmer_content = _programmer_file.load_contents (uri); 
     
    9797        } 
    9898         
    99         public void save (string? uri = null) 
     99        public void save (string? uri = null) throws GLib.Error, GLib.FileError 
    100100        { 
    101101                var key_file = new KeyFile (); 
  • libi4uc/i4ucproject.vala

    r7759ee2 re20be4a  
    3737        public Gee.Map<string, ProjectProfile> profiles { get { return _profiles; } } 
    3838         
    39         public bool open (string uri) 
     39        public bool open (string uri) throws GLib.Error, GLib.KeyFileError 
    4040        { 
    4141                var project_content = _project_file.load_contents (uri); 
  • libi4uc/i4ucprojectprofile.vala

    rc94fa49 re20be4a  
    3131        public Gee.List<string> files { get { return _files; } } 
    3232         
    33         public ProjectProfile.from_key_file (KeyFile key_file, string group) 
     33        public ProjectProfile.from_key_file (KeyFile key_file, string group) throws GLib.KeyFileError 
    3434        { 
    3535                _name = key_file.get_string (group, "name"); 
  • libi4uc/i4ucprojectspresenter.vala

    r8a71947 re20be4a  
    7070        { 
    7171                var project = new Project (); 
    72                 if (project.open (project_uri)) 
    73                         _side_page_presenter.add_project (project); 
    74                 else 
    75                         _view.show_error_message (_("Error trying to open <<%s>>").printf (project_uri)); 
     72                try 
     73                { 
     74                        if (project.open (project_uri)) 
     75                                _side_page_presenter.add_project (project); 
     76                        else 
     77                                _view.show_error_message (_("Error trying to open <<%s>>").printf (project_uri)); 
     78                } 
     79                catch (GLib.Error e) 
     80                { 
     81                        _view.show_error_message (_("Error trying to open <<%s>>: %s").printf (project_uri, e.message)); 
     82                } 
    7683        } 
    7784 
     
    201208                _profile_builder.profile = current_profile.name; 
    202209                _view.show_build_log_page (); 
    203                 _profile_builder.build (); 
     210                 
     211                try 
     212                { 
     213                        _profile_builder.build (); 
     214                } 
     215                catch (GLib.Error e) 
     216                { 
     217                        _view.show_error_message (_("Error trying to build profile %s: %s").printf (current_profile.name, e.message)); 
     218                } 
    204219        } 
    205220         
     
    219234                _profile_builder.project = current_project; 
    220235                _profile_builder.profile = current_profile.name; 
    221                 _profile_builder.clean (); 
     236                 
     237                try 
     238                { 
     239                        _profile_builder.clean (); 
     240                } 
     241                catch (GLib.Error e) 
     242                { 
     243                        _view.show_error_message (_("Error trying to clean profile %s: %s").printf (current_profile.name, e.message)); 
     244                } 
    222245        } 
    223246         
  • libi4uc/i4ucprojectsview.vala

    r4bb5472 re20be4a  
    108108                 
    109109                _ui_manager.insert_action_group (_action_group, -1); 
    110                 _ui_manager.add_ui_from_string (_UI, -1); 
     110                 
     111                try 
     112                { 
     113                        _ui_manager.add_ui_from_string (_UI, -1); 
     114                } 
     115                catch (GLib.Error e) 
     116                { 
     117                        warning (e.message); 
     118                } 
    111119                 
    112120                _add_file_action = _action_group.get_action ("AddFileProjectAction"); 
  • libi4uc/i4ucsettings.vala

    rf6e03d7 re20be4a  
    7979        public Settings () 
    8080        { 
    81                  _working_folder = Filename.to_uri (Environment.get_home_dir ()); 
     81                 _working_folder = File.new_for_path (Environment.get_home_dir ()).get_uri (); 
    8282        } 
    8383         
    84         public void open (string filename) 
     84        public void open (string filename) throws GLib.Error, GLib.KeyFileError 
    8585        { 
    8686                _filename = filename; 
     
    120120        } 
    121121         
    122         public void save () 
     122        public void save () throws GLib.FileError 
    123123        { 
    124124                var key_file = new KeyFile (); 
     
    153153        } 
    154154         
    155         private void load_entries (KeyFile key_file, string group, string key, Gee.Map<string, string> map) 
     155        private void load_entries (KeyFile key_file, string group, string key, Gee.Map<string, string> map) throws GLib.KeyFileError 
    156156        { 
    157157                foreach (var entry in key_file.get_string_list (group, key)) 
  • src/main.vala

    rf6e03d7 re20be4a  
    2525        Gtk.init (ref args); 
    2626         
    27         load_settings (); 
    28         load_builders (); 
    29         load_programmers (); 
     27        try 
     28        { 
     29                load_settings (); 
     30                load_builders (); 
     31                load_programmers (); 
     32        } 
     33        catch (GLib.Error e) 
     34        { 
     35                warning (e.message); 
     36        } 
    3037         
    3138        var main_window_view = new MainWindowView (); 
     
    4956         
    5057        Gtk.main (); 
    51         I4uc.Settings.instance.save (); 
     58         
     59        try 
     60        { 
     61                I4uc.Settings.instance.save (); 
     62        } 
     63        catch (GLib.FileError e) 
     64        { 
     65                warning (e.message); 
     66        } 
    5267} 
    5368 
    54 void load_settings () 
     69void load_settings () throws GLib.KeyFileError 
    5570{ 
    5671        var settings_folder = Path.build_filename (Environment.get_home_dir (), ".i4uc"); 
     
    6176} 
    6277 
    63 void load_builders () 
     78void load_builders () throws GLib.Error, GLib.KeyFileError 
    6479{ 
    6580        //Load builders in $(pkgdatadir)/builders/ 
     
    98113} 
    99114 
    100 void load_programmers () 
     115void load_programmers () throws GLib.Error, GLib.KeyFileError 
    101116{ 
    102117        //Load programmers in $(pkgdatadir)/programmers/ 
Note: See TracChangeset for help on using the changeset viewer.