aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend-dbus/actions.c16
-rw-r--r--src/backend-dbus/actions.h4
-rw-r--r--src/backend-dbus/guest.c14
-rw-r--r--src/backend-dbus/guest.h4
-rw-r--r--src/backend-dbus/users.c16
-rw-r--r--src/backend-dbus/users.h4
-rw-r--r--src/recoverable-problem.c234
-rw-r--r--src/service.c12
8 files changed, 140 insertions, 164 deletions
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c
index d8c5f62..f1c2498 100644
--- a/src/backend-dbus/actions.c
+++ b/src/backend-dbus/actions.c
@@ -47,7 +47,7 @@ enum
END_SESSION_TYPE_REBOOT
};
-struct _IndicatorSessionActionsDbusPriv
+struct _IndicatorSessionActionsDbusPrivate
{
GCancellable * cancellable;
@@ -70,11 +70,9 @@ struct _IndicatorSessionActionsDbusPriv
gboolean seat_allows_activation;
};
-typedef IndicatorSessionActionsDbusPriv priv_t;
+typedef IndicatorSessionActionsDbusPrivate priv_t;
-G_DEFINE_TYPE (IndicatorSessionActionsDbus,
- indicator_session_actions_dbus,
- INDICATOR_TYPE_SESSION_ACTIONS)
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorSessionActionsDbus, indicator_session_actions_dbus, INDICATOR_TYPE_SESSION_ACTIONS)
/***
****
@@ -449,7 +447,7 @@ my_can_reboot (IndicatorSessionActions * actions)
{
IndicatorSessionActionsDbus * self = INDICATOR_SESSION_ACTIONS_DBUS(actions);
priv_t * p = self->priv;
-
+
if (g_settings_get_boolean (p->indicator_settings, "suppress-restart-menuitem"))
return FALSE;
@@ -1334,8 +1332,6 @@ indicator_session_actions_dbus_class_init (IndicatorSessionActionsDbusClass * kl
actions_class->switch_to_greeter = my_switch_to_greeter;
actions_class->switch_to_guest = my_switch_to_guest;
actions_class->switch_to_username = my_switch_to_username;
-
- g_type_class_add_private (klass, sizeof (IndicatorSessionActionsDbusPriv));
}
static void
@@ -1345,9 +1341,7 @@ indicator_session_actions_dbus_init (IndicatorSessionActionsDbus * self)
priv_t * p;
GSettings * s;
- p = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_TYPE_SESSION_ACTIONS_DBUS,
- IndicatorSessionActionsDbusPriv);
+ p = indicator_session_actions_dbus_get_instance_private (self);
p->cancellable = g_cancellable_new ();
p->seat_allows_activation = TRUE;
self->priv = p;
diff --git a/src/backend-dbus/actions.h b/src/backend-dbus/actions.h
index 97d816a..dac392c 100644
--- a/src/backend-dbus/actions.h
+++ b/src/backend-dbus/actions.h
@@ -37,7 +37,7 @@ G_BEGIN_DECLS
#define INDICATOR_IS_SESSION_ACTIONS_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), INDICATOR_TYPE_SESSION_ACTIONS_DBUS))
typedef struct _IndicatorSessionActionsDbus IndicatorSessionActionsDbus;
-typedef struct _IndicatorSessionActionsDbusPriv IndicatorSessionActionsDbusPriv;
+typedef struct _IndicatorSessionActionsDbusPrivate IndicatorSessionActionsDbusPrivate;
typedef struct _IndicatorSessionActionsDbusClass IndicatorSessionActionsDbusClass;
/**
@@ -48,7 +48,7 @@ struct _IndicatorSessionActionsDbus
{
/*< private >*/
IndicatorSessionActions parent;
- IndicatorSessionActionsDbusPriv * priv;
+ IndicatorSessionActionsDbusPrivate * priv;
};
struct _IndicatorSessionActionsDbusClass
diff --git a/src/backend-dbus/guest.c b/src/backend-dbus/guest.c
index 3269097..a1358c5 100644
--- a/src/backend-dbus/guest.c
+++ b/src/backend-dbus/guest.c
@@ -21,7 +21,7 @@
#include "guest.h"
-struct _IndicatorSessionGuestDbusPriv
+struct _IndicatorSessionGuestDbusPrivate
{
GCancellable * cancellable;
@@ -34,11 +34,9 @@ struct _IndicatorSessionGuestDbusPriv
gboolean guest_is_allowed;
};
-typedef IndicatorSessionGuestDbusPriv priv_t;
+typedef IndicatorSessionGuestDbusPrivate priv_t;
-G_DEFINE_TYPE (IndicatorSessionGuestDbus,
- indicator_session_guest_dbus,
- INDICATOR_TYPE_SESSION_GUEST)
+G_DEFINE_TYPE_WITH_PRIVATE (IndicatorSessionGuestDbus, indicator_session_guest_dbus, INDICATOR_TYPE_SESSION_GUEST)
/***
****
@@ -352,8 +350,6 @@ indicator_session_guest_dbus_class_init (IndicatorSessionGuestDbusClass * klass)
guest_class->is_logged_in = my_is_logged_in;
guest_class->is_active = my_is_active;
guest_class->switch_to_guest = my_switch_to_guest;
-
- g_type_class_add_private (klass, sizeof (IndicatorSessionGuestDbusPriv));
}
static void
@@ -361,9 +357,7 @@ indicator_session_guest_dbus_init (IndicatorSessionGuestDbus * self)
{
priv_t * p;
- p = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_TYPE_SESSION_GUEST_DBUS,
- IndicatorSessionGuestDbusPriv);
+ p = indicator_session_guest_dbus_get_instance_private (self);
p->cancellable = g_cancellable_new ();
self->priv = p;
}
diff --git a/src/backend-dbus/guest.h b/src/backend-dbus/guest.h
index 73bb3ca..8f27433 100644
--- a/src/backend-dbus/guest.h
+++ b/src/backend-dbus/guest.h
@@ -37,7 +37,7 @@ G_BEGIN_DECLS
#define INDICATOR_IS_SESSION_GUEST_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), INDICATOR_TYPE_SESSION_GUEST_DBUS))
typedef struct _IndicatorSessionGuestDbus IndicatorSessionGuestDbus;
-typedef struct _IndicatorSessionGuestDbusPriv IndicatorSessionGuestDbusPriv;
+typedef struct _IndicatorSessionGuestDbusPrivate IndicatorSessionGuestDbusPrivate;
typedef struct _IndicatorSessionGuestDbusClass IndicatorSessionGuestDbusClass;
/**
@@ -48,7 +48,7 @@ struct _IndicatorSessionGuestDbus
{
/*< private >*/
IndicatorSessionGuest parent;
- IndicatorSessionGuestDbusPriv * priv;
+ IndicatorSessionGuestDbusPrivate * priv;
};
struct _IndicatorSessionGuestDbusClass
diff --git a/src/backend-dbus/users.c b/src/backend-dbus/users.c
index f770695..e6910c6 100644
--- a/src/backend-dbus/users.c
+++ b/src/backend-dbus/users.c
@@ -21,7 +21,7 @@
#include "users.h"
-struct _IndicatorSessionUsersDbusPriv
+struct _IndicatorSessionUsersDbusPrivate
{
Login1Manager * login1_manager;
Login1Seat * login1_seat;
@@ -45,11 +45,9 @@ struct _IndicatorSessionUsersDbusPriv
guint update_list_tag;
};
-typedef IndicatorSessionUsersDbusPriv priv_t;
+typedef IndicatorSessionUsersDbusPrivate priv_t;
-G_DEFINE_TYPE (IndicatorSessionUsersDbus,
- indicator_session_users_dbus,
- INDICATOR_TYPE_SESSION_USERS)
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorSessionUsersDbus, indicator_session_users_dbus, INDICATOR_TYPE_SESSION_USERS)
/***
****
@@ -240,7 +238,7 @@ untrack_user (IndicatorSessionUsersDbus * self,
if (uid)
{
- g_hash_table_remove (p->uid_to_account, GUINT_TO_POINTER(uid));
+ g_hash_table_remove (p->uid_to_account, GUINT_TO_POINTER(uid));
emit_user_removed (self, uid);
}
@@ -655,8 +653,6 @@ indicator_session_users_dbus_class_init (IndicatorSessionUsersDbusClass * klass)
users_class->get_uids = my_get_uids;
users_class->get_user = my_get_user;
users_class->activate_user = my_activate_user;
-
- g_type_class_add_private (klass, sizeof (IndicatorSessionUsersDbusPriv));
}
static void
@@ -664,9 +660,7 @@ indicator_session_users_dbus_init (IndicatorSessionUsersDbus * self)
{
priv_t * p;
- p = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_TYPE_SESSION_USERS_DBUS,
- IndicatorSessionUsersDbusPriv);
+ p = indicator_session_users_dbus_get_instance_private (self);
self->priv = p;
p->cancellable = g_cancellable_new ();
diff --git a/src/backend-dbus/users.h b/src/backend-dbus/users.h
index d6c17df..ed8c686 100644
--- a/src/backend-dbus/users.h
+++ b/src/backend-dbus/users.h
@@ -37,7 +37,7 @@ G_BEGIN_DECLS
#define INDICATOR_IS_SESSION_USERS_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), INDICATOR_TYPE_SESSION_USERS_DBUS))
typedef struct _IndicatorSessionUsersDbus IndicatorSessionUsersDbus;
-typedef struct _IndicatorSessionUsersDbusPriv IndicatorSessionUsersDbusPriv;
+typedef struct _IndicatorSessionUsersDbusPrivate IndicatorSessionUsersDbusPrivate;
typedef struct _IndicatorSessionUsersDbusClass IndicatorSessionUsersDbusClass;
/**
@@ -48,7 +48,7 @@ struct _IndicatorSessionUsersDbus
{
/*< private >*/
IndicatorSessionUsers parent;
- IndicatorSessionUsersDbusPriv * priv;
+ IndicatorSessionUsersDbusPrivate * priv;
};
struct _IndicatorSessionUsersDbusClass
diff --git a/src/recoverable-problem.c b/src/recoverable-problem.c
index 7aff163..f1f8890 100644
--- a/src/recoverable-problem.c
+++ b/src/recoverable-problem.c
@@ -23,145 +23,145 @@
#include <errno.h>
/* Helpers to ensure we write nicely */
-static void
+static void
write_string (int fd,
const gchar *string)
{
- int res;
- do
- res = write (fd, string, strlen (string));
- while (G_UNLIKELY (res == -1 && errno == EINTR));
+ int res;
+ do
+ res = write (fd, string, strlen (string));
+ while (G_UNLIKELY (res == -1 && errno == EINTR));
}
/* Make NULLs fast and fun! */
-static void
+static void
write_null (int fd)
{
- int res;
- do
- res = write (fd, "", 1);
- while (G_UNLIKELY (res == -1 && errno == EINTR));
+ int res;
+ do
+ res = write (fd, "", 1);
+ while (G_UNLIKELY (res == -1 && errno == EINTR));
}
/* Child watcher */
static gboolean
-apport_child_watch (GPid pid G_GNUC_UNUSED, gint status G_GNUC_UNUSED, gpointer user_data)
+apport_child_watch (gpointer user_data)
{
- g_main_loop_quit((GMainLoop *)user_data);
- return FALSE;
+ g_main_loop_quit((GMainLoop *)user_data);
+ return FALSE;
}
static gboolean
apport_child_timeout (gpointer user_data)
{
- g_warning("Recoverable Error Reporter Timeout");
- g_main_loop_quit((GMainLoop *)user_data);
- return FALSE;
+ g_warning("Recoverable Error Reporter Timeout");
+ g_main_loop_quit((GMainLoop *)user_data);
+ return FALSE;
}
/* Code to report an error */
void
report_recoverable_problem (const gchar * signature, GPid report_pid, gboolean wait, gchar * additional_properties[])
{
- GSpawnFlags flags;
- gboolean first;
- GError * error = NULL;
- gint error_stdin = 0;
- GPid pid = 0;
- gchar * pid_str = NULL;
- gchar ** argv = NULL;
- gchar * argv_nopid[2] = {
- "/usr/share/apport/recoverable_problem",
- NULL
- };
- gchar * argv_pid[4] = {
- "/usr/share/apport/recoverable_problem",
- "-p",
- NULL, /* put pid_str when allocated here */
- NULL
- };
-
-
- argv = (gchar **)argv_nopid;
-
- if (report_pid != 0) {
- pid_str = g_strdup_printf("%d", report_pid);
- argv_pid[2] = pid_str;
- argv = (gchar**)argv_pid;
- }
-
- flags = G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL;
- if (wait) {
- flags |= G_SPAWN_DO_NOT_REAP_CHILD;
- }
-
- g_spawn_async_with_pipes(NULL, /* cwd */
- argv,
- NULL, /* envp */
- flags,
- NULL, NULL, /* child setup func */
- &pid,
- &error_stdin,
- NULL, /* stdout */
- NULL, /* stderr */
- &error);
-
- if (error != NULL) {
- g_warning("Unable to report a recoverable error: %s", error->message);
- g_error_free(error);
- }
-
- first = TRUE;
-
- if (error_stdin != 0 && signature != NULL) {
- write_string(error_stdin, "DuplicateSignature");
- write_null(error_stdin);
- write_string(error_stdin, signature);
-
- first = FALSE;
- }
-
- if (error_stdin != 0 && additional_properties != NULL) {
- gint i;
- for (i = 0; additional_properties[i] != NULL; i++) {
- if (!first) {
- write_null(error_stdin);
- } else {
- first = FALSE;
- }
-
- write_string(error_stdin, additional_properties[i]);
- }
- }
-
- if (error_stdin != 0) {
- close(error_stdin);
- }
-
- if (wait && pid != 0) {
- GSource * child_source, * timeout_source;
- GMainContext * context = g_main_context_new();
- GMainLoop * loop = g_main_loop_new(context, FALSE);
-
- child_source = g_child_watch_source_new(pid);
- g_source_attach(child_source, context);
- g_source_set_callback(child_source, (GSourceFunc)apport_child_watch, loop, NULL);
-
- timeout_source = g_timeout_source_new_seconds(5);
- g_source_attach(timeout_source, context);
- g_source_set_callback(timeout_source, apport_child_timeout, loop, NULL);
-
- g_main_loop_run(loop);
-
- g_source_destroy(timeout_source);
- g_source_destroy(child_source);
- g_main_loop_unref(loop);
- g_main_context_unref(context);
-
- g_spawn_close_pid(pid);
- }
-
- g_free(pid_str);
-
- return;
+ GSpawnFlags flags;
+ gboolean first;
+ GError * error = NULL;
+ gint error_stdin = 0;
+ GPid pid = 0;
+ gchar * pid_str = NULL;
+ gchar ** argv = NULL;
+ gchar * argv_nopid[2] = {
+ "/usr/share/apport/recoverable_problem",
+ NULL
+ };
+ gchar * argv_pid[4] = {
+ "/usr/share/apport/recoverable_problem",
+ "-p",
+ NULL, /* put pid_str when allocated here */
+ NULL
+ };
+
+
+ argv = (gchar **)argv_nopid;
+
+ if (report_pid != 0) {
+ pid_str = g_strdup_printf("%d", report_pid);
+ argv_pid[2] = pid_str;
+ argv = (gchar**)argv_pid;
+ }
+
+ flags = G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL;
+ if (wait) {
+ flags |= G_SPAWN_DO_NOT_REAP_CHILD;
+ }
+
+ g_spawn_async_with_pipes(NULL, /* cwd */
+ argv,
+ NULL, /* envp */
+ flags,
+ NULL, NULL, /* child setup func */
+ &pid,
+ &error_stdin,
+ NULL, /* stdout */
+ NULL, /* stderr */
+ &error);
+
+ if (error != NULL) {
+ g_warning("Unable to report a recoverable error: %s", error->message);
+ g_error_free(error);
+ }
+
+ first = TRUE;
+
+ if (error_stdin != 0 && signature != NULL) {
+ write_string(error_stdin, "DuplicateSignature");
+ write_null(error_stdin);
+ write_string(error_stdin, signature);
+
+ first = FALSE;
+ }
+
+ if (error_stdin != 0 && additional_properties != NULL) {
+ gint i;
+ for (i = 0; additional_properties[i] != NULL; i++) {
+ if (!first) {
+ write_null(error_stdin);
+ } else {
+ first = FALSE;
+ }
+
+ write_string(error_stdin, additional_properties[i]);
+ }
+ }
+
+ if (error_stdin != 0) {
+ close(error_stdin);
+ }
+
+ if (wait && pid != 0) {
+ GSource * child_source, * timeout_source;
+ GMainContext * context = g_main_context_new();
+ GMainLoop * loop = g_main_loop_new(context, FALSE);
+
+ child_source = g_child_watch_source_new(pid);
+ g_source_attach(child_source, context);
+ g_source_set_callback(child_source, apport_child_watch, loop, NULL);
+
+ timeout_source = g_timeout_source_new_seconds(5);
+ g_source_attach(timeout_source, context);
+ g_source_set_callback(timeout_source, apport_child_timeout, loop, NULL);
+
+ g_main_loop_run(loop);
+
+ g_source_destroy(timeout_source);
+ g_source_destroy(child_source);
+ g_main_loop_unref(loop);
+ g_main_context_unref(context);
+
+ g_spawn_close_pid(pid);
+ }
+
+ g_free(pid_str);
+
+ return;
}
diff --git a/src/service.c b/src/service.c
index 4f547b3..c364864 100644
--- a/src/service.c
+++ b/src/service.c
@@ -33,10 +33,6 @@
#define ICON_INFO "system-devices-panel-information"
#define ICON_ALERT "system-devices-panel-alert"
-G_DEFINE_TYPE (IndicatorSessionService,
- indicator_session_service,
- G_TYPE_OBJECT)
-
/* signals enum */
enum
{
@@ -117,6 +113,8 @@ struct _IndicatorSessionServicePrivate
typedef IndicatorSessionServicePrivate priv_t;
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorSessionService, indicator_session_service, G_TYPE_OBJECT)
+
static const char * get_current_real_name (IndicatorSessionService * self);
/***
@@ -1175,9 +1173,7 @@ indicator_session_service_init (IndicatorSessionService * self)
GIcon * icon;
/* init our priv pointer */
- p = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_TYPE_SESSION_SERVICE,
- IndicatorSessionServicePrivate);
+ p = indicator_session_service_get_instance_private (self);
p->indicator_settings = g_settings_new ("org.ayatana.indicator.session");
if (is_mate())
p->keybinding_settings = g_settings_new ("org.mate.SettingsDaemon.plugins.media-keys");
@@ -1376,8 +1372,6 @@ indicator_session_service_class_init (IndicatorSessionServiceClass * klass)
object_class->get_property = my_get_property;
object_class->set_property = my_set_property;
- g_type_class_add_private (klass, sizeof (IndicatorSessionServicePrivate));
-
signals[NAME_LOST] = g_signal_new (INDICATOR_SESSION_SERVICE_SIGNAL_NAME_LOST,
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,