From 1b40a682eac74a10720e4941cb9fc5e45038d3da Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 27 Jan 2010 10:25:49 -0600 Subject: Making it so there is another level of translation so that we can use different strings in the enum. --- src/Makefile.am | 16 +++++- src/libappindicator/app-indicator-enum-types.c.in | 61 ---------------------- .../app-indicator-enum-types.gen.c.in | 61 ++++++++++++++++++++++ 3 files changed, 75 insertions(+), 63 deletions(-) delete mode 100644 src/libappindicator/app-indicator-enum-types.c.in create mode 100644 src/libappindicator/app-indicator-enum-types.gen.c.in diff --git a/src/Makefile.am b/src/Makefile.am index 38e6dd9..efae713 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -63,9 +63,21 @@ pkgconfig_DATA = libappindicator/appindicator-0.1.pc pkgconfigdir = $(libdir)/pkgconfig glib_enum_h = libappindicator/app-indicator-enum-types.h -glib_enum_c = libappindicator/app-indicator-enum-types.c +glib_enum_c = libappindicator/app-indicator-enum-types.gen.c glib_enum_headers = $(libappindicator_headers) +libappindicator/app-indicator-enum-types.c: libappindicator/app-indicator-enum-types.gen.c + sed -e "s|\"passive\"|\"Passive\"|" \ + -e "s|\"active\"|\"Active\"|" \ + -e "s|\"attention\"|\"NeedsAttention\"|" \ + -e "s|\"application-status\"|\"ApplicationStatus\"|" \ + -e "s|\"communications\"|\"Communications\"|" \ + -e "s|\"system-services\"|\"SystemServices\"|" \ + -e "s|\"hardware\"|\"Hardware\"|" \ + -e "s|\"other\"|\"Other\"|" \ + $< > $@ +DISTCLEANFILES += libappindicator/app-indicator-enum-types.c + lib_LTLIBRARIES = \ libappindicator.la @@ -80,7 +92,7 @@ libappindicatorinclude_HEADERS = \ libappindicator_la_SOURCES = \ $(libappindicator_headers) \ - $(glib_enum_c) \ + libappindicator/app-indicator-enum-types.c \ notification-watcher-client.h \ notification-item-server.h \ libappindicator/app-indicator.c diff --git a/src/libappindicator/app-indicator-enum-types.c.in b/src/libappindicator/app-indicator-enum-types.c.in deleted file mode 100644 index 449f3fc..0000000 --- a/src/libappindicator/app-indicator-enum-types.c.in +++ /dev/null @@ -1,61 +0,0 @@ -/*** BEGIN file-header ***/ -/* -An object to represent the application as an application indicator -in the system panel. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould - -This program is free software: you can redistribute it and/or modify it -under the terms of either or both of the following licenses: - -1) the GNU Lesser General Public License version 3, as published by the - Free Software Foundation; and/or -2) the GNU Lesser General Public License version 2.1, as published by - the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR -PURPOSE. See the applicable version of the GNU Lesser General Public -License for more details. - -You should have received a copy of both the GNU Lesser General Public -License version 3 and version 2.1 along with this program. If not, see - -*/ - -#include "libappindicator/app-indicator-enum-types.h" - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -#include "@filename@" -/*** END file-production ***/ - -/*** BEGIN value-header ***/ -GType -@enum_name@_get_type (void) -{ - static GType etype = 0; - if (G_UNLIKELY(etype == 0)) { - static const G@Type@Value values[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, -/*** END value-production ***/ - -/*** BEGIN value-tail ***/ - { 0, NULL, NULL} - }; - - etype = g_@type@_register_static (g_intern_static_string("@EnumName@"), values); - } - - return etype; -} - -/*** END value-tail ***/ diff --git a/src/libappindicator/app-indicator-enum-types.gen.c.in b/src/libappindicator/app-indicator-enum-types.gen.c.in new file mode 100644 index 0000000..449f3fc --- /dev/null +++ b/src/libappindicator/app-indicator-enum-types.gen.c.in @@ -0,0 +1,61 @@ +/*** BEGIN file-header ***/ +/* +An object to represent the application as an application indicator +in the system panel. + +Copyright 2009 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the + Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by + the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see + +*/ + +#include "libappindicator/app-indicator-enum-types.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +#include "@filename@" +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static GType etype = 0; + if (G_UNLIKELY(etype == 0)) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL} + }; + + etype = g_@type@_register_static (g_intern_static_string("@EnumName@"), values); + } + + return etype; +} + +/*** END value-tail ***/ -- cgit v1.2.3 From 53821e94334efe2ef43f2968f8a82e1decaa1c3b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 27 Jan 2010 10:27:55 -0600 Subject: Changing the strings in the #defines here, but really we should be using the enum. --- src/application-service-appstore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 5b0cc15..70fab18 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -55,9 +55,9 @@ struct _ApplicationServiceAppstorePrivate { AppLruFile * lrufile; }; -#define APP_STATUS_PASSIVE_STR "passive" -#define APP_STATUS_ACTIVE_STR "active" -#define APP_STATUS_ATTENTION_STR "attention" +#define APP_STATUS_PASSIVE_STR "Passive" +#define APP_STATUS_ACTIVE_STR "Active" +#define APP_STATUS_ATTENTION_STR "NeedsAttention" typedef enum _ApplicationStatus ApplicationStatus; enum _ApplicationStatus { -- cgit v1.2.3 From d415cb6768ad49b66b313336f2191f92579549e9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 27 Jan 2010 10:32:53 -0600 Subject: Changing strings in the test suite as well. --- tests/test-defines.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-defines.h b/tests/test-defines.h index 3b75c87..2baf728 100644 --- a/tests/test-defines.h +++ b/tests/test-defines.h @@ -23,8 +23,8 @@ with this program. If not, see . #define TEST_ICON_NAME "my-icon-name" #define TEST_ATTENTION_ICON_NAME "my-attention-icon-name" #define TEST_STATE APP_INDICATOR_STATUS_ACTIVE -#define TEST_STATE_S "active" +#define TEST_STATE_S "Active" #define TEST_CATEGORY APP_INDICATOR_CATEGORY_APPLICATION_STATUS -#define TEST_CATEGORY_S "application-status" +#define TEST_CATEGORY_S "ApplicationStatus" #define TEST_OBJECT "/an/object/path/to/use" -- cgit v1.2.3 From c73f5af91cace98d07161252b1a78bb3203e67a8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 27 Jan 2010 10:37:51 -0600 Subject: Changing the category in the fallback test as well. --- tests/test-libappindicator-fallback-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index 291bc7c..2c6e044 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -108,7 +108,7 @@ main (int argc, char ** argv) TestLibappindicatorFallbackItem * item = g_object_new(TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, "id", "test-id", - "category", "other", + "category", "Other", "icon-name", "bob", NULL); -- cgit v1.2.3