// Icons
Gdk.Pixbuf icon_connecting;
Gdk.Pixbuf icon_connected;
+ Gtk.Image icon_enabled;
+ Gtk.Image icon_disabled;
// ConIc, GConf and Osso context
Osso.Context osso;
* Update status area icon and status menu button value
*/
private void update_status () {
- Gtk.IconTheme icon_theme;
- Gdk.Pixbuf pixbuf;
-
if (tor_enabled && tor_connected && icon_connected == null) try {
- icon_theme = Gtk.IconTheme.get_default ();
- pixbuf = icon_theme.load_icon ("statusarea_tor_connected",
- STATUS_AREA_ICON_SIZE,
- Gtk.IconLookupFlags.NO_SVG);
+ var icon_theme = Gtk.IconTheme.get_default ();
+ var pixbuf = icon_theme.load_icon ("statusarea_tor_connected",
+ STATUS_AREA_ICON_SIZE,
+ Gtk.IconLookupFlags.NO_SVG);
icon_connected = pixbuf;
} catch (Error e) {
error (e.message);
}
if (tor_enabled && !tor_connected && icon_connecting == null) try {
- icon_theme = Gtk.IconTheme.get_default ();
- pixbuf = icon_theme.load_icon ("statusarea_tor_connecting",
- STATUS_AREA_ICON_SIZE,
- Gtk.IconLookupFlags.NO_SVG);
+ var icon_theme = Gtk.IconTheme.get_default ();
+ var pixbuf = icon_theme.load_icon ("statusarea_tor_connecting",
+ STATUS_AREA_ICON_SIZE,
+ Gtk.IconLookupFlags.NO_SVG);
icon_connecting = pixbuf;
} catch (Error e) {
error (e.message);
}
+ if (tor_enabled && icon_enabled == null) try {
+ var icon_theme = Gtk.IconTheme.get_default();
+ var pixbuf = icon_theme.load_icon ("statusarea_tor_enabled",
+ STATUS_MENU_ICON_SIZE,
+ Gtk.IconLookupFlags.NO_SVG);
+ icon_enabled = new Gtk.Image.from_pixbuf (pixbuf);
+ } catch (Error e) {
+ error (e.message);
+ }
+ if (!tor_enabled && icon_disabled == null) try {
+ var icon_theme = Gtk.IconTheme.get_default();
+ var pixbuf = icon_theme.load_icon ("statusarea_tor_disabled",
+ STATUS_MENU_ICON_SIZE,
+ Gtk.IconLookupFlags.NO_SVG);
+ icon_disabled = new Gtk.Image.from_pixbuf (pixbuf);
+ } catch (Error e) {
+ error (e.message);
+ }
if (conic_connected && tor_enabled) {
- pixbuf = tor_connected ? icon_connected : icon_connecting;
+ set_status_area_icon (tor_connected ? icon_connected : icon_connecting);
button.set_value (tor_connected ? _("Connected") : _("Connecting ..."));
} else {
- pixbuf = null;
+ set_status_area_icon (null);
button.set_value (tor_enabled ? _("Disconnected") : _("Disabled"));
}
- set_status_area_icon (pixbuf);
+ button.set_image (tor_enabled ? icon_enabled : icon_disabled);
}
/**
}
private void create_widgets () {
- Gtk.IconTheme icon_theme;
- Gdk.Pixbuf pixbuf;
- Gtk.Image image;
-
// Status menu button
button = new Hildon.Button.with_text (Hildon.SizeType.FINGER_HEIGHT,
Hildon.ButtonArrangement.VERTICAL,
_("The Onion Router"),
tor_enabled ? _("Enabled") : _("Disabled"));
- icon_theme = Gtk.IconTheme.get_default();
- try {
- pixbuf = icon_theme.load_icon ("tor_onion",
- STATUS_MENU_ICON_SIZE,
- Gtk.IconLookupFlags.NO_SVG);
- image = new Gtk.Image.from_pixbuf (pixbuf);
- button.set_image (image);
- } catch (Error e) {
- error (e.message);
- }
button.set_alignment (0.0f, 0.5f, 1.0f, 1.0f);
button.set_style (Hildon.ButtonStyle.PICKER);
button.clicked.connect (button_clicked_cb);