From 8d4ca51e188f83fac7c4c6c941b15e217ae8c336 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 16:56:09 -0600 Subject: Adding of a new property, icon path, to store the path to the icons. --- src/notification-item.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notification-item.xml b/src/notification-item.xml index c28cc54..b671e38 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -8,6 +8,7 @@ + -- cgit v1.2.3 From 2f82dde7ca1c76ffd665120ea5576c46c353b6f1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:04:29 -0600 Subject: Adding the icon_path property to the code. --- src/libappindicator/app-indicator.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index bb68cb2..536de59 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -63,6 +63,7 @@ struct _AppIndicatorPrivate { AppIndicatorStatus status; gchar *icon_name; gchar *attention_icon_name; + gchar * icon_path; DbusmenuServer *menuservice; GtkWidget *menu; @@ -91,6 +92,7 @@ enum { PROP_STATUS, PROP_ICON_NAME, PROP_ATTENTION_ICON_NAME, + PROP_ICON_PATH, PROP_MENU, PROP_CONNECTED }; @@ -101,6 +103,7 @@ enum { #define PROP_STATUS_S "status" #define PROP_ICON_NAME_S "icon-name" #define PROP_ATTENTION_ICON_NAME_S "attention-icon-name" +#define PROP_ICON_PATH_S "icon-path" #define PROP_MENU_S "menu" #define PROP_CONNECTED_S "connected" @@ -179,6 +182,14 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property(object_class, + 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_object_class_install_property(object_class, PROP_MENU, g_param_spec_string (PROP_MENU_S, @@ -277,6 +288,7 @@ app_indicator_init (AppIndicator *self) priv->status = APP_INDICATOR_STATUS_PASSIVE; priv->icon_name = NULL; priv->attention_icon_name = NULL; + priv->icon_path = NULL; priv->menu = NULL; priv->menuservice = NULL; @@ -355,6 +367,11 @@ app_indicator_finalize (GObject *object) priv->attention_icon_name = NULL; } + if (priv->icon_path != NULL) { + g_free(priv->icon_path); + priv->icon_path = NULL; + } + G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object); return; } @@ -423,6 +440,13 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu g_value_get_string (value)); break; + case PROP_ICON_PATH: + if (icon_path != NULL) { + g_free(icon_path); + } + priv->icon_path = g_value_dup_string(value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -462,6 +486,10 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->attention_icon_name); break; + case PROP_ICON_PATH: + g_value_set_string (value, priv->icon_path); + break; + case PROP_MENU: if (G_VALUE_HOLDS_STRING(value)) { if (priv->menuservice != NULL) { -- cgit v1.2.3 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 From b3542e0f35267b102155566710c4da5a025db975 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:13:23 -0600 Subject: Forgot to get these from the private struct. --- src/libappindicator/app-indicator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 1756687..d22161c 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -441,8 +441,8 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu break; case PROP_ICON_PATH: - if (icon_path != NULL) { - g_free(icon_path); + if (priv->icon_path != NULL) { + g_free(priv->icon_path); } priv->icon_path = g_value_dup_string(value); break; -- cgit v1.2.3 From a9c6b6e346c1c850284f8766171a371da8c7b595 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:15:08 -0600 Subject: Adding new constructor to docs. --- docs/reference/libappindicator-sections.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/reference/libappindicator-sections.txt b/docs/reference/libappindicator-sections.txt index b994297..68b120a 100644 --- a/docs/reference/libappindicator-sections.txt +++ b/docs/reference/libappindicator-sections.txt @@ -18,6 +18,7 @@ AppIndicator AppIndicatorClass app_indicator_get_type app_indicator_new +app_indicator_new_with_path app_indicator_set_status app_indicator_set_attention_icon app_indicator_set_menu -- cgit v1.2.3 From 9185eeee48ad6fc91b023127e9f92f7348a0c6aa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:24:13 -0600 Subject: Adding in the icon path to the list of parameters that are passed when we have a new application. --- src/application-service-appstore.c | 6 ++++-- src/application-service-marshal.list | 2 +- src/application-service.xml | 1 + src/indicator-application.c | 8 +++++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 1391d33..92e5668 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -40,6 +40,7 @@ static gboolean _application_service_server_get_applications (ApplicationService #define NOTIFICATION_ITEM_PROP_STATUS "Status" #define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName" #define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName" +#define NOTIFICATION_ITEM_PROP_ICON_PATH "IconPath" #define NOTIFICATION_ITEM_PROP_MENU "Menu" /* Private Stuff */ @@ -93,8 +94,8 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ApplicationServiceAppstore, application_added), NULL, NULL, - _application_service_marshal_VOID__STRING_INT_STRING_STRING, - G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE); + _application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING, + G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE); signals[APPLICATION_REMOVED] = g_signal_new ("application-removed", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -185,6 +186,7 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err 0, /* Position */ app->dbus_name, g_value_get_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_MENU)), + g_value_get_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_PATH)), TRUE); return; diff --git a/src/application-service-marshal.list b/src/application-service-marshal.list index a122bf8..6cfbada 100644 --- a/src/application-service-marshal.list +++ b/src/application-service-marshal.list @@ -16,4 +16,4 @@ # # You should have received a copy of the GNU General Public License along # with this program. If not, see . -VOID: STRING, INT, STRING, STRING +VOID: STRING, INT, STRING, STRING, STRING diff --git a/src/application-service.xml b/src/application-service.xml index fdd25bb..d354943 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -35,6 +35,7 @@ with this program. If not, see . + diff --git a/src/indicator-application.c b/src/indicator-application.c index f3566e4..436a743 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -91,7 +91,7 @@ static void indicator_application_dispose (GObject *object); static void indicator_application_finalize (GObject *object); static GList * get_entries (IndicatorObject * io); static void connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplication * application); -static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, IndicatorApplication * application); +static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application); static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application); static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata); @@ -111,12 +111,13 @@ indicator_application_class_init (IndicatorApplicationClass *klass) io_class->get_entries = get_entries; - dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING, + dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); return; @@ -211,6 +212,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplicatio G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal(priv->service_proxy, "ApplicationRemoved", @@ -267,7 +269,7 @@ get_entries (IndicatorObject * io) ApplicationEntry and signaling the indicator host that we've got a new indicator. */ static void -application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, IndicatorApplication * application) +application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application) { g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname); IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); -- cgit v1.2.3 From 3915de95c9d64765cae653d02d124ca82127235e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:28:02 -0600 Subject: Adding the icon path to the app entry struct --- src/indicator-application.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/indicator-application.c b/src/indicator-application.c index 436a743..02c13c8 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -80,6 +80,7 @@ struct _IndicatorApplicationPrivate { typedef struct _ApplicationEntry ApplicationEntry; struct _ApplicationEntry { IndicatorObjectEntry entry; + gchar * icon_path; }; #define INDICATOR_APPLICATION_GET_PRIVATE(o) \ @@ -275,6 +276,7 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); ApplicationEntry * app = g_new(ApplicationEntry, 1); + app->icon_path = g_strdup(icon_path); app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); app->entry.label = NULL; app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); @@ -304,6 +306,9 @@ application_removed (DBusGProxy * proxy, gint position, IndicatorApplication * a priv->applications = g_list_remove(priv->applications, app); g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE); + if (app->icon_path != NULL) { + g_free(app->icon_path); + } if (app->entry.image != NULL) { g_object_unref(G_OBJECT(app->entry.image)); } -- cgit v1.2.3 From cd57997811b56c369eb3891ff0d92bc0cf503133 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 22:16:01 -0600 Subject: Appending the new icon path to the theme search. --- src/indicator-application.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index 02c13c8..e07386a 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -276,7 +276,12 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); ApplicationEntry * app = g_new(ApplicationEntry, 1); - app->icon_path = g_strdup(icon_path); + app->icon_path = NULL; + if (icon_path != NULL && icon_path[0] != '\0') { + app->icon_path = g_strdup(icon_path); + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), app->icon_path); + } + app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); app->entry.label = NULL; app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); -- cgit v1.2.3 From 150a0d7bf767736905bed4d9e4d10e2f235f1be5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 6 Jan 2010 14:18:49 -0600 Subject: Ignoring some of the generated files --- .bzrignore | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.bzrignore b/.bzrignore index 4856033..977611c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -44,3 +44,46 @@ src/libapplication_la-application-service-marshal.lo src/libapplication_la-indicator-application.lo src/libappindicator/app-indicator-enum-types.c src/libappindicator/app-indicator-enum-types.h +gtk-doc.make +py-compile +bindings/mono/appindicator-sharp-0.1.pc +bindings/mono/appindicator-sharp.dll +bindings/mono/appindicator-sharp.dll.config +bindings/mono/generated +bindings/mono/generated-stamp +bindings/mono/libappindicator-api.raw +bindings/mono/libappindicator-api.xml +bindings/mono/examples/indicator-example +bindings/python/.deps +bindings/python/.libs +bindings/python/_appindicator.la +bindings/python/appindicator.c +bindings/python/appindicator.lo +bindings/python/appindicatormodule.lo +docs/reference/.libs +docs/reference/gtkdoc-in-srcdir +docs/reference/html +docs/reference/html-build.stamp +docs/reference/html.stamp +docs/reference/libappindicator-decl-list.txt +docs/reference/libappindicator-decl.txt +docs/reference/libappindicator-docs.sgml +docs/reference/libappindicator-overrides.txt +docs/reference/libappindicator-undeclared.txt +docs/reference/libappindicator-undocumented.txt +docs/reference/libappindicator-unused.txt +docs/reference/libappindicator.args +docs/reference/libappindicator.hierarchy +docs/reference/libappindicator.interfaces +docs/reference/libappindicator.prerequisites +docs/reference/libappindicator.signals +docs/reference/scan-build.stamp +docs/reference/sgml-build.stamp +docs/reference/sgml.stamp +docs/reference/tmpl-build.stamp +docs/reference/tmpl.stamp +docs/reference/version.xml +docs/reference/xml +docs/reference/tmpl/app-indicator.sgml +docs/reference/tmpl/app-indicator.sgml.bak +src/libappindicator/appindicator-0.1.pc -- cgit v1.2.3 From eec24665dda2d3968984141f2d1e07289d10bf79 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 6 Jan 2010 14:27:33 -0600 Subject: Handle the case of no icon path more gracefully, by just passing along the null string. --- src/application-service-appstore.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 92e5668..c9da491 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -180,13 +180,21 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err would involve looking at the name and category and sorting it with the other entries. */ + const gchar * icon_path = NULL; + gpointer icon_path_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_PATH); + if (icon_path_data != NULL) { + icon_path = g_value_get_string((GValue *)icon_path_data); + } else { + icon_path = ""; + } + g_signal_emit(G_OBJECT(app->appstore), signals[APPLICATION_ADDED], 0, g_value_get_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_NAME)), 0, /* Position */ app->dbus_name, g_value_get_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_MENU)), - g_value_get_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_PATH)), + icon_path, TRUE); return; -- cgit v1.2.3 From e16d383c5a0fb85742dde81f1f7191fceefa8667 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Jan 2010 00:55:38 -0600 Subject: Forgot to adjust the parameter count. --- src/application-service-appstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index c9da491..1ac309a 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -95,7 +95,7 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass) G_STRUCT_OFFSET (ApplicationServiceAppstore, application_added), NULL, NULL, _application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING, - G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE); + G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE); signals[APPLICATION_REMOVED] = g_signal_new ("application-removed", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, -- cgit v1.2.3 From ad8ca0d507d627da2221d39cd45c78e760623598 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Jan 2010 01:06:45 -0600 Subject: Adding a path based debug message --- src/indicator-application.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/indicator-application.c b/src/indicator-application.c index e07386a..fbfbd40 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -279,6 +279,7 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co app->icon_path = NULL; if (icon_path != NULL && icon_path[0] != '\0') { app->icon_path = g_strdup(icon_path); + g_debug("\tAppending search path: %s", app->icon_path); gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), app->icon_path); } -- cgit v1.2.3