[Xfce4-commits] [apps/xfdashboard] 03/03: Implement action signal "exit" at XfdashboardApplication to perform quit of application which is useful at XfdashboardActionButton actors
noreply at xfce.org
noreply at xfce.org
Mon Dec 14 13:49:18 CET 2015
This is an automated email from the git hooks/post-receive script.
nomad pushed a commit to branch master
in repository apps/xfdashboard.
commit cb4bc3f00a8e3236443dbc39e9587fadb8afa11c
Author: Stephan Haller <nomad at froevel.de>
Date: Mon Dec 14 13:48:29 2015 +0100
Implement action signal "exit" at XfdashboardApplication to perform quit of application which is useful at XfdashboardActionButton actors
---
xfdashboard/application.c | 37 ++++++++++++++++++++++++++++++++++++-
xfdashboard/application.h | 7 +++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/xfdashboard/application.c b/xfdashboard/application.c
index 63beb0f..823fc5e 100644
--- a/xfdashboard/application.c
+++ b/xfdashboard/application.c
@@ -49,6 +49,7 @@
#include "application-database.h"
#include "application-tracker.h"
#include "plugins-manager.h"
+#include "marshal.h"
/* Define this class in GObject system */
G_DEFINE_TYPE(XfdashboardApplication,
@@ -111,6 +112,9 @@ enum
SIGNAL_RESUME,
SIGNAL_THEME_CHANGED,
+ /* Actions */
+ ACTION_EXIT,
+
SIGNAL_LAST
};
@@ -195,6 +199,21 @@ static void _xfdashboard_application_quit(XfdashboardApplication *self, gboolean
}
}
+/* Action "exit" was called at application */
+static gboolean _xfdashboard_application_action_exit(XfdashboardApplication *self,
+ XfdashboardFocusable *inSource,
+ const gchar *inAction,
+ ClutterEvent *inEvent)
+{
+ g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION(self), CLUTTER_EVENT_PROPAGATE);
+
+ /* Quit application */
+ _xfdashboard_application_quit(self, FALSE);
+
+ /* Prevent the default handler being called */
+ return(CLUTTER_EVENT_STOP);
+}
+
/* The session is going to quit */
static void _xfdashboard_application_on_session_quit(XfdashboardApplication *self,
gpointer inUserData)
@@ -212,7 +231,7 @@ static gboolean _xfdashboard_application_on_delete_stage(XfdashboardApplication
ClutterEvent *inEvent,
gpointer inUserData)
{
- g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION(self), FALSE);
+ g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION(self), CLUTTER_EVENT_PROPAGATE);
/* Quit application */
_xfdashboard_application_quit(self, FALSE);
@@ -874,6 +893,8 @@ static void xfdashboard_application_class_init(XfdashboardApplicationClass *klas
GObjectClass *gobjectClass=G_OBJECT_CLASS(klass);
/* Override functions */
+ klass->exit=_xfdashboard_application_action_exit;
+
appClass->activate=_xfdashboard_application_activate;
appClass->command_line=_xfdashboard_application_command_line;
#if GLIB_CHECK_VERSION(2, 40, 0)
@@ -968,6 +989,20 @@ static void xfdashboard_application_class_init(XfdashboardApplicationClass *klas
1,
XFDASHBOARD_TYPE_THEME);
+ XfdashboardApplicationSignals[ACTION_EXIT]=
+ g_signal_new("exit",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET(XfdashboardApplicationClass, exit),
+ g_signal_accumulator_true_handled,
+ NULL,
+ _xfdashboard_marshal_BOOLEAN__OBJECT_STRING_OBJECT,
+ G_TYPE_BOOLEAN,
+ 3,
+ XFDASHBOARD_TYPE_FOCUSABLE,
+ G_TYPE_STRING,
+ CLUTTER_TYPE_EVENT);
+
/* Register GValue transformation function not provided by any other library */
xfdashboard_register_gvalue_transformation_funcs();
}
diff --git a/xfdashboard/application.h b/xfdashboard/application.h
index 2a7164f..071f864 100644
--- a/xfdashboard/application.h
+++ b/xfdashboard/application.h
@@ -29,6 +29,7 @@
#include <xfconf/xfconf.h>
#include "theme.h"
+#include "focusable.h"
G_BEGIN_DECLS
@@ -87,6 +88,12 @@ struct _XfdashboardApplicationClass
void (*shutdown_final)(XfdashboardApplication *self);
void (*theme_changed)(XfdashboardApplication *self, XfdashboardTheme *inTheme);
+
+ /* Binding actions */
+ gboolean (*exit)(XfdashboardApplication *self,
+ XfdashboardFocusable *inSource,
+ const gchar *inAction,
+ ClutterEvent *inEvent);
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list