--- deliantra/Deliantra-Client/DC/UI/MessageWindow.pm 2007/07/27 17:24:29 1.8 +++ deliantra/Deliantra-Client/DC/UI/MessageWindow.pm 2007/07/31 06:49:38 1.9 @@ -14,6 +14,12 @@ my ($info) = @_; } + +sub clr_def($) { "$_[0]" } +sub clr_act($) { "$_[0]" } +sub clr_hlt($) { "$_[0]" } +sub clr_hlt2($) { "$_[0]" } + sub new { my $class = shift; @@ -73,7 +79,7 @@ $bb->connect (activate => sub { $self->unhighlight_channel ($id); 0 }); $vb->add ( my $b = CFPlus::UI::Label->new ( - expand => 1, markup => $chaninfo->{title}, valign => 0, align => 0 + expand => 1, markup => clr_def ($chaninfo->{title}), valign => 0, align => 0 ) ); @@ -124,9 +130,7 @@ $cv->{_channel_highlighted} = 1; my $tab = $cv->{_tab_button}; $tab->set_markup ( - "" - .$self->{channel_info}->{$id}->{title} - ."" + clr_hlt (defined $id ? $self->{channel_info}->{$id}->{title} : "Log") ); } @@ -136,23 +140,20 @@ my $cv = $self->{chatviews}->{$id}; $cv->{_channel_highlighted} = 0; my $tab = $cv->{_tab_button}; - $tab->set_markup ( - "" - .$self->{channel_info}->{$id}->{title} - ."" - ); + + $tab->set_markup (clr_act (defined $id ? $self->{channel_info}->{$id}->{title} : "Log")); } sub update_current_tab { my ($self, $page) = @_; my $tab = $page->{_tab_button}; - my $label = $self->{channel_info}->{$page->{_chat_id}}->{title}; + my $label; + if (defined $page->{_chat_id}) { + $label = $self->{channel_info}->{$page->{_chat_id}}->{title}; + } $label = "Log" unless defined $label; - $tab->set_markup ( - "" - .$label - ."" - ); + + $tab->set_markup (clr_act ($label)); for ($self->{nb}->pages) { next if $_ eq $page; @@ -160,14 +161,13 @@ next if $_->{_channel_highlighted}; next unless $tab; - my $label = $self->{channel_info}->{$_->{_chat_id}}->{title}; + my $label; + if (defined $_->{_chat_id}) { + $label = $self->{channel_info}->{$_->{_chat_id}}->{title}; + } $label = "Log" unless defined $label; - $tab->set_markup ( - "" - .$label - ."" - ); + $tab->set_markup (clr_def ($label)); } } @@ -181,7 +181,7 @@ my ($self, $para) = @_; my $id = $para->{type}; - if ($self->{channel_info}->{$id}) { + if (exists $self->{channel_info}->{$id}) { $self->touch_channel ($id); $self->{chatviews}->{$id}->message ($para); } else {