aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2010-06-03 17:05:26 +0300
committerClaudio Saavedra <csaavedra@igalia.com>2010-06-03 17:17:06 +0300
commit18192db2f941314fd14053b380d00a2dec696c99 (patch)
tree8074ec76aa8d065db7cf3cc91314af0b04689983
parent622634ebf812dac6f93b653b575610745d60bfd8 (diff)
Add stock items for Hildon
These stock items are the strings that are provided by the library for standard buttons and actions. Up to now, the only possibility to use them in application side was to find out the logical ID and to make a call to a gettext() function. This had several disadvantages: - It doesn't provide guarantees of API or ABI stability. - Application developers need to find out the gettext context, which is internal to the library. - Calls to gettext() for hildon strings in application code causes unwanted strings to appear in the application pot file, which cause confusion among translators.
-rw-r--r--doc/hildon-docs.sgml1
-rw-r--r--doc/hildon-sections.txt14
-rw-r--r--hildon/Makefile.am3
-rw-r--r--hildon/hildon-main.c21
-rw-r--r--hildon/hildon-stock.h32
-rw-r--r--hildon/hildon.h1
6 files changed, 71 insertions, 1 deletions
diff --git a/doc/hildon-docs.sgml b/doc/hildon-docs.sgml
index 0248477..c25a60c 100644
--- a/doc/hildon-docs.sgml
+++ b/doc/hildon-docs.sgml
@@ -74,6 +74,7 @@
<xi:include href="xml/hildon-main.xml"/>
<xi:include href="xml/hildon-gtk.xml"/>
<xi:include href="xml/hildon-defines.xml"/>
+ <xi:include href="xml/hildon-stock.xml"/>
<xi:include href="xml/hildon-helper.xml"/>
<xi:include href="xml/hildon-version.xml"/>
<xi:include href="xml/hildon-sound.xml"/>
diff --git a/doc/hildon-sections.txt b/doc/hildon-sections.txt
index 2297813..5cd15f2 100644
--- a/doc/hildon-sections.txt
+++ b/doc/hildon-sections.txt
@@ -1400,3 +1400,17 @@ hildon_init
hildon_gtk_init
</SECTION>
+<SECTION>
+<FILE>hildon-stock</FILE>
+<TITLE>Stock Items</TITLE>
+HILDON_STOCK_DATE
+HILDON_STOCK_TIME
+HILDON_STOCK_STOP
+HILDON_STOCK_YES
+HILDON_STOCK_NO
+HILDON_STOCK_DONE
+HILDON_STOCK_SORT
+HILDON_STOCK_FINISH
+HILDON_STOCK_PREVIOUS
+HILDON_STOCK_NEXT
+</SECTION>
diff --git a/hildon/Makefile.am b/hildon/Makefile.am
index b0049ff..40ae7bb 100644
--- a/hildon/Makefile.am
+++ b/hildon/Makefile.am
@@ -157,7 +157,8 @@ libhildon_@API_VERSION_MAJOR@_public_headers = \
hildon-gtk.h \
hildon-version.h \
hildon-main.h \
- hildon-live-search.h
+ hildon-live-search.h \
+ hildon-stock.h
libhildon_@API_VERSION_MAJOR@_include_HEADERS = \
$(libhildon_@API_VERSION_MAJOR@_public_headers) \
diff --git a/hildon/hildon-main.c b/hildon/hildon-main.c
index 65cd4dd..d0db06e 100644
--- a/hildon/hildon-main.c
+++ b/hildon/hildon-main.c
@@ -66,7 +66,25 @@
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
#include "hildon-main.h"
+#include "hildon-stock.h"
+
+#define GETTEXT_PACKAGE "hildon-libs"
+
+static const GtkStockItem hildon_items[] = {
+ { HILDON_STOCK_DATE, N_("wdgt_ti_date"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_TIME, N_("wdgt_ti_time"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_STOP, N_("wdgt_bd_stop"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_YES, N_("wdgt_bd_yes"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_NO, N_("wdgt_bd_no"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_DONE, N_("wdgt_bd_done"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_SORT, N_("wdgt_bd_sort"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_FINISH, N_("wdgt_bd_finish"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_PREVIOUS, N_("wdgt_bd_previous"), 0, 0, GETTEXT_PACKAGE },
+ { HILDON_STOCK_NEXT, N_("wdgt_bd_next"), 0, 0, GETTEXT_PACKAGE },
+};
/**
* hildon_init:
@@ -96,6 +114,9 @@ hildon_init (void)
gtk_icon_size_register ("hildon-thumb", 64, 64);
gtk_icon_size_register ("hildon-large", 96, 96);
gtk_icon_size_register ("hildon-xlarge", 128, 128);
+
+ /* Add Hildon stock items */
+ gtk_stock_add_static (hildon_items, G_N_ELEMENTS (hildon_items));
}
/**
diff --git a/hildon/hildon-stock.h b/hildon/hildon-stock.h
new file mode 100644
index 0000000..0743148
--- /dev/null
+++ b/hildon/hildon-stock.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the hildon library
+ *
+ * Copyright (C) 2010 Nokia Corporation, all rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#define HILDON_STOCK_DATE "hildon-stock-date"
+#define HILDON_STOCK_TIME "hildon-stock-time"
+#define HILDON_STOCK_STOP "hildon-stock-stop"
+#define HILDON_STOCK_YES "hildon-stock-yes"
+#define HILDON_STOCK_NO "hildon-stock-no"
+#define HILDON_STOCK_DONE "hildon-stock-done"
+#define HILDON_STOCK_SORT "hildon-stock-sort"
+#define HILDON_STOCK_FINISH "hildon-stock-finish"
+#define HILDON_STOCK_PREVIOUS "hildon-stock-previous"
+#define HILDON_STOCK_NEXT "hildon-stock-next"
diff --git a/hildon/hildon.h b/hildon/hildon.h
index 25099fd..84cbf7a 100644
--- a/hildon/hildon.h
+++ b/hildon/hildon.h
@@ -84,5 +84,6 @@
#include "hildon-dialog.h"
#include "hildon-main.h"
#include "hildon-live-search.h"
+#include "hildon-stock.h"
#endif