Exemplo n.º 1
0
int
main (int argc, char **argv)
{
        gchar *new_default_files[1] = {NULL};
	GtkSettings *settings;
	gint i;
	gtk_init (&argc, &argv);
        
        /* we get a gtkrc from GTK2_RC_FILES, remove the users theme ... */
        settings = gtk_settings_get_default ();
        g_object_set (settings, "gtk-theme-name", "Raleigh", NULL);
        
	create_testwidgets ();

	window = gtk_window_new (GTK_WINDOW_POPUP);
	box = gtk_vbox_new (FALSE, 0);
	
	gtk_container_add ((GtkContainer*)window, box);
	
	for (i = 0; i < WIDGET_COUNT; i++) {
		if (widgets[i] && !widgets[i]->parent)
			gtk_box_pack_end (GTK_BOX (box), widgets[i], FALSE, FALSE, 0);
	}

	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);
	
	gtk_widget_show_all (window);
	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);
	
	for (i = 0; i < G_N_ELEMENTS (tests); i++)
		run_test (i);
	
	/* remove the rc file again. This should cause an unload of the engine
	 * and destruction of all engine objects. */
        gtk_rc_set_default_files (new_default_files);
	gtk_rc_reparse_all_for_settings (settings, TRUE);

	gtk_widget_hide (window);
	gtk_widget_unmap (window);

	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);

	gtk_widget_destroy (window);

	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);

	/* TODO: It would be really cool to check if there is no
	 * loaded engine at this point. */

	/*
	 * HRM: Calling the follwing causes an assertion failure inside cairo here -- 01.10.2010, Benjamin
	cairo_debug_reset_static_data ();
	*/

	return 0;
}
Exemplo n.º 2
0
static VALUE
rg_m_set_default_files(G_GNUC_UNUSED VALUE self, VALUE rbfilenames)
{
    gchar **filenames = (gchar **)RVAL2STRV(rbfilenames);

    gtk_rc_set_default_files(filenames);

    g_free(filenames);

    return rbfilenames;
}
Exemplo n.º 3
0
int main(int   argc,
	 char *argv[])
{
  if(setpgrp() < 0)
    perror("setpgrp()");

  if (parse_command_line(argc, argv) != 0)
    return 1;

#ifdef WIN32
  // if under windows, we need to define the locale directory
  bindtextdomain("poker2d", "./../locale");
#endif
  
  bind_textdomain_codeset("poker2d","UTF-8");    
  textdomain("poker2d");

  if (g_display)
  {
      char	tmp[64];
      snprintf(tmp, sizeof (tmp), "DISPLAY=%s", g_display);
      putenv(tmp);
  }
  
  if (g_gtk_rc_file)
  {
      char* file_name = strrchr(g_gtk_rc_file, '/')+1;

      int path_len = strlen(g_gtk_rc_file);
      int name_len = strlen(file_name);
      int newname_len = strlen(gettext(file_name));
      
      char* new_gtk_rc = malloc(sizeof(char)*(path_len-name_len+newname_len));
      memset(new_gtk_rc, 0, path_len-name_len+newname_len);
      memcpy(new_gtk_rc, g_gtk_rc_file, path_len-name_len);
      strcat(new_gtk_rc, gettext(file_name));
      
      char* tmp[2] = { new_gtk_rc, 0};
      gtk_rc_set_default_files(tmp);
      
      g_message("%s\n", new_gtk_rc);
      g_message(gettext("CANCEL"));
      
      g_free(g_gtk_rc_file);
      g_free(new_gtk_rc);
  }
  gtk_init (&argc, &argv);  

  set_verbose(g_want_verbose);

  if (!init_interface_io(g_hostname ? g_hostname : "127.0.0.1"))
    return 1;

  if (g_smiley_path)
    create_smiley_array(g_smiley_path, "smileys.xml");
  else
    create_smiley_array(".", "smileys.xml");
  gtk_main ();
  destroy_smiley_array();
  if (g_smiley_path) g_free(g_smiley_path);
  if (g_data_dir) g_free(g_data_dir);
  if (g_display) g_free(g_display);
  gui_set_glade_file(NULL);

  exit(0);
}