This file is indexed.

/usr/share/backintime/gnome/logviewdialog.py is in backintime-gnome 1.0.34-0.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#    Back In Time
#    Copyright (C) 2008-2009 Oprea Dan
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License along
#    with this program; if not, write to the Free Software Foundation, Inc.,
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


import os
import os.path
import sys
import copy
import pygtk
pygtk.require("2.0")
import gtk
import gobject
import datetime
import gettext

import config
import snapshots
import tools
import encfstools


_=gettext.gettext


class LogViewDialog(object):
    
    def __init__( self, parent, snapshot_id = None ):
        self.parent = parent
        self.config = parent.config
        self.snapshots = parent.snapshots
        self.profile_id = self.config.get_current_profile()
        self.snapshot_id = snapshot_id
        self.decode = None
        
        builder = gtk.Builder()
        self.builder = builder
        self.builder.set_translation_domain('backintime')
        
        glade_file = os.path.join(self.config.get_app_path(), 'gnome', 'logviewdialog.glade')
        
        builder.add_from_file(glade_file)
        
        get = builder.get_object
        
        self.dialog = get('LogViewDialog')
        self.dialog.set_transient_for( parent.window )

        signals = { 
                'on_combo_profiles_changed': self.on_combo_profiles_changed,
                'on_combo_filter_changed': self.on_combo_filter_changed,
                'on_cb_auto_scroll_toggled': self.dummy_handler,
                'on_cb_decode_toggled': self.on_cb_decode
            }
        
        builder.connect_signals(signals)

        #hide unused
        get('cb_auto_scroll').hide()

        #decode paths
        self.cb_decode = get('cb_decode')
        if self.config.get_snapshots_mode() == 'ssh_encfs':
            self.cb_decode.show()
        else:
            self.cb_decode.hide()

        #log view
        self.txt_log_view = get( 'txt_log_view' )
        
        #profiles
        self.hbox_profiles = get( 'hbox_profiles' )

        self.store_profiles = gtk.ListStore( str, str )
        self.combo_profiles = get( 'combo_profiles' )
        
        text_renderer = gtk.CellRendererText()
        self.combo_profiles.pack_start( text_renderer, True )
        self.combo_profiles.add_attribute( text_renderer, 'text', 0 )
        
        self.combo_profiles.set_model( self.store_profiles )
    
        #filter
        self.store_filter = gtk.ListStore( str, int )
        self.combo_filter = get( 'combo_filter' )
        
        text_renderer = gtk.CellRendererText()
        self.combo_filter.pack_start( text_renderer, True )
        self.combo_filter.add_attribute( text_renderer, 'text', 0 )
        
        self.combo_filter.set_model( self.store_filter )
    
        self.store_filter.append( [ _('All'), 0 ] )
        select_iter = self.store_filter.append( [ _('Errors'), 1 ] )
        set_active = True
        if self.snapshot_id is None or self.snapshots.is_snapshot_failed( self.snapshot_id ):
            self.combo_filter.set_active_iter( select_iter )
            set_active = False
        select_iter = self.store_filter.append( [ _('Changes'), 2 ] )
        if not self.snapshot_id is None and set_active:
            self.combo_filter.set_active_iter( select_iter )
        self.store_filter.append( [ _('Informations'), 3 ] )
        
        #update title
        if not snapshot_id is None:
            self.hbox_profiles.hide()
            self.dialog.set_title( "%s (%s)" % ( self.dialog.get_title(), self.snapshots.get_snapshot_display_name( self.snapshot_id ) ) )
        
        self.update_profiles()

    def on_cb_decode(self, *args):
        if self.cb_decode.get_active():
            self.decode = encfstools.Decode(self.config)
        else:
            if not self.decode is None:
                self.decode.close()
            self.decode = None
        self.update_log_view()
    
    def dummy_handler(self, *args):
        pass
        
    def on_combo_profiles_changed( self, *params ):
        iter = self.combo_profiles.get_active_iter()
        if iter is None:
            return
        
        profile_id = self.store_profiles.get_value( iter, 1 )
        if profile_id != self.profile_id:
            self.profile_id = profile_id
        
        self.update_log_view()
    
    def on_combo_filter_changed( self, *params ):
        self.update_log_view()
    
    def update_profiles( self ):
        profiles = self.config.get_profiles_sorted_by_name()
        
        select_iter = None
        self.store_profiles.clear()

        counter = 0
        for profile_id in profiles:
            counter = counter + 1
            iter = self.store_profiles.append( [ self.config.get_profile_name( profile_id ), profile_id ] )
            if profile_id == self.profile_id:
                select_iter = iter
        
        if not select_iter is None:
            self.combo_profiles.set_active_iter( select_iter )

        if counter <= 1:
            self.hbox_profiles.hide()

        self.update_log_view()
    
    def update_log_view( self ):
        mode = 0
        iter = self.combo_filter.get_active_iter()
        if not iter is None:
            mode = self.store_filter.get_value( iter, 1 )

        if self.snapshot_id is None:
            self.txt_log_view.get_buffer().set_text( self.snapshots.get_take_snapshot_log( mode, self.profile_id, decode = self.decode ) )
        else:
            self.txt_log_view.get_buffer().set_text( self.snapshots.get_snapshot_log( self.snapshot_id, mode, decode = self.decode ) )
        
    def run( self ):
        self.dialog.run()
        if not self.decode is None:
            self.decode.close()
        self.dialog.destroy()