~ubuntu-core-dev/update-notifier/ubuntu

« back to all changes in this revision

Viewing changes to src/update.c

  • Committer: Michael Terry
  • Date: 2011-07-13 14:54:42 UTC
  • mto: This revision was merged to the branch mainline in revision 631.
  • Revision ID: michael.terry@canonical.com-20110713145442-4b0pkrbebadn99h6
convert to gsettings

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
   invoke (actions[i][0], _(actions[i][2]), (long)actions[i][3]);
109
109
 
110
110
   UpdateTrayAppletPrivate *priv = (UpdateTrayAppletPrivate*)ta->user_data;
111
 
   gconf_client_set_int(priv->gconf, GCONF_KEY_DEFAULT_ACTION, i, NULL);
112
111
}
113
112
 
114
113
void 
126
125
      UpdateTrayAppletPrivate *priv = (UpdateTrayAppletPrivate*)ta->user_data;
127
126
 
128
127
      gboolean b = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self));
129
 
      gconf_client_set_bool(priv->gconf, GCONF_KEY_NO_UPDATE_NOTIFICATIONS, 
130
 
                            !b,NULL);
 
128
      g_settings_set_boolean(priv->settings,
 
129
                             SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS, !b);
131
130
      
132
131
 
133
132
      NotifyNotification *n = priv->active_notification;
162
161
 
163
162
        menuitem = gtk_check_menu_item_new_with_label(_("Show notifications"));
164
163
        UpdateTrayAppletPrivate *priv = (UpdateTrayAppletPrivate*)ta->user_data;
165
 
        gboolean b = gconf_client_get_bool(priv->gconf,
166
 
                                           GCONF_KEY_NO_UPDATE_NOTIFICATIONS, 
167
 
                                           NULL);
 
164
        gboolean b = g_settings_get_boolean(priv->settings,
 
165
                                            SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS);
168
166
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), !b);
169
167
        gtk_menu_shell_append (GTK_MENU_SHELL (ta->menu), menuitem);
170
168
        g_signal_connect(G_OBJECT(menuitem), "toggled", 
194
192
 
195
193
   // if the user wants auto-launch mode, do not show the icon
196
194
   // the auto launch stuff will do its magic later
197
 
   if(gconf_client_get_bool(priv->gconf, GCONF_KEY_AUTO_LAUNCH, NULL))
 
195
   if(g_settings_get_boolean(priv->settings, SETTINGS_KEY_AUTO_LAUNCH))
198
196
      return;
199
197
 
200
198
   if(is_running) {
525
523
#endif
526
524
 
527
525
   // when checking for regular updates honor the 
528
 
   // regular_auto_launch_interval
529
 
   interval_days = gconf_client_get_int(priv->gconf,
530
 
                                        GCONF_KEY_AUTO_LAUNCH_INTERVAL, 
531
 
                                        NULL);
532
 
   g_debug_update ("interval_days from gconf: %i\n", interval_days);
 
526
   // regular-auto-launch-interval
 
527
   interval_days = g_settings_get_int(priv->settings,
 
528
                                        SETTINGS_KEY_AUTO_LAUNCH_INTERVAL);
 
529
   g_debug_update ("interval_days: %i\n", interval_days);
533
530
 
534
531
   if (interval_days <= 0) 
535
532
      return TRUE;
536
533
 
537
534
   // check last launch time 
538
 
   last_launch = gconf_client_get_int(priv->gconf,
539
 
                                      GCONF_KEY_LAST_LAUNCH,
540
 
                                      NULL);
541
 
   g_debug_update ("last_launch from gconf: %i (%s)\n", last_launch, ctime(&last_launch));
 
535
   GSettings *um_settings = g_settings_new(SETTINGS_UM_SCHEMA);
 
536
   last_launch = g_settings_get_int(um_settings,
 
537
                                    SETTINGS_UM_KEY_LAST_LAUNCH);
 
538
   g_debug_update ("last_launch: %i (%s)\n", last_launch, ctime(&last_launch));
 
539
   g_object_unref(um_settings);
542
540
 
543
541
   time_t now = time(NULL);
544
542
   if (auto_launch_security_now(priv, now, last_launch))
660
658
 
661
659
   // check if the user wants to see the icon or launch
662
660
   // the default action
663
 
   if(gconf_client_get_bool(priv->gconf,
664
 
                            GCONF_KEY_AUTO_LAUNCH, NULL)) 
 
661
   if(g_settings_get_boolean(priv->settings, SETTINGS_KEY_AUTO_LAUNCH))
665
662
   {
666
663
      gtk_status_icon_set_visible(ta->tray_icon, FALSE);
667
664
      if (auto_launch_now(priv)) 
680
677
   gtk_status_icon_set_visible(ta->tray_icon, TRUE);
681
678
   
682
679
   // the user does not no notification messages
683
 
   if(gconf_client_get_bool(priv->gconf,
684
 
                            GCONF_KEY_NO_UPDATE_NOTIFICATIONS, NULL))
 
680
   if(g_settings_get_boolean(priv->settings,
 
681
                             SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS))
685
682
      return TRUE;
686
683
 
687
684
   // show the notification with some delay. otherwise on a login
697
694
{
698
695
   // create the private data struct
699
696
   UpdateTrayAppletPrivate *priv = g_new0(UpdateTrayAppletPrivate, 1);
700
 
   priv->gconf = gconf_client_get_default();
 
697
   priv->settings = g_settings_new(SETTINGS_SCHEMA);
701
698
   priv->apt_is_running = FALSE;
702
699
   priv->active_notification = NULL;
703
700
   ta->user_data = priv;