Mageia Bugzilla – Attachment 4126 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]
small patch to show dbus use
userdrake-dbus-small.patch (text/plain), 2.83 KB, created by
Pablo Saratxaga
on 2013-06-11 09:52:59 CEST
(
hide
)
Description:
small patch to show dbus use
Filename:
MIME Type:
Creator:
Pablo Saratxaga
Created:
2013-06-11 09:52:59 CEST
Size:
2.83 KB
patch
obsolete
>--- /usr/sbin/drakuser_bak 2013-04-23 21:44:18.000000000 +0200 >+++ /usr/sbin/drakuser 2013-06-09 12:00:35.484044798 +0200 >@@ -1,11 +1,13 @@ > #!/usr/bin/perl > ################################################################################ >-# # >+# # > # # > # Copyright (C) 2003-2009 Mandriva # >+# Copyright (C) 2013 Mageia # > # # > # Daouda Lo # > # Thierry Vignaud <tvignaud@mandriva.com> # >+# Pablo Saratxaga <pablo@walon.org> # > # # > # This program is free software; you can redistribute it and/or modify # > # it under the terms of the GNU General Public License Version 2 as # >@@ -41,6 +43,7 @@ > use Gtk2::Gdk::Keysyms; > use utf8; > use log; >+use Net::DBus; > > $ugtk2::wm_icon = "userdrake"; > >@@ -48,11 +51,16 @@ > my $secfile = '/etc/sysconfig/msec'; > my $pixdir = '/usr/share/userdrake/pixmaps/'; > my @pix = ($pixdir . 'selected.png', $pixdir . 'unselected.png'); >+my $bus = Net::DBus->system; >+my $accounts_service = $bus->get_service("org.freedesktop.Accounts"); >+my $accounts_manager = $accounts_service->get_object( >+ "/org/freedesktop/Accounts", >+ "org.freedesktop.Accounts"); > > my $in = interactive->vnew('su'); > > my $us = {}; >-$us->{VERSION} = '1.13.3'; >+$us->{VERSION} = '1.14.2'; > > my $window_splash = Gtk2::Window->new('popup'); > $window_splash->signal_connect(delete_event => \&QuitGlobal); >@@ -334,7 +342,22 @@ > my @icons = any::facesnames(); > my $i; > my $current_icon; >- my $user_icon = "$::prefix/usr/share/faces/$user.png"; >+ my $user_icon; >+ if ($user) { >+ 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"); >+ } >+ if (!$user_icon) { $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") . ' '), > 0, my $bt = Gtk2::Button->new
--- /usr/sbin/drakuser_bak 2013-04-23 21:44:18.000000000 +0200 +++ /usr/sbin/drakuser 2013-06-09 12:00:35.484044798 +0200 @@ -1,11 +1,13 @@ #!/usr/bin/perl ################################################################################ -# # +# # # # # Copyright (C) 2003-2009 Mandriva # +# Copyright (C) 2013 Mageia # # # # Daouda Lo # # Thierry Vignaud <tvignaud@mandriva.com> # +# Pablo Saratxaga <pablo@walon.org> # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License Version 2 as # @@ -41,6 +43,7 @@ use Gtk2::Gdk::Keysyms; use utf8; use log; +use Net::DBus; $ugtk2::wm_icon = "userdrake"; @@ -48,11 +51,16 @@ my $secfile = '/etc/sysconfig/msec'; my $pixdir = '/usr/share/userdrake/pixmaps/'; my @pix = ($pixdir . 'selected.png', $pixdir . 'unselected.png'); +my $bus = Net::DBus->system; +my $accounts_service = $bus->get_service("org.freedesktop.Accounts"); +my $accounts_manager = $accounts_service->get_object( + "/org/freedesktop/Accounts", + "org.freedesktop.Accounts"); my $in = interactive->vnew('su'); my $us = {}; -$us->{VERSION} = '1.13.3'; +$us->{VERSION} = '1.14.2'; my $window_splash = Gtk2::Window->new('popup'); $window_splash->signal_connect(delete_event => \&QuitGlobal); @@ -334,7 +342,22 @@ my @icons = any::facesnames(); my $i; my $current_icon; - my $user_icon = "$::prefix/usr/share/faces/$user.png"; + my $user_icon; + if ($user) { + 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"); + } + if (!$user_icon) { $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") . ' '), 0, my $bt = Gtk2::Button->new
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 10310
:
4058
|
4126
|
5892
|
5893