Example #1
0
int main(int argc, char *argv[]) 
{
GtkWidget *gmdb;
GnomeProgram *program;

#ifdef SQL
	/* initialize the SQL engine */
	sql = mdb_sql_init();
#endif
	/* initialize MDB Tools library */
	mdb_init();

        /* Initialize GNOME */
	       /* Initialize gnome program */
	program = gnome_program_init ("gmdb", "0.2",
		LIBGNOMEUI_MODULE, argc, argv,
		GNOME_PARAM_POPT_TABLE, NULL,
		GNOME_PARAM_HUMAN_READABLE_NAME,
		_("Gnome-MDB File Viewer"),
		GNOME_PARAM_APP_DATADIR, DATADIR,
		NULL);
	//gnome_init ("gmdb", "0.2", argc, argv);
	//app = gnome_app_new ("gmdb", "Gnome-MDB File Viewer");
	glade_init();

	/* load the interface */
	mainwin_xml = glade_xml_new(GMDB_GLADEDIR "gmdb.glade", NULL, NULL);
	/* connect the signals in the interface */
	glade_xml_signal_autoconnect(mainwin_xml);

	gmdb = glade_xml_get_widget (mainwin_xml, "gmdb");
	gtk_signal_connect (GTK_OBJECT (gmdb), "delete_event",
		GTK_SIGNAL_FUNC (delete_event), NULL);

	//gmdb_load_icons(mainwin_xml);

	if (argc>1) {
		gmdb_file_open(argv[1]);
	}

	gmdb_load_recent_files();

	/* start the event loop */
	gtk_main();

#ifdef SQL
	/* free MDB Tools library */
	mdb_sql_exit(sql);
#endif
	mdb_exit();

	return 0;
}
Example #2
0
int
main(int argc, char *argv[])
{
//  int major;
//  int minor;
  GtkWidget *app_win;
  pthread_t tid;

  parse_cmd_line_params(argc, argv);
  printf("\n width: %d"
      "\n height: %d"
      "\n remote ip: %s"
      "\n remote port: %d"
      "\n local ip: %s"
      "\n local port: %d"
      "\n", displayW, displayH, remoteIp, remotePort, localIp, localPort);

  gtk_init(&argc, &argv);

  printf("%s:%d\n", __FUNCTION__, __LINE__);

  /* load the interface */
  xml = glade_xml_new(/* SHARE_DIR */"xwrcptex.glade", NULL, NULL);
  /* connect the signals in the interface */
  glade_xml_signal_autoconnect(xml);
  app_win = glade_xml_get_widget(xml, "mainwin");

  printf("%s:%d\n", __FUNCTION__, __LINE__);

  g_signal_connect(G_OBJECT(app_win), "event",
      G_CALLBACK(on_mainwin_frame_event), NULL);

#if defined(USE_THEORA)
  x_theora_init();
#endif

  printf("%s:%d\n", __FUNCTION__, __LINE__);

  if (!g_thread_supported())
    g_thread_init(NULL);
  gdk_threads_init();
  pthread_create(&tid, NULL, rtpthread, NULL);

  /* start the event loop */
  // gtk_main();
  printf("%s:%d\n", __FUNCTION__, __LINE__);
  x_main_loop((void *) app_win);

  getchar();

  return 0;
}
Example #3
0
int main(int argc, char* argv[])
{
	regex_t fregex;

	gtk_init(&argc,&argv);

	// check the correct BASS was loaded
	if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS was loaded");
		return 0;
	}

	// enable floating-point DSP (not really necessary as the channels will be floating-point anyway)
	BASS_SetConfig(BASS_CONFIG_FLOATDSP,TRUE);

	// initialize default device
	if (!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error("Can't initialize device");
		return 0;
	}

	// initialize GUI
	glade=glade_xml_new(GLADE_PATH"dsptest.glade",NULL,NULL);
	if (!glade) return 0;
	win=GetWidget("window1");
	if (!win) return 0;
	glade_xml_signal_autoconnect(glade);

	{ // initialize file selector
		GtkFileFilter *filter;
		filesel=gtk_file_chooser_dialog_new("Open File",GTK_WINDOW(win),GTK_FILE_CHOOSER_ACTION_OPEN,
			GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL);
		filter=gtk_file_filter_new();
		gtk_file_filter_set_name(filter,"Playable files");
		regcomp(&fregex,"\\.(mo3|xm|mod|s3m|it|umx|mp[1-3]|ogg|wav|aif)$",REG_ICASE|REG_NOSUB|REG_EXTENDED);
		gtk_file_filter_add_custom(filter,GTK_FILE_FILTER_FILENAME,FileExtensionFilter,&fregex,NULL);
		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filesel),filter);
		filter=gtk_file_filter_new();
		gtk_file_filter_set_name(filter,"All files");
		gtk_file_filter_add_pattern(filter,"*");
		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filesel),filter);
	}

	gtk_main();

	gtk_widget_destroy(filesel);
	regfree(&fregex);

	BASS_Free();

    return 0;
}
Example #4
0
void gmdb_table_export(MdbCatalogEntry *entry) 
{
GtkWidget *export_button;
GtkWidget *close_button;
   
	cat_entry = entry;

	/* load the interface */
	exportwin_xml = glade_xml_new(GMDB_GLADEDIR "gmdb-export.glade", NULL, NULL);
	/* connect the signals in the interface */
	glade_xml_signal_autoconnect(exportwin_xml);
	gmdb_table_export_populate_dialog(exportwin_xml);
}
gboolean
on_ContactsImport_activate (GtkWidget * widget, GdkEvent * event, gpointer user_data)
{
	GnomeDruid *druid;
	gladexml_import_userlist = glade_xml_new (PACKAGE_DATA_DIR "/gnomegadu.glade", "ImportUserlist", NULL);

	druid = GNOME_DRUID (glade_xml_get_widget (gladexml_import_userlist, "ImportUserlistDruid"));

	gnome_druid_set_buttons_sensitive (druid, FALSE, TRUE, TRUE, FALSE);
	glade_xml_signal_autoconnect (gladexml_import_userlist);
	gtk_widget_show_all (GTK_WIDGET (druid));
	return TRUE;
}
int
main (int argc, char **argv)
{
	GOptionContext *context;
	GladeXML       *gui;
	char           *gladefile;

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

	context = g_option_context_new ("");

	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);

	gnome_program_init (argv [0], "0.0.0.0", LIBGNOMEUI_MODULE,
			    argc, argv,
			    GNOME_PARAM_GOPTION_CONTEXT, context,
			    GNOME_PARAM_NONE);

	g_option_context_free (context);

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		return 0;
	}

	gladefile = PANEL_APPLET_GLADEDIR "/panel-test-applets.glade";
	gui = glade_xml_new (gladefile, "toplevel", NULL);
	if (!gui) {
		g_warning ("Error loading `%s'", gladefile);
		return 1;
	}

	glade_xml_signal_autoconnect (gui);

	win             = glade_xml_get_widget (gui, "toplevel");
	applet_combo    = glade_xml_get_widget (gui, "applet-combo");
	prefs_dir_entry = glade_xml_get_widget (gui, "prefs-dir-entry");
	orient_combo    = glade_xml_get_widget (gui, "orient-combo");
	size_combo      = glade_xml_get_widget (gui, "size-combo");

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	return 0;
}
int
main (int argc, char **argv)
{
  bindtextdomain (PACKAGE, LOCALEDIR);
  bind_textdomain_codeset (PACKAGE, "UTF-8");
  textdomain (PACKAGE);

  gtk_init (&argc, &argv);

  if (g_file_test ("gksu-properties.glade", G_FILE_TEST_EXISTS) == TRUE)
    {
      gui = glade_xml_new ("gksu-properties.glade", NULL, NULL);
    }
  else if (g_file_test (PREFIX "/share/" PACKAGE "/gksu-properties.glade",
			G_FILE_TEST_EXISTS) == TRUE)
    {
      gui = glade_xml_new (PREFIX "/share/" PACKAGE "/gksu-properties.glade", NULL,
			   NULL);
    }

  if (!gui) {
    GtkWidget *dialog;

    dialog = gtk_message_dialog_new (NULL,
				     0,
				     GTK_MESSAGE_ERROR,
				     GTK_BUTTONS_CLOSE,
				     _("Failed to load glade file; please check your installation."));

    gtk_dialog_run (GTK_DIALOG (dialog));
    gtk_widget_destroy (dialog);

    return 1;
  }

  glade_xml_signal_autoconnect (gui);

  gconf_client = gconf_client_get_default ();

  update_from_gconf ();
  create_dialog ();
  setup_notifications ();

  if (main_window)
    gtk_main ();

  g_object_unref (gconf_client);

  return 0;
}
/*
** Load and set up GUI with libglade
*/
GtkWidget *InitTestMEdWindow( void )
{
    GtkWidget *win=NULL, *frame=NULL;
    GladeXML *xml=NULL;
    char *rootnode=NULL; // This is probably never needed

    errormsg(MAPDEBUG1,"InitTestMEdWindow: Entered");

    glade_init();
    errormsg(MAPDEBUG4,"InitTestMEdWindow: glade_init done");
    xml = glade_xml_new(TESTMAPEDITFILE, rootnode);

    errormsg(MAPDEBUG4,"InitTestMEdWindow: glade_xml_new done");

    if (!xml) {
        g_warning("something bad happened while creating the interface");
	CloseAll();
	exit(20);
    }

    if (rootnode) // Probably never needed
    {
	GtkWidget *wid = glade_xml_get_widget(xml, rootnode);
	if (!GTK_IS_WINDOW(wid))
	{
	    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	    errormsg(MAPDEBUG3,"InitTestMEdWindow: win=%x",win);
	    gtk_signal_connect(GTK_OBJECT(win), "destroy",
			       GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
	    gtk_container_set_border_width(GTK_CONTAINER(win), 5);
	    frame = gtk_frame_new(NULL);
	    gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
	    gtk_container_add(GTK_CONTAINER(win), frame);
	    gtk_widget_show(frame);
	    gtk_container_add(GTK_CONTAINER(frame), wid);
	    gtk_widget_show(win);
	}
	else win=wid;
    }

    // Connect signals
    errormsg(MAPDEBUG3,"InitTestMEdWindow: win=%x",win);
    glade_xml_signal_autoconnect(xml);
    gtk_object_unref(GTK_OBJECT(xml));
    errormsg(MAPDEBUG3,"InitTestMEdWindow: win=%x now!",win);

    errormsg(MAPDEBUG1,"InitTestMEdWindow: Finished succesfully");
    return win; // Problem: We never get a window pointer ?
}
Example #9
0
/*
	Display popup menu (right click)
*/
static GtkWidget* display_popup_menu(void)
{
	GladeXML *xml;
	GtkWidget *menu;

	xml = glade_xml_new
	    (tilp_paths_build_glade("dbg_regs-2.glade"), "dbgregs_popup",
	     PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	menu = glade_xml_get_widget(xml, "dbgregs_popup");
	return menu;
}
Example #10
0
void 
preferences_show (void)
{
	if (dialog == NULL) 
	{
		glade_xml = glade_xml_new(g_build_filename(MINBAR_DATADIR,GLADE_MAIN_INTERFACE,NULL), NULL, NULL);
		glade_xml_signal_autoconnect(glade_xml);

		dialog = glade_xml_get_widget(glade_xml, "editcity");

		setup_dialog();
		update_widgets();
	}
	gtk_window_present(GTK_WINDOW(dialog));
}
Example #11
0
void
on_rescue_button_clicked            (GtkButton       *button,
									 gpointer         user_data)
{
	GtkWidget *window;

    rescue_glade = glade_xml_new("check.glade", "media_select"); 
    glade_xml_signal_autoconnect(rescue_glade);

	/* Ask the user to insert the media */
    window = glade_xml_get_widget(rescue_glade, "media_select");
	on_cdrom_radio_toggled(NULL, NULL);

	gtk_widget_show(window);
}
Example #12
0
gint display_quicksend_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("quicksend-2.glade"), 
		 "quicksend_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "quicksend_dbox");

	tmp_enabled = options.qs_enabled;
	tmp_file = g_strdup(options.qs_file);

	fcb = glade_xml_get_widget(xml, "filechooserbutton1");
	gtk_widget_set_sensitive(fcb, tmp_enabled && tmp_file);
	if(tmp_file && strlen(tmp_file))
		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fcb), tmp_file);
	// filter wildcards to set
	//"*.89?;*.92?;*.9x?;*.9X?;*.v2?;*.V2?;*.tig"

	data = glade_xml_get_widget(xml, "checkbutton1");
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), tmp_enabled);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		options.qs_enabled = tmp_enabled;

		g_free(options.qs_file);
		options.qs_file = tmp_file;
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Example #13
0
/* callbacks */
GtkWidget *
gmdb_info_new()
{
    GtkWidget *propswin, *label;
    GladeXML *propswin_xml;
    gchar title[100];
    gchar tmpstr[20];
    gchar *filename, *filepath;
    int i;
    struct stat st;

    /* load the interface */
    propswin_xml = glade_xml_new(GMDB_GLADEDIR "gmdb-props.glade", NULL, NULL);
    /* connect the signals in the interface */
    glade_xml_signal_autoconnect(propswin_xml);

    filepath = g_strdup(mdb->f->filename);
    for (i=strlen(filepath); i>0 && filepath[i-1]!='/'; i--);
    filename=&filepath[i];

    propswin = glade_xml_get_widget (propswin_xml, "props_dialog");
    g_snprintf(title, 100, "%s Properties",filename);
    gtk_window_set_title(GTK_WINDOW(propswin), title);

    label = glade_xml_get_widget (propswin_xml, "props_filename");
    gtk_label_set_text(GTK_LABEL(label), filename);

    label = glade_xml_get_widget (propswin_xml, "props_jetver");
    gtk_label_set_text(GTK_LABEL(label), mdb->f->jet_version == MDB_VER_JET3 ? "3 (Access 97)" : "4 (Access 2000/XP)");

    assert( fstat(mdb->f->fd, &st)!=-1 );
    sprintf(tmpstr, "%ld K", st.st_size/1024);
    label = glade_xml_get_widget (propswin_xml, "props_filesize");
    gtk_label_set_text(GTK_LABEL(label), tmpstr);

    sprintf(tmpstr, "%ld", st.st_size / mdb->fmt->pg_size);
    label = glade_xml_get_widget (propswin_xml, "props_numpages");
    gtk_label_set_text(GTK_LABEL(label), tmpstr);

    sprintf(tmpstr, "%d", mdb->num_catalog);
    label = glade_xml_get_widget (propswin_xml, "props_numobjs");
    gtk_label_set_text(GTK_LABEL(label), tmpstr);

    g_free(filepath);

    return propswin;
}
Example #14
0
int main(int argc, char **argv) {
  
  FILE *ftmp = NULL;
  char guipath[512];
//  char cwd[512];

//  getcwd(cwd,511);
//  chdir("/usr/share/dynebolic/splash");

  sprintf(guipath,"dynesplash.glade");

  ftmp = fopen(guipath,"r");
  if(!ftmp) {
    sprintf(guipath,"/usr/share/dyne/splash/dynesplash.glade");
    ftmp = fopen(guipath,"r");
  }
  if(!ftmp) {
    fprintf(stdout,"file missing: dynesplash.glade\n");
    fprintf(stdout,"fatal error: GUI description not found");
    exit(0);
  } else fclose(ftmp);

  /* internationalization stuff */
  bindtextdomain ("dynesplash", "/usr/share/dyne/splash");
  textdomain ("dynesplash");
  gtk_set_locale ();

  gtk_init(&argc,&argv);
  gui = glade_xml_new(guipath,NULL,NULL);

  /* connect callbacks automatically  */
  glade_xml_signal_autoconnect(gui);
  
  /* ====== connect callbacks manually */
    
  // credits
  CONNECT_ARG("rastasoft_button","clicked",goto_url,www_rastasoft);
  CONNECT_ARG("puredyne_button","clicked",goto_url,www_puredyne);
  CONNECT_ARG("eu_button","clicked",goto_url,www_europe);
  CONNECT_ARG("gnu_button","clicked",goto_url,www_gnu);
  CONNECT_ARG("morecredits_button","clicked",goto_url,www_lulz);

  gtk_main();

  exit(1);
}
Example #15
0
int main (int argc, 
          char *argv[])
{
  GtkWidget *window;

  gtk_init (&argc, &argv);

  xml = glade_xml_new ("exercise10-2.glade", NULL, NULL);
  window = glade_xml_get_widget (xml, "window");
  gtk_window_set_title (GTK_WINDOW (window), "Untitled");
  glade_xml_signal_autoconnect (xml);

  gtk_widget_show_all (window);
  gtk_main ();

  return 0;
}
gboolean
on_userlist_import_page_1_next (GnomeDruidPage * druidpage, GtkWidget * widget, gpointer user_data)
{
	GtkWidget *radio_import_server, *radio_import_file;
	GnomeDruid *druid = GNOME_DRUID (glade_xml_get_widget (gladexml_import_userlist, "ImportUserlistDruid"));
	GnomeDruidPage *page_last = GNOME_DRUID_PAGE (glade_xml_get_widget (gladexml_import_userlist, "userlist_import_page_last"));

	radio_import_server = glade_xml_get_widget (gladexml_import_userlist, "RadioImportServer");
	radio_import_file = glade_xml_get_widget (gladexml_import_userlist, "RadioImportFile");
	g_assert (radio_import_file);

	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_import_server)))
	{
		GtkWidget *progress_window;

		if (!gnomegadu_gadugadu_session)
		{
			GtkDialog *msgdialog = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
										   "<span weight=\"bold\"size=\"larger\">Brak połączenia</span>\n\nPołącz się z siecią Gadu-Gadu i spróbuj ponownie.");
			gtk_dialog_run (GTK_DIALOG (msgdialog));
			gtk_widget_destroy (GTK_WIDGET (msgdialog));
			return TRUE;
		}

		gladexml_import_userlist_progress = glade_xml_new (PACKAGE_DATA_DIR "/gnomegadu.glade", "ImportUserlistServerProgressWindow", NULL);
		glade_xml_signal_autoconnect (gladexml_import_userlist_progress);

		g_assert (gladexml_import_userlist_progress);

		progress_window = glade_xml_get_widget (gladexml_import_userlist_progress, "ImportUserlistServerProgressWindow");
		g_assert(progress_window);
		gtk_widget_show_all (GTK_WIDGET(progress_window));

		gg_userlist_request (gnomegadu_gadugadu_session, GG_USERLIST_GET, NULL);

		gnome_druid_set_page (druid, page_last);
		gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, FALSE);
		gnome_druid_set_show_finish (druid, TRUE);
	}
	else
	{
		//gtk_file_chooser_get_filename ()
		//gnomegadu_import_userlist_from_file();
	}
	return FALSE;
}
Example #17
0
int
main(int argc, char **argv)
{
    gtk_init(&argc, &argv);

    char *glade_xml_file = find_in_share("c2v.glade");
    if (!glade_xml_file) {
        printf("Couldn't find the glade file: c2v.glade.  "
               "Aborting...\n");
        exit(1);
    }

    glade_xml = glade_xml_new(glade_xml_file, NULL, NULL);
    free(glade_xml_file);

    set_font();
    set_title();

    GtkWidget *win = get_widget_checked("c2v_window");
    GError *err=NULL;
    int ok=gtk_window_set_icon_from_file(GTK_WINDOW(win),
                                         imgloc("c2v.png"),&err);
    if (!ok)
        printf("Error loading icon: %s\n", err->message);

    if (argc>1) {
        select_defaults_by_file_type(argv[1],TRUE);
        add_input_file(argv[1]);
        int output_format = get_combo_box_item("output_format_combobox");
        process();
        // if we opened up an external application, we can just exit now
        // otherwise we will stay open
        if (output_format == OUTPUT_KML || output_format == OUTPUT_ALOS_CSV)
            exit(EXIT_SUCCESS);
    }
    else {
        set_combo_box_item("input_format_combobox", INPUT_AUTO);
        set_combo_box_item("output_format_combobox", OUTPUT_KML);
    }

    glade_xml_signal_autoconnect(glade_xml);
    gtk_main ();

    exit (EXIT_SUCCESS);
}
Example #18
0
int main(int argc, char **argv)
{
  int valor;
  guint timer = 1000;

#if OPCIONES_LINEA
  const GOptionEntry entries[] = {
    { "timer", 't', 0, G_OPTION_ARG_INT, &timer, "Establece el intervalo del temporizador generador de ciclos, en milisegundos", "T" },
    { NULL }
  };  
  GOptionContext* contexto = g_option_context_new (" <pipeline> - ejecuta un pipeline definido en un XML válido");
  g_option_context_add_main_entries (contexto, entries, 0);
  g_option_context_add_group (contexto, gtk_get_option_group (TRUE));
  g_option_context_parse (contexto, &argc, &argv, 0);
  g_option_context_set_help_enabled (contexto, TRUE);
#endif

  if (argc < 2) {
    printf("Faltan argumentos. Uso: %s <pipeline>.\n", argv[0]);
    return -1;
  }  
  else {
    gtk_init(&argc, &argv);
    glade_init();
    xml = glade_xml_new("ventana_pipeline.glade", NULL, NULL);
    glade_xml_signal_autoconnect(xml);
    pipeline_t * p = pipeline_cargar(argv[1], g_get_current_dir(), funcion_error);
    if(p) {
      g_timeout_add(timer, tick, p);
      pipeline_iniciar(p);	
      gtk_main();
      pipeline_borrar(p);
      valor = 0;
    }
    else {
      valor = -1;
    }
  }

#if OPCIONES_LINEA
  g_option_context_free(contexto);
#endif 

  return valor;
}
Example #19
0
gint dbgsr_display_dbox(void)
{
	GladeXML *xml;
	GtkWidget *dbox;
	gint result;
    gint i;
    gint ret = -1;

    // load GUI
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_regs-2.glade"), "dbgsr_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgsr_window");

    // set initial states
    ti68k_register_get_sr(&tmp_sr);
    for(i = 0; i < 16; i++)
    {
        gchar *str = g_strdup_printf("checkbutton%i", i+1);
        btns[i] = glade_xml_get_widget(xml, str);
        g_free(str);

        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(btns[i]), 
                tmp_sr & (1 << i) ? TRUE : FALSE);
    }

	// run dialog
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
        ti68k_register_set_sr(tmp_sr);
        ret = 0;
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return ret;
}
int show_teacher_window()
{
		GladeXML *TeacherWinXML;
		GtkWidget *teacher_window, *exit_button;
		GtkWidget *treeview;      /*树视图*/
		GtkTreeIter iter;           /*迭代器*/
		GtkCellRenderer* renderer;  /*渲染器*/
		GtkTreeModel *store;      /*树模式*/
		char *sqlresult;
		MYSQL_ROW row;
		unsigned int i=0;
		
		gtk_init(&argc,&argv);
		TeacherWinXML = glade_xml_new("ui/teacher_win.glade", NULL, NULL);
		teacher_window = glade_xml_get_widget(TeacherWinXML, "window1");
		glade_xml_signal_autoconnect(TeacherWinXML);
		treeview = glade_xml_get_widget(TeacherWinXML, "treeview");
		/*定义渲染器,定义视图中的列,设置各列的数据均为text*/
		renderer = gtk_cell_renderer_text_new();
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 学  号 "), renderer, "text", STU_ID, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 姓  名 "), renderer, "text", STU_NAME, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 课程编号 "), renderer, "text", CRS_ID, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 课程名称 "), renderer, "text", CRS_NAME, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 学  分 "), renderer, "text", CRS_CREDIT, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 成  绩 "), renderer, "text", MARK, NULL);
		/*设置树模式中各列的数据类型*/
		store = GTK_TREE_MODEL(gtk_list_store_new(TEA_COLUM_NUM,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT,G_TYPE_FLOAT));
		gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), store);
		/*向模式中插入数据*/
		for(i=0; i<tea_res_tab.row; i++)
		{
			row = mysql_fetch_row(tea_res_tab.res)
			gtk_list_store_append(GTK_LIST_STORE(store), &iter);   /*获取插入的位置*/
			gtk_list_store_set(GTK_LIST_STORE(store),&iter,STU_ID,row[STU_ID],STU_NAME,row[STU_NAME],CRS_ID,row[CRS_ID],CRS_NAME,row[CRS_NAME],CRS_CREDIT,ROW[CRS_CREDIT],MARK,row[MARK],-1);
		}
		g_object_unref(store);
		/*为界面添加信号*/
		exit_button = glade_xml_get_widget(TeacherWinXML, "exit_button");
		g_signal_connect(G_OBJECT(exit_button), "clicked", G_CALLBACK(gtk_main_quit),teacher_window);
		g_signal_connect(G_OBJECT(teacher_window),"destroy",G_CALLBACK(gtk_main_quit),teacher_window);
		gtk_widget_show_all(teacher_window);
		gtk_main();
		return 0;
}
Example #21
0
/* The Main Interface Launcher */
int launch_gfmgui(void)
{
    GladeXML *xml;
    GtkWidget *widget;

    // Load the GFM Dialog from gfm.glade
    xml = glade_xml_new(paths_build_glade("gfm.glade"), "gfm_dbox", NULL);

    // Glade File Error
    if (!xml)
        g_error("Failure GFM GUI (%s)!\n", __FILE__);
		
    // Connect The Symbols
    glade_xml_signal_autoconnect(xml);
		
    // Retrieve the dialog widget
    widget = glade_xml_get_widget(xml, "gfm_dbox");

    // Global Widget Access
	gfm_widget.tree = glade_xml_get_widget(xml, "treeview1");
	gfm_widget.model = glade_xml_get_widget(xml, "label6");
	gfm_widget.entries = glade_xml_get_widget(xml, "label7");
	gfm_widget.comment = glade_xml_get_widget(xml, "button1");
	gfm_widget.ram = glade_xml_get_widget(xml, "label9");
	gfm_widget.flash = glade_xml_get_widget(xml, "label10");
	gfm_widget.save = glade_xml_get_widget(xml, "toolbutton3");
	//gfm_widget.test = glade_xml_get_widget(xml, "label11");
	gfm_widget.pbar = glade_xml_get_widget(xml, "progressbar1");

	// Inits global vars
	enable_save(FALSE);
	enable_tree(FALSE);

	// Show the Widget
	ctree_init();
    gtk_widget_show(widget);

	if(cmdline_get() != NULL)
		on_open_clicked(NULL, (gpointer)cmdline_get());

    // Return
    return 0;
}
Example #22
0
int
main (int argc, char *argv[])
{
	gchar 		*path;
	GtkWidget	*main_window;

	gtk_init (&argc, &argv);
	
	path = g_strdup_printf ("%s%s", PREFIX, GLADE_FILE);
	xml = glade_xml_new (path, NULL, NULL);
	g_free (path);
	
	if (xml == NULL)
	{	
		g_error (_("Failed to initialize interface."));
		exit_cleanup ();
	}
	
	glade_xml_signal_autoconnect (xml);
	
	if (gimmix_config_exists())
	{
		gimmix_config_init ();
		if (gimmix_connect())
		{
			gimmix_init ();
		}
		else
		{
			gimmix_connect_error ();
		}
	}
	else
	{
		gimmix_show_firstrun_dialog ();
	}
	
	gtk_main ();
	exit_cleanup ();
	
	return 0;
}
Example #23
0
/* Create a window with 1 label */
void create_pbar_type2(const gchar *title)
{
	GladeXML *xml;

	reset_counters();

	xml = glade_xml_new
	    (tilp_paths_build_glade("pbars-2.glade"), "pbar2_dbox",
	     PACKAGE);
	if (!xml)
		g_error("GUI loading failed !\n");
	glade_xml_signal_autoconnect(xml);

	pbar_window = glade_xml_get_widget(xml, "pbar2_dbox");
	gtk_window_set_title(GTK_WINDOW(pbar_window), title);

	p_win.label = glade_xml_get_widget(xml, "label20");

	gtk_widget_show_all(pbar_window);
}
Example #24
0
/* Create a window with 1 progress bar */
void create_pbar_type1(const gchar * title)
{
	GladeXML *xml;

	reset_counters();

	xml = glade_xml_new(tilp_paths_build_glade("pbars-2.glade"), "pbar1_dbox", PACKAGE);
	if (!xml)
		g_error("GUI loading failed !\n");
	glade_xml_signal_autoconnect(xml);

	window = glade_xml_get_widget(xml, "pbar1_dbox");
	gtk_window_set_title(GTK_WINDOW(window), title);

	pbar_wnd.pbar1 = glade_xml_get_widget(xml, "progressbar10");
	pbar_wnd.label_rate = glade_xml_get_widget(xml, "label11");

	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_TYPE);
	gtk_widget_show_all(window);
}
Example #25
0
int
main (int argc, char *argv[])
{
  GladeXML *xml;

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

  xml = glade_xml_new("basic.glade", NULL);

  if (!xml) {
    g_warning("something bad happened while creating the interface");
    return 1;
  }

  glade_xml_signal_autoconnect(xml);

  gtk_main ();
  return 0;
}
Example #26
0
/*
	Type address in a box.
*/
gint display_dbgmem_address(uint32_t *addr)
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *entry;
	gint result;
	gchar *str;
	gint ret = -1;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_mem-2.glade"), "dbgmem_address", PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	entry = glade_xml_get_widget(xml, "entry1");
	str = g_strdup_printf("0x%06x", *addr);
	gtk_entry_set_text(GTK_ENTRY(entry), str);
	g_free(str);

	gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
	
	dbox = glade_xml_get_widget(xml, "dbgmem_address");	
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		str = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
		sscanf(str, "%x", addr);
		ret = 0;
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);
	return ret;
}
Example #27
0
int main(int argc, char *argv[]) {
    GladeXML *xml;
	GtkWidget *window1;
	int a=1;

    gtk_init(&argc, &argv);

    /* load the interface */
    xml = glade_xml_new("test.glade", NULL, NULL);

	window1 = glade_xml_get_widget(xml, "window");
//		treeview = glade_xml_get_widget(xml, "treeview");
//	init_list(treeview);

	GtkWidget *progress_bar = glade_xml_get_widget (xml, "progressbar1");
  	gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar));
	g_assert(progress_bar);

	GtkWidget *my_button = glade_xml_get_widget (xml, butt "1");
  	g_signal_connect (G_OBJECT (my_button), "pressed", G_CALLBACK (button_clicked),&a);

	g_assert(my_button);

	gint func_ref = g_timeout_add (100, update_progress_bar, progress_bar);

	gtk_widget_show (window1);

	GTimer *wasted_time_tracker = g_timer_new ();

  	GtkWidget *widget = glade_xml_get_widget (xml, "WasteTimeWindow");
  	g_signal_connect (G_OBJECT (widget), "delete_event", G_CALLBACK (inform_user_of_time_wasted),wasted_time_tracker);

    /* connect the signals in the interface */
    glade_xml_signal_autoconnect(xml);

    /* start the event loop */
    gtk_main();
	g_source_remove (func_ref);
    return 0;
}
Example #28
0
int
main(int argc, char **argv)
{
    gchar *glade_xml_file;

    gtk_init(&argc, &argv);

    glade_xml_file = (gchar *) find_in_share("preview.glade");
    glade_xml = glade_xml_new(glade_xml_file, NULL, NULL);
    g_free(glade_xml_file);

    set_app_title();
    set_font();

    if (argc > 1)
        add_file(argv[1]);

    glade_xml_signal_autoconnect(glade_xml);
    gtk_main ();

    exit (EXIT_SUCCESS);
}
Example #29
0
/*
	Display source code window
*/
GtkWidget* display_dbgcode_window(void)
{
	GladeXML *xml;
	GtkWidget *dbox;
    GtkWidget *data;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_code-2.glade"), "dbgcode_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgcode_window");

	tb.b1 = glade_xml_get_widget(xml, "button1");
	tb.b2 = glade_xml_get_widget(xml, "button2");
	tb.b3 = glade_xml_get_widget(xml, "button3");
	tb.b4 = glade_xml_get_widget(xml, "button4");
	tb.b5 = glade_xml_get_widget(xml, "button5");
	tb.b6 = glade_xml_get_widget(xml, "button6");
    list = glade_xml_get_widget(xml, "treeview1");

	data = glade_xml_get_widget(xml, "treeview1");
    store = clist_create(data);
	clist_populate(store, ti68k_debug_get_pc());

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));
	gtk_widget_show(data);

	gtk_window_resize(GTK_WINDOW(dbox), options3.code.w, options3.code.h);
	gtk_window_move(GTK_WINDOW(dbox), options3.code.x, options3.code.y);
    gtk_widget_show(GTK_WIDGET(dbox));

	already_open = !0;

	return dbox;
}
Example #30
0
int main (int argc, char *argv[])
{
	PREFS images;															/* Create preferences object */
	gchar *window_name;												/* String to hold window's name */
	gchar *xmlpath;														/* Path to Glade's XML file */
	gchar *iconpath;													/* Path to MESSyFront's icon */

	gtk_init (&argc, &argv);									/* Initialize GTK */
	glade_init ();														/* Initialize Glade */

	/* Create Glade Interface */
	xmlpath = g_strjoin (DIR_SEP, INSTALL_PREFIX, XML_DIRECTORY, XML_FILENAME, NULL);
	images.xml = glade_xml_new (xmlpath, NULL, NULL);
	if (!images.xml)
	{
		g_warning ("MESSYFRONT: Unable to create interface with libglade!");
		exit (EXIT_FAILURE);
	}

	/* Connect homemade signals */
	connect_signals (&images);

	/* Connect Glade-made signals */
	glade_xml_signal_autoconnect (images.xml);

	/* Set window's name and icon */
	window_name = g_strjoin (" ", MESSY_APP_NAME, MESSY_VERSION, NULL);
	change_window_name (&images, window_name);
	iconpath = g_strjoin (DIR_SEP, INSTALL_PREFIX, ICON_PATH, ICON_NAME, NULL);
	change_window_icon (&images, iconpath);

	get_prefs_from_file (&images);						/* Get user's preferences */
	populate_object_from_fields (&images);		/* Initialize object "images" */

	gtk_main ();															/* Start the main event loop */

	return EXIT_SUCCESS;											/* End of story. */
}