diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 12:33:44 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 12:33:44 +0100 |
commit | 19aa428a6c72a8cc525898f5b855d5389da03870 (patch) | |
tree | e1f532550a8c3b103dd255f427cfd552fb39d34d | |
parent | ac5045acd5ee5facfea596a38bc8c41e44ce3b23 (diff) | |
parent | f271da656cf19b917c28e8b04e031be55f8bc22d (diff) | |
download | mgaonline-19aa428a6c72a8cc525898f5b855d5389da03870.tar mgaonline-19aa428a6c72a8cc525898f5b855d5389da03870.tar.gz mgaonline-19aa428a6c72a8cc525898f5b855d5389da03870.tar.bz2 mgaonline-19aa428a6c72a8cc525898f5b855d5389da03870.tar.xz mgaonline-19aa428a6c72a8cc525898f5b855d5389da03870.zip |
Merge branch 'topic/systray'
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | icons/hicolor/16x16/apps/mgaonline.png (renamed from icons/mgaonline16.png) | bin | 625 -> 625 bytes | |||
-rw-r--r-- | icons/hicolor/32x32/apps/mgaonline.png (renamed from icons/mgaonline32.png) | bin | 1327 -> 1327 bytes | |||
-rw-r--r-- | icons/hicolor/48x48/apps/mgaonline.png (renamed from icons/mgaonline48.png) | bin | 2099 -> 2099 bytes | |||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-bugfix.svg (renamed from pixmaps/svg/bugfix.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-bundle.svg (renamed from pixmaps/svg/bundle.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-busy.svg (renamed from pixmaps/svg/busy.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-disabled.svg (renamed from pixmaps/svg/disabled.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-disconnect.svg (renamed from pixmaps/svg/disconnect.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-noconf.svg (renamed from pixmaps/svg/noconf.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-okay.svg (renamed from pixmaps/svg/okay.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/actions/mgaonline-updates.svg (renamed from pixmaps/svg/updates.svg) | 0 | ||||
-rw-r--r-- | icons/hicolor/scalable/apps/mgaonline.svg (renamed from icons/mgaonline.svg) | 0 | ||||
-rwxr-xr-x | mgaapplet | 68 | ||||
-rwxr-xr-x | mgaapplet-upgrade-helper | 1 | ||||
-rw-r--r-- | mgaapplet_gui.pm | 2 | ||||
-rw-r--r-- | mgaonline.pm | 2 | ||||
-rw-r--r-- | pixmaps/bugfix.png | bin | 1072 -> 0 bytes | |||
-rw-r--r-- | pixmaps/bundle.png | bin | 1072 -> 0 bytes | |||
-rw-r--r-- | pixmaps/busy.png | bin | 1020 -> 0 bytes | |||
-rw-r--r-- | pixmaps/disabled.png | bin | 723 -> 0 bytes | |||
-rw-r--r-- | pixmaps/disconnect.png | bin | 696 -> 0 bytes | |||
-rw-r--r-- | pixmaps/enhancement.png | bin | 1094 -> 0 bytes | |||
-rw-r--r-- | pixmaps/noconf.png | bin | 930 -> 0 bytes | |||
-rw-r--r-- | pixmaps/okay.png | bin | 978 -> 0 bytes | |||
-rw-r--r-- | pixmaps/updates.png | bin | 861 -> 0 bytes |
27 files changed, 64 insertions, 28 deletions
@@ -8,7 +8,6 @@ SUBDIRS = po polkit PREFIX = / DATADIR = $(PREFIX)/usr/share ICONSDIR = $(DATADIR)/icons -PIXDIR = $(DATADIR)/$(NAME) LIBEXECDIR = $(PREFIX)/usr/libexec BINDIR = $(PREFIX)/usr/bin FBLIBDIR = $(PREFIX)/usr/lib/libDrakX/drakfirsttime @@ -30,15 +29,14 @@ clean: find . -name '*~' | xargs rm -f install: all - install -d $(PREFIX)/usr/{bin,libexec,share/{mime/packages,$(NAME)/pixmaps,autostart,gnome/autostart,icons/{mini,large}},lib/libDrakX/drakfirsttime} + install -d $(PREFIX)/usr/{bin,libexec,share/{mime/packages,autostart,gnome/autostart,icons},lib/libDrakX/drakfirsttime} install -m755 $(MGAUPDATE) $(MGAAPPLET)-config $(MGAAPPLET)-upgrade-helper $(LIBEXECDIR) install -m755 $(MGAAPPLET) $(MGAAPPLET)-update-checker $(BINDIR) install -d $(SYSCONFDIR) install -m644 mgaapplet.conf $(SYSCONFDIR)/mgaapplet - install -m644 icons/$(NAME)16.png $(ICONSDIR)/mini/$(NAME).png - install -m644 icons/$(NAME)32.png $(ICONSDIR)/$(NAME).png - install -m644 icons/$(NAME)48.png $(ICONSDIR)/large/$(NAME).png - install -m644 pixmaps/*.png $(PIXDIR)/pixmaps + cp -a icons/hicolor $(ICONSDIR) + # Compat symlink, to be sure we don't break external apps relying on this icon + ln -s $(ICONSDIR)/hicolor/32x32/apps/$(NAME).png $(ICONSDIR)/$(NAME).png perl -pi -e "s/version = 1/version = '$(VERSION)'/" mgaonline.pm install -m644 mgaonline.pm $(FBLIBDIR) install -m644 mgaapplet.pm $(FBLIBDIR) @@ -1,3 +1,12 @@ +- install and use SVG icons by default + o they are now installed in the standard hicolor theme, so that they + can be used without hardcoding paths +- mgaapplet: Fix the systray applet not working in Plasma + o it now uses the SNI specification via the statusnotifier lib + for Plasma only; other DEs keep using the previous code with + GtkStatusIcon (which is not supported in Plasma) + o always show the status icon when passing --testing + Version 3.17 - 10 Aug 2016, Anne Nicolas - mgaapplet: diff --git a/icons/mgaonline16.png b/icons/hicolor/16x16/apps/mgaonline.png Binary files differindex 1e376758..1e376758 100644 --- a/icons/mgaonline16.png +++ b/icons/hicolor/16x16/apps/mgaonline.png diff --git a/icons/mgaonline32.png b/icons/hicolor/32x32/apps/mgaonline.png Binary files differindex 5dabbcab..5dabbcab 100644 --- a/icons/mgaonline32.png +++ b/icons/hicolor/32x32/apps/mgaonline.png diff --git a/icons/mgaonline48.png b/icons/hicolor/48x48/apps/mgaonline.png Binary files differindex bb9df771..bb9df771 100644 --- a/icons/mgaonline48.png +++ b/icons/hicolor/48x48/apps/mgaonline.png diff --git a/pixmaps/svg/bugfix.svg b/icons/hicolor/scalable/actions/mgaonline-bugfix.svg index 760d3e8c..760d3e8c 100644 --- a/pixmaps/svg/bugfix.svg +++ b/icons/hicolor/scalable/actions/mgaonline-bugfix.svg diff --git a/pixmaps/svg/bundle.svg b/icons/hicolor/scalable/actions/mgaonline-bundle.svg index 55c703df..55c703df 100644 --- a/pixmaps/svg/bundle.svg +++ b/icons/hicolor/scalable/actions/mgaonline-bundle.svg diff --git a/pixmaps/svg/busy.svg b/icons/hicolor/scalable/actions/mgaonline-busy.svg index 02591187..02591187 100644 --- a/pixmaps/svg/busy.svg +++ b/icons/hicolor/scalable/actions/mgaonline-busy.svg diff --git a/pixmaps/svg/disabled.svg b/icons/hicolor/scalable/actions/mgaonline-disabled.svg index 8453f8fb..8453f8fb 100644 --- a/pixmaps/svg/disabled.svg +++ b/icons/hicolor/scalable/actions/mgaonline-disabled.svg diff --git a/pixmaps/svg/disconnect.svg b/icons/hicolor/scalable/actions/mgaonline-disconnect.svg index a904ea83..a904ea83 100644 --- a/pixmaps/svg/disconnect.svg +++ b/icons/hicolor/scalable/actions/mgaonline-disconnect.svg diff --git a/pixmaps/svg/noconf.svg b/icons/hicolor/scalable/actions/mgaonline-noconf.svg index e0209c03..e0209c03 100644 --- a/pixmaps/svg/noconf.svg +++ b/icons/hicolor/scalable/actions/mgaonline-noconf.svg diff --git a/pixmaps/svg/okay.svg b/icons/hicolor/scalable/actions/mgaonline-okay.svg index 9a16755d..9a16755d 100644 --- a/pixmaps/svg/okay.svg +++ b/icons/hicolor/scalable/actions/mgaonline-okay.svg diff --git a/pixmaps/svg/updates.svg b/icons/hicolor/scalable/actions/mgaonline-updates.svg index 519c2aaa..519c2aaa 100644 --- a/pixmaps/svg/updates.svg +++ b/icons/hicolor/scalable/actions/mgaonline-updates.svg diff --git a/icons/mgaonline.svg b/icons/hicolor/scalable/apps/mgaonline.svg index 71ec37ae..71ec37ae 100644 --- a/icons/mgaonline.svg +++ b/icons/hicolor/scalable/apps/mgaonline.svg @@ -40,6 +40,12 @@ use mgaapplet_gui; use Gtk3::Notify '-init', 'mgaapplet'; use Net::DBus qw(:typing); use Rpmdrake::open_db; +use Glib::Object::Introspection; + +Glib::Object::Introspection->setup( + basename => 'StatusNotifier', + version => '0.1', + package => 'StatusNotifier'); POSIX::sigprocmask(SIG_BLOCK, POSIX::SigSet->new(SIGCHLD)); @@ -169,12 +175,27 @@ my %actions = ( 'upgrade_distro' => { name => N("Upgrade the system"), launch => \&upgrade }, ); -my $icon = Gtk3::StatusIcon->new; -#$icon->shape_combine_mask($img, 0, 0); -$icon->signal_connect(popup_menu => sub { - my ($_icon, $button, $time) = @_; - $menu and $menu->popup(undef, undef, undef, undef, $button, $time); - }); +my ($icon, $is_plasma); +# Plasma supports SNI natively. Other DE do not. In that case, we fall back to +# the deprecated GtkStatusIcon. +if ($ENV{DESKTOP_SESSION} =~ /plasma$/i) { + $is_plasma = 1; + $icon = StatusNotifier::Notifier->new_from_icon_name('mgaapplet', 'STATUS_NOTIFIER_CATEGORY_APPLICATION_STATUS', 'mgaonline'); + $icon->set_title('mgaapplet'); + $icon->set_status('STATUS_NOTIFIER_STATUS_ACTIVE'); + $icon->register; + $icon->signal_connect(context_menu => sub { + $menu->popup(undef, undef, undef, undef, 0, Gtk3::get_current_event_time()) if $menu; + }); +} +else { + $icon = Gtk3::StatusIcon->new; + $icon->signal_connect(popup_menu => sub { + my ($_icon, $button, $time) = @_; + $menu->popup(undef, undef, undef, undef, $button, $time) if $menu; + }); +} + $icon->signal_connect(activate => sub { my %click_actions = ( no_update_medium => \&add_media, @@ -190,7 +211,7 @@ $icon->signal_connect(activate => sub { } $click_actions{$action}->() if ref $click_actions{$action}; - }); + }); foreach my $opt (@ARGV) { if (member($opt, qw(--force -f))) { setAutoStart('TRUE') } if ($opt =~ /--(rpm-root|urpmi-root)=(.*)/) { @@ -484,7 +505,7 @@ sub no_more_supported() { if ($choice eq 'upgrade') { really_confirm_upgrade() and real_upgrade(); } elsif ($choice eq 'nothing') { - $icon->set_visible(0); + $is_plasma ? $icon->set_status('STATUS_NOTIFIER_STATUS_PASSIVE') : $icon->set_visible(0); } undef $no_more_supported_wip; } @@ -633,9 +654,9 @@ sub about_dialog() { $url =~ s/^https:/http:/; my $w = gtknew('AboutDialog', name => N("Mageia Online %s", $ver), copyright => N("Copyright (C) %s by %s", 'Mandriva', '2001-2010') . "\n" . - N("Copyright (C) %s by %s", 'Mageia', '2010-2016'), + N("Copyright (C) %s by %s", 'Mageia', '2010-2017'), license => join('', cat_('/usr/share/common-licenses/GPL')), - icon => '/usr/share/icons/mini/mgaonline.png', + icon => '/usr/share/icons/hicolor/48x48/apps/mgaonline.png', comments => N("Mageia Online gives access to Mageia web services."), website => $url, website_label => N("Online WebSite"), @@ -656,23 +677,34 @@ sub setState { my $checkme; state $previous_state; my @arr = @{$state{$state}{menu}}; - my $tmp = eval { gtkcreate_pixbuf($state{$state}{colour}[0]) }; - $icon->set_from_pixbuf($tmp) if $tmp; - $icon->set_tooltip_text(formatAlaTeX(translate($state{$state}{tt}[0]))); - my @invisible_states = qw(delayed okay disconnected locked); - $icon->set_visible(!member($state, @invisible_states)); + my $icon_name = 'mgaonline-' . $state{$state}{colour}[0]; + if ($is_plasma) { + $icon->set_from_icon_name('STATUS_NOTIFIER_ICON', $icon_name); + $icon->set_tooltip($icon_name, 'mgaapplet', formatAlaTeX(translate($state{$state}{tt}[0]))); + } + else { + $icon_name = "/usr/share/icons/hicolor/scalable/actions/${icon_name}.svg"; + $icon->set_from_pixbuf(gtkcreate_pixbuf($icon_name)); + $icon->set_tooltip_text(formatAlaTeX(translate($state{$state}{tt}[0]))); + } + my @invisible_states = qw(delayed okay disconnected locked); # do not show icon while checking if previously hidden: - $icon->set_visible(0) if $state eq 'busy' && member($previous_state, @invisible_states); + if (!$::testing && (member($state, @invisible_states) or $state eq 'busy' && member($previous_state, @invisible_states))) { + $is_plasma ? $icon->set_status('STATUS_NOTIFIER_STATUS_PASSIVE') : $icon->set_visible(0); + } + else { + $is_plasma ? $icon->set_status('STATUS_NOTIFIER_STATUS_ACTIVE') : $icon->set_visible(1); + } $previous_state = $state; gtkflush(); # so that bubbles are displayed on right icon - if ($state{$state}{tt}[0] && $icon->isa('Gtk3::StatusIcon') && !$state{$state}{do_not_use_bubble}) { + if ($state{$state}{tt}[0] && !$state{$state}{do_not_use_bubble}) { $bubble->clear_actions; $bubble->update(N("Warning"), formatAlaTeX(translate($state{$state}{tt}[0])) . "\n", - '/usr/share/icons/mgaonline.png'); + '/usr/share/icons/hicolor/scalable/apps/mgaonline.svg'); if ($state eq 'new_distribution') { $bubble->add_action('upgrade', N("More Information"), sub { upgrade() }); if ($sub_state eq 'updates') { diff --git a/mgaapplet-upgrade-helper b/mgaapplet-upgrade-helper index aff62818..9a6d516a 100755 --- a/mgaapplet-upgrade-helper +++ b/mgaapplet-upgrade-helper @@ -41,7 +41,6 @@ use Rpmdrake::open_db; use lang; use mgaapplet_gui qw(run_ask_credentials_dialog); -ugtk3::add_icon_path("/usr/share/mgaonline/pixmaps/"); my ($log_file); my ($new_distro_version, $download_dir); diff --git a/mgaapplet_gui.pm b/mgaapplet_gui.pm index 247bd1f1..75e09fca 100644 --- a/mgaapplet_gui.pm +++ b/mgaapplet_gui.pm @@ -53,8 +53,6 @@ use interactive; use interactive::gtk; use lib qw(/usr/lib/libDrakX/drakfirsttime); -ugtk3::add_icon_path("/usr/share/mgaonline/pixmaps/"); - our $localdir = "$ENV{HOME}/.MgaOnline"; our $localfile = "$localdir/mgaonline"; diff --git a/mgaonline.pm b/mgaonline.pm index 99fcd56f..7659431f 100644 --- a/mgaonline.pm +++ b/mgaonline.pm @@ -139,7 +139,7 @@ sub fork_exec { sub get_banner_icon() { find { -e $_ } - qw(/usr/share/mcc/themes/default/rpmdrake-mga.png /usr/share/icons/large/mgaonline.png); + qw(/usr/share/mcc/themes/default/rpmdrake-mdk.png /usr/share/icons/hicolor/48x48/apps/mgaonline.png); } sub get_banner { diff --git a/pixmaps/bugfix.png b/pixmaps/bugfix.png Binary files differdeleted file mode 100644 index 6fa2f737..00000000 --- a/pixmaps/bugfix.png +++ /dev/null diff --git a/pixmaps/bundle.png b/pixmaps/bundle.png Binary files differdeleted file mode 100644 index b57e4f2f..00000000 --- a/pixmaps/bundle.png +++ /dev/null diff --git a/pixmaps/busy.png b/pixmaps/busy.png Binary files differdeleted file mode 100644 index 2361f464..00000000 --- a/pixmaps/busy.png +++ /dev/null diff --git a/pixmaps/disabled.png b/pixmaps/disabled.png Binary files differdeleted file mode 100644 index 5bc469c6..00000000 --- a/pixmaps/disabled.png +++ /dev/null diff --git a/pixmaps/disconnect.png b/pixmaps/disconnect.png Binary files differdeleted file mode 100644 index 0a12fae9..00000000 --- a/pixmaps/disconnect.png +++ /dev/null diff --git a/pixmaps/enhancement.png b/pixmaps/enhancement.png Binary files differdeleted file mode 100644 index a1792116..00000000 --- a/pixmaps/enhancement.png +++ /dev/null diff --git a/pixmaps/noconf.png b/pixmaps/noconf.png Binary files differdeleted file mode 100644 index ce7b65d1..00000000 --- a/pixmaps/noconf.png +++ /dev/null diff --git a/pixmaps/okay.png b/pixmaps/okay.png Binary files differdeleted file mode 100644 index 8a284dba..00000000 --- a/pixmaps/okay.png +++ /dev/null diff --git a/pixmaps/updates.png b/pixmaps/updates.png Binary files differdeleted file mode 100644 index 85376e71..00000000 --- a/pixmaps/updates.png +++ /dev/null |