#include <gtk/gtk.h>
static void send_notification ( const gchar *const title )
{
/// ***
GApplication *application;
GNotification* notification;
const gchar* const id = "window-present-notification";
/// ***
application = g_application_get_default();
/// ***
notification = g_notification_new ( title );
/// ***
g_application_send_notification ( application, id, notification );
/// ***
g_application_withdraw_notification ( application, id );
}
static void activate ( GtkApplication *application, G_GNUC_UNUSED gpointer data )
{
GtkWidget *window;
/// ***
window = gtk_application_window_new ( application );
/// ***
gtk_window_set_default_size ( GTK_WINDOW ( window ), 200, 200 );
/// ***
send_notification ( "The window is Present." );
/// ***
gtk_window_present ( GTK_WINDOW ( window ) );
}
int main ( void )
{
/// ***
gint status;
GtkApplication *application;
/// ***
application = gtk_application_new ( "this.is.my.app", 0 );
/// ***
GApplicationFlags flags;
flags = g_application_get_flags ( G_APPLICATION ( application ) );
/// ***
if ( flags != G_APPLICATION_HANDLES_OPEN )
{
g_message ( "True\n" );
g_application_set_flags ( G_APPLICATION ( application ), G_APPLICATION_HANDLES_OPEN );
}
/// ***
g_signal_connect ( application, "activate", G_CALLBACK ( activate ), NULL );
/// ***
status = g_application_run ( G_APPLICATION ( application ), FALSE, NULL );
/// ***
g_object_unref ( application );
/// ***
return status;
}