~ubuntu-branches/ubuntu/lucid/awn-extras-applets/lucid

« back to all changes in this revision

Viewing changes to applets/maintained/notification-area/notification-area.vala

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-03-30 20:26:40 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100330202640-vza3bdnv9gc9bg5z
Tags: 0.4.0~rc1-0ubuntu1
* New upstream release (rc1) (LP: #551309)
 - Stack applet close on click (LP: #261520)
* debian/patches/
 - 03-remove-cairo-menu-pref.patch: From upstream (r1244 + r1245 + r1252),
   remove menu entry for cairo-menu preferences, it's not implemented
   (LP: #511254)
 - 04-tomboy-threading-free.patch: From upstream (r1246), remove threading to
   make the applet working. 
* debian/*.install: Update installation location of comics and digital 
  applets.
* debian/control: 
 - Move digital applet from python to C, and add proper Replaces.
 - Add Replaces for awn-applets-c-core to handle migration from 0.3.2.2.
   (LP: #524559)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
using EggTray;
28
28
using NotificationAreaPrefs;
29
29
 
 
30
static bool gpm_workaround_done = false;
 
31
 
30
32
public class NotificationArea : GLib.Object
31
33
{
32
34
  private const int BORDER = 2;
385
387
      }
386
388
      else
387
389
      {
388
 
        prefs_window.get_dialog ().window.raise ();
 
390
        var dialog = prefs_window.get_dialog ();
 
391
        dialog.present_with_time (event.time);
389
392
      }
390
393
      return true;
391
394
    }
537
540
    }
538
541
  }
539
542
 
540
 
  private void on_icon_added (Widget icon)
 
543
  private void on_icon_added (Widget widget)
541
544
  {
 
545
    unowned EggTray.Child icon = (EggTray.Child)widget;
 
546
 
 
547
    // workaround for https://bugzilla.gnome.org/show_bug.cgi?id=604579
 
548
    if (!gpm_workaround_done && icon.get_title () == "gnome-power-manager")
 
549
    {
 
550
      Timeout.add (2000, workaround_gpm_bug);
 
551
      gpm_workaround_done = true;
 
552
    }
 
553
 
542
554
    icon.set_qdata (this.addition_quark, 1.to_pointer());
543
555
    icon.set_qdata (this.deletion_quark, 0.to_pointer());
544
556
 
545
 
    this.tray_icons.append ((EggTray.Child)icon);
 
557
    this.tray_icons.append (icon);
546
558
 
547
559
    int icon_size = this.get_tray_icon_size ();
548
560
    icon.set_size_request (icon_size, icon_size);
550
562
    this.table_refresh ();
551
563
  }
552
564
 
553
 
  private void on_icon_removed (Widget icon)
 
565
  private void on_icon_removed (Widget widget)
554
566
  {
 
567
    unowned EggTray.Child icon = (EggTray.Child)widget;
555
568
    icon.set_qdata (this.deletion_quark, 1.to_pointer());
556
569
 
557
 
    this.tray_icons.remove ((EggTray.Child)icon);
 
570
    this.tray_icons.remove (icon);
558
571
 
559
572
    this.table_refresh ();
560
573
  }
601
614
}
602
615
 
603
616
// see https://bugzilla.gnome.org/show_bug.cgi?id=604579
604
 
public void workaround_gpm_bug ()
 
617
public bool workaround_gpm_bug ()
605
618
{
606
 
  DBusWatcher watcher = DBusWatcher.get_default ();
607
 
  if (watcher.has_name ("org.gnome.PowerManager"))
608
 
  {
609
 
    string command = "python -c \"" +
610
 
      "import time, gconf;" +
611
 
      "time.sleep(5);" +
612
 
      "c = gconf.Client();" +
613
 
      "key = '/apps/gnome-power-manager/ui/icon_policy';" +
614
 
      "pol = c.get_string(key);" +
615
 
      "c.set_string(key, 'always');" +
616
 
      "c.set_string(key, pol);" +
617
 
      "\"";
618
 
 
619
 
    GLib.Process.spawn_command_line_async (command);
620
 
  }
621
 
  watcher.unref (); // watcher would live on, but we don't want it
 
619
  string command = "python -c \"" +
 
620
    "import gconf;" +
 
621
    "c = gconf.Client();" +
 
622
    "key = '/apps/gnome-power-manager/ui/icon_policy';" +
 
623
    "pol = c.get_string(key);" +
 
624
    "c.set_string(key, 'always');" +
 
625
    "c.set_string(key, pol);" +
 
626
    "\"";
 
627
 
 
628
  GLib.Process.spawn_command_line_async (command);
 
629
 
 
630
  return false;
622
631
}
623
632
 
624
633
public Applet?
649
658
                          (GLib.Callback)NotificationArea.on_visibility_change,
650
659
                          na);
651
660
 
652
 
  workaround_gpm_bug ();
653
 
 
654
661
  return applet;
655
662
}
656
663