aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-03 21:34:40 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-02-03 21:34:40 -0600
commit2893b128d4aa61f9c55f2916350c898b1fa4a477 (patch)
tree8fb62b5fbd1b733db35b89b95d5b505eb06de7f7
parent726ad7f90ceea7cd7c2e56706a82d23aec366708 (diff)
downloadayatana-indicator-datetime-2893b128d4aa61f9c55f2916350c898b1fa4a477.tar.gz
ayatana-indicator-datetime-2893b128d4aa61f9c55f2916350c898b1fa4a477.tar.bz2
ayatana-indicator-datetime-2893b128d4aa61f9c55f2916350c898b1fa4a477.zip
when displaying alarms, use the 'alarm-clock' key matching the icon in ubuntu-mobile-icons
-rw-r--r--CMakeLists.txt3
-rw-r--r--debian/control1
-rw-r--r--src/menu.cpp69
3 files changed, 9 insertions, 64 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53a3f7e..ab8cca4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,8 +40,7 @@ pkg_check_modules (SERVICE_DEPS REQUIRED
libedataserver-1.2>=3.5
libnotify>=0.7.6
url-dispatcher-1>=1
- properties-cpp>=0.0.1
- json-glib-1.0>=0.16.2)
+ properties-cpp>=0.0.1)
include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS})
pkg_check_modules (PANEL_DEPS
diff --git a/debian/control b/debian/control
index 175684f..54d265d 100644
--- a/debian/control
+++ b/debian/control
@@ -22,7 +22,6 @@ Build-Depends: cmake,
libical-dev (>= 1.0),
libgtk-3-dev (>= 3.1.4),
libcairo2-dev (>= 1.10),
- libjson-glib-dev,
libpolkit-gobject-1-dev,
libedataserver1.2-dev (>= 3.5),
libgconf2-dev (>= 2.31),
diff --git a/src/menu.cpp b/src/menu.cpp
index 5d97859..7f41b22 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -22,8 +22,6 @@
#include <datetime/formatter.h>
#include <datetime/state.h>
-#include <json-glib/json-glib.h>
-
#include <glib/gi18n.h>
#include <gio/gio.h>
@@ -62,7 +60,7 @@ GMenuModel* Menu::menu_model()
****/
-#define FALLBACK_ALARM_CLOCK_ICON_NAME "clock"
+#define ALARM_ICON_NAME "alarm-clock"
#define CALENDAR_ICON_NAME "calendar"
class MenuImpl: public Menu
@@ -78,9 +76,6 @@ protected:
m_actions(actions),
m_formatter(formatter)
{
- // preload the alarm icon from click
- m_serialized_alarm_icon = create_alarm_icon();
-
// initialize the menu
create_gmenu();
for (int i=0; i<NUM_SECTIONS; i++)
@@ -142,68 +137,20 @@ protected:
std::shared_ptr<const Formatter> m_formatter;
GMenu* m_submenu = nullptr;
- GVariant* get_serialized_alarm_icon() { return m_serialized_alarm_icon; }
-
-private:
-
- /* try to get the clock app's filename from click. (/$pkgdir/$icon) */
- static GVariant* create_alarm_icon()
+ GVariant* get_serialized_alarm_icon()
{
- GVariant* serialized = nullptr;
- gchar* icon_filename = nullptr;
- gchar* standard_error = nullptr;
- gchar* pkgdir = nullptr;
-
- g_spawn_command_line_sync("click pkgdir com.ubuntu.clock", &pkgdir, &standard_error, nullptr, nullptr);
- g_clear_pointer(&standard_error, g_free);
- if (pkgdir != nullptr)
+ if (G_UNLIKELY(m_serialized_alarm_icon == nullptr))
{
- gchar* manifest = nullptr;
- g_strstrip(pkgdir);
- g_spawn_command_line_sync("click info com.ubuntu.clock", &manifest, &standard_error, nullptr, nullptr);
- g_clear_pointer(&standard_error, g_free);
- if (manifest != nullptr)
- {
- JsonParser* parser = json_parser_new();
- if (json_parser_load_from_data(parser, manifest, -1, nullptr))
- {
- JsonNode* root = json_parser_get_root(parser); /* transfer-none */
- if ((root != nullptr) && (JSON_NODE_TYPE(root) == JSON_NODE_OBJECT))
- {
- JsonObject* o = json_node_get_object(root); /* transfer-none */
- const gchar* icon_name = json_object_get_string_member(o, "icon");
- if (icon_name != nullptr)
- icon_filename = g_build_filename(pkgdir, icon_name, nullptr);
- }
- }
- g_object_unref(parser);
- g_free(manifest);
- }
- g_free(pkgdir);
- }
-
- if (icon_filename != nullptr)
- {
- GFile* file = g_file_new_for_path(icon_filename);
- GIcon* icon = g_file_icon_new(file);
-
- serialized = g_icon_serialize(icon);
-
- g_object_unref(icon);
- g_object_unref(file);
- g_free(icon_filename);
- }
-
- if (serialized == nullptr)
- {
- auto i = g_themed_icon_new_with_default_fallbacks(FALLBACK_ALARM_CLOCK_ICON_NAME);
- serialized = g_icon_serialize(i);
+ auto i = g_themed_icon_new_with_default_fallbacks(ALARM_ICON_NAME);
+ m_serialized_alarm_icon = g_icon_serialize(i);
g_object_unref(i);
}
- return serialized;
+ return m_serialized_alarm_icon;
}
+private:
+
GVariant* get_serialized_calendar_icon()
{
if (G_UNLIKELY(m_serialized_calendar_icon == nullptr))