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

« back to all changes in this revision

Viewing changes to src/update-notifier.c

  • Committer: Michael Vogt
  • Date: 2006-07-27 14:25:33 UTC
  • Revision ID: michael.vogt@ubuntu.com-20060727142533-c660f90ac5c3dab3
* switch the code to use GtkIconTheme and install the icons 
  in a icon-theme friendly way

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
gboolean update_timer_finished(gpointer data);
47
47
static void tray_destroyed_cb(GtkWidget *widget, void *data);
48
48
 
49
 
#define UPDATE_ICON_FILE PACKAGE_DATA_DIR"/pixmaps/update-icon.png"
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
 
#define CRASHREPORT_ICON_FILE PACKAGE_DATA_DIR"/pixmaps/crashreport-icon.png"
53
 
 
54
49
// the time when we check for fam events
55
50
#define TIMEOUT_FAM 1000*5 /* 5 sec */
56
51
 
80
75
 
81
76
 
82
77
gboolean
83
 
trayapplet_create (TrayApplet *un, char *name, char *iconfile)
 
78
trayapplet_create (TrayApplet *un, char *name)
84
79
{
85
80
        //g_print("trayicon_create()\n");
86
81
        GdkPixbuf *pixbuf;
87
82
 
 
83
        GtkIconTheme* icon_theme = gtk_icon_theme_get_default();
 
84
 
88
85
        /* setup widgets */
89
86
        un->tooltip = gtk_tooltips_new ();
90
87
        un->tray_icon = egg_tray_icon_new (name);
97
94
        pixbuf = gtk_image_get_pixbuf (GTK_IMAGE(un->icon));
98
95
        if (pixbuf)
99
96
                g_object_unref (G_OBJECT (pixbuf));
100
 
        pixbuf = gdk_pixbuf_new_from_file (iconfile, NULL);
 
97
        pixbuf = gtk_icon_theme_load_icon (icon_theme, name,
 
98
                                           16, 0,NULL);
101
99
        gtk_image_set_from_pixbuf (GTK_IMAGE (un->icon), pixbuf);
102
100
 
103
101
        /* build container */
312
310
 
313
311
   /* new upates tray icon */
314
312
   un->update = g_new0 (TrayApplet, 1);
315
 
   trayapplet_create(un->update, "update-notifier", UPDATE_ICON_FILE);
 
313
 
 
314
   trayapplet_create(un->update, "updates-notifier");
316
315
   update_tray_icon_init(un->update);
317
316
 
318
317
   /* a destroy signal handler (e.g. when the gnome-panel is restarted */
321
320
 
322
321
   /* update hook icon*/
323
322
   un->hook = g_new0 (TrayApplet, 1);
324
 
   trayapplet_create(un->hook, "hook-notifier", HOOK_ICON_FILE);
 
323
   trayapplet_create(un->hook, "hook-notifier");
325
324
   hook_tray_icon_init(un->hook);
326
325
 
327
326
   /* reboot required icon */
328
327
   un->reboot = g_new0 (TrayApplet, 1);
329
 
   trayapplet_create(un->reboot, "reboot-notifier", REBOOT_ICON_FILE);
 
328
   trayapplet_create(un->reboot, "reboot-notifier");
330
329
   reboot_tray_icon_init(un->reboot);
331
330
 
332
331
   /* crashreport detected icon */
333
332
   un->crashreport = g_new0 (TrayApplet, 1);
334
 
   trayapplet_create(un->crashreport, 
335
 
                     "crashreport-notifier", 
336
 
                     CRASHREPORT_ICON_FILE);
 
333
   trayapplet_create(un->crashreport, "crashreport-notifier");
337
334
   crashreport_tray_icon_init(un->crashreport);
338
335
 
339
336
   return FALSE; // for the tray_destroyed_cb
407
404
        bind_textdomain_codeset(PACKAGE, "UTF-8");
408
405
        textdomain(PACKAGE);
409
406
 
 
407
        g_set_application_name (_("update-notifier"));
 
408
        gtk_window_set_default_icon_name ("update-notifier");
 
409
 
410
410
        //g_print("starting update-notifier\n");
411
411
        
412
412
        // check if we should run at all (see HideAdminTools spec