From c44c00bdd91e0e5bf3010b0a7ac511b60c443370 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:11:23 -0600 Subject: Making the icon-path property construct only and making a constructor to set it. --- src/libappindicator/app-indicator.c | 34 ++++++++++++++++++++++++++++++++-- src/libappindicator/app-indicator.h | 4 ++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 536de59..1756687 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -183,12 +183,12 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property(object_class, - PROP_ICON_PATH, + PROP_ICON_PATH, g_param_spec_string (PROP_ICON_PATH_S, "An additional path for custom icons.", "An additional place to look for icon names that may be installed by the application.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(object_class, PROP_MENU, @@ -600,6 +600,36 @@ app_indicator_new (const gchar *id, return indicator; } +/** + app_indicator_new_with_path: + @id: The unique id of the indicator to create. + @icon_name: The icon name for this indicator + @category: The category of indicator. + @icon_path: A custom path for finding icons. + + Creates a new #AppIndicator setting the properties: + #AppIndicator::id with @id, #AppIndicator::category + with @category, #AppIndicator::icon-name with + @icon_name and #AppIndicator::icon-path with @icon_path. + + Return value: A pointer to a new #AppIndicator object. + */ +AppIndicator * +app_indicator_new_with_path (const gchar *id, + const gchar *icon_name, + AppIndicatorCategory category, + const gchar *icon_path) +{ + AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE, + "id", id, + "category", category_from_enum (category), + "icon-name", icon_name, + "icon-path", icon_path, + NULL); + + return indicator; +} + /** app_indicator_get_type: diff --git a/src/libappindicator/app-indicator.h b/src/libappindicator/app-indicator.h index e966a49..52438f6 100644 --- a/src/libappindicator/app-indicator.h +++ b/src/libappindicator/app-indicator.h @@ -202,6 +202,10 @@ GType app_indicator_get_type (void) G_GNUC_C AppIndicator *app_indicator_new (const gchar *id, const gchar *icon_name, AppIndicatorCategory category); +AppIndicator *app_indicator_new_with_path (const gchar *id, + const gchar *icon_name, + AppIndicatorCategory category, + const gchar *icon_path); /* Set properties */ void app_indicator_set_status (AppIndicator *self, -- cgit v1.2.3