aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-08 14:11:55 -0600
committerTed Gould <ted@gould.cx>2010-01-08 14:11:55 -0600
commit6c2b2fd483e74576aa53a496dee76cdf16fe07d4 (patch)
tree5aa25a86ff344e8527ace4369bf796f638012cdc
parentae5ff4b699c260dd30ecd59e6c6d58fc5252794d (diff)
parent5f797d71ef38ddb421e9b26757df8d3e87b84bce (diff)
downloadayatana-indicator-application-6c2b2fd483e74576aa53a496dee76cdf16fe07d4.tar.gz
ayatana-indicator-application-6c2b2fd483e74576aa53a496dee76cdf16fe07d4.tar.bz2
ayatana-indicator-application-6c2b2fd483e74576aa53a496dee76cdf16fe07d4.zip
Fixing everything by putting the slots on correctly.
-rw-r--r--debian/changelog6
-rw-r--r--src/application-service-appstore.c36
-rw-r--r--src/application-service-appstore.h8
-rw-r--r--src/application-service.c4
4 files changed, 43 insertions, 11 deletions
diff --git a/debian/changelog b/debian/changelog
index aa3b3a4..6b08bec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+indicator-application (0.0.6-0ubuntu1~ppa4~icon2) UNRELEASED; urgency=low
+
+ * Fixing everything by putting the slots on correctly.
+
+ -- Ted Gould <ted@ubuntu.com> Fri, 08 Jan 2010 14:11:31 -0600
+
indicator-application (0.0.6-0ubuntu1~ppa4~icon1) karmic; urgency=low
* Syncing with all the other branches.
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index ae9876e..fa1b9d2 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -78,6 +78,7 @@ struct _Application {
gchar * aicon;
gchar * menu;
gchar * icon_path;
+ gboolean currently_free;
};
#define APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(o) \
@@ -116,26 +117,25 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass)
signals[APPLICATION_ADDED] = g_signal_new ("application-added",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ApplicationServiceAppstore, application_added),
+ G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_added),
NULL, NULL,
_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING,
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,
- G_STRUCT_OFFSET (ApplicationServiceAppstore, application_removed),
+ G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_removed),
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1, G_TYPE_INT, G_TYPE_NONE);
signals[APPLICATION_ICON_CHANGED] = g_signal_new ("application-icon-changed",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ApplicationServiceAppstore, application_icon_changed),
+ G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_icon_changed),
NULL, NULL,
_application_service_marshal_VOID__INT_STRING,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE);
-
dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE,
&dbus_glib__application_service_server_object_info);
@@ -248,7 +248,6 @@ get_position (Application * app) {
GList * applistitem = g_list_find(priv->applications, app);
if (applistitem == NULL) {
- g_warning("Change the icon of an application that isn't in the application list?");
return -1;
}
@@ -261,6 +260,18 @@ static void
application_free (Application * app)
{
if (app == NULL) return;
+
+ /* Handle the case where this could be called by unref'ing one of
+ the proxy objects. */
+ if (app->currently_free) return;
+ app->currently_free = TRUE;
+
+ if (app->dbus_proxy) {
+ g_object_unref(app->dbus_proxy);
+ }
+ if (app->prop_proxy) {
+ g_object_unref(app->prop_proxy);
+ }
if (app->dbus_name != NULL) {
g_free(app->dbus_name);
@@ -309,6 +320,7 @@ apply_status (Application * app, ApplicationStatus status)
if (app->status == status) {
return;
}
+ g_debug("Changing app status to: %d", status);
ApplicationServiceAppstore * appstore = app->appstore;
ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore);
@@ -512,6 +524,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
app->aicon = NULL;
app->menu = NULL;
app->icon_path = NULL;
+ app->currently_free = FALSE;
/* Get the DBus proxy for the NotificationItem interface */
GError * error = NULL;
@@ -585,6 +598,8 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
return;
}
+/* Removes an application. Currently only works for the apps
+ that are shown. /TODO Need to fix that. */
void
application_service_appstore_application_remove (ApplicationServiceAppstore * appstore, const gchar * dbus_name, const gchar * dbus_object)
{
@@ -592,6 +607,17 @@ application_service_appstore_application_remove (ApplicationServiceAppstore * ap
g_return_if_fail(dbus_name != NULL && dbus_name[0] != '\0');
g_return_if_fail(dbus_object != NULL && dbus_object[0] != '\0');
+ ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore);
+ GList * listpntr;
+
+ for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) {
+ Application * app = (Application *)listpntr->data;
+
+ if (!g_strcmp0(app->dbus_name, dbus_name) && !g_strcmp0(app->dbus_object, dbus_object)) {
+ application_removed_cb(NULL, app);
+ break; /* NOTE: Must break as the list will become inconsistent */
+ }
+ }
return;
}
diff --git a/src/application-service-appstore.h b/src/application-service-appstore.h
index 7ab20c5..6bd7a01 100644
--- a/src/application-service-appstore.h
+++ b/src/application-service-appstore.h
@@ -40,16 +40,16 @@ typedef struct _ApplicationServiceAppstoreClass ApplicationServiceAppstoreClass;
struct _ApplicationServiceAppstoreClass {
GObjectClass parent_class;
-};
-
-struct _ApplicationServiceAppstore {
- GObject parent;
void (*application_added) (ApplicationServiceAppstore * appstore, gchar *, gint, gchar *, gchar *, gpointer);
void (*application_removed) (ApplicationServiceAppstore * appstore, gint, gpointer);
void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
};
+struct _ApplicationServiceAppstore {
+ GObject parent;
+};
+
GType application_service_appstore_get_type (void);
void application_service_appstore_application_add (ApplicationServiceAppstore * appstore,
const gchar * dbus_name,
diff --git a/src/application-service.c b/src/application-service.c
index 45295a1..d21154f 100644
--- a/src/application-service.c
+++ b/src/application-service.c
@@ -43,7 +43,7 @@ service_disconnected (IndicatorService * service, gpointer data)
{
g_debug("Service disconnected");
if (mainloop != NULL) {
- g_main_loop_quit(mainloop);
+ //g_main_loop_quit(mainloop);
}
return;
}
@@ -57,7 +57,7 @@ main (int argc, char ** argv)
/* Bring us up as a basic indicator service */
service = indicator_service_new(INDICATOR_APPLICATION_DBUS_ADDR);
- g_signal_connect(G_OBJECT(service), "disconnected", G_CALLBACK(service_disconnected), NULL);
+ g_signal_connect(G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_disconnected), NULL);
/* Building our app store */
appstore = APPLICATION_SERVICE_APPSTORE(g_object_new(APPLICATION_SERVICE_APPSTORE_TYPE, NULL));