aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-08-08 09:15:30 -0600
committerTed Gould <ted@canonical.com>2009-08-08 09:15:30 -0600
commit46812f4eb145ce20d50b728944b8b4e1205bbb41 (patch)
treeee3af6f4f5180b100e6f725c5c43c2dee8aa6b59
parent32ae53755e9d5646ca3779bd889303d6a8ef5378 (diff)
parent839f57951591a4bf9d0ce4fd32b0c5b2d06bf73e (diff)
downloadayatana-indicator-session-46812f4eb145ce20d50b728944b8b4e1205bbb41.tar.gz
ayatana-indicator-session-46812f4eb145ce20d50b728944b8b4e1205bbb41.tar.bz2
ayatana-indicator-session-46812f4eb145ce20d50b728944b8b4e1205bbb41.zip
Lots of updates from a branch to make things on the status
front all happy happy joy joy.
-rw-r--r--debian/changelog7
-rw-r--r--src/Makefile.am6
-rw-r--r--src/dbus-shared-names.h2
-rw-r--r--src/indicator-sus.c1
-rw-r--r--src/status-provider-pidgin.c7
-rw-r--r--src/status-provider.c2
-rw-r--r--src/status-provider.h3
-rw-r--r--src/status-service-dbus.c11
-rw-r--r--src/status-service-dbus.h1
-rw-r--r--src/status-service.c33
-rw-r--r--src/status-service.xml4
-rw-r--r--src/users-service.c1
12 files changed, 67 insertions, 11 deletions
diff --git a/debian/changelog b/debian/changelog
index ea25fee..ebd721c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-sus (0.1~ppa7~status1) UNRELEASED; urgency=low
+
+ * Lots of updates from a branch to make things on the status
+ front all happy happy joy joy.
+
+ -- Ted Gould <ted@ubuntu.com> Sat, 08 Aug 2009 09:14:41 -0600
+
indicator-sus (0.1~ppa6) karmic; urgency=low
* debian/control: Conflicting with gdm < 2.27.4-0ubuntu9 or
diff --git a/src/Makefile.am b/src/Makefile.am
index ab79f0f..39d360c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,7 @@ indicator_status_service_SOURCES = \
status-provider.c \
status-provider-pidgin.h \
status-provider-pidgin.c
-indicator_status_service_CFLAGS = $(STATUSSERVICE_CFLAGS)
+indicator_status_service_CFLAGS = $(STATUSSERVICE_CFLAGS) -Wall -Werror
indicator_status_service_LDADD = $(STATUSSERVICE_LIBS)
status-service-client.h: status-service.xml
@@ -51,7 +51,7 @@ status-service-server.h: status-service.xml
###############
indicator_users_service_SOURCES = users-service.c
-indicator_users_service_CFLAGS = $(USERSSERVICE_CFLAGS)
+indicator_users_service_CFLAGS = $(USERSSERVICE_CFLAGS) -Wall -Werror
indicator_users_service_LDADD = $(USERSSERVICE_LIBS)
#################
@@ -59,7 +59,7 @@ indicator_users_service_LDADD = $(USERSSERVICE_LIBS)
#################
indicator_session_service_SOURCES = session-service.c
-indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\"
+indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS)
###############
diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h
index 3ba21f8..9c828b1 100644
--- a/src/dbus-shared-names.h
+++ b/src/dbus-shared-names.h
@@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define INDICATOR_STATUS_DBUS_NAME "org.ayatana.indicator.status"
#define INDICATOR_STATUS_DBUS_OBJECT "/org/ayatana/indicator/status"
-#define INDICATOR_STATUS_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/status-service"
+#define INDICATOR_STATUS_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/statusservice"
#define INDICATOR_USERS_DBUS_NAME "org.ayatana.indicator.users"
#define INDICATOR_USERS_DBUS_OBJECT "/org/ayatana/indicator/users"
diff --git a/src/indicator-sus.c b/src/indicator-sus.c
index e248e68..1ab810c 100644
--- a/src/indicator-sus.c
+++ b/src/indicator-sus.c
@@ -72,6 +72,7 @@ GtkImage *
get_icon (void)
{
GtkImage * image = GTK_IMAGE(gtk_image_new_from_icon_name("user-offline", GTK_ICON_SIZE_MENU));
+ gtk_widget_show(GTK_WIDGET(image));
return image;
}
diff --git a/src/status-provider-pidgin.c b/src/status-provider-pidgin.c
index 6a3f7a5..aaa8732 100644
--- a/src/status-provider-pidgin.c
+++ b/src/status-provider-pidgin.c
@@ -129,6 +129,12 @@ status_provider_pidgin_init (StatusProviderPidgin *self)
static void
status_provider_pidgin_dispose (GObject *object)
{
+ StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(object);
+
+ if (priv->proxy != NULL) {
+ g_object_unref(priv->proxy);
+ priv->proxy = NULL;
+ }
G_OBJECT_CLASS (status_provider_pidgin_parent_class)->dispose (object);
return;
@@ -166,6 +172,7 @@ set_status (StatusProvider * sp, StatusProviderStatus status)
StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(sp);
pg_status_t pg_status = sp_to_pg_map[status];
priv->pg_status = pg_status;
+ g_signal_emit(G_OBJECT(sp), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, pg_to_sp_map[priv->pg_status], TRUE);
return;
}
diff --git a/src/status-provider.c b/src/status-provider.c
index 1c9561b..83d44ac 100644
--- a/src/status-provider.c
+++ b/src/status-provider.c
@@ -43,7 +43,7 @@ G_DEFINE_TYPE (StatusProvider, status_provider, G_TYPE_OBJECT);
static void
status_provider_class_init (StatusProviderClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ // GObjectClass *object_class = G_OBJECT_CLASS (klass);
klass->status_changed = NULL;
diff --git a/src/status-provider.h b/src/status-provider.h
index f01a90e..9cc9885 100644
--- a/src/status-provider.h
+++ b/src/status-provider.h
@@ -47,7 +47,8 @@ typedef enum
}
StatusProviderStatus;
-#define STATUS_PROVIDER_SIGNAL_STATUS_CHANGED "status-changed"
+#define STATUS_PROVIDER_SIGNAL_STATUS_CHANGED "status-changed"
+#define STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID (g_signal_lookup(STATUS_PROVIDER_SIGNAL_STATUS_CHANGED, STATUS_PROVIDER_TYPE))
typedef struct _StatusProvider StatusProvider;
struct _StatusProvider {
diff --git a/src/status-service-dbus.c b/src/status-service-dbus.c
index a8e031c..09d2711 100644
--- a/src/status-service-dbus.c
+++ b/src/status-service-dbus.c
@@ -102,8 +102,8 @@ status_service_dbus_class_init (StatusServiceDbusClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(StatusServiceDbusClass, status_icons_changed),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
dbus_g_object_type_install_info(STATUS_SERVICE_DBUS_TYPE, &dbus_glib__status_service_server_object_info);
@@ -172,3 +172,10 @@ _status_service_server_pretty_user_name (StatusServiceDbus * service, gchar ** u
return TRUE;
}
+
+void
+status_service_dbus_set_status (StatusServiceDbus * self, const gchar * icon)
+{
+ g_signal_emit(G_OBJECT(self), signals[STATUS_ICONS_CHANGED], 0, icon, TRUE);
+ return;
+}
diff --git a/src/status-service-dbus.h b/src/status-service-dbus.h
index 66c9206..34a9c3c 100644
--- a/src/status-service-dbus.h
+++ b/src/status-service-dbus.h
@@ -52,6 +52,7 @@ struct _StatusServiceDbus {
};
GType status_service_dbus_get_type (void);
+void status_service_dbus_set_status (StatusServiceDbus * self, const gchar * icon);
G_END_DECLS
diff --git a/src/status-service.c b/src/status-service.c
index 4c48c72..5a9d9b5 100644
--- a/src/status-service.c
+++ b/src/status-service.c
@@ -23,6 +23,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <sys/types.h>
#include <pwd.h>
+#include <unistd.h>
#include <glib/gi18n.h>
@@ -67,6 +68,30 @@ static DbusmenuMenuitem * root_menuitem = NULL;
static DbusmenuMenuitem * status_menuitem = NULL;
static GMainLoop * mainloop = NULL;
static StatusServiceDbus * dbus_interface = NULL;
+static StatusProviderStatus global_status = STATUS_PROVIDER_STATUS_OFFLINE;
+
+static void
+status_update (void) {
+ StatusProviderStatus oldglobal = global_status;
+ global_status = STATUS_PROVIDER_STATUS_ONLINE;
+
+ int i;
+ for (i = 0; i < STATUS_PROVIDER_CNT; i++) {
+ StatusProviderStatus localstatus = status_provider_get_status(status_providers[i]);
+ if (localstatus > global_status) {
+ global_status = localstatus;
+ }
+ }
+
+ if (global_status != oldglobal) {
+ g_debug("Global status changed to: %s", _(status_strings[global_status]));
+
+ dbusmenu_menuitem_property_set(status_menuitem, "label", _(status_strings[global_status]));
+ status_service_dbus_set_status(dbus_interface, status_icons[global_status]);
+ }
+
+ return;
+}
/* A fun little function to actually lock the screen. If,
that's what you want, let's do it! */
@@ -114,8 +139,14 @@ build_providers (gpointer data)
int i;
for (i = 0; i < STATUS_PROVIDER_CNT; i++) {
status_providers[i] = status_provider_newfuncs[i]();
+
+ if (status_providers[i] != NULL) {
+ g_signal_connect(G_OBJECT(status_providers[i]), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED, G_CALLBACK(status_update), NULL);
+ }
}
+ status_update();
+
return FALSE;
}
@@ -154,7 +185,7 @@ build_menu (gpointer data)
build_user_item(root);
status_menuitem = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(status_menuitem, "label", "Status");
+ dbusmenu_menuitem_property_set(status_menuitem, "label", _(status_strings[global_status]));
dbusmenu_menuitem_child_append(root, status_menuitem);
StatusProviderStatus i;
diff --git a/src/status-service.xml b/src/status-service.xml
index 3807158..ba1f79f 100644
--- a/src/status-service.xml
+++ b/src/status-service.xml
@@ -7,7 +7,7 @@
<annotation name="org.freedesktop.DBus.GLib.Async" value="true" />
</method>
<method name="StatusIcons">
- <arg type="a(s)" name="icons" direction="out" />
+ <arg type="s" name="icons" direction="out" />
</method>
<method name="PrettyUserName">
<arg type="s" name="name" direction="out" />
@@ -18,7 +18,7 @@
<arg type="s" name="name" direction="out" />
</signal>
<signal name="StatusIconsChanged">
- <arg type="a(s)" name="icons" direction="out" />
+ <arg type="s" name="icons" direction="out" />
</signal>
</interface>
diff --git a/src/users-service.c b/src/users-service.c
index a8a9c67..9ada91f 100644
--- a/src/users-service.c
+++ b/src/users-service.c
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <unistd.h>
#include <glib/gi18n.h>