Commit 3fb670ae authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

application: Show main window on clicking notification

parent b19f9aa8
......@@ -201,6 +201,19 @@ application_open_uri (ChattyApplication *self)
return G_SOURCE_REMOVE;
}
static void
chatty_application_show_window (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
ChattyApplication *self = user_data;
g_assert (CHATTY_IS_APPLICATION (self));
g_application_activate (G_APPLICATION (self));
gtk_window_present (GTK_WINDOW (self->main_window));
}
static void
chatty_application_finalize (GObject *object)
{
......@@ -279,6 +292,9 @@ chatty_application_startup (GApplication *application)
{
ChattyApplication *self = (ChattyApplication *)application;
g_autofree char *db_path = NULL;
static const GActionEntry app_entries[] = {
{ "show-window", chatty_application_show_window },
};
self->daemon = FALSE;
self->manager = g_object_ref (chatty_manager_get_default ());
......@@ -297,6 +313,9 @@ chatty_application_startup (GApplication *application)
gtk_css_provider_load_from_resource (self->css_provider,
"/sm/puri/chatty/css/style.css");
g_action_map_add_action_entries (G_ACTION_MAP (self), app_entries,
G_N_ELEMENTS (app_entries), self);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default(),
GTK_STYLE_PROVIDER (self->css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
......
......@@ -52,6 +52,7 @@ chatty_notify_show_notification (const char *title,
application = g_application_get_default ();
notification = g_notification_new ("chatty");
g_notification_set_default_action (notification, "app.show-window");
if (pixbuf) {
icon = chatty_icon_get_gicon_from_pixbuf (pixbuf);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment