/* GObject implementation stuff {{{1 */ static void g_application_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GApplication *application = G_APPLICATION (object); switch (prop_id) { case PROP_APPLICATION_ID: g_application_set_application_id (application, g_value_get_string (value)); break; case PROP_FLAGS: g_application_set_flags (application, g_value_get_flags (value)); break; case PROP_INACTIVITY_TIMEOUT: g_application_set_inactivity_timeout (application, g_value_get_uint (value)); break; case PROP_ACTION_GROUP: g_application_set_action_group (application, g_value_get_object (value)); break; default: g_assert_not_reached (); } }
int main (int argc, char **argv) { GApplication *app; int status; app = g_application_new ("org.gtk.TestApplication", 0); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); g_application_set_inactivity_timeout (app, 10000); add_actions (app); if (argc > 1 && strcmp (argv[1], "--simple-action") == 0) { g_application_register (app, NULL, NULL); g_action_group_activate_action (G_ACTION_GROUP (app), "simple-action", NULL); exit (0); } else if (argc > 1 && strcmp (argv[1], "--toggle-action") == 0) { g_application_register (app, NULL, NULL); g_action_group_activate_action (G_ACTION_GROUP (app), "toggle-action", NULL); exit (0); } status = g_application_run (app, argc, argv); g_object_unref (app); return status; }
static void trg_gtk_app_init(TrgGtkApp * self) { g_application_set_inactivity_timeout(G_APPLICATION(self), 10000); g_signal_connect(self, "command-line", G_CALLBACK(trg_gtk_app_command_line), NULL); g_signal_connect(self, "startup", G_CALLBACK(trg_gtk_app_startup), NULL); }
int main(int argc, char* argv[]) { GApplication* app; int status; bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #ifdef HAVE_PTHREAD g_type_init (); gdk_threads_init (); #endif #ifdef HAVE_LIBGCRYPT gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); gcry_check_version (NULL); gcry_control (GCRYCTL_DISABLE_SECMEM, 0); gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif gtk_init(&argc, &argv); app = g_application_new("org.Remmina", G_APPLICATION_HANDLES_COMMAND_LINE); g_signal_connect(app, "startup", G_CALLBACK(remmina_on_startup), NULL); g_signal_connect(app, "command-line", G_CALLBACK(remmina_on_command_line), NULL); g_application_set_inactivity_timeout(app, 10000); status = g_application_run(app, argc, argv); if (status == 0 && !g_application_get_is_remote(app)) { THREADS_ENTER gtk_main(); THREADS_LEAVE }
int main (int argc, char *argv[]) { GOptionContext *optcontext; GOptionEntry options[] = { { NULL } }; #ifdef ENABLE_DEBUG TpDebugSender *debug_sender; #endif GError *error = NULL; gint retval; GtkSettings *gtk_settings; /* Init */ g_thread_init (NULL); #ifdef GDK_WINDOWING_X11 /* We can't call clutter_gst_init() before gtk_clutter_init(), so no choice * but to intiialise X11 threading ourself */ XInitThreads (); #endif /* Clutter needs this */ gdk_disable_multidevice (); optcontext = g_option_context_new (N_("- Empathy Audio/Video Client")); g_option_context_add_group (optcontext, gst_init_get_option_group ()); g_option_context_add_group (optcontext, gtk_get_option_group (TRUE)); g_option_context_add_group (optcontext, cogl_get_option_group ()); g_option_context_add_group (optcontext, clutter_get_option_group_without_init ()); g_option_context_add_group (optcontext, gtk_clutter_get_option_group ()); g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE); if (!g_option_context_parse (optcontext, &argc, &argv, &error)) { g_print ("%s\nRun '%s --help' to see a full list of available command " "line options.\n", error->message, argv[0]); g_warning ("Error in empathy-call init: %s", error->message); return EXIT_FAILURE; } g_option_context_free (optcontext); clutter_gst_init (&argc, &argv); empathy_gtk_init (); g_set_application_name (_("Empathy Audio/Video Client")); /* Make empathy and empathy-call appear as the same app in gnome-shell */ gdk_set_program_class ("Empathy"); gtk_window_set_default_icon_name ("empathy"); textdomain (GETTEXT_PACKAGE); gtk_settings = gtk_settings_get_default (); g_object_set (G_OBJECT (gtk_settings), "gtk-application-prefer-dark-theme", TRUE, NULL); app = gtk_application_new (EMPATHY_CALL_DBUS_NAME, G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL); #ifdef ENABLE_DEBUG /* Set up debug sender */ debug_sender = tp_debug_sender_dup (); g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN); #endif if (g_getenv ("EMPATHY_PERSIST") != NULL) { DEBUG ("Disable timer"); use_timer = FALSE; } call_windows = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); /* the inactivity timeout can only be set while the application is held */ g_application_hold (G_APPLICATION (app)); g_application_set_inactivity_timeout (G_APPLICATION (app), TIMEOUT * 1000); g_application_release (G_APPLICATION (app)); retval = g_application_run (G_APPLICATION (app), argc, argv); g_hash_table_unref (call_windows); g_object_unref (app); tp_clear_object (&call_factory); #ifdef ENABLE_DEBUG g_object_unref (debug_sender); #endif return retval; }
int main (int argc, char *argv[]) { GOptionContext *optcontext; GOptionEntry options[] = { { NULL } }; #ifdef ENABLE_DEBUG TpDebugSender *debug_sender; #endif GError *error = NULL; gint retval; /* Init */ g_thread_init (NULL); optcontext = g_option_context_new (N_("- Empathy Audio/Video Client")); g_option_context_add_group (optcontext, gst_init_get_option_group ()); g_option_context_add_group (optcontext, gtk_get_option_group (TRUE)); g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE); if (!g_option_context_parse (optcontext, &argc, &argv, &error)) { g_print ("%s\nRun '%s --help' to see a full list of available command " "line options.\n", error->message, argv[0]); g_warning ("Error in empathy-av init: %s", error->message); return EXIT_FAILURE; } g_option_context_free (optcontext); clutter_gst_init (&argc, &argv); empathy_gtk_init (); g_set_application_name (_("Empathy Audio/Video Client")); g_setenv ("PULSE_PROP_media.role", "phone", TRUE); /* Make empathy and empathy-av appear as the same app in gnome-shell */ gdk_set_program_class ("Empathy"); gtk_window_set_default_icon_name ("empathy"); textdomain (GETTEXT_PACKAGE); app = gtk_application_new (EMPATHY_AV_DBUS_NAME, G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL); #ifdef ENABLE_DEBUG /* Set up debug sender */ debug_sender = tp_debug_sender_dup (); g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN); #endif if (g_getenv ("EMPATHY_PERSIST") != NULL) { DEBUG ("Disable timer"); use_timer = FALSE; } /* the inactivity timeout can only be set while the application is held */ g_application_hold (G_APPLICATION (app)); g_application_set_inactivity_timeout (G_APPLICATION (app), TIMEOUT * 1000); g_application_release (G_APPLICATION (app)); retval = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); tp_clear_object (&call_factory); #ifdef ENABLE_DEBUG g_object_unref (debug_sender); #endif return retval; }
int main (int argc, char *argv[]) { GOptionContext *optcontext; GOptionEntry options[] = { { NULL } }; #ifdef ENABLE_DEBUG TpDebugSender *debug_sender; #endif GError *error = NULL; EmpathyChatManager *chat_mgr; EmpathyIdle *idle; gint retval; /* Init */ g_thread_init (NULL); optcontext = g_option_context_new (N_("- Empathy Chat Client")); g_option_context_add_group (optcontext, gtk_get_option_group (TRUE)); g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE); if (!g_option_context_parse (optcontext, &argc, &argv, &error)) { g_print ("%s\nRun '%s --help' to see a full list of available command " "line options.\n", error->message, argv[0]); g_warning ("Error in empathy-av init: %s", error->message); return EXIT_FAILURE; } g_option_context_free (optcontext); empathy_gtk_init (); gtk_window_set_default_icon_name ("empathy"); textdomain (GETTEXT_PACKAGE); app = gtk_application_new (EMPATHY_CHAT_DBUS_NAME, G_APPLICATION_IS_SERVICE); g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL); #ifdef ENABLE_DEBUG /* Set up debug sender */ debug_sender = tp_debug_sender_dup (); g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN); #endif /* Setting up Idle */ idle = empathy_idle_dup_singleton (); chat_mgr = empathy_chat_manager_dup_singleton (); g_signal_connect (chat_mgr, "handled-chats-changed", G_CALLBACK (handled_chats_changed_cb), GUINT_TO_POINTER (1)); if (g_getenv ("EMPATHY_PERSIST") != NULL) { DEBUG ("Disable timer"); use_timer = FALSE; } /* the inactivity timeout can only be set while the application is held */ g_application_hold (G_APPLICATION (app)); g_application_set_inactivity_timeout (G_APPLICATION (app), TIMEOUT * 1000); g_application_release (G_APPLICATION (app)); DEBUG ("Waiting for text channels to handle"); retval = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); g_object_unref (idle); g_object_unref (chat_mgr); #ifdef ENABLE_DEBUG g_object_unref (debug_sender); #endif return retval; }
int main (int argc, char **argv) { gs_unref_object GApplication *app = NULL; const char *home_dir, *charset; GError *error = NULL; if (G_UNLIKELY ((getuid () != geteuid () || getgid () != getegid ()) && geteuid () == 0 && getegid () == 0)) { g_printerr ("Wrong euid/egid, exiting.\n"); return _EXIT_FAILURE_WRONG_ID; } if (setlocale (LC_ALL, "") == NULL) { g_printerr ("Locale not supported.\n"); return _EXIT_FAILURE_UNSUPPORTED_LOCALE; } terminal_i18n_init (TRUE); if (!g_get_charset (&charset)) { g_printerr ("Non UTF-8 locale (%s) is not supported!\n", charset); return _EXIT_FAILURE_NO_UTF8; } /* Sanitise environment */ g_unsetenv ("DBUS_STARTER_BUS_TYPE"); /* Not interested in silly debug spew polluting the journal, bug #749195 */ if (g_getenv ("G_ENABLE_DIAGNOSTIC") == NULL) g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE); #ifndef ENABLE_DISTRO_PACKAGING #ifdef HAVE_UBUNTU /* Set some env vars to disable the ubuntu modules. Their package will be * built using --enable-distro-packaging, but anyone running from git will * get the right behaviour. */ g_setenv ("LIBOVERLAY_SCROLLBAR", "0", TRUE); g_setenv ("UBUNTU_MENUPROXY", "0", TRUE); g_setenv ("NO_UNITY_GTK_MODULE", "1", TRUE); #endif #endif _terminal_debug_init (); // FIXMEchpe: just use / here but make sure #565328 doesn't regress /* Change directory to $HOME so we don't prevent unmounting, e.g. if the * factory is started by nautilus-open-terminal. See bug #565328. * On failure back to /. */ home_dir = g_get_home_dir (); if (home_dir == NULL || chdir (home_dir) < 0) (void) chdir ("/"); g_set_prgname ("gnome-terminal-server"); g_set_application_name (_("Terminal")); if (!gtk_init_with_args (&argc, &argv, NULL, options, NULL, &error)) { g_printerr ("Failed to parse arguments: %s\n", error->message); g_error_free (error); exit (_EXIT_FAILURE_GTK_INIT); } if (!increase_rlimit_nofile ()) { g_printerr ("Failed to increase RLIMIT_NOFILE: %m\n"); } /* Now we can create the app */ app = terminal_app_new (app_id); g_free (app_id); /* We stay around a bit after the last window closed */ g_application_set_inactivity_timeout (app, INACTIVITY_TIMEOUT); return g_application_run (app, 0, NULL); }