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

« back to all changes in this revision

Viewing changes to src/update-notifier.c

  • Committer: mvo
  • Date: 2006-01-26 23:07:09 UTC
  • Revision ID: gustavo@niemeyer.net-20060126230709-7f3bc6c7cb03368e
* merged the changes from scott

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <limits.h>
32
32
#include <gtk/gtk.h>
33
33
#include <glade/glade.h>
34
 
#include <libgnome/gnome-desktop-item.h>
35
34
#include <libgnomevfs/gnome-vfs.h>
36
35
#include <libgnomevfs/gnome-vfs-utils.h>
37
36
#include <libgnomevfs/gnome-vfs-monitor.h>
49
48
 
50
49
#define UPDATE_ICON_FILE PACKAGE_DATA_DIR"/pixmaps/update-icon.png"
51
50
#define HOOK_ICON_FILE PACKAGE_DATA_DIR"/pixmaps/hook-notifier.png"
 
51
#define REBOOT_ICON_FILE PACKAGE_DATA_DIR"/pixmaps/reboot-icon.png"
52
52
 
53
53
// the time when we check for fam events
54
54
#define TIMEOUT_FAM 1000*5 /* 5 sec */
134
134
   gboolean dpkg_was_run = FALSE;
135
135
   gboolean apt_get_update_runing  = FALSE;
136
136
   gboolean new_update_hook = FALSE;
 
137
   gboolean reboot_required = FALSE;
137
138
   static gboolean hook_pending = FALSE;
138
139
   static time_t last_apt_action = 0;
139
140
   static guint hook_timer = 0; 
166
167
   if(strstr(info_uri, "/var/lib/update-notifier/dpkg-run-stamp")) {
167
168
      dpkg_was_run = TRUE;
168
169
   } 
 
170
   if(strstr(info_uri, REBOOT_FILE)) {
 
171
      reboot_required = TRUE;
 
172
   }
169
173
   if(strstr(info_uri, HOOKS_DIR)) {
170
174
      g_print("new hook!\n");
171
175
      new_update_hook = TRUE;
281
285
         last_apt_action = 0;
282
286
      }
283
287
   }
 
288
      
 
289
   if (reboot_required)
 
290
      reboot_check (un->reboot);
 
291
      
 
292
 
284
293
}
285
294
 
286
295
gboolean 
337
346
                               GNOME_VFS_MONITOR_FILE,
338
347
                               monitor_cb,
339
348
                               un);
 
349
   res = gnome_vfs_monitor_add(&monitor_handle,
 
350
                               "/var/run/reboot-required", 
 
351
                               GNOME_VFS_MONITOR_FILE,
 
352
                               monitor_cb,
 
353
                               un);
340
354
 
341
355
   g_timeout_add (TIMEOUT_FAM, (GSourceFunc)file_monitor_periodic_check, un);
342
356
 
422
436
        un->hook = g_new0 (TrayApplet, 1);
423
437
        trayapplet_create(un->hook, "hook-notifier", HOOK_ICON_FILE);
424
438
        hook_tray_icon_init(un->hook);
425
 
        
 
439
 
 
440
        /* reboot required icon */
 
441
        un->reboot = g_new0 (TrayApplet, 1);
 
442
        trayapplet_create(un->reboot, "reboot-notifier", REBOOT_ICON_FILE);
 
443
        reboot_tray_icon_init(un->reboot);
 
444
 
426
445
        return FALSE; // for the tray_destroyed_cb
427
446
}
428
447