Example #1
0
static void
activate_about (GSimpleAction *action,
                GVariant      *parameter,
                gpointer       user_data)
{
  GtkApplication *app = user_data;
  const gchar *authors[] = {
    "Andrea Cimitan",
    "Cosimo Cecchi",
    NULL
  };

  gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
                         "program-name", "GTK+ Widget Factory",
                         "version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
                                                     PACKAGE_VERSION,
                                                     gtk_get_major_version (),
                                                     gtk_get_minor_version (),
                                                     gtk_get_micro_version ()),
                         "copyright", "(C) 1997-2013 The GTK+ Team",
                         "license-type", GTK_LICENSE_LGPL_2_1,
                         "website", "http://www.gtk.org",
                         "comments", "Program to demonstrate GTK+ themes and widgets",
                         "authors", authors,
                         "logo-icon-name", "gtk3-widget-factory",
                         "title", "About GTK+ Widget Factory",
                         NULL);
}
Example #2
0
static void
print_version (void)
{
  g_print ("gtk3-demo %d.%d.%d\n",
           gtk_get_major_version (),
           gtk_get_minor_version (),
           gtk_get_micro_version ());
}
static void
activate_about (GSimpleAction *action,
                GVariant      *parameter,
                gpointer       user_data)
{
  GtkWidget *window = user_data;
  GdkPixbuf *pixbuf;

  const gchar *authors[] = {
    "Peter Mattis",
    "Spencer Kimball",
    "Josh MacDonald",
    "and many more...",
    NULL
  };

  const gchar *documentors[] = {
    "Owen Taylor",
    "Tony Gale",
    "Matthias Clasen <*****@*****.**>",
    "and many more...",
    NULL
  };

  pixbuf = gdk_pixbuf_new_from_resource ("/application/gtk-logo-48.png", NULL);

  gtk_show_about_dialog (GTK_WINDOW (window),
                         "program-name", "GTK+ Code Demos",
                         "version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
                                                     PACKAGE_VERSION,
                                                     gtk_get_major_version (),
                                                     gtk_get_minor_version (),
                                                     gtk_get_micro_version ()),
                         "copyright", "(C) 1997-2009 The GTK+ Team",
                         "license-type", GTK_LICENSE_LGPL_2_1,
                         "website", "http://www.gtk.org",
                         "comments", "Program to demonstrate GTK+ functions.",
                         "authors", authors,
                         "documenters", documentors,
                         "logo", pixbuf,
                         "title", "About GTK+ Code Demos",
                         NULL);
  g_object_unref (pixbuf);
}
int main(int argc, char* argv[])
{
	gtk_init(&argc, &argv);

	if (!isThemeAvailable())
		return 0;

	printf
	(
		"GTK version: %d.%d.%d\n",
		gtk_get_major_version(),
		gtk_get_minor_version(),
		gtk_get_micro_version()
	);

	// testColors();
	getTooltipColors_GtkWidgetPath();
	getTooltipColors_GtkTooltipWindow();
	getTooltipColors_TooltipSetCustom();

	return 0;
}
Example #5
0
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj,
                                           int *verMin,
                                           int *verMicro) const
{
#ifdef __WXGTK3__
    if (verMaj)
        *verMaj = gtk_get_major_version();
    if (verMin)
        *verMin = gtk_get_minor_version();
    if (verMicro)
        *verMicro = gtk_get_micro_version();
#else
    if ( verMaj )
        *verMaj = gtk_major_version;
    if ( verMin )
        *verMin = gtk_minor_version;
    if ( verMicro )
        *verMicro = gtk_micro_version;
#endif

    return wxPORT_GTK;
}
Example #6
0
int
main (int   argc,
      char *argv[])
{
    IdeApplication *app;
    int ret;

    ide_log_init (TRUE, NULL);

    g_message ("Initializing with Gtk+ version %d.%d.%d.",
               gtk_get_major_version (),
               gtk_get_minor_version (),
               gtk_get_micro_version ());

    app = ide_application_new ();
    ret = g_application_run (G_APPLICATION (app), argc, argv);
    g_clear_object (&app);

    ide_log_shutdown ();

    return ret;
}
Example #7
0
int
main (int   argc,
      char *argv[])
{
  GApplication *app;
  int ret;

  setlocale (LC_ALL, "");

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

  g_set_prgname (PACKAGE_TARNAME);
  g_set_application_name (_("Builder"));

  ide_set_program_name ("gnome-builder");

  ide_log_init (TRUE, NULL);

  g_message ("Initializing with Gtk+ version %d.%d.%d.",
             gtk_get_major_version (),
             gtk_get_minor_version (),
             gtk_get_micro_version ());

  g_resources_register (gb_icons_get_resource ());

  app = g_object_new (GB_TYPE_APPLICATION,
                      "application-id", "org.gnome.Builder",
                      "flags", G_APPLICATION_HANDLES_OPEN,
                      NULL);
  ret = g_application_run (app, argc, argv);
  g_clear_object (&app);

  ide_log_shutdown ();

  return ret;
}
Example #8
0
char *get_toolkit_version()
{
    char *p = malloc(64);
    sprintf(p, "GTK+ ver %u.%u.%u", gtk_get_major_version(), gtk_get_minor_version(), gtk_get_micro_version());
    return p;
}
Example #9
0
int
main (int argc, char *argv[])
{
  GError *error = NULL;
  GOptionContext *context = NULL;
  gchar *summary;
  gchar *app_name;
#ifdef G_OS_UNIX
  gchar *desktop_file_name;
  gchar *bus_name = NULL;
#endif
  GAppInfo *info = NULL;
  GAppLaunchContext *launch_context;
  GList *l;
  GFile *f;

  setlocale (LC_ALL, "");

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

  /* Translators: this message will appear immediately after the */
  /* usage string - Usage: COMMAND [OPTION...] <THIS_MESSAGE>    */
  context =
    g_option_context_new (_("APPLICATION [URI...] — launch an APPLICATION"));

  /* Translators: this message will appear after the usage string */
  /* and before the list of options.                              */
  summary = _("Launch an application (specified by its desktop file name),\n"
              "optionally passing one or more URIs as arguments.");
  g_option_context_set_summary (context, summary);
  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
  g_option_context_add_group (context, gtk_get_option_group (FALSE));

  g_option_context_parse (context, &argc, &argv, &error);

  g_option_context_free (context);

  if (error != NULL)
    {
      g_printerr (_("Error parsing commandline options: %s\n"), error->message);
      g_printerr ("\n");
      g_printerr (_("Try \"%s --help\" for more information."), g_get_prgname ());
      g_printerr ("\n");
      g_error_free (error);
      return 1;
    }

  if (show_version)
    {
      g_print ("%d.%d.%d\n",
               gtk_get_major_version (),
               gtk_get_minor_version (),
               gtk_get_micro_version ());
      return 0;
    }

  if (!args)
    {
      /* Translators: the %s is the program name. This error message */
      /* means the user is calling gtk-launch without any argument.  */
      g_printerr (_("%s: missing application name"), g_get_prgname ());
      g_printerr ("\n");
      g_printerr (_("Try \"%s --help\" for more information."), g_get_prgname ());
      g_printerr ("\n");
      return 1;
    }


  gtk_init (&argc, &argv);

  app_name = *args;
#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
  bus_name = g_strdup (app_name);
  if (g_str_has_suffix (app_name, ".desktop"))
    {
      desktop_file_name = g_strdup (app_name);
      bus_name[strlen (bus_name) - strlen(".desktop")] = '\0';
    }
  else
    {
      desktop_file_name = g_strconcat (app_name, ".desktop", NULL);
    }

  if (!g_dbus_is_name (bus_name))
    g_clear_pointer (&bus_name, g_free);
  info = G_APP_INFO (g_desktop_app_info_new (desktop_file_name));
  g_free (desktop_file_name);
#else
#warning Please add support for creating AppInfo from id for your OS
  g_printerr (_("Creating AppInfo from id not supported on non unix operating systems"));
#endif
  args++;

  if (!info)
    {
      /* Translators: the first %s is the program name, the second one */
      /* is the application name.                                      */
      g_printerr (_("%s: no such application %s"),
                  g_get_prgname (), app_name);
      g_printerr ("\n");
      return 2;
    }

  l = NULL;
  for (; *args; args++)
    {
      f = g_file_new_for_commandline_arg (*args);
      l = g_list_append (l, f);
    }

  launch_context = (GAppLaunchContext*) gdk_display_get_app_launch_context (gdk_display_get_default ());
  if (!g_app_info_launch (info, l, launch_context, &error))
    {
       /* Translators: the first %s is the program name, the second one  */
       /* is the error message.                                          */
       g_printerr (_("%s: error launching application: %s\n"),
                   g_get_prgname (), error->message);
       return 3;
    }
  g_object_unref (info);
  g_object_unref (launch_context);

#ifdef G_OS_UNIX
  if (bus_name != NULL)
    {
      GDBusConnection *connection;
      gchar *object_path, *p;

      connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);

      object_path = g_strdup_printf ("/%s", bus_name);
      for (p = object_path; *p != '\0'; p++)
          if (*p == '.')
              *p = '/';

      if (connection)
        g_dbus_connection_call_sync (connection,
                                     bus_name,
                                     object_path,
                                     "org.freedesktop.DBus.Peer",
                                     "Ping",
                                     NULL, NULL,
                                     G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
      g_clear_pointer (&object_path, g_free);
      g_clear_object (&connection);
      g_clear_pointer (&bus_name, g_free);
    }
#endif
  g_list_free_full (l, g_object_unref);

  return 0;
}