~ubuntu-branches/ubuntu/natty/gdm/natty-updates

« back to all changes in this revision

Viewing changes to gui/simple-greeter/gdm-user.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2011-04-08 16:35:19 UTC
  • mfrom: (1.4.48 upstream)
  • Revision ID: james.westby@ubuntu.com-20110408163519-nd6602f2j3c2n2qc
Tags: 2.32.1-0ubuntu1
* New upstream release
* debian/patches/01git_xdmcp_ipv6.patch:
* debian/patches/43_CVE-2011-0727.patch:
  - Applied upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#define GLOBAL_FACEDIR    DATADIR "/faces"
43
43
#define MAX_FILE_SIZE     65536
44
44
 
45
 
#define USER_ACCOUNTS_NAME      "org.freedesktop.Accounts"
46
 
#define USER_ACCOUNTS_INTERFACE "org.freedesktop.Accounts.User"
 
45
#define ACCOUNTS_NAME           "org.freedesktop.Accounts"
 
46
#define ACCOUNTS_USER_INTERFACE "org.freedesktop.Accounts.User"
47
47
 
48
48
enum {
49
49
        PROP_0,
75
75
        guint           is_loaded : 1;
76
76
};
77
77
 
78
 
typedef struct _GdmUserClass
 
78
struct _GdmUserClass
79
79
{
80
80
        GObjectClass parent_class;
81
 
} GdmUserClass;
 
81
};
82
82
 
83
83
static void gdm_user_finalize     (GObject      *object);
84
84
static gboolean check_user_file (const char *filename);
279
279
 * @pwent: the user data to use.
280
280
 *
281
281
 * Updates the properties of @user using the data in @pwent.
282
 
 *
283
 
 * Since: 1.0
284
282
 **/
285
283
void
286
284
_gdm_user_update_from_pwent (GdmUser             *user,
373
371
/**
374
372
 * _gdm_user_update_login_frequency:
375
373
 * @user: the user object to update
 
374
 * @login_frequency: the number of times the user has logged in
376
375
 *
377
376
 * Updates the login frequency of @user
378
 
 *
379
 
 * Since: 1.0
380
377
 **/
381
378
void
382
379
_gdm_user_update_login_frequency (GdmUser *user,
398
395
 *
399
396
 * Retrieves the ID of @user.
400
397
 *
401
 
 * Returns: a pointer to an array of characters which must not be modified or
 
398
 * Returns: (transfer none): a pointer to an array of characters which must not be modified or
402
399
 *  freed, or %NULL.
403
 
 *
404
 
 * Since: 1.0
405
400
 **/
406
401
 
407
402
gulong
418
413
 *
419
414
 * Retrieves the display name of @user.
420
415
 *
421
 
 * Returns: a pointer to an array of characters which must not be modified or
 
416
 * Returns: (transfer none): a pointer to an array of characters which must not be modified or
422
417
 *  freed, or %NULL.
423
 
 *
424
 
 * Since: 1.0
425
418
 **/
426
419
const char *
427
420
gdm_user_get_real_name (GdmUser *user)
437
430
 *
438
431
 * Retrieves the login name of @user.
439
432
 *
440
 
 * Returns: a pointer to an array of characters which must not be modified or
 
433
 * Returns: (transfer none): a pointer to an array of characters which must not be modified or
441
434
 *  freed, or %NULL.
442
 
 *
443
 
 * Since: 1.0
444
435
 **/
445
436
 
446
437
const char *
451
442
        return user->user_name;
452
443
}
453
444
 
 
445
/**
 
446
 * gdm_user_get_login_frequency:
 
447
 * @user: a #GdmUser
 
448
 *
 
449
 * Returns the number of times @user has logged in.
 
450
 *
 
451
 * Returns: the login frequency
 
452
 */
454
453
gulong
455
454
gdm_user_get_login_frequency (GdmUser *user)
456
455
{
769
768
        return dest;
770
769
}
771
770
 
 
771
/**
 
772
 * gdm_user_is_logged_in:
 
773
 * @user: a #GdmUser
 
774
 *
 
775
 * Returns whether or not #GdmUser is currently logged in.
 
776
 *
 
777
 * Returns: %TRUE or %FALSE
 
778
 */
772
779
gboolean
773
780
gdm_user_is_logged_in (GdmUser *user)
774
781
{
775
782
        return user->sessions != NULL;
776
783
}
777
784
 
 
785
/**
 
786
 * gdm_user_render_icon:
 
787
 * @user: a #GdmUser
 
788
 * @icon_size: the size to render the icon at
 
789
 *
 
790
 * Returns a #GdkPixbuf of the account icon belonging to @user
 
791
 * at the pixel size specified by @icon_size.
 
792
 *
 
793
 * Returns: (transfer full): a #GdkPixbuf
 
794
 */
778
795
GdkPixbuf *
779
796
gdm_user_render_icon (GdmUser   *user,
780
797
                      gint       icon_size)
828
845
        return pixbuf;
829
846
}
830
847
 
 
848
/**
 
849
 * gdm_user_get_icon_file:
 
850
 * @user: a #GdmUser
 
851
 *
 
852
 * Returns the path to the account icon belonging to @user.
 
853
 *
 
854
 * Returns: (transfer none): a path to an icon
 
855
 */
831
856
const char *
832
857
gdm_user_get_icon_file (GdmUser *user)
833
858
{
836
861
        return user->icon_file;
837
862
}
838
863
 
 
864
/**
 
865
 * gdm_user_get_object_path:
 
866
 * @user: a #GdmUser
 
867
 *
 
868
 * Returns the user accounts service object path of @user,
 
869
 * or %NULL if @user doesn't have an object path associated
 
870
 * with it.
 
871
 *
 
872
 * Returns: (transfer none): the primary ConsoleKit session id of the user
 
873
 */
839
874
const char *
840
875
gdm_user_get_object_path (GdmUser *user)
841
876
{
844
879
        return user->object_path;
845
880
}
846
881
 
 
882
/**
 
883
 * gdm_user_get_primary_session_id:
 
884
 * @user: a #GdmUser
 
885
 *
 
886
 * Returns the primary ConsoleKit session id of @user, or %NULL if @user isn't
 
887
 * logged in.
 
888
 *
 
889
 * Returns: (transfer none): the primary ConsoleKit session id of the user
 
890
 */
847
891
const char *
848
892
gdm_user_get_primary_session_id (GdmUser *user)
849
893
{
962
1006
        DBusGProxyCall *call;
963
1007
 
964
1008
        proxy = dbus_g_proxy_new_for_name (user->connection,
965
 
                                           USER_ACCOUNTS_NAME,
 
1009
                                           ACCOUNTS_NAME,
966
1010
                                           user->object_path,
967
1011
                                           DBUS_INTERFACE_PROPERTIES);
968
1012
 
973
1017
                                        user,
974
1018
                                        NULL,
975
1019
                                        G_TYPE_STRING,
976
 
                                        USER_ACCOUNTS_INTERFACE,
 
1020
                                        ACCOUNTS_USER_INTERFACE,
977
1021
                                        G_TYPE_INVALID);
978
1022
 
979
1023
        if (call == NULL) {
1021
1065
        user->object_path = g_strdup (object_path);
1022
1066
 
1023
1067
        user->accounts_proxy = dbus_g_proxy_new_for_name (user->connection,
1024
 
                                                          USER_ACCOUNTS_NAME,
 
1068
                                                          ACCOUNTS_NAME,
1025
1069
                                                          user->object_path,
1026
 
                                                          USER_ACCOUNTS_INTERFACE);
 
1070
                                                          ACCOUNTS_USER_INTERFACE);
1027
1071
        dbus_g_proxy_set_default_timeout (user->accounts_proxy, INT_MAX);
1028
1072
        dbus_g_proxy_add_signal (user->accounts_proxy, "Changed", G_TYPE_INVALID);
1029
1073
 
1035
1079
        }
1036
1080
}
1037
1081
 
 
1082
/**
 
1083
 * gdm_user_is_loaded:
 
1084
 * @user: a #GdmUser
 
1085
 *
 
1086
 * Determines whether or not the user object is loaded and ready to read from.
 
1087
 * #GdmUserManager:is-loaded property must be %TRUE before calling
 
1088
 * gdm_user_manager_list_users()
 
1089
 *
 
1090
 * Returns: %TRUE or %FALSE
 
1091
 */
1038
1092
gboolean
1039
1093
gdm_user_is_loaded (GdmUser *user)
1040
1094
{