def on_btn_remove_snapshot_clicked( self, button ):
		iter = self.list_time_line.get_selection().get_selected()[1]
		if iter is None:
			return

		snapshot_id = self.store_time_line.get_value( iter, 1 )
		if len( snapshot_id ) <= 1:
			return

		if gtk.RESPONSE_YES == gnomemessagebox.show_question( self.window, self.config, _('Are you sure you want to remove the snapshot:\n<b>%s</b>') % self.snapshots.get_snapshot_display_name( snapshot_id ) ):
			print "Remove Snapshot: %s" % snapshot_id
			self.snapshots.remove_snapshot( snapshot_id )
			self.fill_time_line()
    def on_btn_remove_snapshot_clicked(self, button):
        iter = self.list_time_line.get_selection().get_selected()[1]
        if iter is None:
            return

        snapshot_id = self.store_time_line.get_value(iter, 1)
        if len(snapshot_id) <= 1:
            return

        if gtk.RESPONSE_YES == gnomemessagebox.show_question(
                self.window, self.config,
                _('Are you sure you want to remove the snapshot:\n<b>%s</b>') %
                self.snapshots.get_snapshot_display_name(snapshot_id)):
            print "Remove Snapshot: %s" % snapshot_id
            self.snapshots.remove_snapshot(snapshot_id)
            self.fill_time_line()
    def validate(self):
        #snapshots path
        snapshots_path = self.fcb_where.get_filename()

        #hack
        if snapshots_path.startswith('//'):
            snapshots_path = snapshots_path[1:]

        #include list
        include_list = []
        iter = self.store_include.get_iter_first()
        while not iter is None:
            include_list.append((self.store_include.get_value(iter, 0),
                                 self.store_include.get_value(iter, 3)))
            iter = self.store_include.iter_next(iter)

        #exclude patterns
        exclude_list = []
        iter = self.store_exclude.get_iter_first()
        while not iter is None:
            exclude_list.append(self.store_exclude.get_value(iter, 0))
            iter = self.store_exclude.iter_next(iter)

        #check params
        check_ret_val = self.config.check_take_snapshot_params(
            snapshots_path, include_list, exclude_list)
        if not check_ret_val is None:
            err_id, err_msg = check_ret_val
            gnomemessagebox.show_error(self.dialog, self.config, err_msg)
            return False

        #check if back folder changed
        if len(self.config.get_snapshots_path()
               ) > 0 and self.config.get_snapshots_path() != snapshots_path:
            if gtk.RESPONSE_YES != gnomemessagebox.show_question(
                    self.dialog, self.config,
                    _('Are you sure you want to change snapshots directory ?')
            ):
                return False

        #ok let's save to config
        msg = self.config.set_snapshots_path(snapshots_path)
        if not msg is None:
            gnomemessagebox.show_error(self.dialog, self.config, msg)
            return False

        self.config.set_include_folders(include_list)
        self.config.set_exclude_patterns(exclude_list)

        #global schedule
        self.config.set_automatic_backup_mode(
            self.store_backup_mode.get_value(
                self.cb_backup_mode.get_active_iter(), 1))

        #auto-remove snapshots
        self.config.set_remove_old_snapshots(
            self.cb_remove_old_backup.get_active(),
            int(self.edit_remove_old_backup_value.get_value()),
            self.store_remove_old_backup_unit.get_value(
                self.cb_remove_old_backup_unit.get_active_iter(), 1))
        self.config.set_min_free_space(
            self.cb_min_free_space.get_active(),
            int(self.edit_min_free_space_value.get_value()),
            self.store_min_free_space_unit.get_value(
                self.cb_min_free_space_unit.get_active_iter(), 1))
        self.config.set_dont_remove_named_snapshots(
            self.cb_dont_remove_named_snapshots.get_active())
        self.config.set_smart_remove(self.cb_smart_remove.get_active())

        #options
        self.config.set_notify_enabled(
            self.cb_enable_notifications.get_active())

        #expert options
        self.config.set_per_directory_schedule(
            self.cb_per_directory_schedule.get_active())

        self.config.save()

        msg = self.config.setup_cron()
        if not msg is None:
            gnomemessagebox.show_error(self.dialog, self.config, msg)
            return False

        return True
	def validate( self ):
		#snapshots path
		snapshots_path = self.fcb_where.get_filename()

		#hack
		if snapshots_path.startswith( '//' ):
			snapshots_path = snapshots_path[ 1 : ]

		#include list 
		include_list = []
		iter = self.store_include.get_iter_first()
		while not iter is None:
			include_list.append( ( self.store_include.get_value( iter, 0 ), self.store_include.get_value( iter, 3 ) ) )
			iter = self.store_include.iter_next( iter )

		#exclude patterns
		exclude_list = []
		iter = self.store_exclude.get_iter_first()
		while not iter is None:
			exclude_list.append( self.store_exclude.get_value( iter, 0 ) )
			iter = self.store_exclude.iter_next( iter )

		#check params
		check_ret_val = self.config.check_take_snapshot_params( snapshots_path, include_list, exclude_list )
		if not check_ret_val is None:
			err_id, err_msg = check_ret_val
			gnomemessagebox.show_error( self.dialog, self.config, err_msg )
			return False

		#check if back folder changed
		if len( self.config.get_snapshots_path() ) > 0 and self.config.get_snapshots_path() != snapshots_path:
			if gtk.RESPONSE_YES != gnomemessagebox.show_question( self.dialog, self.config, _('Are you sure you want to change snapshots directory ?') ):
				return False 

		#ok let's save to config
		msg = self.config.set_snapshots_path( snapshots_path )
		if not msg is None:
			gnomemessagebox.show_error( self.dialog, self.config, msg )
			return False

		self.config.set_include_folders( include_list )
		self.config.set_exclude_patterns( exclude_list )

		#global schedule
		self.config.set_automatic_backup_mode( self.store_backup_mode.get_value( self.cb_backup_mode.get_active_iter(), 1 ) )

		#auto-remove snapshots
		self.config.set_remove_old_snapshots( 
						self.cb_remove_old_backup.get_active(), 
						int( self.edit_remove_old_backup_value.get_value() ),
						self.store_remove_old_backup_unit.get_value( self.cb_remove_old_backup_unit.get_active_iter(), 1 ) )
		self.config.set_min_free_space( 
						self.cb_min_free_space.get_active(), 
						int( self.edit_min_free_space_value.get_value() ),
						self.store_min_free_space_unit.get_value( self.cb_min_free_space_unit.get_active_iter(), 1 ) )
		self.config.set_dont_remove_named_snapshots( self.cb_dont_remove_named_snapshots.get_active() )
		self.config.set_smart_remove( self.cb_smart_remove.get_active() )

		#options
		self.config.set_notify_enabled( self.cb_enable_notifications.get_active() )

		#expert options
		self.config.set_per_directory_schedule( self.cb_per_directory_schedule.get_active() )

		self.config.save()

		msg = self.config.setup_cron()
		if not msg is None:
			gnomemessagebox.show_error( self.dialog, self.config, msg )
			return False

		return True