From d68a776f7c88fc1304572e4739a65ee1b93688e4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Jun 2009 14:45:38 -0500 Subject: Switching the pkgconfig based directory. --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index c29d179..3bae3f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ -fusalibdir = $(libdir)/indicators/1 +fusalibdir = $(INDICATORDIR) fusalib_LTLIBRARIES = libfusa.la libfusa_la_SOURCES = indicator-fusa.c libfusa_la_CFLAGS = $(APPLET_CFLAGS) -- cgit v1.2.3 From 80b3de3f554b9d9fc60d20c4835026017465b61c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Jun 2009 16:25:14 -0500 Subject: Making things into a set of three user-daemons. --- src/Makefile.am | 2 +- src/dbus-shared-names.h | 15 +++++++++++++-- src/indicator-fusa.c | 43 +++++++++++++++++++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 7 deletions(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 3bae3f2..325e351 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,5 +2,5 @@ fusalibdir = $(INDICATORDIR) fusalib_LTLIBRARIES = libfusa.la libfusa_la_SOURCES = indicator-fusa.c -libfusa_la_CFLAGS = $(APPLET_CFLAGS) +libfusa_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libfusa_la_LIBADD = $(APPLET_LIBS) diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index 35839a4..f56e9cb 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -1,3 +1,14 @@ -#define INDICATOR_FUSA_DBUS_NAME "org.indicators.fusa" -#define INDICATOR_FUSA_DBUS_OBJECT "/org/fusa" +#ifndef __DBUS_SHARED_NAMES_H__ +#define __DBUS_SHARED_NAMES_H__ 1 + +#define INDICATOR_STATUS_DBUS_NAME "com.ubuntu.indicator.status" +#define INDICATOR_STATUS_DBUS_OBJECT "/com/ubuntu/indicator/status" + +#define INDICATOR_USERS_DBUS_NAME "com.ubuntu.indicator.users" +#define INDICATOR_USERS_DBUS_OBJECT "/com/ubuntu/indicator/users" + +#define INDICATOR_SESSION_DBUS_NAME "com.ubuntu.indicator.session" +#define INDICATOR_SESSION_DBUS_OBJECT "/com/ubuntu/indicator/session" + +#endif /* __DBUS_SHARED_NAMES_H__ */ diff --git a/src/indicator-fusa.c b/src/indicator-fusa.c index 8815fb5..4c1c163 100644 --- a/src/indicator-fusa.c +++ b/src/indicator-fusa.c @@ -7,14 +7,19 @@ #include INDICATOR_SET_VERSION -INDICATOR_SET_NAME("users-status-shutdown") +INDICATOR_SET_NAME("users-status-session") #include "dbus-shared-names.h" +static GtkMenu * status_menu = NULL; +static GtkMenu * users_menu = NULL; +static GtkMenu * session_menu = NULL; +static GtkMenu * main_menu = NULL; + GtkLabel * get_label (void) { - GtkLabel * returnval = gtk_label_new("Ted Gould"); + GtkLabel * returnval = GTK_LABEL(gtk_label_new("Ted Gould")); return returnval; } @@ -33,7 +38,7 @@ get_menu (void) DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_FUSA_DBUS_NAME, 0, &returnval, &error)) { + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_STATUS_DBUS_NAME, 0, &returnval, &error)) { g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); g_error_free(error); return NULL; @@ -44,7 +49,37 @@ get_menu (void) return NULL; } - return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_FUSA_DBUS_NAME, INDICATOR_FUSA_DBUS_OBJECT)); + status_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_STATUS_DBUS_NAME, INDICATOR_STATUS_DBUS_OBJECT)); + + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_USERS_DBUS_NAME, 0, &returnval, &error)) { + g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); + g_error_free(error); + return NULL; + } + + if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { + g_error("Return value isn't indicative of success: %d", returnval); + return NULL; + } + + users_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_USERS_DBUS_NAME, INDICATOR_USERS_DBUS_OBJECT)); + + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_SESSION_DBUS_NAME, 0, &returnval, &error)) { + g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); + g_error_free(error); + return NULL; + } + + if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { + g_error("Return value isn't indicative of success: %d", returnval); + return NULL; + } + + session_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); + + main_menu = GTK_MENU(gtk_menu_new()); + + return main_menu; } -- cgit v1.2.3 From 770526c7bb912c8f04a82293c6d49e1c060edeb7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Jun 2009 16:57:56 -0500 Subject: Changing the name to get rid of FUSA, which doesn't really make sense anymore. --- .bzrignore | 2 ++ src/Makefile.am | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/Makefile.am') diff --git a/.bzrignore b/.bzrignore index 69e9e68..ff78cee 100644 --- a/.bzrignore +++ b/.bzrignore @@ -14,3 +14,5 @@ debian/indicator-messages.postrm.debhelper debian/indicator-messages.substvars debian/stamp-autotools-files debian/stamp-makefile-build +libstatus-users-session.la +libstatus_users_session_la-indicator-fusa.lo diff --git a/src/Makefile.am b/src/Makefile.am index 325e351..45400c3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ -fusalibdir = $(INDICATORDIR) -fusalib_LTLIBRARIES = libfusa.la -libfusa_la_SOURCES = indicator-fusa.c -libfusa_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror -libfusa_la_LIBADD = $(APPLET_LIBS) +status_users_sessionlibdir = $(INDICATORDIR) +status_users_sessionlib_LTLIBRARIES = libstatus-users-session.la +libstatus_users_session_la_SOURCES = indicator-fusa.c +libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror +libstatus_users_session_la_LIBADD = $(APPLET_LIBS) -- cgit v1.2.3 From a94e5d414a44af3c3f4ae2bb0c00978c0270dd1a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Jun 2009 16:59:12 -0500 Subject: Renaming the C file as well. --- .bzrignore | 1 + src/Makefile.am | 2 +- src/indicator-fusa.c | 85 ---------------------------------------------------- src/indicator-sus.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 86 deletions(-) delete mode 100644 src/indicator-fusa.c create mode 100644 src/indicator-sus.c (limited to 'src/Makefile.am') diff --git a/.bzrignore b/.bzrignore index ff78cee..3eac215 100644 --- a/.bzrignore +++ b/.bzrignore @@ -16,3 +16,4 @@ debian/stamp-autotools-files debian/stamp-makefile-build libstatus-users-session.la libstatus_users_session_la-indicator-fusa.lo +libstatus_users_session_la-indicator-sus.lo diff --git a/src/Makefile.am b/src/Makefile.am index 45400c3..4fe35ff 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ status_users_sessionlibdir = $(INDICATORDIR) status_users_sessionlib_LTLIBRARIES = libstatus-users-session.la -libstatus_users_session_la_SOURCES = indicator-fusa.c +libstatus_users_session_la_SOURCES = indicator-sus.c dbus-shared-names.h libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) diff --git a/src/indicator-fusa.c b/src/indicator-fusa.c deleted file mode 100644 index 4c1c163..0000000 --- a/src/indicator-fusa.c +++ /dev/null @@ -1,85 +0,0 @@ - -#include -#include - -#include -#include - -#include -INDICATOR_SET_VERSION -INDICATOR_SET_NAME("users-status-session") - -#include "dbus-shared-names.h" - -static GtkMenu * status_menu = NULL; -static GtkMenu * users_menu = NULL; -static GtkMenu * session_menu = NULL; -static GtkMenu * main_menu = NULL; - -GtkLabel * -get_label (void) -{ - GtkLabel * returnval = GTK_LABEL(gtk_label_new("Ted Gould")); - return returnval; -} - -GtkImage * -get_icon (void) -{ - return NULL; -} - -GtkMenu * -get_menu (void) -{ - guint returnval = 0; - GError * error = NULL; - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - - if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_STATUS_DBUS_NAME, 0, &returnval, &error)) { - g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); - g_error_free(error); - return NULL; - } - - if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { - g_error("Return value isn't indicative of success: %d", returnval); - return NULL; - } - - status_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_STATUS_DBUS_NAME, INDICATOR_STATUS_DBUS_OBJECT)); - - if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_USERS_DBUS_NAME, 0, &returnval, &error)) { - g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); - g_error_free(error); - return NULL; - } - - if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { - g_error("Return value isn't indicative of success: %d", returnval); - return NULL; - } - - users_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_USERS_DBUS_NAME, INDICATOR_USERS_DBUS_OBJECT)); - - if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_SESSION_DBUS_NAME, 0, &returnval, &error)) { - g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); - g_error_free(error); - return NULL; - } - - if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { - g_error("Return value isn't indicative of success: %d", returnval); - return NULL; - } - - session_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); - - main_menu = GTK_MENU(gtk_menu_new()); - - return main_menu; -} - - diff --git a/src/indicator-sus.c b/src/indicator-sus.c new file mode 100644 index 0000000..4c1c163 --- /dev/null +++ b/src/indicator-sus.c @@ -0,0 +1,85 @@ + +#include +#include + +#include +#include + +#include +INDICATOR_SET_VERSION +INDICATOR_SET_NAME("users-status-session") + +#include "dbus-shared-names.h" + +static GtkMenu * status_menu = NULL; +static GtkMenu * users_menu = NULL; +static GtkMenu * session_menu = NULL; +static GtkMenu * main_menu = NULL; + +GtkLabel * +get_label (void) +{ + GtkLabel * returnval = GTK_LABEL(gtk_label_new("Ted Gould")); + return returnval; +} + +GtkImage * +get_icon (void) +{ + return NULL; +} + +GtkMenu * +get_menu (void) +{ + guint returnval = 0; + GError * error = NULL; + + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_STATUS_DBUS_NAME, 0, &returnval, &error)) { + g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); + g_error_free(error); + return NULL; + } + + if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { + g_error("Return value isn't indicative of success: %d", returnval); + return NULL; + } + + status_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_STATUS_DBUS_NAME, INDICATOR_STATUS_DBUS_OBJECT)); + + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_USERS_DBUS_NAME, 0, &returnval, &error)) { + g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); + g_error_free(error); + return NULL; + } + + if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { + g_error("Return value isn't indicative of success: %d", returnval); + return NULL; + } + + users_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_USERS_DBUS_NAME, INDICATOR_USERS_DBUS_OBJECT)); + + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_SESSION_DBUS_NAME, 0, &returnval, &error)) { + g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); + g_error_free(error); + return NULL; + } + + if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { + g_error("Return value isn't indicative of success: %d", returnval); + return NULL; + } + + session_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); + + main_menu = GTK_MENU(gtk_menu_new()); + + return main_menu; +} + + -- cgit v1.2.3 From 1e2d4592308c3bff63c74c48b9e97b6d246d2b92 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 9 Jun 2009 10:59:51 -0500 Subject: Now we're building services. Snazy. --- .bzrignore | 3 +++ src/Makefile.am | 9 +++++++++ src/session-service.c | 7 +++++++ src/status-service.c | 7 +++++++ src/users-service.c | 7 +++++++ 5 files changed, 33 insertions(+) create mode 100644 src/session-service.c create mode 100644 src/status-service.c create mode 100644 src/users-service.c (limited to 'src/Makefile.am') diff --git a/.bzrignore b/.bzrignore index 3eac215..d7bb9e0 100644 --- a/.bzrignore +++ b/.bzrignore @@ -17,3 +17,6 @@ debian/stamp-makefile-build libstatus-users-session.la libstatus_users_session_la-indicator-fusa.lo libstatus_users_session_la-indicator-sus.lo +indicator-session-service +indicator-status-service +indicator-users-service diff --git a/src/Makefile.am b/src/Makefile.am index 4fe35ff..4e0df47 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,15 @@ +libexec_PROGRAMS = indicator-status-service indicator-users-service indicator-session-service + status_users_sessionlibdir = $(INDICATORDIR) status_users_sessionlib_LTLIBRARIES = libstatus-users-session.la libstatus_users_session_la_SOURCES = indicator-sus.c dbus-shared-names.h libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) + +indicator_status_service_SOURCES = status-service.c + +indicator_users_service_SOURCES = users-service.c + +indicator_session_service_SOURCES = session-service.c + diff --git a/src/session-service.c b/src/session-service.c new file mode 100644 index 0000000..63590c7 --- /dev/null +++ b/src/session-service.c @@ -0,0 +1,7 @@ + +int +main (int argc, char ** argv) +{ + + return 0; +} diff --git a/src/status-service.c b/src/status-service.c new file mode 100644 index 0000000..63590c7 --- /dev/null +++ b/src/status-service.c @@ -0,0 +1,7 @@ + +int +main (int argc, char ** argv) +{ + + return 0; +} diff --git a/src/users-service.c b/src/users-service.c new file mode 100644 index 0000000..63590c7 --- /dev/null +++ b/src/users-service.c @@ -0,0 +1,7 @@ + +int +main (int argc, char ** argv) +{ + + return 0; +} -- cgit v1.2.3 From ee013228b486d5b49be2737e90f3e75aded90365 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 9 Jun 2009 16:53:00 -0500 Subject: Adding more dependencies and cflags and stuff to make the builds of the services more complete --- configure.ac | 17 +++++++++++++++++ src/Makefile.am | 6 ++++++ 2 files changed, 23 insertions(+) (limited to 'src/Makefile.am') diff --git a/configure.ac b/configure.ac index 742403a..1d86cac 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,23 @@ PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) +DBUSMENUGLIB_REQUIRED_VERSION=0.0.0 + +PKG_CHECK_MODULES(STATUSSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION) + +AC_SUBST(STATUSERVICE_CFLAGS) +AC_SUBST(STATUSERVICE_LIBS) + +PKG_CHECK_MODULES(USERSSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION) + +AC_SUBST(USERSERVICE_CFLAGS) +AC_SUBST(USERSERVICE_LIBS) + +PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION) + +AC_SUBST(SESSIONERVICE_CFLAGS) +AC_SUBST(SESSIONERVICE_LIBS) + ########################### # Indicator Info ########################### diff --git a/src/Makefile.am b/src/Makefile.am index 4e0df47..86bacb8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,8 +8,14 @@ libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) indicator_status_service_SOURCES = status-service.c +indicator_status_service_CFLAGS = $(STATUSSERVICE_CFLAGS) +indicator_status_service_LDADD = $(STATUSSERVICE_LIBS) indicator_users_service_SOURCES = users-service.c +indicator_users_service_CFLAGS = $(USERSSERVICE_CFLAGS) +indicator_users_service_LDADD = $(USERSSERVICE_LIBS) indicator_session_service_SOURCES = session-service.c +indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) +indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) -- cgit v1.2.3 From 3fc5dff1de2389211bae97ba54db3c1370dbab0c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Jun 2009 10:20:46 -0500 Subject: Adding in the basic (generated) framework for the status provider object --- src/Makefile.am | 2 +- src/status-provider.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/status-provider.h | 31 +++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 src/status-provider.c create mode 100644 src/status-provider.h (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 86bacb8..df51cf5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ libstatus_users_session_la_SOURCES = indicator-sus.c dbus-shared-names.h libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) -indicator_status_service_SOURCES = status-service.c +indicator_status_service_SOURCES = status-service.c status-provider.h status-provider.c indicator_status_service_CFLAGS = $(STATUSSERVICE_CFLAGS) indicator_status_service_LDADD = $(STATUSSERVICE_LIBS) diff --git a/src/status-provider.c b/src/status-provider.c new file mode 100644 index 0000000..c2f7de2 --- /dev/null +++ b/src/status-provider.c @@ -0,0 +1,55 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "status-provider.h" + +typedef struct _StatusProviderPrivate StatusProviderPrivate; +struct _StatusProviderPrivate { +}; + +#define STATUS_PROVIDER_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), STATUS_PROVIDER_TYPE, StatusProviderPrivate)) + +static void status_provider_class_init (StatusProviderClass *klass); +static void status_provider_init (StatusProvider *self); +static void status_provider_dispose (GObject *object); +static void status_provider_finalize (GObject *object); + +G_DEFINE_TYPE (StatusProvider, status_provider, G_TYPE_OBJECT); + +static void +status_provider_class_init (StatusProviderClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (StatusProviderPrivate)); + + object_class->dispose = status_provider_dispose; + object_class->finalize = status_provider_finalize; + + return; +} + +static void +status_provider_init (StatusProvider *self) +{ + + return; +} + +static void +status_provider_dispose (GObject *object) +{ + + G_OBJECT_CLASS (status_provider_parent_class)->dispose (object); + return; +} + +static void +status_provider_finalize (GObject *object) +{ + + G_OBJECT_CLASS (status_provider_parent_class)->finalize (object); + return; +} diff --git a/src/status-provider.h b/src/status-provider.h new file mode 100644 index 0000000..7d36f02 --- /dev/null +++ b/src/status-provider.h @@ -0,0 +1,31 @@ +#ifndef __STATUS_PROVIDER_H__ +#define __STATUS_PROVIDER_H__ + +#include +#include + +G_BEGIN_DECLS + +#define STATUS_PROVIDER_TYPE (status_provider_get_type ()) +#define STATUS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_TYPE, StatusProvider)) +#define STATUS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_TYPE, StatusProviderClass)) +#define IS_STATUS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_PROVIDER_TYPE)) +#define IS_STATUS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_PROVIDER_TYPE)) +#define STATUS_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_PROVIDER_TYPE, StatusProviderClass)) + + +typedef struct _StatusProviderClass StatusProviderClass; +struct _StatusProviderClass { + GObjectClass parent_class; +}; + +typedef struct _StatusProvider StatusProvider; +struct _StatusProvider { + GObject parent; +}; + +GType status_provider_get_type (void); + +G_END_DECLS + +#endif -- cgit v1.2.3 From 963f1418caa6b438d80445b2eb66f5b42e5add06 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Jun 2009 14:47:42 -0500 Subject: Preliminary pidgin wrappers. --- src/Makefile.am | 6 ++++- src/status-provider-pidgin.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ src/status-provider-pidgin.h | 33 ++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 src/status-provider-pidgin.c create mode 100644 src/status-provider-pidgin.h (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index df51cf5..a5380ac 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,11 @@ libstatus_users_session_la_SOURCES = indicator-sus.c dbus-shared-names.h libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) -indicator_status_service_SOURCES = status-service.c status-provider.h status-provider.c +indicator_status_service_SOURCES = status-service.c \ + status-provider.h \ + status-provider.c \ + status-provider-pidgin.h \ + status-provider-pidgin.c indicator_status_service_CFLAGS = $(STATUSSERVICE_CFLAGS) indicator_status_service_LDADD = $(STATUSSERVICE_LIBS) diff --git a/src/status-provider-pidgin.c b/src/status-provider-pidgin.c new file mode 100644 index 0000000..16fbb69 --- /dev/null +++ b/src/status-provider-pidgin.c @@ -0,0 +1,56 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "status-provider.h" +#include "status-provider-pidgin.h" + +typedef struct _StatusProviderPidginPrivate StatusProviderPidginPrivate; +struct _StatusProviderPidginPrivate { +}; + +#define STATUS_PROVIDER_PIDGIN_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidginPrivate)) + +static void status_provider_pidgin_class_init (StatusProviderPidginClass *klass); +static void status_provider_pidgin_init (StatusProviderPidgin *self); +static void status_provider_pidgin_dispose (GObject *object); +static void status_provider_pidgin_finalize (GObject *object); + +G_DEFINE_TYPE (StatusProviderPidgin, status_provider_pidgin, STATUS_PROVIDER_TYPE); + +static void +status_provider_pidgin_class_init (StatusProviderPidginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (StatusProviderPidginPrivate)); + + object_class->dispose = status_provider_pidgin_dispose; + object_class->finalize = status_provider_pidgin_finalize; + + return; +} + +static void +status_provider_pidgin_init (StatusProviderPidgin *self) +{ + + return; +} + +static void +status_provider_pidgin_dispose (GObject *object) +{ + + G_OBJECT_CLASS (status_provider_pidgin_parent_class)->dispose (object); + return; +} + +static void +status_provider_pidgin_finalize (GObject *object) +{ + + G_OBJECT_CLASS (status_provider_pidgin_parent_class)->finalize (object); + return; +} diff --git a/src/status-provider-pidgin.h b/src/status-provider-pidgin.h new file mode 100644 index 0000000..5d4459c --- /dev/null +++ b/src/status-provider-pidgin.h @@ -0,0 +1,33 @@ +#ifndef __STATUS_PROVIDER_PIDGIN_H__ +#define __STATUS_PROVIDER_PIDGIN_H__ + +#include +#include + +#include "status-provider.h" + +G_BEGIN_DECLS + +#define STATUS_PROVIDER_PIDGIN_TYPE (status_provider_pidgin_get_type ()) +#define STATUS_PROVIDER_PIDGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidgin)) +#define STATUS_PROVIDER_PIDGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidginClass)) +#define IS_STATUS_PROVIDER_PIDGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_PROVIDER_PIDGIN_TYPE)) +#define IS_STATUS_PROVIDER_PIDGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_PROVIDER_PIDGIN_TYPE)) +#define STATUS_PROVIDER_PIDGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidginClass)) + + +typedef struct _StatusProviderPidginClass StatusProviderPidginClass; +struct _StatusProviderPidginClass { + StatusProviderClass parent_class; +}; + +typedef struct _StatusProviderPidgin StatusProviderPidgin; +struct _StatusProviderPidgin { + StatusProvider parent; +}; + +GType status_provider_pidgin_get_type (void); + +G_END_DECLS + +#endif -- cgit v1.2.3 From d9116a6713e4a7d5bdbf10ba96fc3d34caf4f5eb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Jun 2009 16:20:47 -0500 Subject: Adding a DBus interface for the status specific stuff --- src/Makefile.am | 33 ++++++++++++++++++++++++++++----- src/status-service.xml | 23 +++++++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 src/status-service.xml (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index a5380ac..a6ce265 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,14 +7,31 @@ libstatus_users_session_la_SOURCES = indicator-sus.c dbus-shared-names.h libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) -indicator_status_service_SOURCES = status-service.c \ - status-provider.h \ - status-provider.c \ - status-provider-pidgin.h \ - status-provider-pidgin.c +indicator_status_service_SOURCES = \ + status-service.c \ + status-service-client.h \ + status-service-server.h \ + status-provider.h \ + status-provider.c \ + status-provider-pidgin.h \ + status-provider-pidgin.c indicator_status_service_CFLAGS = $(STATUSSERVICE_CFLAGS) indicator_status_service_LDADD = $(STATUSSERVICE_LIBS) +status-service-client.h: status-service.xml + dbus-binding-tool \ + --prefix=_status_service_client \ + --mode=glib-client \ + --output=status-service-client.h \ + $(srcdir)/status-service.xml + +status-service-server.h: status-service.xml + dbus-binding-tool \ + --prefix=_status_service_server \ + --mode=glib-server \ + --output=status-service-server.h \ + $(srcdir)/status-service.xml + indicator_users_service_SOURCES = users-service.c indicator_users_service_CFLAGS = $(USERSSERVICE_CFLAGS) indicator_users_service_LDADD = $(USERSSERVICE_LIBS) @@ -23,3 +40,9 @@ indicator_session_service_SOURCES = session-service.c indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) +BUILT_SOURCES = \ + status-service-client.h \ + status-service-server.h + +EXTRA_DIST = \ + status-service.xml diff --git a/src/status-service.xml b/src/status-service.xml new file mode 100644 index 0000000..189df81 --- /dev/null +++ b/src/status-service.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 92632f9ebdf278b654c6ad99eabab826e4b32cac Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Jun 2009 16:31:10 -0500 Subject: Actually the client is the indicator. Silly to have one binary be both client and server, heh. --- src/Makefile.am | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index a6ce265..a6a4dd5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,15 +1,25 @@ libexec_PROGRAMS = indicator-status-service indicator-users-service indicator-session-service +################### +# Indicator Stuff +################### + status_users_sessionlibdir = $(INDICATORDIR) status_users_sessionlib_LTLIBRARIES = libstatus-users-session.la -libstatus_users_session_la_SOURCES = indicator-sus.c dbus-shared-names.h +libstatus_users_session_la_SOURCES = \ + indicator-sus.c \ + dbus-shared-names.h \ + status-service-client.h libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) +################ +# Status Stuff +################ + indicator_status_service_SOURCES = \ status-service.c \ - status-service-client.h \ status-service-server.h \ status-provider.h \ status-provider.c \ @@ -32,14 +42,26 @@ status-service-server.h: status-service.xml --output=status-service-server.h \ $(srcdir)/status-service.xml +############### +# Users Stuff +############### + indicator_users_service_SOURCES = users-service.c indicator_users_service_CFLAGS = $(USERSSERVICE_CFLAGS) indicator_users_service_LDADD = $(USERSSERVICE_LIBS) +################# +# Session Stuff +################# + indicator_session_service_SOURCES = session-service.c indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) +############### +# Other Stuff +############### + BUILT_SOURCES = \ status-service-client.h \ status-service-server.h -- cgit v1.2.3 From 9eb765152122a08ddfa95b150d9a7d5c46559356 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Jun 2009 16:56:08 -0500 Subject: A quickly little object to put itself on DBus. --- src/Makefile.am | 2 ++ src/status-service-dbus.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ src/status-service-dbus.h | 31 ++++++++++++++++++++++++++ src/status-service.c | 2 ++ 4 files changed, 91 insertions(+) create mode 100644 src/status-service-dbus.c create mode 100644 src/status-service-dbus.h (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index a6a4dd5..1965fe9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,6 +20,8 @@ libstatus_users_session_la_LIBADD = $(APPLET_LIBS) indicator_status_service_SOURCES = \ status-service.c \ + status-service-dbus.h \ + status-service-dbus.c \ status-service-server.h \ status-provider.h \ status-provider.c \ diff --git a/src/status-service-dbus.c b/src/status-service-dbus.c new file mode 100644 index 0000000..1eb94ca --- /dev/null +++ b/src/status-service-dbus.c @@ -0,0 +1,56 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "status-service-dbus.h" + +static void status_service_dbus_class_init (StatusServiceDbusClass *klass); +static void status_service_dbus_init (StatusServiceDbus *self); +static void status_service_dbus_dispose (GObject *object); +static void status_service_dbus_finalize (GObject *object); +static void _status_service_server_watch (void); + +#include "status-service-server.h" + +G_DEFINE_TYPE (StatusServiceDbus, status_service_dbus, G_TYPE_OBJECT); + +static void +status_service_dbus_class_init (StatusServiceDbusClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = status_service_dbus_dispose; + object_class->finalize = status_service_dbus_finalize; + + return; +} + +static void +status_service_dbus_init (StatusServiceDbus *self) +{ + + return; +} + +static void +status_service_dbus_dispose (GObject *object) +{ + + G_OBJECT_CLASS (status_service_dbus_parent_class)->dispose (object); + return; +} + +static void +status_service_dbus_finalize (GObject *object) +{ + + G_OBJECT_CLASS (status_service_dbus_parent_class)->finalize (object); + return; +} + +static void +_status_service_server_watch (void) +{ + + return; +} diff --git a/src/status-service-dbus.h b/src/status-service-dbus.h new file mode 100644 index 0000000..1805dc5 --- /dev/null +++ b/src/status-service-dbus.h @@ -0,0 +1,31 @@ +#ifndef __STATUS_SERVICE_DBUS_H__ +#define __STATUS_SERVICE_DBUS_H__ + +#include +#include + +G_BEGIN_DECLS + +#define STATUS_SERVICE_DBUS_TYPE (status_service_dbus_get_type ()) +#define STATUS_SERVICE_DBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_SERVICE_DBUS_TYPE, StatusServiceDbus)) +#define STATUS_SERVICE_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_SERVICE_DBUS_TYPE, StatusServiceDbusClass)) +#define IS_STATUS_SERVICE_DBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_SERVICE_DBUS_TYPE)) +#define IS_STATUS_SERVICE_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_SERVICE_DBUS_TYPE)) +#define STATUS_SERVICE_DBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_SERVICE_DBUS_TYPE, StatusServiceDbusClass)) + +typedef struct _StatusServiceDbus StatusServiceDbus; +typedef struct _StatusServiceDbusClass StatusServiceDbusClass; + +struct _StatusServiceDbusClass { + GObjectClass parent_class; +}; + +struct _StatusServiceDbus { + GObject parent; +}; + +GType status_service_dbus_get_type (void); + +G_END_DECLS + +#endif diff --git a/src/status-service.c b/src/status-service.c index 392b23a..e31a0db 100644 --- a/src/status-service.c +++ b/src/status-service.c @@ -9,6 +9,8 @@ #include "dbus-shared-names.h" +#include "status-service-dbus.h" + #include "status-provider.h" #include "status-provider-pidgin.h" -- cgit v1.2.3 From 5a5c1bb4559496948f43d893f17ca84690a847d0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 22 Jun 2009 13:08:35 -0500 Subject: Removing the .so* stuff --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 1965fe9..b681b5b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,6 +13,7 @@ libstatus_users_session_la_SOURCES = \ status-service-client.h libstatus_users_session_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libstatus_users_session_la_LIBADD = $(APPLET_LIBS) +libstatus_users_session_la_LDFLAGS = -module -avoid-version ################ # Status Stuff -- cgit v1.2.3 From 96ca29c44edb5a8b92339d8be7b8b9189cc8863b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Jul 2009 15:56:01 -0500 Subject: Building a little dialog. Now it's kinda linked into the build system. --- configure.ac | 1 + src/Makefile.am | 1 + src/gtk-dialog/Makefile.am | 8 + src/gtk-dialog/gtk-logout-helper.c | 8 + src/gtk-dialog/logout-dialog.c | 369 +++++++++++++++++++++++++++++++++++++ src/gtk-dialog/logout-dialog.h | 99 ++++++++++ 6 files changed, 486 insertions(+) create mode 100644 src/gtk-dialog/Makefile.am create mode 100644 src/gtk-dialog/gtk-logout-helper.c create mode 100644 src/gtk-dialog/logout-dialog.c create mode 100644 src/gtk-dialog/logout-dialog.h (limited to 'src/Makefile.am') diff --git a/configure.ac b/configure.ac index d299a0d..58fee07 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,7 @@ AC_SUBST(DBUSSERVICEDIR) AC_OUTPUT([ Makefile src/Makefile +src/gtk-dialog/Makefile data/Makefile ]) diff --git a/src/Makefile.am b/src/Makefile.am index b681b5b..cf18aaa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,4 @@ +SUBDIRS = gtk-dialog libexec_PROGRAMS = indicator-status-service indicator-users-service indicator-session-service diff --git a/src/gtk-dialog/Makefile.am b/src/gtk-dialog/Makefile.am new file mode 100644 index 0000000..20e3d83 --- /dev/null +++ b/src/gtk-dialog/Makefile.am @@ -0,0 +1,8 @@ + +libexec_PROGRAMS = gtk-logout-helper + +gtk_logout_helper_SOURCES = \ + gtk-logout-helper.c \ + logout-dialog.c \ + logout-dialog.h + diff --git a/src/gtk-dialog/gtk-logout-helper.c b/src/gtk-dialog/gtk-logout-helper.c new file mode 100644 index 0000000..f268be4 --- /dev/null +++ b/src/gtk-dialog/gtk-logout-helper.c @@ -0,0 +1,8 @@ + +int +main (int argc, char * argv[]) +{ + + + return 0; +} diff --git a/src/gtk-dialog/logout-dialog.c b/src/gtk-dialog/logout-dialog.c new file mode 100644 index 0000000..0cd0f7a --- /dev/null +++ b/src/gtk-dialog/logout-dialog.c @@ -0,0 +1,369 @@ +/* + * libgksuui -- Gtk+ widget and convenience functions for requesting passwords + * Copyright (C) 2004 Gustavo Noronha Silva + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include + +#include +#include +#include +#include + +#include "../config.h" + +#include "logout-dialog.h" +#include "applet.h" + +enum { + PROP_ZERO, + PROP_ACTION +}; + + +static void +logout_dialog_class_init (LogoutDialogClass *klass); + +static void +logout_dialog_init (LogoutDialog *logout_dialog); + +static void +set_property (GObject * object, guint param_id, const GValue * value, GParamSpec *pspec); + +static void +get_property (GObject * object, guint param_id, GValue * value, GParamSpec *pspec); + +static gboolean +timer_cb (gpointer data); + +static void +show_cb (GtkWidget * widget, gpointer data); + +static void +check_restart (LogoutDialog * dialog); + +static gchar* +get_plural_string (LogoutDialog * dialog); + +static const gchar * title_strings[LOGOUT_DIALOG_ACTION_CNT] = { + /* LOGOUT_DIALOG_LOGOUT, */ NC_("title", "Log Out"), + /* LOGOUT_DIALOG_RESTART, */ NC_("title", "Restart"), + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("title", "Shut Down") +}; + +static const gchar * button_strings[LOGOUT_DIALOG_ACTION_CNT] = { + /* LOGOUT_DIALOG_LOGOUT, */ NC_("button", "Log Out"), + /* LOGOUT_DIALOG_RESTART, */ NC_("button", "Restart"), + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Shut Down") +}; + +static const gchar * restart_auth = N_("Restart..."); + +static const gchar * body_logout_update = N_("You recently installed updates which will only take effect after a restart. Restart to apply software updates."); + +static const gchar * icon_strings[LOGOUT_DIALOG_ACTION_CNT] = { + /* LOGOUT_DIALOG_LOGOUT, */ "system-log-out", + /* LOGOUT_DIALOG_RESTART, */ "system-restart", + /* LOGOUT_DIALOG_SHUTDOWN, */ "system-shutdown" +}; + +GType +logout_dialog_get_type (void) +{ + static GType type = 0; + + if (type == 0) + { + static const GTypeInfo info = + { + sizeof (LogoutDialogClass), /* size of class */ + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) logout_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (LogoutDialog), /* size of object */ + 0, /* n_preallocs */ + (GInstanceInitFunc) logout_dialog_init /* instance_init */ + }; + type = g_type_register_static (gtk_dialog_get_type (), + "LogoutDialogType", + &info, 0); + } + + return type; +} + +static gchar* +get_plural_string (LogoutDialog * dialog) +{ + static gchar *plural_string = ""; + + switch (dialog->action) + { + case LOGOUT_DIALOG_LOGOUT: + plural_string = ngettext("You will be logged out in %d second.", + "You will be logged out in %d seconds.", + dialog->timeout); + break; + case LOGOUT_DIALOG_RESTART: + plural_string = ngettext("The computer will restart in %d second.", + "The computer will restart in %d seconds.", + dialog->timeout); + break; + case LOGOUT_DIALOG_SHUTDOWN: + plural_string = ngettext("The computer will be shut down in %d second.", + "The computer will be shut down in %d seconds.", + dialog->timeout); + break; + default: + break; + } + + return plural_string; +} + +static void +logout_dialog_class_init (LogoutDialogClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property(gobject_class, PROP_ACTION, + g_param_spec_int("action", NULL, NULL, + LOGOUT_DIALOG_LOGOUT, LOGOUT_DIALOG_SHUTDOWN, + LOGOUT_DIALOG_LOGOUT, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + return; +} + +static void +set_property (GObject * object, guint param_id, const GValue * value, GParamSpec *pspec) +{ + g_return_if_fail(param_id == PROP_ACTION); + + LogoutDialog * dialog = LOGOUT_DIALOG(object); + dialog->action = (LogoutDialogAction)g_value_get_int(value); + + gtk_image_set_from_icon_name(GTK_IMAGE(dialog->image), icon_strings[dialog->action], GTK_ICON_SIZE_DIALOG); + gtk_window_set_title (GTK_WINDOW(dialog), _(title_strings[dialog->action])); + gtk_widget_hide(dialog->message); + gtk_button_set_label(GTK_BUTTON(dialog->ok_button), _(button_strings[dialog->action])); + + gchar * timeouttxt = g_strdup_printf(get_plural_string(dialog), dialog->timeout); + gtk_label_set_text(GTK_LABEL(dialog->timeout_text), timeouttxt); + g_free(timeouttxt); + + check_restart(dialog); + + return; +} + +static void +get_property (GObject * object, guint param_id, GValue * value, GParamSpec *pspec) +{ + g_return_if_fail(param_id == PROP_ACTION); + g_value_set_int(value, LOGOUT_DIALOG(object)->action); +} + +static gboolean +timer_cb (gpointer data) +{ + LogoutDialog * dialog = LOGOUT_DIALOG(data); + + if (dialog->timeout == 0) { + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); + dialog->timerfunc = 0; + return FALSE; + } else { + dialog->timeout--; + + gchar * timeouttxt = g_strdup_printf(get_plural_string(dialog), dialog->timeout); + gtk_label_set_text(GTK_LABEL(dialog->timeout_text), timeouttxt); + g_free(timeouttxt); + } + + return TRUE; +} + +static void +show_cb (GtkWidget * widget, gpointer data) +{ + LogoutDialog * dialog = LOGOUT_DIALOG(widget); + + if (dialog->timerfunc != 0) { + g_source_remove(dialog->timerfunc); + dialog->timerfunc = 0; + } + + dialog->timerfunc = g_timeout_add_seconds(1, timer_cb, dialog); + return; +} + +static void +check_restart (LogoutDialog * dialog) +{ + if (dialog->action != LOGOUT_DIALOG_LOGOUT) { + return; + } + + if (g_file_test("/var/run/reboot-required", G_FILE_TEST_EXISTS)) { + if (pk_can_do_action("org.freedesktop.consolekit.system.restart", NULL) || + pk_can_do_action("org.freedesktop.consolekit.system.restart-multiple-users", NULL)) { + + gtk_label_set_text(GTK_LABEL(dialog->message), _(body_logout_update)); + gtk_widget_show(dialog->message); + if (pk_require_auth(LOGOUT_DIALOG_RESTART)) { + gtk_button_set_label(GTK_BUTTON(dialog->restart_button), _(restart_auth)); + } else { + gtk_button_set_label(GTK_BUTTON(dialog->restart_button), _(button_strings[LOGOUT_DIALOG_RESTART])); + } + gtk_widget_show(dialog->restart_button); + } + } + + return; +} + +static gboolean +focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) +{ + gtk_window_present (GTK_WINDOW(widget)); + return TRUE; +} + +static void +logout_dialog_init (LogoutDialog *logout_dialog) +{ + GtkDialog *dialog; + gint border_width = 6; + + logout_dialog->timeout = 60; + logout_dialog->timerfunc = 0; + + /* dialog window */ + dialog = GTK_DIALOG(logout_dialog); + + /* make sure that our window will always have the focus */ + g_signal_connect (G_OBJECT(dialog), "focus-out-event", + G_CALLBACK(focus_out_cb), NULL); + + logout_dialog->main_vbox = dialog->vbox; + + gtk_window_set_title (GTK_WINDOW(logout_dialog), ""); + gtk_dialog_set_has_separator (GTK_DIALOG(logout_dialog), FALSE); + gtk_container_set_border_width (GTK_CONTAINER(logout_dialog), border_width); + gtk_box_set_spacing (GTK_BOX(logout_dialog->main_vbox), 12); + gtk_window_set_resizable (GTK_WINDOW(logout_dialog), FALSE); + + gtk_window_stick(GTK_WINDOW(logout_dialog)); + gtk_window_set_keep_above(GTK_WINDOW(logout_dialog), TRUE); + gtk_widget_realize(GTK_WIDGET(logout_dialog)); + gdk_window_set_functions(GTK_WIDGET(logout_dialog)->window, GDK_FUNC_CLOSE); + + /* center window */ + gtk_window_set_position (GTK_WINDOW(logout_dialog), GTK_WIN_POS_CENTER); + + /* the action buttons */ + /* the cancel button */ + logout_dialog->restart_button = gtk_dialog_add_button (dialog, + GTK_STOCK_HELP, + GTK_RESPONSE_HELP); + gtk_button_set_label(GTK_BUTTON(logout_dialog->restart_button), _(button_strings[LOGOUT_DIALOG_RESTART])); + gtk_widget_hide(logout_dialog->restart_button); + + /* the cancel button */ + logout_dialog->cancel_button = gtk_dialog_add_button (dialog, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL); + /* the ok button */ + logout_dialog->ok_button = gtk_dialog_add_button (dialog, + GTK_STOCK_OK, + GTK_RESPONSE_OK); + gtk_widget_grab_default (logout_dialog->ok_button); + + /* Title */ + gtk_window_set_title (GTK_WINDOW(logout_dialog), _(title_strings[logout_dialog->action])); + + /* hbox */ + logout_dialog->hbox = gtk_hbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER(logout_dialog->hbox), 6); + gtk_box_pack_start (GTK_BOX(logout_dialog->main_vbox), + logout_dialog->hbox, FALSE, FALSE, 0); + gtk_widget_show (logout_dialog->hbox); + + /* image */ + logout_dialog->image = + gtk_image_new_from_icon_name (icon_strings[logout_dialog->action], + GTK_ICON_SIZE_DIALOG); + gtk_misc_set_alignment (GTK_MISC(logout_dialog->image), 0.5, 0); + gtk_box_pack_start (GTK_BOX(logout_dialog->hbox), logout_dialog->image, + FALSE, FALSE, 0); + gtk_widget_show (logout_dialog->image); + + /* vbox for text */ + logout_dialog->vbox_text = gtk_vbox_new(FALSE, 12); + gtk_box_pack_start(GTK_BOX(logout_dialog->hbox), logout_dialog->vbox_text, TRUE, TRUE, 0); + gtk_widget_show(logout_dialog->vbox_text); + + /* Message */ + logout_dialog->message = gtk_label_new(""); + gtk_label_set_line_wrap(GTK_LABEL(logout_dialog->message), TRUE); + gtk_label_set_single_line_mode(GTK_LABEL(logout_dialog->message), FALSE); + gtk_label_set_selectable(GTK_LABEL(logout_dialog->message), TRUE); + gtk_misc_set_alignment (GTK_MISC(logout_dialog->message), 0.0, 0.0); + gtk_box_pack_start(GTK_BOX(logout_dialog->vbox_text), logout_dialog->message, TRUE, TRUE, 0); + gtk_widget_show(logout_dialog->message); + + /* timeout */ + logout_dialog->timeout_text = gtk_label_new(""); + gtk_label_set_line_wrap(GTK_LABEL(logout_dialog->timeout_text), TRUE); + gtk_label_set_single_line_mode(GTK_LABEL(logout_dialog->timeout_text), FALSE); + gtk_label_set_selectable(GTK_LABEL(logout_dialog->timeout_text), FALSE); + gtk_misc_set_alignment (GTK_MISC(logout_dialog->timeout_text), 0.0, 0.5); + gtk_box_pack_start(GTK_BOX(logout_dialog->vbox_text), logout_dialog->timeout_text, TRUE, TRUE, 0); + gtk_widget_show(logout_dialog->timeout_text); + + g_signal_connect(G_OBJECT(logout_dialog), "show", G_CALLBACK(show_cb), logout_dialog); + + return; +} + +/** + * logout_dialog_new: + * + * Creates a new #LogoutDialog. + * + * Returns: the new #LogoutDialog + */ +GtkWidget* +logout_dialog_new (LogoutDialogAction action) +{ + LogoutDialog * dialog = g_object_new (LOGOUT_TYPE_DIALOG, "action", action, NULL); + return GTK_WIDGET(dialog); +} + +LogoutDialogAction +logout_dialog_get_action (LogoutDialog * dialog) +{ + return dialog->action; +} + diff --git a/src/gtk-dialog/logout-dialog.h b/src/gtk-dialog/logout-dialog.h new file mode 100644 index 0000000..b0e19b7 --- /dev/null +++ b/src/gtk-dialog/logout-dialog.h @@ -0,0 +1,99 @@ +/* + * libgksuui -- Gtk+ widget and convenience functions for requesting passwords + * Copyright (C) 2004 Gustavo Noronha Silva + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __LOGOUT_DIALOG_H__ +#define __LOGOUT_DIALOG_H__ + +#include + +G_BEGIN_DECLS + +#define LOGOUT_TYPE_DIALOG (logout_dialog_get_type ()) +#define LOGOUT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LOGOUT_TYPE_DIALOG, LogoutDialog)) +#define LOGOUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LOGOUT_TYPE_DIALOG, LogoutDialogClass)) +#define LOGOUT_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LOGOUT_TYPE_DIALOG)) +#define LOGOUT_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOGOUT_TYPE_CONTEXT)) +#define LOGOUT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOGOUT_TYPE_DIALOG, LogoutDialogClass)) + +typedef struct _LogoutDialogClass LogoutDialogClass; +typedef struct _LogoutDialog LogoutDialog; +typedef enum _LogoutDialogAction LogoutDialogAction; + +enum _LogoutDialogAction { + LOGOUT_DIALOG_LOGOUT, + LOGOUT_DIALOG_RESTART, + LOGOUT_DIALOG_SHUTDOWN, + LOGOUT_DIALOG_ACTION_CNT +}; + +struct _LogoutDialogClass +{ + GtkDialogClass parent_class; +}; + +/** + * LogoutDialog: + * @dialog: parent widget + * @main_vbox: GtkDialog's vbox + * @hbox: box to separate the image of the right-side widgets + * @image: the authorization image, left-side widget + * @entry_vbox: right-side widgets container + * @label: message describing what is required from the user, + * right-side widget + * @entry: place to type the password in, right-side widget + * @ok_button: OK button of the dialog + * @cancel_button: Cancel button of the dialog + * + * Convenience widget based on #GtkDialog to request a password. + */ +struct _LogoutDialog +{ + GtkDialog dialog; + + GtkWidget *main_vbox; + GtkWidget *hbox; + GtkWidget *image; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *restart_button; + GtkWidget *vbox_text; + GtkWidget *message; + GtkWidget *timeout_text; + + LogoutDialogAction action; + + /* private */ + gchar * timeout_result; + guint timeout; + guint timerfunc; +}; + +GType +logout_dialog_get_type (void); + +GtkWidget* +logout_dialog_new (LogoutDialogAction action); + +LogoutDialogAction +logout_dialog_get_action (LogoutDialog * widget); + +G_END_DECLS + +#endif -- cgit v1.2.3 From c9cfcc8a9aefd2122e80e3674c0da96ffe849a34 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Jul 2009 12:31:39 -0500 Subject: Executing the helper, but it needs to be the one in the libexec path. --- src/Makefile.am | 2 +- src/session-service.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index cf18aaa..ab79f0f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,7 +59,7 @@ indicator_users_service_LDADD = $(USERSSERVICE_LIBS) ################# indicator_session_service_SOURCES = session-service.c -indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) +indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) ############### diff --git a/src/session-service.c b/src/session-service.c index 55e60df..b301baf 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -15,7 +15,19 @@ static GMainLoop * mainloop = NULL; static void show_dialog (DbusmenuMenuitem * mi, gchar * type) { - g_debug("Showing dialog '%s'", type); + gchar * helper = g_build_path(LIBEXECDIR, "gtk-logout-helper", NULL); + gchar * dialog_line = g_strdup_printf("%s --%s", helper, type); + g_free(helper); + + g_debug("Showing dialog '%s'", dialog_line); + + GError * error = NULL; + if (!g_spawn_command_line_async(dialog_line, &error)) { + g_warning("Unable to show dialog: %s", error->message); + g_error_free(error); + } + + g_free(dialog_line); return; } -- cgit v1.2.3