~ubuntu-branches/ubuntu/oneiric/indicator-session/oneiric-proposed

« back to all changes in this revision

Viewing changes to src/users-service-dbus.c

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2011-08-25 08:58:56 UTC
  • mfrom: (1.1.34 upstream)
  • Revision ID: james.westby@ubuntu.com-20110825085856-qtuta6vqal1iw7mt
Tags: 0.3.3-0ubuntu1
* New upstream release.
  - User menu should still show even if there is only 1 user (LP: #831758)
  - Bluetooth item in menu not needed (LP: #825111)
  - Newly created users are not added to the menu until next 
    login (LP: #552048)
  - Users list in shutdown menu is not updated on user 
    deletion (LP: #557608)
  - should use gsettings rather than gconf (LP: #656323)
* debian/control
  - Bump dbusmenu build dep to >= 0.4.92

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
static void     user_deleted                           (DBusGProxy        *proxy,
59
59
                                                        const gchar       *user_id,
60
60
                                                        gpointer           user_data);
 
61
static void     user_changed                            (DBusGProxy       *proxy,
 
62
                                                         gpointer          user_data);                                                        
61
63
static void     seat_proxy_session_added               (DBusGProxy        *seat_proxy,
62
64
                                                        const gchar       *session_id,
63
65
                                                        UsersServiceDbus  *service);
711
713
  g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
712
714
  UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
713
715
 
714
 
  if (g_hash_table_size (priv->users) > 0)
715
 
    {
716
 
      return;
717
 
    }
718
 
 
719
716
  if (priv->count > MINIMUM_USERS && priv->count < MAXIMUM_USERS)
720
717
    {
721
718
      GPtrArray *users = NULL;
758
755
 
759
756
              continue;
760
757
            }
761
 
 
762
 
          user = g_new0 (UserData, 1);
763
 
 
 
758
          
 
759
          user = g_hash_table_lookup (priv->users, id);
 
760
            // Double check we havent processed this user already
 
761
          if (user != NULL)
 
762
            {
 
763
              g_free(user->user_name);
 
764
              g_free(user->real_name);
 
765
              g_free(user->icon_file);
 
766
              user->real_name_conflict = FALSE;              
 
767
              //continue;                                     
 
768
            }
 
769
          else
 
770
            {            
 
771
            user = g_new0 (UserData, 1);
 
772
            }
 
773
          // Can't subscribe to the Changed signal on each individual user path
 
774
          // for some reason.
 
775
          dbus_g_proxy_add_signal (proxy,
 
776
                                   "Changed",
 
777
                                   G_TYPE_INVALID);
 
778
 
 
779
          dbus_g_proxy_connect_signal (proxy, "Changed",
 
780
                                       G_CALLBACK(user_changed),
 
781
                                       self,
 
782
                                       NULL);
764
783
          user->uid         = g_value_get_uint64 (g_hash_table_lookup (properties, "Uid"));
765
784
          user->user_name   = g_strdup (g_value_get_string (g_hash_table_lookup (properties, "UserName")));
766
785
          user->real_name   = g_strdup (g_value_get_string (g_hash_table_lookup (properties, "RealName")));
767
786
          user->icon_file    = g_strdup (g_value_get_string (g_hash_table_lookup (properties, "IconFile")));
768
787
          user->real_name_conflict = FALSE;
769
 
                  user->menuitem    = NULL;
 
788
                      user->menuitem    = NULL;
770
789
 
771
790
          g_hash_table_unref (properties);
772
791
 
782
801
}
783
802
 
784
803
static void
 
804
user_changed (DBusGProxy  *proxy,
 
805
              gpointer     user_data)
 
806
{
 
807
  g_debug ("JUST RESYNCED THE USERS FROM A USER CHANGE");
 
808
  UsersServiceDbus *service = (UsersServiceDbus *)user_data;
 
809
  sync_users (service);
 
810
}
 
811
 
 
812
static void
785
813
user_added (DBusGProxy  *proxy,
786
814
            const gchar *user_id,
787
815
            gpointer     user_data)
788
816
{
789
817
  UsersServiceDbus *service = (UsersServiceDbus *)user_data;
790
818
  UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
791
 
 
792
819
  priv->count++;
793
820
 
794
821
  if (priv->count < MAXIMUM_USERS)
795
822
    {
796
823
      sync_users (service);
797
824
    }
 
825
 
 
826
  g_signal_emit (service,
 
827
                 signals[USER_ADDED],
 
828
                 0,
 
829
                 user_id);   
798
830
}
799
831
 
800
832
static void
801
833
user_deleted (DBusGProxy  *proxy,
802
834
              const gchar *user_id,
803
835
              gpointer     user_data)
804
 
{
 
836
{  
805
837
  UsersServiceDbus *service = (UsersServiceDbus *)user_data;
806
838
  UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
807
839
 
808
840
  priv->count--;
809
841
  g_hash_table_remove (priv->users, user_id);
 
842
 
 
843
  g_signal_emit (service,
 
844
                 signals[USER_DELETED],
 
845
                 0,
 
846
                 user_id);   
 
847
  
810
848
}
811
849
 
812
850
UserData *