Gtk2-AppIndicator
view release on metacpan or search on metacpan
lib/Gtk2/AppIndicator.pm view on Meta::CPAN
}
sub get_title {
my $self=shift;
return appindicator_get_title($self->{ind});
}
sub set_label {
my $self=shift;
my $label=shift or die "usage: set_label(label,guide)";
my $guide=shift or die "usage: set_label(label,guide)";
appindicator_set_label($self->{ind},$label,$guide);
}
sub get_label {
my $self=shift;
return appindicator_get_label($self->{ind});
}
sub get_guide {
my $self=shift;
return appindicator_get_label_guide($self->{ind});
}
1;
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
Gtk2::AppIndicator - Perl extension for libappindicator
=head1 SYNOPSIS
use Gtk2 '-init';
use Gtk2::AppIndicator;
use Cwd;
# Initialize the status icon. an_icon_name must be present
# at the icon theme path location, with an image extension like
# .jpg, .png or .svg, etc.
$status_icon=Gtk2::AppIndicator->new("AnAppName","an_icon_name");
# If you want to be in control over your icon location, you
# can set it manually. It must be an absolute path, in order
# to work.
my $absolute_current_working_directory=getcwd();
my $acwd=$absolute_current_working_directory;
$status_icon->set_icon_theme_path($acwd);
# Optionally set different icons
# $status_icon->set_icon_name_active("an_icon_name");
# $status_icon->set_icon_name_attention("an_other_icon_name");
# $status_icon->set_icon_name_passive("an_other_icon_name");
# Add a menu to the indicator
my $menu=Gtk2::Menu->new();
my $showcp=Gtk2::CheckMenuItem->new_with_mnemonic("_Show My App");
$showcp->set_active(1);
$showcp->signal_connect("toggled",sub { hide_show($window,$showcp); });
my $quit=Gtk2::MenuItem->new_with_mnemonic("_Quit");
$quit->signal_connect("activate",sub { Gtk->main_quit(); });
$menu->append($showcp);
$menu->append(Gtk2::SeparatorMenuItem->new());
$menu->append($quit);
$status_icon->set_menu($menu);
# Show our icon and set the state
$menu->show_all();
$status_icon->set_active();
=head1 DESCRIPTION
This module gives an interface to the new ubuntu Unity libappindicator stuff.
=head1 FUNCTIONS
$ind=Gtk2::AppIndicator->new($application_id,$active_icon_name [,$category])
Creates a new application indicator object with given name (id) and icon name for the active icon.
Category must be one of { 'application-status','communications','system-services','hardware','other' }
if set. if not set, it defaults to 'application-status'.
$ind->set_icon_theme_path($path)
Set the icon theme path to 'path'. This is where icons should be found with names like <active_icon_name>.png.
$ind->get_icon_theme_path()
Returns the (previously written) icon theme path, or undefined if not set.
$ind->get_category()
Returns the previously set category with the new function.
$ind->get_id()
Returns the application id given to the new function.
$ind->set_icon_name_active($name)
Sets the icon name for the active icon.
$ind->get_icon_name_active()
Returns the name of the icon for active state.
$ind->set_icon_name_attention($name)
Sets the icon name for the attention icon
$ind->get_icon_name_attention()
Returns the name of the icon for attention state.
$ind->set_active()
Makes the application indicator active.
$ind->set_attention()
Makes the application indicator show the attention icon.
( run in 0.442 second using v1.01-cache-2.11-cpan-e1769b4cff6 )