aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-09-23 13:03:11 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-09-23 13:03:11 -0400
commit56dd8ea486d13905bf24ea28a59d48e1c30130d9 (patch)
tree5291ede4f9d3a89d2c89b82406cdfff835fda780
parent3751cc4b823c5d701456317bb86fc4fc39bf3b9e (diff)
parenta93ea524812af4e44481280e0baba8eafde6bc83 (diff)
downloadayatana-indicator-power-56dd8ea486d13905bf24ea28a59d48e1c30130d9.tar.gz
ayatana-indicator-power-56dd8ea486d13905bf24ea28a59d48e1c30130d9.tar.bz2
ayatana-indicator-power-56dd8ea486d13905bf24ea28a59d48e1c30130d9.zip
Import upstream version 0.9
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog78
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in6
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--data/com.canonical.indicator.power.gschema.xml (renamed from data/org.ubuntu.indicator-power.gschema.xml)4
-rw-r--r--data/com.canonical.indicator.power.gschema.xml.in9
-rw-r--r--src/indicator-power.c124
9 files changed, 199 insertions, 49 deletions
diff --git a/AUTHORS b/AUTHORS
index 54bcfd2..13bc049 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,5 +1,6 @@
# Generated by Makefile. Do not edit.
+ Gabor Kelemen
Javier Jardon
Javier Jardón
Ken VanDine
diff --git a/ChangeLog b/ChangeLog
index 31c25ae..d288e95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,83 @@
# Generated by Makefile. Do not edit.
+2011-09-23 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ 0.9
+
+2011-09-21 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Do not activate g-s-d, but just watch dbus for g-s-d to appear
+
+ Fixes https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/854717
+
+2011-09-14 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Do not show (charged) in menu title when fully charged
+
+ Fixes https://bugs.launchpad.net/ubuntu/+source/indicator-power/+bug/850011
+
+2011-09-12 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ 0.8
+
+2011-09-12 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Fix a gap in the indicators region when the power indicator is not show
+
+ This fixes https://bugs.launchpad.net/indicator-power/+bug/842188
+
+2011-09-12 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Use the same icon for all charge levels if we are in the charging status
+
+ From the designers (see bug comments):
+ "I think the shading inside the battery when charging is obscuring the
+ lightning bolt, and also giving the icon a visual style that is obviously
+ different from the text and discourages "reading" it together with the text.
+ So, I suggest leaving the brackets in place, but removing the shading from
+ the icon.
+
+ Fixes https://bugs.launchpad.net/indicator-power/+bug/824629
+
+2011-09-11 Gabor Kelemen <kelemeng@gnome.hu>
+
+ Use correct dgettext and g_dngettext calls. LP: #846895
+
+2011-09-11 Gabor Kelemen <kelemeng@gnome.hu>
+
+ Use correct dgettext and g_dngettext calls. LP: #846895
+
+2011-09-08 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Handle the case with broken batteries
+
+ The remining time is not reported with is more than 100h. This generally
+ means that our battery is broken (never reach a fully charged status)
+
+2011-09-07 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ indicator-power.c: Add padding between the icon and the text in the menu items
+
+2011-08-25 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Use consistent location for gsettings schema
+
+ Use the same location as indicator-datetime
+
+2011-08-24 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Fix a memory leak
+
+ Fixes https://bugs.launchpad.net/ubuntu/+source/indicator-power/+bug/779185
+
+2011-08-23 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Makefile.am: fix typo to include .gschema.xml.in to the dist
+
+2011-08-23 Javier Jardón <javier.jardon@codethink.co.uk>
+
+ Fix typo in the gsettings schema: show_time -> show-time
+
2011-08-23 Javier Jardón <javier.jardon@codethink.co.uk>
Release 0.7
diff --git a/Makefile.am b/Makefile.am
index 8ae7e6d..0d4d34b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = po
-gsettings_in_file = data/org.ubuntu.indicator-power.gschema.xml.in
+gsettings_in_file = data/com.canonical.indicator.power.gschema.xml.in
gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
@INTLTOOL_XML_NOMERGE_RULE@
@@ -35,7 +35,7 @@ dist_noinst_SCRIPTS = \
autogen.sh
dist_noinst_DATA = \
- data/org.ubuntu.indicator-power.gschema.xml
+ data/com.canonical.indicator.power.gschema.xml \
$(gsettings_in_file)
CLEANFILES = \
diff --git a/Makefile.in b/Makefile.in
index 7818e41..9c1d3f8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -332,7 +332,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = po
-gsettings_in_file = data/org.ubuntu.indicator-power.gschema.xml.in
+gsettings_in_file = data/com.canonical.indicator.power.gschema.xml.in
gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
###################
@@ -363,7 +363,8 @@ dist_noinst_SCRIPTS = \
autogen.sh
dist_noinst_DATA = \
- data/org.ubuntu.indicator-power.gschema.xml
+ data/com.canonical.indicator.power.gschema.xml \
+ $(gsettings_in_file)
CLEANFILES = \
$(gsettings_SCHEMAS)
@@ -975,7 +976,6 @@ uninstall-am: uninstall-powerlibLTLIBRARIES
@INTLTOOL_XML_NOMERGE_RULE@
@GSETTINGS_RULES@
- $(gsettings_in_file)
############################################################
diff --git a/configure b/configure
index 913aaaa..e371315 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for indicator-power 0.7.
+# Generated by GNU Autoconf 2.68 for indicator-power 0.9.
#
# Report bugs to <http://bugs.launchpad.net/indicator-power>.
#
@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-power'
PACKAGE_TARNAME='indicator-power'
-PACKAGE_VERSION='0.7'
-PACKAGE_STRING='indicator-power 0.7'
+PACKAGE_VERSION='0.9'
+PACKAGE_STRING='indicator-power 0.9'
PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-power'
PACKAGE_URL='http://launchpad.net/indicator-power'
@@ -1367,7 +1367,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-power 0.7 to adapt to many kinds of systems.
+\`configure' configures indicator-power 0.9 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1437,7 +1437,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-power 0.7:";;
+ short | recursive ) echo "Configuration of indicator-power 0.9:";;
esac
cat <<\_ACEOF
@@ -1568,7 +1568,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-power configure 0.7
+indicator-power configure 0.9
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1846,7 +1846,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-power $as_me 0.7, which was
+It was created by indicator-power $as_me 0.9, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2670,7 +2670,7 @@ fi
# Define the identity of the package.
PACKAGE='indicator-power'
- VERSION='0.7'
+ VERSION='0.9'
cat >>confdefs.h <<_ACEOF
@@ -15119,7 +15119,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-power $as_me 0.7, which was
+This file was extended by indicator-power $as_me 0.9, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15186,7 +15186,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-power config.status 0.7
+indicator-power config.status 0.9
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 8cdded6..4176d1f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([indicator-power],
- [0.7],
+ [0.9],
[http://bugs.launchpad.net/indicator-power],
[indicator-power],
[http://launchpad.net/indicator-power])
diff --git a/data/org.ubuntu.indicator-power.gschema.xml b/data/com.canonical.indicator.power.gschema.xml
index a3d2494..1a51f69 100644
--- a/data/org.ubuntu.indicator-power.gschema.xml
+++ b/data/com.canonical.indicator.power.gschema.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
- <schema path="/org/ubuntu/indicator-power/" id="org.ubuntu.indicator-power" gettext-domain="@GETTEXT_PACKAGE@">
- <key type="b" name="show-label">
+ <schema path="/com/canonical/indicator/power/" id="com.canonical.indicator.power" gettext-domain="@GETTEXT_PACKAGE@">
+ <key type="b" name="show-time">
<default>false</default>
<summary>Show time in Menu Bar</summary>
<description>Whether show the time in the menu bar.</description>
diff --git a/data/com.canonical.indicator.power.gschema.xml.in b/data/com.canonical.indicator.power.gschema.xml.in
new file mode 100644
index 0000000..bf4368f
--- /dev/null
+++ b/data/com.canonical.indicator.power.gschema.xml.in
@@ -0,0 +1,9 @@
+<schemalist>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="com.canonical.indicator.power" path="/com/canonical/indicator/power/">
+ <key name="show-time" type="b">
+ <default>false</default>
+ <_summary>Show time in Menu Bar</_summary>
+ <_description>Whether show the time in the menu bar.</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 7f9e479..275e871 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -79,6 +79,7 @@ struct _IndicatorPowerPrivate
GCancellable *proxy_cancel;
GDBusProxy *proxy;
+ guint watcher_id;
GVariant *devices;
GVariant *device;
@@ -183,7 +184,7 @@ get_timestring (guint64 time_secs,
if (minutes < 60)
{
*short_timestring = g_strdup_printf ("0:%.2i", minutes);
- *detailed_timestring = g_strdup_printf (ngettext ("%i minute",
+ *detailed_timestring = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%i minute",
"%i minutes",
minutes), minutes);
return;
@@ -196,7 +197,7 @@ get_timestring (guint64 time_secs,
if (minutes == 0)
{
- *detailed_timestring = g_strdup_printf (ngettext (
+ *detailed_timestring = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
"%i hour",
"%i hours",
hours), hours);
@@ -206,8 +207,8 @@ get_timestring (guint64 time_secs,
/* TRANSLATOR: "%i %s %i %s" are "%i hours %i minutes"
* Swap order with "%2$s %2$i %1$s %1$i if needed */
*detailed_timestring = g_strdup_printf (_("%i %s %i %s"),
- hours, ngettext ("hour", "hours", hours),
- minutes, ngettext ("minute", "minutes", minutes));
+ hours, g_dngettext (GETTEXT_PACKAGE, "hour", "hours", hours),
+ minutes, g_dngettext (GETTEXT_PACKAGE, "minute", "minutes", minutes));
}
}
@@ -219,47 +220,47 @@ device_kind_to_localised_string (UpDeviceKind kind)
switch (kind) {
case UP_DEVICE_KIND_LINE_POWER:
/* TRANSLATORS: system power cord */
- text = gettext ("AC adapter");
+ text = _("AC adapter");
break;
case UP_DEVICE_KIND_BATTERY:
/* TRANSLATORS: laptop primary battery */
- text = gettext ("Battery");
+ text = _("Battery");
break;
case UP_DEVICE_KIND_UPS:
/* TRANSLATORS: battery-backed AC power source */
- text = gettext ("UPS");
+ text = _("UPS");
break;
case UP_DEVICE_KIND_MONITOR:
/* TRANSLATORS: a monitor is a device to measure voltage and current */
- text = gettext ("Monitor");
+ text = _("Monitor");
break;
case UP_DEVICE_KIND_MOUSE:
/* TRANSLATORS: wireless mice with internal batteries */
- text = gettext ("Mouse");
+ text = _("Mouse");
break;
case UP_DEVICE_KIND_KEYBOARD:
/* TRANSLATORS: wireless keyboard with internal battery */
- text = gettext ("Keyboard");
+ text = _("Keyboard");
break;
case UP_DEVICE_KIND_PDA:
/* TRANSLATORS: portable device */
- text = gettext ("PDA");
+ text = _("PDA");
break;
case UP_DEVICE_KIND_PHONE:
/* TRANSLATORS: cell phone (mobile...) */
- text = gettext ("Cell phone");
+ text = _("Cell phone");
break;
case UP_DEVICE_KIND_MEDIA_PLAYER:
/* TRANSLATORS: media player, mp3 etc */
- text = gettext ("Media player");
+ text = _("Media player");
break;
case UP_DEVICE_KIND_TABLET:
/* TRANSLATORS: tablet device */
- text = gettext ("Tablet");
+ text = _("Tablet");
break;
case UP_DEVICE_KIND_COMPUTER:
/* TRANSLATORS: tablet device */
- text = gettext ("Computer");
+ text = _("Computer");
break;
default:
g_warning ("enum unrecognised: %i", kind);
@@ -324,7 +325,7 @@ build_device_time_details (const gchar *device_name,
{
*details = g_strdup_printf (_("%s (charged)"), device_name);
*accesible_name = g_strdup (*details);
- *short_details = g_strdup (_("(charged)"));
+ *short_details = g_strdup ("");
}
else if (percentage > 0)
{
@@ -359,6 +360,41 @@ set_accessible_desc (IndicatorPower *self,
priv->accessible_desc = g_strdup (desc);
}
+static GIcon*
+get_device_icon (UpDeviceKind kind,
+ UpDeviceState state,
+ gchar *device_icon)
+{
+ GIcon *gicon;
+
+ if (kind == UP_DEVICE_KIND_BATTERY &&
+ state == UP_DEVICE_STATE_CHARGING)
+ {
+ GString *filename;
+ gchar **iconnames;
+ const gchar *kind_str;
+
+ kind_str = up_device_kind_to_string (kind);
+ filename = g_string_new (NULL);
+ g_string_append_printf (filename, "battery-caution-charging-symbolic;");
+ g_string_append_printf (filename, "gpm-%s-000-charging;", kind_str);
+ g_string_append_printf (filename, "battery-caution-charging;");
+
+ iconnames = g_strsplit (filename->str, ";", -1);
+ gicon = g_themed_icon_new_from_names (iconnames, -1);
+
+ g_strfreev (iconnames);
+ g_string_free (filename, TRUE);
+ }
+ else
+ {
+ gicon = g_icon_new_for_string (device_icon, NULL);
+ }
+
+ return gicon;
+}
+
+
static void
menu_add_device (GtkMenu *menu,
GVariant *device)
@@ -397,7 +433,7 @@ menu_add_device (GtkMenu *menu,
g_debug ("%s: got data from object %s", G_STRFUNC, object_path);
/* Process the data */
- device_gicons = g_icon_new_for_string (device_icon, NULL);
+ device_gicons = get_device_icon (kind, state, device_icon);
icon = gtk_image_new_from_gicon (device_gicons,
GTK_ICON_SIZE_SMALL_TOOLBAR);
@@ -409,7 +445,7 @@ menu_add_device (GtkMenu *menu,
item = gtk_image_menu_item_new ();
grid = gtk_grid_new ();
- gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
gtk_grid_attach (GTK_GRID (grid), icon, 0, 0, 1, 1);
details_label = gtk_label_new (details);
gtk_grid_attach_next_to (GTK_GRID (grid), details_label, icon, GTK_POS_RIGHT, 1, 1);
@@ -496,7 +532,7 @@ build_menu (IndicatorPower *self)
gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
/* preferences */
- item = gtk_image_menu_item_new_with_mnemonic (_("Power Settings..."));
+ item = gtk_image_menu_item_new_with_label (_("Power Settings..."));
image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
@@ -533,6 +569,7 @@ get_primary_device (GVariant *devices)
for (i = 0; i < n_devices; i++)
{
+ time = 0;
device = g_variant_get_child_value (devices, i);
g_variant_get (device,
"(susdut)",
@@ -561,6 +598,10 @@ get_primary_device (GVariant *devices)
else if (state == UP_DEVICE_STATE_CHARGING)
{
charging = TRUE;
+ if (time == 0) /* Battery broken */
+ {
+ primary_device_charging = device;
+ }
if (time > max_charging_time)
{
max_charging_time = time;
@@ -618,7 +659,7 @@ put_primary_device (IndicatorPower *self,
g_debug ("%s: got data from object %s", G_STRFUNC, object_path);
/* set icon */
- device_gicons = g_icon_new_for_string (device_icon, NULL);
+ device_gicons = get_device_icon (kind, state, device_icon);
gtk_image_set_from_gicon (priv->status_image,
device_gicons,
GTK_ICON_SIZE_LARGE_TOOLBAR);
@@ -661,6 +702,7 @@ get_devices_cb (GObject *source_object,
return;
}
priv->devices = g_variant_get_child_value (devices_container, 0);
+ g_variant_unref (devices_container);
priv->device = get_primary_device (priv->devices);
if (priv->device == NULL)
@@ -742,6 +784,28 @@ service_proxy_cb (GObject *object,
}
static void
+gsd_appeared_callback (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
+{
+ IndicatorPower *self = INDICATOR_POWER (user_data);
+ IndicatorPowerPrivate *priv = self->priv;
+
+ priv->proxy_cancel = g_cancellable_new ();
+
+ g_dbus_proxy_new (connection,
+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+ NULL,
+ name,
+ POWER_DBUS_PATH,
+ POWER_DBUS_INTERFACE,
+ priv->proxy_cancel,
+ service_proxy_cb,
+ self);
+}
+
+static void
indicator_power_init (IndicatorPower *self)
{
IndicatorPowerPrivate *priv;
@@ -755,20 +819,17 @@ indicator_power_init (IndicatorPower *self)
priv->menu = NULL;
priv->accessible_desc = NULL;
- priv->proxy_cancel = g_cancellable_new();
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- DBUS_SERVICE,
- POWER_DBUS_PATH,
- POWER_DBUS_INTERFACE,
- priv->proxy_cancel,
- service_proxy_cb,
- self);
+ priv->watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
+ DBUS_SERVICE,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ gsd_appeared_callback,
+ NULL,
+ self,
+ NULL);
/* GSettings */
- priv->settings = g_settings_new ("org.ubuntu.indicator-power");
+ priv->settings = g_settings_new ("com.canonical.indicator.power");
}
static void
@@ -798,6 +859,7 @@ get_label (IndicatorObject *io)
{
/* Create the label if it doesn't exist already */
priv->label = GTK_LABEL (gtk_label_new (""));
+ gtk_widget_set_visible (GTK_WIDGET (priv->label), FALSE);
}
return priv->label;