diff options
author | Thierry Vignaud <tv@mandriva.org> | 2009-12-03 17:41:02 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2009-12-03 17:41:02 +0000 |
commit | 3ce73b864e599dc88de8af4f7c782a836d00bcdb (patch) | |
tree | e850c535738650b37557697db957041d817812a7 /Rpmdrake/rpmnew.pm | |
parent | 33be3d14096c7ae35569dc4422ee84ddee71f427 (diff) | |
download | rpmdrake-3ce73b864e599dc88de8af4f7c782a836d00bcdb.tar rpmdrake-3ce73b864e599dc88de8af4f7c782a836d00bcdb.tar.gz rpmdrake-3ce73b864e599dc88de8af4f7c782a836d00bcdb.tar.bz2 rpmdrake-3ce73b864e599dc88de8af4f7c782a836d00bcdb.tar.xz rpmdrake-3ce73b864e599dc88de8af4f7c782a836d00bcdb.zip |
(inspect) use gtksourceview-2 instead of gtksourceview-1
Diffstat (limited to 'Rpmdrake/rpmnew.pm')
-rw-r--r-- | Rpmdrake/rpmnew.pm | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Rpmdrake/rpmnew.pm b/Rpmdrake/rpmnew.pm index 6980b567..0fb447c1 100644 --- a/Rpmdrake/rpmnew.pm +++ b/Rpmdrake/rpmnew.pm @@ -82,8 +82,8 @@ sub inspect { my $d = ugtk2->new(N("Inspecting %s", $file), grab => 1, transient => $::main_window); my $save_wsize = sub { @inspect_wsize = $d->{rwindow}->get_size }; my %texts; - require Gtk2::SourceView; - my $lang_manager = Gtk2::SourceView::LanguagesManager->new; + require Gtk2::SourceView2; + my $lang_manager = Gtk2::SourceView2::LanguageManager->get_default; gtkadd( $d->{window}, gtkpack_( @@ -93,19 +93,19 @@ sub inspect { gtkpack_( gtknew('VBox'), 0, gtknew('Label', text_markup => qq(<span font_desc="monospace">$file:</span>)), - 1, gtknew('ScrolledWindow', child => $texts{file} = Gtk2::SourceView::View->new), + 1, gtknew('ScrolledWindow', child => $texts{file} = Gtk2::SourceView2::View->new), ), gtkpack_( gtknew('VBox'), 0, gtknew('Label', text_markup => qq(<span font_desc="monospace">$rpmnew:</span>)), - 1, gtknew('ScrolledWindow', child => $texts{rpmnew} = Gtk2::SourceView::View->new), + 1, gtknew('ScrolledWindow', child => $texts{rpmnew} = Gtk2::SourceView2::View->new), ), resize1 => 1, ), gtkpack_( gtknew('VBox'), 0, gtknew('Label', text => N("Changes:")), - 1, gtknew('ScrolledWindow', child => $texts{diff} = Gtk2::SourceView::View->new), + 1, gtknew('ScrolledWindow', child => $texts{diff} = Gtk2::SourceView2::View->new), ), resize1 => 1, ), @@ -136,18 +136,14 @@ sub inspect { my %files = (file => $file, rpmnew => $rpmnew); foreach (keys %files) { gtktext_insert($texts{$_}, [ [ scalar(cat_($files{$_})), { 'font' => 'monospace' } ] ]); - require File::MimeInfo::Magic; - my $mime_type = File::MimeInfo::Magic::mimetype($files{$_}); - next if !$mime_type; - my $lang = $lang_manager->get_language_from_mime_type($mime_type); + my $lang = $lang_manager->guess_language($files{$_}); + $lang ||= $lang_manager->get_language('sh'); my $buffer = $texts{$_}->get_buffer; - $buffer->set('highlight', $lang); $buffer->set_language($lang) if $lang; } gtktext_insert($texts{diff}, [ [ join('', @diff), { 'font' => 'monospace' } ] ]); my $buffer = $texts{diff}->get_buffer; - my $lang = $lang_manager->get_language_from_mime_type('text/x-patch'); - $buffer->set('highlight', $lang); + my $lang = $lang_manager->get_language('diff'); $buffer->set_language($lang) if $lang; $d->{rwindow}->set_default_size(@inspect_wsize); $d->main; |