--- /dev/null
+
+
+GETTEXT_PACKAGE = status-area-displayblanking-applet
+PACKAGE = status-area-displayblanking-applet
+
+SHELL = /bin/sh
+
+prefix = /usr
+DATADIRNAME = share
+itlocaledir = $(prefix)/$(DATADIRNAME)/locale
+
+INSTALL = install -c
+INSTALL_DATA = ${INSTALL} -m 644
+
+GMSGFMT = msgfmt
+MSGFMT = msgfmt
+XGETTEXT = xgettext
+MSGMERGE = msgmerge
+
+PO_LINGUAS= es_AR
+
+USE_LINGUAS= es_AR
+
+POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
+
+DISTFILES = Makefile POTFILES.in $(POFILES)
+EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS
+
+POTFILES = ../src/lib-display-blanking-status-menu-widget.c
+# This comment gets stripped out
+
+CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
+
+.SUFFIXES:
+.SUFFIXES: .po .gmo .mo
+
+.po.mo:
+ $(MSGFMT) -o $@ $<
+
+.po.gmo:
+ file=`echo $* | sed 's,.*/,,'`.gmo \
+ && rm -f $$file && $(GMSGFMT) -o $$file $<
+
+all: compile
+
+compile: $(CATALOGS)
+
+$(GETTEXT_PACKAGE).pot: $(POTFILES)
+ $(XGETTEXT) --package-name=$(PACKAGE) -o $(GETTEXT_PACKAGE).pot $(POTFILES)
+
+install: all
+ @linguas="$(USE_LINGUAS)"; \
+ for lang in $$linguas; do \
+ dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
+ mkdir -p $$dir; \
+ if test -r $$lang.gmo; then \
+ $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
+ echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
+ fi; \
+ done
+
+clean:
+ rm -f *.mo *.gmo
+
+update-po:
+ $(MAKE) $(GETTEXT_PACKAGE).pot
+ @linguas="$(USE_LINGUAS)"; \
+ for lang in $$linguas; do \
+ echo "$$lang:"; \
+ if test -r $$lang.po; then \
+ $(MSGMERGE) -U $$lang.po $(GETTEXT_PACKAGE).pot; \
+ else \
+ cp $(GETTEXT_PACKAGE).pot $$lang.po; \
+ fi; \
+ done
+
--- /dev/null
+# .pot file for display blanking applet.
+# Copyright (C) 2012
+# This file is distributed under the same license as the status-area-displayblanking-applet package.
+# Leandro Lucarella <luca@llucax.com.ar>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: status-area-displayblanking-applet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-10 03:19+0200\n"
+"PO-Revision-Date: 2012-07-10 02:14+0200\n"
+"Last-Translator: Leandro Lucarella <luca@llucax.com.ar>\n"
+"Language-Team: Leandro Lucarella <luca@llucax.com.ar>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/lib-display-blanking-status-menu-widget.c:45
+msgid "Enabled"
+msgstr "Activado"
+
+#: ../src/lib-display-blanking-status-menu-widget.c:46
+msgid "Only on battery"
+msgstr "Sólo con batería"
+
+#: ../src/lib-display-blanking-status-menu-widget.c:47
+msgid "Blanking only on battery"
+msgstr "Apagar sólo con batería"
+
+#: ../src/lib-display-blanking-status-menu-widget.c:48
+msgid "Disabled"
+msgstr "Desactivado"
+
+#: ../src/lib-display-blanking-status-menu-widget.c:49
+msgid "Only dimming"
+msgstr "Sólo ahorro de energía"
+
+#: ../src/lib-display-blanking-status-menu-widget.c:95
+msgid "Changed display blanking mode to: %s"
+msgstr "Modo de apagado de pantalla cambiado a: %s"
+
+#: ../src/lib-display-blanking-status-menu-widget.c:117
+msgid "Display blanking mode"
+msgstr "Apagado de pantalla"
--- /dev/null
+ /***********************************************************************************
+ * Display blanking status area plugin
+ * Copyright (C) 2012 Leandro Lucarella
+ * Based on status-area-orientationlock-applet by Mohammad Abu-Garbeyyeh.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ ***********************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libintl.h>
+#include <gtk/gtk.h>
+#include <hildon/hildon.h>
+#include <libhildondesktop/libhildondesktop.h>
+#include <gconf/gconf-client.h>
+
+
+#define TYPE_DISPLAY_BLANKING_STATUS_PLUGIN (display_blanking_status_plugin_get_type ())
+
+#define DISPLAY_BLANKING_STATUS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ TYPE_DISPLAY_BLANKING_STATUS_PLUGIN, DisplayBlankingStatusPlugin))
+
+#define DISPLAY_BLANKING_STATUS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ TYPE_DISPLAY_BLANKING_STATUS_PLUGIN, DisplayBlankingStatusPluginClass))
+
+#define IS_DISPLAY_BLANKING_STATUS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ TYPE_DISPLAY_BLANKING_STATUS_PLUGIN))
+
+#define IS_DISPLAY_BLANKING_STATUS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ TYPE_DISPLAY_BLANKING_STATUS_PLUGIN))
+
+#define DISPLAY_BLANKING_STATUS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ TYPE_DISPLAY_BLANKING_STATUS_PLUGIN, DisplayBlankingStatusPluginClass))
+
+#define STATUS_AREA_DISPLAY_BLANKING_ICON_SIZE 18
+
+typedef struct _DisplayBlankingStatusPlugin DisplayBlankingStatusPlugin;
+typedef struct _DisplayBlankingStatusPluginClass DisplayBlankingStatusPluginClass;
+typedef struct _DisplayBlankingStatusPluginPrivate DisplayBlankingStatusPluginPrivate;
+
+struct _DisplayBlankingStatusPlugin
+{
+ HDStatusMenuItem parent;
+
+ DisplayBlankingStatusPluginPrivate *priv;
+};
+
+struct _DisplayBlankingStatusPluginClass
+{
+ HDStatusMenuItemClass parent;
+};
+
+GType display_blanking_status_plugin_get_type (void);
+
+#define DISPLAY_BLANKING_STATUS_PLUGIN_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE (obj, \
+ TYPE_DISPLAY_BLANKING_STATUS_PLUGIN, \
+ DisplayBlankingStatusPluginPrivate))
+
+#define GCONF_KEY_DISPLAY_BLANKING "/system/osso/dsm/display/inhibit_blank_mode"
+
+// Shoud contain one, and only one "%d"
+#define DISPLAY_BLANKING_ICON_TEMPLATE "display-blanking-icon.%d"
+
+#define GETTEXT_DOM "status-area-displayblanking-applet"
+#define gettext_noop(str) (str)
+
+#define DISPLAY_BLANKING_MODES 5
+static const char *_DisplayBlankingDescription[DISPLAY_BLANKING_MODES] =
+{
+ gettext_noop ("Both enabled"),
+ gettext_noop ("Both only on battery"),
+ gettext_noop ("Blanking only on battery"),
+ gettext_noop ("Both disabled"),
+ gettext_noop ("Only dimming")
+};
+
+struct _DisplayBlankingStatusPluginPrivate
+{
+ GtkWidget *button;
+ GConfClient *gconf_client;
+ gpointer data;
+};
+
+HD_DEFINE_PLUGIN_MODULE (DisplayBlankingStatusPlugin,
+ display_blanking_status_plugin, HD_TYPE_STATUS_MENU_ITEM);
+
+static void
+display_blanking_status_plugin_class_finalize (
+ DisplayBlankingStatusPluginClass *klass)
+{
+}
+
+static void
+display_blanking_status_plugin_class_init (DisplayBlankingStatusPluginClass *c)
+{
+ g_type_class_add_private (c, sizeof (DisplayBlankingStatusPluginPrivate));
+}
+
+static void
+display_blanking_status_plugin_mode_set (DisplayBlankingStatusPluginPrivate *priv,
+ gboolean update)
+{
+ // Should be enough if DISPLAY_BLANKING_MODES stays in 1 digit, "%d"
+ // provides space for that digit and '\0'
+ static char icon_name[sizeof (DISPLAY_BLANKING_ICON_TEMPLATE)];
+
+ // Get the mode to set
+ gint mode = gconf_client_get_int (priv->gconf_client,
+ GCONF_KEY_DISPLAY_BLANKING, NULL);
+ if (update)
+ mode = (mode + 1) % DISPLAY_BLANKING_MODES;
+
+ // Toggle display blanking
+ gconf_client_set_int (priv->gconf_client, GCONF_KEY_DISPLAY_BLANKING,
+ mode, NULL);
+
+ // Update button text and status bar icon
+ hildon_button_set_value (HILDON_BUTTON (priv->button),
+ dgettext (GETTEXT_DOM, _DisplayBlankingDescription[mode]));
+ int r = snprintf (icon_name, sizeof (icon_name),
+ DISPLAY_BLANKING_ICON_TEMPLATE, mode);
+ g_assert(r < sizeof (icon_name)); // otherwise it was truncated
+ GtkWidget *icon = gtk_image_new_from_icon_name (icon_name,
+ GTK_ICON_SIZE_DIALOG);
+ hildon_button_set_image (HILDON_BUTTON (priv->button), icon);
+
+ // Show a notification banner (only if updating)
+ if (update) {
+ GtkWidget *banner = hildon_banner_show_informationf (priv->button, NULL,
+ dgettext (GETTEXT_DOM, "Changed display blanking mode to: %s"),
+ _DisplayBlankingDescription[mode]);
+ hildon_banner_set_timeout (HILDON_BANNER (banner), 5000);
+ }
+}
+
+static void
+display_blanking_status_plugin_on_button_clicked (GtkWidget *button,
+ DisplayBlankingStatusPlugin *plugin)
+{
+ display_blanking_status_plugin_mode_set (
+ DISPLAY_BLANKING_STATUS_PLUGIN_GET_PRIVATE (plugin), TRUE);
+}
+
+static void
+display_blanking_status_plugin_init (DisplayBlankingStatusPlugin *plugin)
+{
+ plugin->priv = DISPLAY_BLANKING_STATUS_PLUGIN_GET_PRIVATE (plugin);
+
+ plugin->priv->gconf_client = gconf_client_get_default();
+ g_assert(GCONF_IS_CLIENT(plugin->priv->gconf_client));
+
+ plugin->priv->button = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT |
+ HILDON_SIZE_AUTO_WIDTH, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+ gtk_button_set_alignment (GTK_BUTTON (plugin->priv->button), 0, 0);
+ hildon_button_set_style (HILDON_BUTTON (plugin->priv->button),
+ HILDON_BUTTON_STYLE_PICKER);
+ hildon_button_set_title (HILDON_BUTTON (plugin->priv->button),
+ dgettext (GETTEXT_DOM, "Display blanking mode"));
+
+ display_blanking_status_plugin_mode_set (plugin->priv, FALSE);
+
+ g_signal_connect (plugin->priv->button, "clicked",
+ G_CALLBACK (display_blanking_status_plugin_on_button_clicked),
+ plugin);
+
+ gtk_container_add (GTK_CONTAINER (plugin), plugin->priv->button);
+
+ gtk_widget_show_all (plugin->priv->button);
+
+ gtk_widget_show (GTK_WIDGET (plugin));
+}
+