Mageia Bugzilla – Attachment 5893 Details for
Bug 10310
userdrake should use dbus org.freedesktop.Accounts to get/set user account info
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
use the dbus org.freedesktop.Accounts service to get/set the user icon
userdrake-dbus-small2.patch (text/plain), 1.66 KB, created by
Thierry Vignaud
on 2015-02-11 08:55:00 CET
(
hide
)
Description:
use the dbus org.freedesktop.Accounts service to get/set the user icon
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2015-02-11 08:55:00 CET
Size:
1.66 KB
patch
obsolete
> >v1.0 (Pablo Saratxaga ): use the dbus org.freedesktop.Accounts service to get/set the user icon >v2.0 (Thierry Vignaud): simplify ; use eval {} as DBus sometiles fail > >--- /usr/sbin/drakuser_bak 2013-04-23 21:44:18.000000000 +0200 >+++ /usr/sbin/drakuser 2013-06-09 12:00:35.484044798 +0200 >@@ -41,6 +43,7 @@ > use Gtk2::Gdk::Keysyms; > use utf8; > use log; >+use Net::DBus; > > $ugtk2::wm_icon = "userdrake"; > >@@ -48,6 +51,11 @@ > my $secfile = '/etc/sysconfig/msec'; > my $pixdir = '/usr/share/userdrake/pixmaps/'; > my @pix = ($pixdir . 'selected.png', $pixdir . 'unselected.png'); >+my $bus = eval { Net::DBus->system }; >+my $accounts_service = eval { $bus->get_service("org.freedesktop.Accounts") }; >+my $accounts_manager = eval { $accounts_service->get_object( >+ "/org/freedesktop/Accounts", >+ "org.freedesktop.Accounts") }; > > my $in = interactive->vnew('su'); > >@@ -334,7 +342,21 @@ > my $current_icon; > my $user_icon; > if ($user) { >+ eval { >+ my $accounts_user_path = $accounts_manager->FindUserByName($user); >+ # service doens't provide Get methods; we need to use different >+ # interface to read properties >+ my $accounts_user_get = $accounts_service->get_object( >+ $accounts_user_path, >+ "org.freedesktop.DBus.Properties"); >+ my $accounts_user_set = $accounts_service->get_object( >+ $accounts_user_path, >+ "org.freedesktop.Accounts.User"); >+ $user_icon = $accounts_user_get->Get( >+ "org.freedesktop.Accounts.User", >+ "IconFile"); >+ }; >- $user_icon = "$::prefix/usr/share/faces/$user.png"; >+ $user_icon ||= "$::prefix/usr/share/faces/$user.png"; > } > gtkpack_(my $hb = Gtk2::HBox->new(0, 2), > 0, Gtk2::Label->new(N("Click on the icon to change it") . ' '),
v1.0 (Pablo Saratxaga ): use the dbus org.freedesktop.Accounts service to get/set the user icon v2.0 (Thierry Vignaud): simplify ; use eval {} as DBus sometiles fail --- /usr/sbin/drakuser_bak 2013-04-23 21:44:18.000000000 +0200 +++ /usr/sbin/drakuser 2013-06-09 12:00:35.484044798 +0200 @@ -41,6 +43,7 @@ use Gtk2::Gdk::Keysyms; use utf8; use log; +use Net::DBus; $ugtk2::wm_icon = "userdrake"; @@ -48,6 +51,11 @@ my $secfile = '/etc/sysconfig/msec'; my $pixdir = '/usr/share/userdrake/pixmaps/'; my @pix = ($pixdir . 'selected.png', $pixdir . 'unselected.png'); +my $bus = eval { Net::DBus->system }; +my $accounts_service = eval { $bus->get_service("org.freedesktop.Accounts") }; +my $accounts_manager = eval { $accounts_service->get_object( + "/org/freedesktop/Accounts", + "org.freedesktop.Accounts") }; my $in = interactive->vnew('su'); @@ -334,7 +342,21 @@ my $current_icon; my $user_icon; if ($user) { + eval { + my $accounts_user_path = $accounts_manager->FindUserByName($user); + # service doens't provide Get methods; we need to use different + # interface to read properties + my $accounts_user_get = $accounts_service->get_object( + $accounts_user_path, + "org.freedesktop.DBus.Properties"); + my $accounts_user_set = $accounts_service->get_object( + $accounts_user_path, + "org.freedesktop.Accounts.User"); + $user_icon = $accounts_user_get->Get( + "org.freedesktop.Accounts.User", + "IconFile"); + }; - $user_icon = "$::prefix/usr/share/faces/$user.png"; + $user_icon ||= "$::prefix/usr/share/faces/$user.png"; } gtkpack_(my $hb = Gtk2::HBox->new(0, 2), 0, Gtk2::Label->new(N("Click on the icon to change it") . ' '),
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 10310
:
4058
|
4126
|
5892
| 5893