int main (int argc, char **argv) {
  GtkApplication *app;
  int status;

  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), argc, argv);
  g_object_unref (app);

  return status;
}
Exemple #2
0
int main(int argc, char* argv[]){
  GtkApplication* app;
  int status;

  app = gtk_application_new("atommed.github.io.learn_gtk",
                             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;
}
Exemple #3
0
int main(int argc, char** argv)
{
    bindtextdomain("gnome-twitch", GT_LOCALE_DIR);
    bind_textdomain_codeset("gnome-twitch", "UTF-8");
    textdomain("gnome-twitch");

    gst_init(0, NULL);

    main_app = gt_app_new();

    return g_application_run(G_APPLICATION(main_app), argc, argv);
}
int
main (int argc, char *argv[])
{
	gint retval;
	NautilusApplication *application;
	
#if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD)
	/* Nautilus uses lots and lots of small and medium size allocations,
	 * and then a few large ones for the desktop background. By default
	 * glibc uses a dynamic treshold for how large allocations should
	 * be mmaped. Unfortunately this triggers quickly for nautilus when
	 * it does the desktop background allocations, raising the limit
	 * such that a lot of temporary large allocations end up on the
	 * heap and are thus not returned to the OS. To fix this we set
	 * a hardcoded limit. I don't know what a good value is, but 128K
	 * was the old glibc static limit, lets use that.
	 */
	mallopt (M_MMAP_THRESHOLD, 128 *1024);
#endif

	g_type_init ();
	g_thread_init (NULL);

	/* This will be done by gtk+ later, but for now, force it to GNOME */
	g_desktop_app_info_set_desktop_env ("GNOME");

	if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
		eel_make_warnings_and_criticals_stop_in_debugger ();
	}
	
	/* Initialize gettext support */
	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	g_set_prgname ("nautilus");

#ifdef HAVE_EXEMPI
	xmp_init();
#endif

	/* Run the nautilus application. */
	application = nautilus_application_get_singleton ();

	retval = g_application_run (G_APPLICATION (application),
				    argc, argv);

	g_object_unref (application);

 	eel_debug_shut_down ();

	return retval;
}
static void
photos_thumbnailer_finalize (GObject *object)
{
  PhotosThumbnailer *self = PHOTOS_THUMBNAILER (object);

  g_free (self->address);

  if (g_application_get_is_registered (G_APPLICATION (self)))
    gegl_exit ();

  G_OBJECT_CLASS (photos_thumbnailer_parent_class)->finalize (object);
}
Exemple #6
0
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;
}
Exemple #7
0
int
main (int argc, char **argv)
{
	ArvViewer *viewer;
	int status;
	GOptionContext *context;
	GError *error = NULL;

	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	arv_g_thread_init (NULL);

	gtk_init (&argc, &argv);
	gst_init (&argc, &argv);

	context = g_option_context_new (NULL);
	g_option_context_add_main_entries (context, arv_viewer_option_entries, NULL);
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
	g_option_context_add_group (context, gst_init_get_option_group ());
	if (!g_option_context_parse (context, &argc, &argv, &error)) {
		g_option_context_free (context);
		g_print ("Option parsing failed: %s\n", error->message);
		g_error_free (error);
		return EXIT_FAILURE;
	}

	g_option_context_free (context);

	arv_debug_enable (arv_viewer_option_debug_domains);

	viewer = arv_viewer_new ();
	if (!ARV_IS_VIEWER (viewer))
		return EXIT_FAILURE;

	arv_viewer_set_options (viewer,
				arv_viewer_option_auto_socket_buffer,
				!arv_viewer_option_no_packet_resend,
				arv_viewer_option_packet_timeout,
				arv_viewer_option_frame_retention);

	notify_init ("Aravis Viewer");

	status = g_application_run (G_APPLICATION (viewer), argc, argv);

	g_object_unref (viewer);

	notify_uninit ();

	return status;
}
Exemple #8
0
int
main (int argc, char **argv)
{
    MxApplication *app;

    app = mx_application_new ("org.clutter-project.Mx.TestWindow", 0);

    g_signal_connect_after (app, "startup", G_CALLBACK (startup_cb), NULL);

    g_application_run (G_APPLICATION (app), argc, argv);

    return 0;
}
int
main(int argc, char **argv)
{
    int ret = 1;
    GApplication *app = NULL;

    virt_viewer_util_init(_("Remote Viewer"));
    app = G_APPLICATION(remote_viewer_new());

    ret = g_application_run(app, argc, argv);
    g_object_unref(app);
    return ret;
}
int
main (int argc, char *argv[])
{
  MxApplication *application;

  application = mx_application_new ("org.clutter-project.Mx.TestKineticScrollView", 0);
  g_signal_connect_after (application, "startup", G_CALLBACK (startup_cb), NULL);

  /* run the application */
  g_application_run (G_APPLICATION (application), argc, argv);

  return 0;
}
Exemple #11
0
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 -- */

  app = gtk_application_new ("org.gtk.Demo", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);

  g_action_map_add_action_entries (G_ACTION_MAP (app),
                                   app_entries, G_N_ELEMENTS (app_entries),
                                   app);

  g_application_add_main_option (G_APPLICATION (app), "version", 0, 0, G_OPTION_ARG_NONE, "Show program version", NULL);
  g_application_add_main_option (G_APPLICATION (app), "run", 0, 0, G_OPTION_ARG_STRING, "Run an example", "EXAMPLE");
  g_application_add_main_option (G_APPLICATION (app), "list", 0, 0, G_OPTION_ARG_NONE, "List examples", NULL);
  g_application_add_main_option (G_APPLICATION (app), "autoquit", 0, 0, G_OPTION_ARG_NONE, "Quit after a delay", NULL);

  g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
  g_signal_connect (app, "command-line", G_CALLBACK (command_line), NULL);
  g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL);

  g_application_run (G_APPLICATION (app), argc, argv);

  return 0;
}
Exemple #12
0
static void
gedit_app_init (GeditApp *app)
{
	GeditAppPrivate *priv;

	priv = gedit_app_get_instance_private (app);

	g_set_application_name ("gedit");
	gtk_window_set_default_icon_name ("accessories-text-editor");

	priv->monitor = g_network_monitor_get_default ();
	g_signal_connect (priv->monitor,
	                  "network-changed",
	                  G_CALLBACK (get_network_available),
	                  app);

	g_application_add_main_option_entries (G_APPLICATION (app), options);

#ifdef ENABLE_INTROSPECTION
	g_application_add_option_group (G_APPLICATION (app), g_irepository_get_option_group ());
#endif
}
Exemple #13
0
int
main (int argc,
      char *argv[])
{
  GtdApplication *app;
  int status;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  app = gtd_application_new ();
  g_application_set_default (G_APPLICATION (app));

  status = g_application_run (G_APPLICATION (app), argc, argv);

  g_object_unref (app);

  return status;
}
Exemple #14
0
TerminalWindow *
terminal_app_new_window (TerminalApp *app,
                         GdkScreen *screen)
{
  TerminalWindow *window;

  window = terminal_window_new (G_APPLICATION (app));

  if (screen)
    gtk_window_set_screen (GTK_WINDOW (window), screen);

  return window;
}
static void
photos_thumbnailer_init (PhotosThumbnailer *self)
{
  setlocale (LC_ALL, "");

  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  photos_gegl_ensure_builtins ();

  self->cancellables = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref);
  g_application_add_main_option_entries (G_APPLICATION (self), COMMAND_LINE_OPTIONS);
}
/*********************************************************************** 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;
}
Exemple #17
0
void
sflphone_quit(gboolean force_quit, SFLPhoneClient *client)
{
    if (force_quit || calllist_get_size(current_calls_tab) == 0 || main_window_ask_quit(client)) {
        dbus_unregister(getpid());
        dbus_clean();
        account_list_free();
        calllist_clean(current_calls_tab);
        calllist_clean(contacts_tab);
        calllist_clean(history_tab);
        free_addressbook();

        // make sure all open dialogs get a response signal so that they can close
        GList* top_level_windows = gtk_window_list_toplevels();
        g_list_foreach(top_level_windows, (GFunc)send_response_to_dialogs, NULL);

#if GLIB_CHECK_VERSION(2,32,0)
        g_application_quit(G_APPLICATION(client));
#else
        g_application_release(G_APPLICATION(client));
#endif
    }
}
static void
gbp_greeter_application_addin_add_option_entries (IdeApplicationAddin *addin,
                                                  IdeApplication      *app)
{
  g_assert (IDE_IS_APPLICATION_ADDIN (addin));
  g_assert (G_IS_APPLICATION (app));

  g_application_add_main_option (G_APPLICATION (app),
                                 "greeter",
                                 'g',
                                 G_OPTION_FLAG_IN_MAIN,
                                 G_OPTION_ARG_NONE,
                                 _("Display a new greeter window"),
                                 NULL);

  g_application_add_main_option (G_APPLICATION (app),
                                 "clone",
                                 0,
                                 G_OPTION_FLAG_IN_MAIN,
                                 G_OPTION_ARG_STRING,
                                 _("Begin cloning project from URI"),
                                 "URI");
}
Exemple #19
0
int main(int argc, char **argv)
{
	GApplicationFlags flags;
	GmpvApplication *app;
	gint status;

	flags = G_APPLICATION_HANDLES_COMMAND_LINE|G_APPLICATION_HANDLES_OPEN;
	app = gmpv_application_new(APP_ID, flags);
	status = g_application_run(G_APPLICATION(app), argc, argv);

	g_object_unref(app);

	return status;
}
static void
terminal_app_init (TerminalApp *app)
{
  gs_unref_object GSettings *settings;

  gtk_window_set_default_icon_name (GNOME_TERMINAL_ICON_NAME);

  /* Desktop proxy settings */
  app->system_proxy_settings = g_settings_new (SYSTEM_PROXY_SETTINGS_SCHEMA);

  /* Desktop Interface settings */
  app->desktop_interface_settings = g_settings_new (DESKTOP_INTERFACE_SETTINGS_SCHEMA);

  /* Terminal global settings */
  app->global_settings = g_settings_new (TERMINAL_SETTING_SCHEMA);

#if GTK_CHECK_VERSION (3, 19, 0)
  {
  GtkSettings *gtk_settings;

  gtk_settings = gtk_settings_get_default ();
  terminal_app_theme_variant_changed_cb (app->global_settings,
                                         TERMINAL_SETTING_THEME_VARIANT_KEY, gtk_settings);
  g_signal_connect (app->global_settings,
                    "changed::" TERMINAL_SETTING_THEME_VARIANT_KEY,
                    G_CALLBACK (terminal_app_theme_variant_changed_cb),
                    gtk_settings);
  }
#endif /* GTK+ 3.19 */

  /* Check if we need to migrate from gconf to dconf */
  maybe_migrate_settings (app);

  /* Get the profiles */
  app->profiles_list = terminal_profiles_list_new ();

  /* Get the encodings */
  app->encodings = terminal_encodings_get_builtins ();
  terminal_app_encoding_list_notify_cb (app->global_settings, "encodings", app);
  g_signal_connect (app->global_settings,
                    "changed::encodings",
                    G_CALLBACK (terminal_app_encoding_list_notify_cb),
                    app);

  app->screen_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);

  settings = g_settings_get_child (app->global_settings, "keybindings");
  terminal_accels_init (G_APPLICATION (app), settings);
}
Exemple #21
0
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;
}
Exemple #22
0
gint
main (gint argc, gchar *argv[])
{
  GtkApplication *app;
  PhotosRemoteDisplayManager *remote_display_mngr;
  gint exit_status;

  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  g_set_prgname (PACKAGE_TARNAME);

  app = photos_application_new ();
  if (g_getenv ("PHOTOS_PERSIST") != NULL)
    g_application_hold (G_APPLICATION (app));

  remote_display_mngr = photos_remote_display_manager_dup_singleton ();
  exit_status = g_application_run (G_APPLICATION (app), argc, argv);
  g_object_unref (remote_display_mngr);
  g_object_unref (app);

  return exit_status;
}
Exemple #23
0
int
main (int    argc, char **argv)
{
    gst_init(&argc,&argv);
    GtkApplication *app;
    int status;
    init_socket();

    app = gtk_application_new ("smart.house", 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
action_kill (GSimpleAction *action,
	     GVariant *parameter,
	     gpointer user_data)
{
	GtkApplication *application = user_data;
	GList *windows;

	/* this will also destroy the desktop windows */
	windows = gtk_application_get_windows (application);
	g_list_foreach (windows, (GFunc) gtk_widget_destroy, NULL);

	/* we have been asked to force quit */
	g_application_quit (G_APPLICATION (application));
}
Exemple #25
0
static void
g_application_finalize (GObject *object)
{
  GApplication *application = G_APPLICATION (object);

  if (application->priv->impl)
    g_application_impl_destroy (application->priv->impl);
  g_free (application->priv->id);

  if (application->priv->mainloop)
    g_main_loop_unref (application->priv->mainloop);

  G_OBJECT_CLASS (g_application_parent_class)
    ->finalize (object);
}
Exemple #26
0
gint
main (gint argc, gchar *argv[])
{
    setlocale (LC_CTYPE, "");
    bindtextdomain (LOCALE_PACKAGE, LOCALE_DIR);
    textdomain (LOCALE_PACKAGE);

    g_print (COLOR_RED APP_NAME " rel. " APP_VERSION COLOR_RESET"\n");
    g_print (APP_DESCRIPTION "\n\n");
    g_print (APP_COPYRIGHT " " APP_AUTHOR_EMAIL "\n");
    g_print (APP_LICENSE "\n");

    g_print (APP_GNU_WARN "\n\n");

    app_application = gtk_application_new (APP_ID, G_APPLICATION_FLAGS_NONE);

    g_signal_connect (app_application, "activate", G_CALLBACK (app_activate), NULL);
    g_signal_connect (app_application, "shutdown", G_CALLBACK (app_shutdown), NULL);
    g_signal_connect (app_application, "startup", G_CALLBACK (app_startup), NULL);

    g_application_set_default (G_APPLICATION (app_application));

    return g_application_run (G_APPLICATION (app_application), argc, argv);
}
Exemple #27
0
static void
ide_application_actions_quit (GSimpleAction *action,
                              GVariant      *param,
                              gpointer       user_data)
{
  IdeApplication *self = user_data;

  IDE_ENTRY;

  g_assert (IDE_IS_APPLICATION (self));

  g_application_quit (G_APPLICATION (self));

  IDE_EXIT;
}
Exemple #28
0
void xfdashboard_application_quit_forced(void)
{
	if(G_LIKELY(application!=NULL))
	{
		/* Quit also any other running instance */
		if(g_application_get_is_remote(G_APPLICATION(application))==TRUE)
		{
			g_action_group_activate_action(G_ACTION_GROUP(application), "Quit", NULL);
		}

		/* Quit this instance */
		_xfdashboard_application_quit(application, TRUE);
	}
		else clutter_main_quit();
}
int
main (int argc, char *argv[])
{
  int ret;
  const char *xdg_data_dirs;
  char **dirs = NULL;
  char *schemas_dir;

  /* Save XDG_DATA_DIRS to set GSETTINGS_SCHEME_DIR, otherwise we
   * won't find the sytem schemas. */
  xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
  if (xdg_data_dirs)
    dirs = g_strsplit (xdg_data_dirs, ":", -1);

  /* We can only use one directory, so use the first one or the system default. */
  schemas_dir = g_build_filename (dirs ? dirs[0] : "/usr/share", "glib-2.0", "schemas", NULL);
  g_setenv ("GSETTINGS_SCHEMA_DIR", schemas_dir, TRUE);
  g_strfreev (dirs);
  g_free (schemas_dir);

  g_setenv ("XDG_DATA_DIRS", TEST_DIR, TRUE);
  g_setenv ("XDG_DATA_HOME", TEST_DIR, TRUE);

  gtk_test_init (&argc, &argv);

  ephy_debug_init ();

  if (!ephy_file_helpers_init (NULL, EPHY_FILE_HELPERS_PRIVATE_PROFILE | EPHY_FILE_HELPERS_ENSURE_EXISTS, NULL)) {
    g_debug ("Something wrong happened with ephy_file_helpers_init()");
    return -1;
  }

  _ephy_shell_create_instance (EPHY_EMBED_SHELL_MODE_TEST);
  g_application_register (G_APPLICATION (ephy_embed_shell_get_default ()), NULL, NULL);

  g_test_add_func ("/embed/ephy-embed-shell/launch_handler",
                   test_ephy_embed_shell_launch_handler);

  g_test_add_func ("/embed/ephy-embed-shell/web-view-created",
                   test_ephy_embed_shell_web_view_created);

  ret = g_test_run ();

  g_object_unref (ephy_embed_shell_get_default ());
  ephy_file_helpers_shutdown ();

  return ret;
}
Exemple #30
0
static int 
gw_application_command_line (GApplication *application, GApplicationCommandLine *command_line)
{
    //Declarations
    LwDictionary *dictionary;
    GwSearchWindow *window;
    GwDictionaryList *dictionarylist;
    GwApplicationPrivate *priv;
    gint argc;
    gchar **argv;
    gint position;

    //Initializations
    priv = GW_APPLICATION (application)->priv;
    dictionarylist = gw_application_get_installed_dictionarylist (GW_APPLICATION (application));
    argv = NULL;

    if (command_line != NULL)
    {
      argv = g_application_command_line_get_arguments (command_line, &argc);

      gw_application_parse_args (GW_APPLICATION (application), &argc, &argv);
    }
    g_application_activate (G_APPLICATION (application));
    window = gw_application_get_last_focused_searchwindow (GW_APPLICATION (application));
    if (window == NULL) 
      return 0;
    dictionary = lw_dictionarylist_get_dictionary_fuzzy (LW_DICTIONARYLIST (dictionarylist), priv->arg_dictionary);

    //Set the initial dictionary
    if (dictionary != NULL)
    {
      position = lw_dictionarylist_get_position (LW_DICTIONARYLIST (dictionarylist), dictionary);
      gw_searchwindow_set_dictionary (window, position);
    }

    //Set the initial query text if it was passed as an argument to the program
    if (priv->arg_query != NULL)
    {
      gw_searchwindow_entry_set_text (window, priv->arg_query);
      gw_searchwindow_search_cb (GTK_WIDGET (window), window);
    }

    //Cleanup
    if (argv != NULL) g_strfreev (argv); argv = NULL;

    return 0;
}