/* * GTK+ 프로그램에서 main() 함수는 GtkApplication 객체를 생성하고 실행한다. * 여기서는 app이라는 이름의 GtkApplication 포인터를 선언하고, * gtk_application_new() 함수를 이용해 초기화했다. */ int main (int argc, char **argv) { GtkApplication *app; int status; /* * gtk_application_new() 함수는 GtkApplication 객체를 생성하며, * application ID와 GApplicationFlags를 인자로 받는다. * application ID는 해당 프로그램 고유의 이름으로서 여러 용도로 쓰이며, * 다른 프로그램과 중복되면 여러가지 문제를 일을킬 수 있다. * 그러므로 도메인 이름같은 형식으로 중복을 방지한다. */ app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE); /* * g_signal_connect() 함수는 GtkApplication 객체와 특정한 함수를 연결시켜 * g_application_run() 함수에서 해당 GtkApplication 객체가 호출될 때, * 연결된 함수가 실행되도록 한다. */ g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); /* * g_application_run() 함수는 GtkApplication 객체에 연결된 함수가 실행되도록 한다. * 이때, 별도의 사용자 인자를 전달하며, * [x] 버튼이 눌려 창이 닫힐 때, 종료 상태에 대한 int 형 정보를 돌려준다. */ status = g_application_run (G_APPLICATION (app), argc, argv); // g_object_unref() 함수는 GtkApplication 객체가 차지했던 메모리를 자유롭게 만든다. g_object_unref (app); return status; }
int main(int argc, char **argv) { GtkApplication *app; int status; setlocale(LC_ALL, ""); bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); /* Seed random number generator. */ srand48((long) time((time_t *) 0)); g_type_init(); get_options(argc, argv); gtk_init(&argc, &argv); gtk_window_set_default_icon_name("accessories-calculator"); app = gtk_application_new("org.gnome.gcalctool", G_APPLICATION_FLAGS_NONE); g_signal_connect(app, "startup", G_CALLBACK(startup_cb), NULL); g_signal_connect(app, "activate", G_CALLBACK(activate_cb), NULL); status = g_application_run(G_APPLICATION(app), argc, argv); return status; }
int main(int argc, char **argv) { GtkApplication *app = gtk_application_new("org.oovaide.oovEdit", G_APPLICATION_HANDLES_COMMAND_LINE); GApplication *gapp = G_APPLICATION(app); Editor editor; gEditor = &editor; g_signal_connect(app, "activate", G_CALLBACK(activateApp), NULL); g_signal_connect(app, "startup", G_CALLBACK(startupApp), NULL); g_signal_connect(app, "command-line", G_CALLBACK(commandLine), NULL); // For some reason, the '-' arguments quit working when upgrading Ubuntu. // It would cause the commandLine function to fail in some way. So // this cheat converts the minus to a plus, and both are handled in // the commandLine function. This dirty trick does change memory that is // passed to main, but it seems to work. #ifdef __linux__ for(int i=0; i<argc; i++) { if(argv[i][0] == '-') { argv[i][0] = '+'; } } #endif int status = g_application_run(gapp, argc, argv); g_object_unref(app); return status; }
int main (int argc, char *argv[]) { GtkApplication *app; GObjectClass *app_class; gint retval; g_type_init (); #ifdef HAVE_CHEESE /* Used by the avatar chooser */ g_return_val_if_fail (cheese_gtk_init (&argc, &argv), 1); #endif empathy_init (); g_set_application_name (_("Empathy Accounts")); /* Make empathy and empathy-accounts appear as the same app in gnome-shell */ gdk_set_program_class ("Empathy"); gtk_window_set_default_icon_name ("empathy"); app = gtk_application_new (EMPATHY_ACCOUNTS_DBUS_NAME, G_APPLICATION_FLAGS_NONE); app_class = G_OBJECT_GET_CLASS (app); G_APPLICATION_CLASS (app_class)->local_command_line = local_cmdline; G_APPLICATION_CLASS (app_class)->activate = app_activate; retval = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return retval; }
int main (int argc, char *argv[]) { g_autoptr(GsEditor) self = NULL; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); gtk_init (&argc, &argv); self = g_new0 (GsEditor, 1); self->cancellable = g_cancellable_new (); self->builder = gtk_builder_new (); self->store = as_store_new (); as_store_set_add_flags (self->store, AS_STORE_ADD_FLAG_USE_UNIQUE_ID); self->store_global = as_store_new (); as_store_set_add_flags (self->store_global, AS_STORE_ADD_FLAG_USE_UNIQUE_ID); /* are we already activated? */ self->application = gtk_application_new ("org.gnome.Software.Editor", G_APPLICATION_HANDLES_COMMAND_LINE); g_signal_connect (self->application, "startup", G_CALLBACK (gs_editor_startup_cb), self); g_signal_connect (self->application, "command-line", G_CALLBACK (gs_editor_commandline_cb), self); /* run */ return g_application_run (G_APPLICATION (self->application), argc, argv); }
gint main(gint argc, gchar *argv[]) { GtkApplication *app; gint status; /* initialize app settings */ settings = g_settings_new("ir.ubuntu.acal"); /* set up i18n */ if(g_settings_get_boolean(settings, "persian-lang")) { g_setenv("LANG", "fa_IR.UTF-8", TRUE); g_setenv("LANGUAGE", "fa.UTF-8", TRUE); } bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); /* creates a new gtkapplication instance */ app = gtk_application_new("ir.ubuntu.acal", G_APPLICATION_FLAGS_NONE); g_signal_connect(app, "startup", G_CALLBACK(startup), NULL); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); return status; }
int main (int argc, char **argv) { GtkApplication *app; int status,yes=1; app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), NULL, NULL); g_object_unref (app); //pthread_t id,id1; //int i,ret; //args *ar={argc, argv}; //drawGTK(ar); //ret=pthread_create(&id,NULL,(void *) thread,NULL); //ret=pthread_create(&id1,NULL,(void *) drawGTK, ar); //if(ret!=0){ // printf ("Create pthread error!\n"); // exit (1); //} //pthread_join(id,NULL); //pthread_join(id1,NULL); }
int main (int argc, char **argv) { GtkApplication *app; static GActionEntry app_entries[] = { { "about", activate_about, NULL, NULL, NULL }, { "quit", activate_quit, NULL, NULL, NULL }, }; /* Most code in gtk-demo is intended to be exemplary, but not * these few lines, which are just a hack so gtk-demo will work * in the GTK tree without installing it. */ if (g_file_test ("../../modules/input/immodules.cache", G_FILE_TEST_EXISTS)) { g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE); } /* -- End of hack -- */ gtk_init (&argc, &argv); app = gtk_application_new ("org.gtk.Demo", 0); g_action_map_add_action_entries (G_ACTION_MAP (app), app_entries, G_N_ELEMENTS (app_entries), app); g_signal_connect (app, "startup", G_CALLBACK (startup), NULL); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); g_application_run (G_APPLICATION (app), argc, argv); return 0; }
int main (int argc, char* argv[]) { gtk_init(&argc, &argv); /* register signal handler */ signal(SIGHUP, signal_handler); signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); GtkCssProvider *provider = gtk_css_provider_new(); gtk_css_provider_load_from_data(provider, TINYTERM_STYLE, strlen(TINYTERM_STYLE), NULL); gtk_style_context_add_provider_for_screen( gdk_screen_get_default(), provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); GtkApplication *app; int status; app = gtk_application_new("org.nhoad.tinyterm", G_APPLICATION_HANDLES_COMMAND_LINE); _application = G_APPLICATION(app); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); g_signal_connect(app, "command-line", G_CALLBACK(command_line), NULL); status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); return status; }
int main (int argc, char *argv[]) { GtkApplication *app; GSettings *settings; GAction *action; gtk_init (NULL, NULL); app = gtk_application_new ("org.gtk.Demo2", 0); settings = g_settings_new ("org.gtk.Demo"); g_action_map_add_action_entries (G_ACTION_MAP (app), app_entries, G_N_ELEMENTS (app_entries), app); action = g_settings_create_action (settings, "color"); g_action_map_add_action (G_ACTION_MAP (app), action); g_signal_connect (app, "startup", G_CALLBACK (startup), NULL); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); g_application_run (G_APPLICATION (app), 0, NULL); return 0; }
int main(int argc, char* argv[]){ GtkApplication* app = gtk_application_new("io.github.atkv",G_APPLICATION_FLAGS_NONE); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); int status = g_application_run(G_APPLICATION(app),argc, argv); g_object_unref(app); return status; }
int main(int argc, char **argv) { GtkApplication *app; gmpv_handle *ctx; gint status; app = gtk_application_new(APP_ID, G_APPLICATION_HANDLES_OPEN); ctx = g_malloc(sizeof(gmpv_handle)); g_signal_connect( app, "startup", G_CALLBACK(app_startup_handler), ctx ); g_signal_connect( app, "activate", G_CALLBACK(app_activate_handler), ctx ); g_signal_connect( app, "open", G_CALLBACK(app_open_handler), ctx ); status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); return status; }
int main (int argc, char **argv) { GtkApplication *app; gint retval; g_thread_init (NULL); gtk_init (&argc, &argv); empathy_gtk_init (); app = gtk_application_new (EMPATHY_DEBUGGER_DBUS_NAME, G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL); g_set_application_name (_("Empathy Debugger")); /* Make empathy and empathy-debugger appear as the same app in gnome-shell */ gdk_set_program_class ("Empathy"); gtk_window_set_default_icon_name ("empathy"); textdomain (GETTEXT_PACKAGE); retval = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return retval; }
int main(int argc, char* argv[]) { gboolean hidden = FALSE; GtkApplication *app; gint retval; app = gtk_application_new ("org.mate.mate-control-center.shell", 0); GError* error; GOptionEntry options[] = { {"hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL}, {NULL} }; #ifdef ENABLE_NLS bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif error = NULL; if (!gtk_init_with_args(&argc, &argv, NULL, options, GETTEXT_PACKAGE, &error)) { g_printerr("%s\n", error->message); g_error_free(error); return 1; } g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); g_signal_connect (app, "window-removed", G_CALLBACK (quit), NULL); retval = g_application_run (G_APPLICATION (app), argc, argv); return retval; }
/** * main: **/ int main (int argc, char *argv[]) { gboolean ret; gint status = 1; GOptionContext *context; GtkApplication *application = NULL; const GOptionEntry options[] = { { "filter", 'f', 0, G_OPTION_ARG_STRING, &filter, /* TRANSLATORS: preset the GtktextBox with this filter text */ N_("Set the filter to this value"), NULL }, { "parent-window", 'p', 0, G_OPTION_ARG_INT, &xid, /* TRANSLATORS: we can make this modal (stay on top of) another window */ _("Set the parent window to make this modal"), NULL }, { NULL} }; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); gtk_init (&argc, &argv); context = g_option_context_new (NULL); g_option_context_set_summary (context, _("Software Log Viewer")); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, gpk_debug_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); /* are we running privileged */ ret = gpk_check_privileged_user (_("Log viewer"), TRUE); if (!ret) goto out; /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), GPK_DATA G_DIR_SEPARATOR_S "icons"); /* are we already activated? */ application = gtk_application_new ("org.freedesktop.PackageKit.LogViewer", 0); g_signal_connect (application, "startup", G_CALLBACK (gpk_log_startup_cb), NULL); g_signal_connect (application, "activate", G_CALLBACK (gpk_log_activate_cb), NULL); /* run */ status = g_application_run (G_APPLICATION (application), argc, argv); out: if (builder != NULL) g_object_unref (builder); if (application != NULL) g_object_unref (application); return status; }
void drawGTK(pargs ar){ GtkApplication *app; int status,yes=1; app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), ar->argc, ar->argv); g_object_unref (app); }
/////////////////////////////////////////////////////////////////////////////// // Programme principal /////////////////////////////////////////////////////////////////////////////// int main(int argc,char *argv[]) { GtkApplication *app=gtk_application_new("fr.iutbeziers.gtk3-02", G_APPLICATION_FLAGS_NONE); g_signal_connect(app,"activate",G_CALLBACK(startApplication),NULL); int status=g_application_run(G_APPLICATION(app),argc,argv); g_object_unref(app); return status; }
int main (int argc, char *argv[]) { GtkApplication *app = gtk_application_new ("org.gtk.fmuellner.Revealer", 0); g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL); return g_application_run (G_APPLICATION (app), argc, argv); }
int main (int argc, char *argv[]) { GcmPickerPrivate *priv; GOptionContext *context; GtkApplication *application; guint xid = 0; int status = 0; const GOptionEntry options[] = { { "parent-window", 'p', 0, G_OPTION_ARG_INT, &xid, /* TRANSLATORS: we can make this modal (stay on top of) another window */ _("Set the parent window to make this modal"), NULL }, { NULL} }; /* setup translations */ setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); /* setup LCMS */ cmsSetLogErrorHandler (gcm_picker_error_cb); context = g_option_context_new (NULL); /* TRANSLATORS: tool that is used to pick colors */ g_option_context_set_summary (context, _("GNOME Color Manager Color Picker")); g_option_context_add_group (context, gcm_debug_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_add_main_entries (context, options, NULL); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); /* create private */ priv = g_new0 (GcmPickerPrivate, 1); priv->last_ambient = -1.0f; priv->xid = xid; /* ensure single instance */ application = gtk_application_new ("org.gnome.ColorManager.Picker", 0); g_signal_connect (application, "startup", G_CALLBACK (gcm_picker_startup_cb), priv); g_signal_connect (application, "activate", G_CALLBACK (gcm_picker_activate_cb), priv); status = g_application_run (G_APPLICATION (application), argc, argv); g_object_unref (application); if (priv->client != NULL) g_object_unref (priv->client); if (priv->builder != NULL) g_object_unref (priv->builder); g_free (priv); return status; }
int main (int argc, char *argv[]) { GtkApplication *app; app = gtk_application_new ("org.gtk.Test.ActionBar", 0); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); return g_application_run (G_APPLICATION (app), argc, argv); }
int main(int argc, char **argv) { GtkApplication *app; int status; app = gtk_application_new("or.gtk.example", G_APPLICATION_FLAGS_NONE); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); return status; }
static void nimf_settings_init (NimfSettings *nsettings) { nsettings->schema_source = g_settings_schema_source_get_default (); nsettings->pages = g_ptr_array_new_with_free_func ((GDestroyNotify) nimf_settings_page_free); nsettings->app = gtk_application_new ("org.nimf.settings", G_APPLICATION_FLAGS_NONE); g_signal_connect (nsettings->app, "activate", G_CALLBACK (on_activate), nsettings); }
int main (int argc, char *argv[]) { GtkApplication *app; gtk_init (&argc, &argv); app = gtk_application_new ("org.freedesktop.AppStream", G_APPLICATION_FLAGS_NONE); gtk_application_get_menu_by_id (app, "not-going-to-exist"); g_object_unref (app); return 0; }
int GUI::run() { GtkApplication *app; int status; app = gtk_application_new("org.gnome.fract",G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK(activate), this); status = g_application_run(G_APPLICATION (app), 0, NULL); g_object_unref(app); return status; }
int main(int argc, char **argv) { GtkApplication *app = gtk_application_new("org.simonallen.handy", 0); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); int status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); return status; }
FileDialog* NativeDialogsGTK::createFileDialog() { if (!m_gtkApp) { int argc = 0; char** argv = nullptr; gtk_init(&argc, &argv); m_gtkApp = gtk_application_new(nullptr, G_APPLICATION_FLAGS_NONE); } return new FileDialogGTK; }
virtual GtkApplication* create_application (const gchar* application_id, GApplicationFlags application_flags, int argc, char_t** argv, char_t** env) { GtkApplication* application = 0; LAMNA_LOG_MESSAGE_DEBUG("gtk_application_new(\"" << application_id << "\",...)..."); if ((application = gtk_application_new(application_id, application_flags))) { LAMNA_LOG_MESSAGE_DEBUG("...gtk_application_new(\"" << application_id << "\",...)"); } else { LAMNA_LOG_ERROR("...failed on gtk_application_new(\"" << application_id << "\",...)"); } return application; }
int main(int argc, char** argv) { GtkApplication* app; int status; indexHome((char*)"/home/ananth"); app=gtk_application_new("com.gmail.ananth1987.test",G_APPLICATION_FLAGS_NONE); g_signal_connect(app,"activate",G_CALLBACK(button_activate),NULL); status=g_application_run(G_APPLICATION(app),argc,argv); g_object_unref(app); return status; }
/*********************************************************************** main */ int main (int argc, char **argv) { int status; bmd_widgets *a = g_malloc (sizeof (bmd_widgets)); a->app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE); g_signal_connect (a->app, "activate", G_CALLBACK (bmd_activate), (gpointer) a); status = g_application_run (G_APPLICATION (a->app), argc, argv); g_object_unref (a->app); g_free (a); return status; }
int main(int argc, char *argv[]) { #ifdef ENABLE_NLS bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif gtk_init(&argc, &argv); /* Create configuration dir ~/.chimara */ gchar *configdir = g_build_filename(g_get_home_dir(), ".chimara", NULL); if(!g_file_test(configdir, G_FILE_TEST_IS_DIR) && g_mkdir(configdir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) g_error("Cannot create configuration directory ~/.chimara"); g_free(configdir); /* Initialize settings file; it can be overridden by a "chimara-config" file in the current directory */ gchar *keyfile; if(g_file_test("chimara-config", G_FILE_TEST_IS_REGULAR)) keyfile = g_strdup("chimara-config"); else keyfile = g_build_filename(g_get_home_dir(), ".chimara", "config", NULL); GSettingsBackend *backend = g_keyfile_settings_backend_new(keyfile, "/org/chimara-if/player/", NULL); prefs_settings = g_settings_new_with_backend("org.chimara-if.player.preferences", backend); state_settings = g_settings_new_with_backend("org.chimara-if.player.state", backend); g_free(keyfile); app = gtk_application_new("org.chimara-if.player", G_APPLICATION_HANDLES_OPEN); g_signal_connect(app, "activate", G_CALLBACK(on_activate), NULL); g_signal_connect(app, "open", G_CALLBACK(on_open), NULL); if( !create_window() ) { error_dialog(NULL, NULL, "Error while building interface."); return 1; } int status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); chimara_glk_stop(CHIMARA_GLK(glk)); chimara_glk_wait(CHIMARA_GLK(glk)); g_object_unref( G_OBJECT(builder) ); return status; }