static void
CappletSetup (MatekbdIndicatorPluginsCapplet * gipc)
{
	GtkBuilder *builder;
	GError *error = NULL;
	GtkWidget *button;
	GtkWidget *capplet;
	GtkWidget *activePlugins;
	GtkTreeModel *activePluginsModel;
	GtkCellRenderer *renderer =
	    GTK_CELL_RENDERER (gtk_cell_renderer_text_new ());
	GtkTreeViewColumn *column =
	    gtk_tree_view_column_new_with_attributes (NULL, renderer,
						      "text", 0,
						      NULL);
	GtkTreeSelection *selection;
	builder = gtk_builder_new ();

	gtk_window_set_default_icon_name ("input-keyboard");

	/* default domain! */
	if (!gtk_builder_add_from_file (builder,
	                                UIDIR "/matekbd-indicator-plugins.ui",
	                                &error)) {
		g_warning ("Could not load builder file: %s", error->message);
		g_error_free(error);
		return;
	}

	gipc->capplet = capplet =
	    GTK_WIDGET (gtk_builder_get_object (builder, "matekbd_indicator_plugins"));

	gtk_builder_connect_signals (builder, NULL);

	g_object_set_data (G_OBJECT (capplet), "uiData", builder);

	#if GTK_CHECK_VERSION(3, 0, 0)
		g_signal_connect_swapped(G_OBJECT(capplet), "destroy", G_CALLBACK(g_object_unref), builder);
	#else
		g_signal_connect_swapped(GTK_OBJECT(capplet), "destroy", G_CALLBACK(g_object_unref), builder);
	#endif

	g_signal_connect_swapped (G_OBJECT (capplet), "unrealize", G_CALLBACK (g_main_loop_quit), loop);

	#if GTK_CHECK_VERSION(3, 0, 0)
		g_signal_connect(G_OBJECT(capplet), "response", G_CALLBACK(CappletResponse), NULL);
	#else
		g_signal_connect(GTK_OBJECT(capplet), "response", G_CALLBACK(CappletResponse), NULL);
	#endif


	button = GTK_WIDGET (gtk_builder_get_object (builder, "btnUp"));
	g_signal_connect (button,  "clicked",
				       G_CALLBACK
				       (CappletPromotePlugin), gipc);
	button = GTK_WIDGET (gtk_builder_get_object (builder, "btnDown"));
	g_signal_connect (button,
				       "clicked",
				       G_CALLBACK
				       (CappletDemotePlugin), gipc);
	button = GTK_WIDGET (gtk_builder_get_object (builder, "btnAdd"));
	g_signal_connect (button,  "clicked",
				       G_CALLBACK
				       (CappletEnablePlugin), gipc);
	button = GTK_WIDGET (gtk_builder_get_object (builder, "btnRemove"));
	g_signal_connect (button,  "clicked",
				       G_CALLBACK
				       (CappletDisablePlugin), gipc);
	button = GTK_WIDGET (gtk_builder_get_object (builder, "btnProperties"));
	g_signal_connect (button,  "clicked",
				       G_CALLBACK
				       (CappletConfigurePlugin), gipc);

	activePlugins = CappletGetUiWidget (gipc, "activePlugins");
	activePluginsModel =
	    GTK_TREE_MODEL (gtk_list_store_new
			    (2, G_TYPE_STRING, G_TYPE_STRING));
	gtk_tree_view_set_model (GTK_TREE_VIEW (activePlugins),
				 activePluginsModel);
	gtk_tree_view_append_column (GTK_TREE_VIEW (activePlugins),
				     column);
	selection =
	    gtk_tree_view_get_selection (GTK_TREE_VIEW (activePlugins));
	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
	g_signal_connect (G_OBJECT (selection), "changed",
			  G_CALLBACK
			  (CappletActivePluginsSelectionChanged), gipc);
	CappletFillActivePluginList (gipc);
	CappletActivePluginsSelectionChanged (selection, gipc);
	gtk_widget_show_all (capplet);
}
Exemplo n.º 2
0
/**
 * @fn int main (int argc, char **argv)
 * @brief Main program & Gtk thread.
 * 
 * Create window and all widgets, then set there parameters to be the <br>
 * ROS params.
 */
int main(int argc, char **argv) {
	GtkBuilder *builder;
	GdkColor black = { 0, 0, 0, 0 };
	GError *error = NULL;
	char glade_gui_file[FILENAME_MAX];
	int start_zoom = 15;
	char *mapcachedir;
	OsmGpsMapPoint fei_coord = { -23.725377, -46.582015 };

	struct arg param;
	param.argc = argc;
	param.argv = argv;

	pthread_t rosThread;

	// **** init threads
	g_thread_init(NULL);
	gdk_threads_init();
	gdk_threads_enter();

	// **** init gtk
	gtk_init(&argc, &argv);

	// **** allocate data structure
	data = g_slice_new (AppData);

	// **** set the glade gui file & set icon directory
	std::string package_path = ros::package::getPath(ROS_PACKAGE_NAME);
	sprintf(glade_gui_file, "%s/gui/%s", package_path.c_str(), "gui.glade");
	sprintf(data->icon_directory, "%s/gui/icon", package_path.c_str());

	std::string rosbag_path = ros::package::getPath("rosbag");
	sprintf(data->rosbag_rec_path, "%s/bin/record", rosbag_path.c_str());

	data->current_page = 0;
	data->telemetry_opt_popup_state = false;
	data->gps_opt_popup_state = false;
	data->fullscreen = false;
	load_icon();

	// **** Create new GtkBuilder object
	builder = gtk_builder_new();
	// **** Load UI from file
	if (!gtk_builder_add_from_file(builder, glade_gui_file, &error)) {
		g_warning("%s", error->message);
		g_free(error);
		exit(-1);
	}

	// **** Get main window pointer from UI
	data->window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
	gtk_window_set_title(GTK_WINDOW (data->window), "Ground Station");
	gtk_window_set_position(GTK_WINDOW (data->window), GTK_WIN_POS_CENTER);
	gtk_window_set_default_size(GTK_WINDOW (data->window), 1024, 576);

	// **** create ROS thread
	pthread_create(&rosThread, NULL, startROS, &param);

	// **** wait for ros to finish reading params
	while (!data->ros_param_read) {
		ROS_DEBUG("Waiting for ROS params");
	}

	// **** Get GtkNotebook objsect
	data->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook1"));

	// #####################################################################
	// #####################################################################
	// **** Tab 1: Telemetry

	// **** create altimeter widget
	data->alt = gtk_altimeter_new();
	g_object_set(GTK_ALTIMETER (data->alt), "grayscale-color",
			data->grayscale_color, "unit-is-feet", data->altimeter_unit_is_feet,
			"unit-step-value", data->altimeter_step_value, "radial-color",
			data->radial_color, NULL);

	// **** create compass widgets
	data->comp = gtk_compass_new();
	g_object_set(GTK_COMPASS (data->comp), "grayscale-color",
			data->grayscale_color, "radial-color", data->radial_color, NULL);

	data->comp2 = gtk_compass_new();
	g_object_set(GTK_COMPASS (data->comp2), "grayscale-color",
			data->grayscale_color, "radial-color", data->radial_color, NULL);

	data->gauge1 = gtk_gauge_new();
	g_object_set(GTK_GAUGE (data->gauge1), "name", data->gauge1_name_f, NULL);
	g_object_set(GTK_GAUGE (data->gauge1), "grayscale-color",
			data->grayscale_color, "radial-color", data->radial_color,
			"start-value", data->gauge1_start_value, "end-value",
			data->gauge1_end_value, "initial-step", data->gauge1_initial_step,
			"sub-step", (gdouble) data->gauge1_sub_step, "drawing-step",
			data->gauge1_drawing_step, "color-strip-order",
			data->gauge1_color_strip_order, "green-strip-start",
			data->gauge1_green_strip_start, "yellow-strip-start",
			data->gauge1_yellow_strip_start, "red-strip-start",
			data->gauge1_red_strip_start, NULL);

	// **** create artificial horizon widget
	data->arh = gtk_artificial_horizon_new();
	g_object_set(GTK_ARTIFICIAL_HORIZON (data->arh), "grayscale-color",
			data->grayscale_color, "radial-color", data->radial_color, NULL);

	// **** create variometer widget
	data->vario = gtk_variometer_new();
	g_object_set(GTK_VARIOMETER (data->vario), "grayscale-color",
			data->grayscale_color, "unit-is-feet",
			data->variometer_unit_is_feet, "unit-step-value",
			data->variometer_step_value, "radial-color", data->radial_color,
			NULL);

	data->widget_table = GTK_WIDGET (gtk_builder_get_object (builder, "table_Widgets"));

	// place widgets within table
	gtk_table_attach_defaults(GTK_TABLE (data->widget_table), data->alt,    0, 1,  0, 1);
	gtk_table_attach_defaults(GTK_TABLE (data->widget_table), data->arh,    1, 2,  0, 1);
	gtk_table_attach_defaults(GTK_TABLE (data->widget_table), data->comp,   2, 3,  0, 1);
	gtk_table_attach_defaults(GTK_TABLE (data->widget_table), data->vario,  0, 1,  1, 2);
	gtk_table_attach_defaults(GTK_TABLE (data->widget_table), data->gauge1, 1, 2,  1, 2);
	gtk_table_attach_defaults(GTK_TABLE (data->widget_table), data->comp2,  2, 3,  1, 2);

	gtk_widget_modify_bg(data->alt, GTK_STATE_NORMAL, &black);
	gtk_widget_modify_bg(data->comp, GTK_STATE_NORMAL, &black);
	gtk_widget_modify_bg(data->comp2, GTK_STATE_NORMAL, &black);
	gtk_widget_modify_bg(data->arh, GTK_STATE_NORMAL, &black);
	gtk_widget_modify_bg(data->gauge1, GTK_STATE_NORMAL, &black);
	gtk_widget_modify_bg(data->vario, GTK_STATE_NORMAL, &black);

	data->telemetry_option_popup =
			GTK_WIDGET (gtk_builder_get_object (builder, "hbox_TelemetryOption"));
	data->btn_open_telemetry_option_popup =
			GTK_WIDGET (gtk_builder_get_object (builder, "button_OpenTelemetryOptionPopup"));
	data->btn_close_telemetry_option_popup =
			GTK_WIDGET (gtk_builder_get_object (builder, "button_CloseTelemetryOptionPopup"));
	gtk_button_set_image(GTK_BUTTON (data->btn_open_telemetry_option_popup),
			gtk_image_new_from_pixbuf(
					gdk_pixbuf_scale_simple(data->leftarrow_icon_64, 24, 50,
							GDK_INTERP_HYPER)));
	gtk_button_set_image(GTK_BUTTON (data->btn_close_telemetry_option_popup),
			gtk_image_new_from_pixbuf(
					gdk_pixbuf_scale_simple(data->rightarrow_icon_64, 24, 50,
							GDK_INTERP_HYPER)));

	// #####################################################################
	// #####################################################################
	// **** Tab 2: GPS

	// Some GpsdViewer initialisation
	data->draw_path = false;
	data->map_provider = OSM_GPS_MAP_SOURCE_OPENSTREETMAP;
	data->map_zoom_max = 18;
	data->map_current_zoom = start_zoom;
	data->repo_uri = osm_gps_map_source_get_repo_uri(data->map_provider);
	data->friendly_name = osm_gps_map_source_get_friendly_name(
			data->map_provider);
	data->uav_track = osm_gps_map_track_new();
	mapcachedir = osm_gps_map_get_default_cache_directory();
	data->cachedir = g_build_filename(mapcachedir, data->friendly_name, NULL);
	g_free(mapcachedir);

	// Create the OsmGpsMap object
	data->map = (OsmGpsMap *) g_object_new(OSM_TYPE_GPS_MAP, "map-source",
			data->map_provider, "tile-cache", data->cachedir, "proxy-uri",
			g_getenv("http_proxy"), NULL);

	//Set the starting coordinates and zoom level for the map
	osm_gps_map_set_zoom(data->map, start_zoom);
	osm_gps_map_set_center(data->map, fei_coord.rlat, fei_coord.rlon);

	data->osd = gpsd_viewer_osd_new();
	g_object_set(GPSD_VIEWER_OSD (data->osd), "show-scale", true,
			"show-coordinates", true, "show-dpad", true, "show-zoom", true,
			"show-gps-in-dpad", true, "show-gps-in-zoom", false, "dpad-radius",
			30, NULL);
	osm_gps_map_layer_add(OSM_GPS_MAP (data->map),
			OSM_GPS_MAP_LAYER (data->osd));

	data->map_box =
			GTK_WIDGET (gtk_builder_get_object (builder, "hbox_map_box"));
	data->map_container =
			GTK_WIDGET (gtk_builder_get_object (builder, "hbox_map_container"));
	gtk_box_pack_start(GTK_BOX (data->map_box), GTK_WIDGET (data->map), TRUE,
			TRUE, 0);

	data->gpsd_option_popup =
			GTK_WIDGET (gtk_builder_get_object (builder, "hbox_GpsdOptionPopup"));
	data->btn_open_gpsd_option_popup =
			GTK_WIDGET (gtk_builder_get_object (builder, "button_OpenGpsdOptionPopup"));
	data->btn_close_gpsd_option_popup =
			GTK_WIDGET (gtk_builder_get_object (builder, "button_CloseGpsdOptionPopup"));
	gtk_button_set_image(GTK_BUTTON (data->btn_open_gpsd_option_popup),
			gtk_image_new_from_pixbuf(
					gdk_pixbuf_scale_simple(data->leftarrow_icon_64, 24, 50,
							GDK_INTERP_HYPER)));
	gtk_button_set_image(GTK_BUTTON (data->btn_close_gpsd_option_popup),
			gtk_image_new_from_pixbuf(
					gdk_pixbuf_scale_simple(data->rightarrow_icon_64, 24, 50,
							GDK_INTERP_HYPER)));

	// #####################################################################
	// #####################################################################
	// **** Tab 3: Logging

	data->recording = 0;
	data->rosbag_record_cmd = "rosbag record";
	data->topicsList = GTK_LIST_STORE (gtk_builder_get_object (builder, "liststore_TopicList"));
	data->cmd_line_entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry_CommandLine"));
	data->prefix_entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry_Prefix"));
	data->info_textview = GTK_WIDGET (gtk_builder_get_object (builder, "textview_BagInfo"));
	data->update_btn = GTK_WIDGET (gtk_builder_get_object (builder, "button_UpdateTopicList"));
	data->box_MotorStatus = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_MotorStatus"));
	//data->box_Flying = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_Flying"));
	data->box_Gps = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_Gps"));
	data->numSats_label = GTK_WIDGET (gtk_builder_get_object (builder, "label_NumSatsValue"));
	data->flightMode_label = GTK_WIDGET (gtk_builder_get_object (builder, "label_FlightModeValue"));
	data->upTime_label = GTK_WIDGET (gtk_builder_get_object (builder, "label_UpTimeValue"));
	data->cpuLoad_label = GTK_WIDGET (gtk_builder_get_object (builder, "label_CpuLoadValue"));
	data->box_RecordStatus = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_RecordStatus"));
	data->record_stop_btn = GTK_WIDGET (gtk_builder_get_object (builder, "button_RecordStop"));

	gtk_box_pack_end(GTK_BOX (data->box_MotorStatus), data->status_ok_icon_motor, TRUE, TRUE, 0);
	gtk_box_pack_end(GTK_BOX (data->box_MotorStatus), data->status_fail_icon_motor, TRUE, TRUE, 0);
	//gtk_box_pack_end(GTK_BOX (data->box_Flying), data->status_ok_icon_flying, TRUE, TRUE, 0);
	//gtk_box_pack_end(GTK_BOX (data->box_Flying), data->status_fail_icon_flying, TRUE, TRUE, 0);
	gtk_box_pack_end(GTK_BOX (data->box_Gps), data->status_ok_icon_gps, TRUE, TRUE, 0);
	gtk_box_pack_end(GTK_BOX (data->box_Gps), data->status_fail_icon_gps, TRUE, TRUE, 0);
	gtk_box_pack_end(GTK_BOX (data->box_RecordStatus), data->record_icon, TRUE, TRUE, 0);
	gtk_box_pack_end(GTK_BOX (data->box_RecordStatus), data->record_g_icon, TRUE, TRUE, 0);

	gtk_button_set_image(GTK_BUTTON (data->update_btn),
			gtk_image_new_from_pixbuf(
					gdk_pixbuf_scale_simple(data->refresh_icon_64, 24, 24,
							GDK_INTERP_HYPER)));
	gtk_button_set_image(GTK_BUTTON (data->record_stop_btn),
			gtk_image_new_from_pixbuf(
					gdk_pixbuf_scale_simple(data->record_icon_64, 40, 40,
							GDK_INTERP_HYPER)));

	// Connect signals
	gtk_builder_connect_signals(builder, data);

	// Destroy builder, since we don't need it anymore
	g_object_unref(G_OBJECT (builder));

	// Show window. All other widgets are automatically shown by GtkBuilder
	gtk_widget_show_all(data->window);
	gtk_widget_hide(data->record_icon);
	gtk_widget_hide(data->status_ok_icon_motor);
	//gtk_widget_hide(data->status_ok_icon_flying);
	gtk_widget_hide(data->status_ok_icon_gps);
	gtk_widget_hide_all(data->telemetry_option_popup);
	gtk_widget_hide_all(data->gpsd_option_popup);

	// **** allow ROS spinning
	data->widget_created = true;

	// **** udpate all widgets
	g_timeout_add(data->telemetry_refresh_rate, widgets_update, NULL);

	gtk_main();
	gdk_threads_leave();
	return 0;
}
static gboolean
headerbarui_init () {
    GtkWindow *mainwin;
    GtkWidget *menubar;
    GtkWidget *menubtn_image;
    GtkBuilder *builder;

    mainwin = GTK_WINDOW (gtkui_plugin->get_mainwin ());

    menubar = lookup_widget (GTK_WIDGET(mainwin), "menubar");
    g_assert_nonnull(mainwin);
    g_assert_nonnull(menubar);

    builder = gtk_builder_new_from_resource("/org/deadbeef/headerbarui/headerbar.ui");
    headerbar = gtk_builder_get_object(builder, "headerbar1");
    volbutton = gtk_builder_get_object(builder, "volumebutton1");
    headerbar_menubtn =  gtk_builder_get_object(builder, "menubutton1");
    headerbar_seekbar = gtk_builder_get_object(builder, "scale1");
    headerbar_playbtn = gtk_builder_get_object(builder, "playbtn");
    headerbar_pausebtn = gtk_builder_get_object(builder, "pausebtn");

    gtk_widget_show(headerbar);

    gtk_window_set_titlebar(mainwin, GTK_WIDGET(headerbar));

    if (!headerbarui_flag_embed_menubar)
    {
        GtkMenu *menu;
        gtk_widget_hide(menubar);

        headerbarui_update_menubutton();

        gtk_widget_set_can_focus(headerbar_menubtn, FALSE);
        gtk_widget_show (headerbar_menubtn);
    } else {
        gtk_widget_destroy(headerbar_menubtn);
        gtk_widget_reparent(menubar, headerbar);
    }

    if (!headerbarui_flag_show_seek_bar)
    {
        gtk_widget_hide(headerbar_seekbar);
    }

    float volume = deadbeef->volume_get_min_db()-deadbeef->volume_get_db();
    g_assert_false((volume>0));
    gtk_scale_button_set_adjustment(GTK_SCALE_BUTTON (volbutton),
        gtk_adjustment_new (volume, 0, (int)-deadbeef->volume_get_min_db (), 5, 5, 0));

    gtk_widget_show(volbutton);

    gtk_builder_add_callback_symbols(builder,
        "on_volbutton_value_changed", on_volbutton_value_changed,
        "on_nextbtn_clicked", on_nextbtn_clicked,
        "on_prevbtn_clicked", on_prevbtn_clicked,
        "on_pausebtn_clicked", on_pausebtn_clicked,
        "on_playbtn_clicked", on_playbtn_clicked,
        "on_stopbtn_clicked", on_stopbtn_clicked,
        "on_seekbar_format_value", on_seekbar_format_value,
        "on_seekbar_button_press_event", on_seekbar_button_press_event,
        "on_seekbar_button_release_event", on_seekbar_button_release_event,
        NULL);
    gtk_builder_connect_signals(builder, NULL);

    return FALSE;
}
Exemplo n.º 4
0
int main( int argc,char **argv )
{
    GtkBuilder *builder;
    GtkWidget  *window;
    Data        data;
    GtkWidget *quit;
    GtkWidget *label;
    gtk_init( NULL,NULL );
    GtkWidget *play;
    /* Create builder and load interface */
    builder = gtk_builder_new();
    gtk_builder_add_from_file( builder, "../ressource/ihm.glade", NULL );
 
    /* Obtain widgets that we need */
    window = GTK_WIDGET( gtk_builder_get_object( builder, "fenetre" ) );
    /* Connect callbacks */
    
    
   
    
    //IHM Ouverture fichier
    GtkWidget *sauvegarde = NULL;
    sauvegarde = GTK_WIDGET( gtk_builder_get_object( builder, "ouvrir_sauvegarde" ) );
    GtkWidget *entry = NULL;
    entry = GTK_WIDGET( gtk_builder_get_object(builder,"entry1"));
    Save save;
    save.sauvegarde = sauvegarde;
    save.entry = entry;
    GtkWidget *ouvrir = NULL;
    //ouvrir = GTK_WIDGET(gtk_builder_get_object(builder,"ouvrir"));
    //g_signal_connect(G_OBJECT(ouvrir), "activate", G_CALLBACK(ouvrir_clicked_cb), &save);
    
    g_signal_connect(G_OBJECT(sauvegarde),"selection_changed",G_CALLBACK(gestion_browser), &save);
    GtkWidget *selection_fichier = NULL;
    selection_fichier = GTK_WIDGET(gtk_builder_get_object(builder,"selection_fichier"));    
    g_signal_connect(G_OBJECT(selection_fichier),"clicked",G_CALLBACK(on_selection_fichier_activate),&save);
    GtkWidget *annuler_ouverture = NULL;
    annuler_ouverture = GTK_WIDGET(gtk_builder_get_object(builder,"annuler_fichier"));
    g_signal_connect(G_OBJECT(annuler_ouverture),"clicked",G_CALLBACK(on_annuler_fichier_clicked),&save);
    
    //parametres_habitations
    GtkWidget *Param_habitation = NULL;
    Param_habitation = GTK_WIDGET(gtk_builder_get_object(builder, "parametres_habitation"));
    gtk_builder_connect_signals( builder, NULL );
    gtk_builder_connect_signals( builder, &save );
    //drawing area
    GtkWidget *AreaMaison;
    AreaMaison = GTK_WIDGET(gtk_builder_get_object(builder, "dessin_maison"));
    
    /*GtkWidget *frame = NULL;
    frame = gtk_frame_new (NULL);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
     gtk_container_add (GTK_CONTAINER (frame), AreaMaison);*/
    cairo_t *cr;
    cr = gdk_cairo_create (AreaMaison->window);
    //cairo_clip(cr);
    //cairo_rectangle(cr, 20, 20, 120, 80);
    
    
    /* Destroy builder */
    g_object_unref( G_OBJECT( builder ) );
    /* Show main window and start main loop */
    gtk_widget_show( Param_habitation );
    gtk_main();
 
    return( 0 );
}
Exemplo n.º 5
0
int main(int argc, char *argv[]) {


     gdk_threads_init();

    /* Do stuff as usual */
    gtk_init( &argc, &argv );
    gtk_init(&argc, &argv);
    gst_init (&argc, &argv);
	GMutex* lock;
	GList *list;
	

  
    t_error=NULL;
    builder = gtk_builder_new();
    if (!gtk_builder_add_from_file(builder, "Video-Conference.glade", NULL)) {
        g_print("Error opening file");
        return 0;
    }

    

    window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
    vBox = GTK_WIDGET(gtk_builder_get_object(builder, "vbox1"));
    hBox = GTK_WIDGET(gtk_builder_get_object(builder, "hbox1"));
    menu = GTK_MENU_BAR(gtk_builder_get_object(builder, "menubar1"));
    client_video = GTK_WIDGET(gtk_builder_get_object(builder, "user_drawingareaClient"));
    remote_video = GTK_WIDGET(gtk_builder_get_object(builder, "user_drawingareaRemote"));
    aspectFrameClient = GTK_WIDGET(gtk_builder_get_object(builder, "user_frame"));
    aspectFrameRemote = GTK_WIDGET(gtk_builder_get_object(builder, "user_frame1"));
    label_remote = GTK_WIDGET(gtk_builder_get_object(builder, "frame_label"));
    label_client = GTK_WIDGET(gtk_builder_get_object(builder, "frame_label1"));
    button = GTK_WIDGET(gtk_builder_get_object(builder, "button"));
    port = GTK_ENTRY(gtk_builder_get_object(builder, "Port"));
    portC = GTK_ENTRY(gtk_builder_get_object(builder, "PortC"));
    gtk_signal_connect(GTK_OBJECT (window), "delete_event",
		     GTK_SIGNAL_FUNC(delete_event), NULL);
          
  gtk_signal_connect(GTK_OBJECT (window), "destroy",
		     GTK_SIGNAL_FUNC(destroy), NULL);
    gtk_signal_connect(GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(on_click), NULL);

          
 
/*
    //Ports
    //Video
    RTP_SRC_V=8002;
    RTCP_SRC_V=8003;
    RTCP_SINK_V=8007;

    //Audio
    RTP_SRC_A=5002;
    RTCP_SRC_A=5003;
    RTCP_SINK_A=5007;
*/



if(!g_thread_create( thread_func, NULL,FALSE, &t_error ))
    {
		g_printerr ("Failed to create YES thread: %s\n", t_error->message);
	        return 1;
    }
    
   
    gtk_builder_connect_signals(builder, NULL);

    g_object_unref(G_OBJECT(builder));

    gtk_widget_show_all(window);
    gdk_threads_enter();
   
    gtk_main();
    

    gdk_threads_leave();

    exit(0);
}
Exemplo n.º 6
0
/** This function build and presents the assistant that presents the user
 *  with the two methods of making the gconf schemas visible, and
 *  learns whether gnucash should do the work or the user will do the
 *  work.  This function then blocks in a call to gtk_main(), while
 *  all of the work happens in callback functions.  Once the dialog is
 *  finished, this function kills off any existing gconf daemon so
 *  that the changes will be noticed upon daemon restart.
 */
static GtkWidget *
gnc_gnome_install_gconf_schemas (void)
{
    gconf_data *data;
    GtkBuilder *builder;
    GtkWidget *dialog;
    GError *error = NULL;


    data = g_new0 (gconf_data, 1);
    builder = gtk_builder_new();
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer1");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer2");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer3");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer4");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer5");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer6");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer7");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "textbuffer8");
    gnc_builder_add_from_file (builder, "assistant-gconf-setup.glade", "GConf Setup Assistant");

    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "GConf Setup Assistant"));
    data->dialog = dialog;

    /* Set the colors for the assistant */
    gnc_assistant_set_colors (GTK_ASSISTANT (data->dialog));

    /* Enable buttons on all pages. */
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "start_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "choose_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "update_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "step_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "install_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "finish_page")),
                                     TRUE);

    /* Choose page */
    data->update_path = GTK_WIDGET(gtk_builder_get_object (builder, "update_path"));

    /* Update page */
    data->program1 = GTK_WIDGET(gtk_builder_get_object (builder, "program1"));
    data->user1 = GTK_WIDGET(gtk_builder_get_object (builder, "user1"));
    data->update_text = GTK_WIDGET(gtk_builder_get_object (builder, "update_text"));

    /* Install page */
    data->program2 = GTK_WIDGET(gtk_builder_get_object (builder, "program2"));
    data->user2 = GTK_WIDGET(gtk_builder_get_object (builder, "user2"));
    data->install_text = GTK_WIDGET(gtk_builder_get_object (builder, "install_text"));

    /* Finish page  */
    data->finish_page = GTK_WIDGET(gtk_builder_get_object (builder, "finish_page"));

    gtk_builder_connect_signals(builder, data);
    g_object_unref(G_OBJECT(builder));

    gtk_widget_show_all(dialog);

    /* This won't return until the dialog is finished */
    gtk_main();

    /* Destroy the Assistant dialog */
    gtk_widget_destroy(GTK_WIDGET(data->dialog));

    /* Kill the backend daemon. When it restarts it will find our changes */
    if (!g_spawn_command_line_sync("gconftool-2 --shutdown", NULL, NULL,
                                   NULL, &error))
    {
        gnc_warning_dialog(NULL, "%s", error->message);
        g_error_free(error);
    }

    return dialog;
}
Exemplo n.º 7
0
int main(int argc, char **argv)
{
	int 					nResponse, i, nKeyWordGroup = 0;
	GtkTextBuffer			*buffer;
	GtkBuilder 				*builder;
	PangoFontDescription    *font_desc;
	JJGui					*jibber_ui;

	// allocate the memory needed by our structure
	jibber_ui = g_slice_new(JJGui);

	// init the gtk toolkit
	gtk_init(&argc, &argv);

	// get a new interface builder
	builder = gtk_builder_new();

	// read the GUI definitions from the XML file
	gtk_builder_add_from_file(builder, "jibber.glade", NULL);

	// point the structure members to the UI elements we need to control
	jibber_ui->window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
	jibber_ui->edit_field = GTK_ENTRY (gtk_builder_get_object (builder, "text_field"));
	jibber_ui->text_view = GTK_WIDGET (gtk_builder_get_object (builder, "textview1"));

	// connect the signal handlers
	gtk_builder_connect_signals(builder, jibber_ui);

	// release the builder memory
	g_object_unref(G_OBJECT (builder));

	// set the desired font
	font_desc = pango_font_description_from_string("monospace 10");
	gtk_widget_override_font(jibber_ui->text_view, font_desc);
	pango_font_description_free(font_desc);

	// get a handle on the buffer from the text window
	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (jibber_ui->text_view));

	// create some style tags
	gtk_text_buffer_create_tag(buffer, "italic", "style", PANGO_STYLE_ITALIC, NULL);
	gtk_text_buffer_create_tag(buffer, "bold", "weight", PANGO_WEIGHT_BOLD, NULL);

	// intialise the SQLite library
	sqlite3_initialize( );

	// Initialize random number generator
	srand(time(NULL));

	// don't show the internal workings
	bShow = false;

	// open the database
	nResponse = sqlite3_open_v2( "worldview.sl3", &knowledgeDB, SQLITE_OPEN_READWRITE, NULL );

	// if it didn't open OK, shutdown and exit
	if ( nResponse != SQLITE_OK) {
		printf("Couldn't open world view database.\n");
		sqlite3_close( knowledgeDB );
		exit (-1);
	}

	// set all the position flags to 'never been used'
	for (i=0; i<1000; i++)
			nGroupPositionFlags[ i ] = (-2);

	// record the KeyWordGroups for the categories that need special processing
	nProcessCategories[ TIME_HANDLER ] = GetGroupFromTriggerPhrase("WHAT TIME IS IT", jibber_ui);
	nProcessCategories[ DATE_HANDLER ] = GetGroupFromTriggerPhrase("WHAT DATE IS IT", jibber_ui);
	nProcessCategories[ DAY_HANDLER ] = GetGroupFromTriggerPhrase("WHAT DAY IS IT", jibber_ui);
	nProcessCategories[ YEAR_HANDLER ] = GetGroupFromTriggerPhrase("WHAT YEAR IS IT", jibber_ui);
	nProcessCategories[ MONTH_HANDLER ] = GetGroupFromTriggerPhrase("WHAT MONTH IS IT", jibber_ui);
	nProcessCategories[ END_MARKER ] = (-1);

	// no topics in the linked list yet
	Root = End = NULL;

	// Announce ourselves
	AppendText(jibber_ui, DIR_SYSTEM, "Jibber Jabber %s :: Compiled on %s at %s.", JJ_VERSION, __DATE__, __TIME__);
	AppendText(jibber_ui, DIR_BLANK, "" );

	nKeyWordGroup = GetGroupFromTriggerPhrase("JJOPENINGLINES", jibber_ui);

	// get response from this keywordgroup
	if ( nKeyWordGroup )
			GetResponseFromGroup( nKeyWordGroup, "", 0, jibber_ui );

	// display the window
	gtk_widget_show(jibber_ui->window);

	// enter the UI event handler loop
	gtk_main();

	// shut down and exit
	sqlite3_close( knowledgeDB );
	sqlite3_shutdown( );

	// flag exit code to OS
	return (0);

}	// end of main
Exemplo n.º 8
0
static gboolean
create_window(void)
{
	GError *error = NULL;

	builder = gtk_builder_new_from_resource("/org/chimara-if/player/chimara.ui");
	window = GTK_WIDGET(load_object("chimara"));
	aboutwindow = GTK_WIDGET(load_object("aboutwindow"));
	prefswindow = GTK_WIDGET(load_object("prefswindow"));
	recentwindow = GTK_WIDGET(load_object("recentwindow"));

	glk = chimara_if_new();
	g_object_set(glk,
	    "ignore-errors", TRUE,
	    /*"interpreter-number", CHIMARA_IF_ZMACHINE_TANDY_COLOR,*/
	    NULL);

	GBytes *css_bytes = g_resources_lookup_data("/org/chimara-if/player/style.css",
		G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
	if (!css_bytes)
		return FALSE;

	size_t len;
	char *css = g_bytes_unref_to_data(css_bytes, &len);
	chimara_glk_set_css_from_string(CHIMARA_GLK(glk), css);
	g_free(css);

	/* DON'T UNCOMMENT THIS your eyes will burn
	 but it is a good test of programmatically altering just one style
	chimara_glk_set_css_from_string(CHIMARA_GLK(glk),
	    "buffer { font-family: 'Comic Sans MS'; }");*/
	
	GtkBox *vbox = GTK_BOX( gtk_builder_get_object(builder, "vbox") );			
	if(vbox == NULL)
		return FALSE;

	create_app_actions(G_ACTION_MAP(app), glk);
	create_window_actions(G_ACTION_MAP(window), glk);

	GtkWidget *toolbar = GTK_WIDGET(gtk_builder_get_object(builder, "toolbar"));

	/* Set the default value of the "View/Toolbar" menu item upon creation of a
	 new window to the "show-toolbar-default" setting, but bind the setting
	 one-way only - we don't want toolbars to disappear suddenly */
	GPropertyAction *toolbar_action = g_property_action_new("toolbar", toolbar, "visible");
	g_action_map_add_action(G_ACTION_MAP(window), G_ACTION(toolbar_action));
	if (g_settings_get_boolean(state_settings, "show-toolbar-default"))
		gtk_widget_show(toolbar);
	else
		gtk_widget_hide(toolbar);
	g_settings_bind(state_settings, "show-toolbar-default",
		toolbar, "visible", G_SETTINGS_BIND_SET);

	gtk_box_pack_end(vbox, glk, TRUE, TRUE, 0);
	gtk_box_pack_start(vbox, toolbar, FALSE, FALSE, 0);

	gtk_builder_connect_signals(builder, glk);
	g_signal_connect(glk, "notify::program-name", G_CALLBACK(change_window_title), window);
	g_signal_connect(glk, "notify::story-name", G_CALLBACK(change_window_title), window);
	
	/* Create preferences window */
	preferences_create(CHIMARA_GLK(glk));

	return TRUE;
}
Exemplo n.º 9
0
int
main (int argc, char **argv)
{
	GtkBuilder *builder;
	char       *uifile;
	char       *applets_dir;
	GError     *error;

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

	error = NULL;
	if (!gtk_init_with_args (&argc, &argv,
				 "", (GOptionEntry *) options, GETTEXT_PACKAGE,
				 &error)) {
		if (error) {
			g_printerr ("%s\n", error->message);
			g_error_free (error);
		} else
			g_printerr ("Cannot initiliaze GTK+.\n");

		return 1;
	}

	panel_modules_ensure_loaded ();

	if (g_file_test ("../libmate-panel-applet", G_FILE_TEST_IS_DIR)) {
		applets_dir = g_strdup_printf ("%s:../libmate-panel-applet", MATE_PANEL_APPLETS_DIR);
		g_setenv ("MATE_PANEL_APPLETS_DIR", applets_dir, FALSE);
		g_free (applets_dir);
	}

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		panel_cleanup_do ();

		return 0;
	}

	builder = gtk_builder_new ();
	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);

	uifile = BUILDERDIR "/panel-test-applets.ui";
	gtk_builder_add_from_file (builder, uifile, &error);

	if (error) {
		g_warning ("Error loading \"%s\": %s", uifile, error->message);
		g_error_free (error);
		panel_cleanup_do ();

		return 1;
	}

	gtk_builder_connect_signals (builder, NULL);

	win             = GTK_WIDGET (gtk_builder_get_object (builder,
							      "toplevel"));
	applet_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "applet-combo"));
	prefs_path_entry = GTK_WIDGET (gtk_builder_get_object (builder,
							      "prefs-path-entry"));
	orient_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "orient-combo"));
	size_combo      = GTK_WIDGET (gtk_builder_get_object (builder,
							      "size-combo"));
	g_object_unref (builder);

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	panel_cleanup_do ();

	return 0;
}
Exemplo n.º 10
0
int main(int argc, char *argv[])
{
    GtkBuilder *builder;
    GError *err;

    err = NULL;
    gtk_init(&argc, &argv);
    builder = gtk_builder_new();

    gtk_builder_add_from_file(builder, "upravovac.glade", &err);
    if (err != NULL) {
        g_printerr("%s: can not load gui.\n", argv[0]);
        return EXIT_FAILURE;
    }


    /* Populate global widgets. */
    widgets.window = GET_WIDGET_BY_ID(builder, "window");
    widgets.img = GET_WIDGET_BY_ID(builder, "img");
    widgets.aboutdialog = GET_WIDGET_BY_ID(builder, "aboutdialog");

    widgets.toolbutton_undo =
                    GET_WIDGET_BY_ID(builder, "toolbutton_undo");
    widgets.toolbutton_redo =
                    GET_WIDGET_BY_ID(builder, "toolbutton_redo");

    widgets.filechooser_open =
                    GET_WIDGET_BY_ID(builder, "filechooser_open");
    widgets.filechooser_save_as =
                    GET_WIDGET_BY_ID(builder, "filechooser_save_as");


    widgets.edge_detect_dialog =
                    GET_WIDGET_BY_ID(builder, "edge_detect_dialog");
    widgets.edge_detect_combo_box =
                    GET_WIDGET_BY_ID(builder, "edge_detect_combo_box");

    widgets.gray_scale_dialog =
                    GET_WIDGET_BY_ID(builder, "gray_scale_dialog");
    widgets.gray_scale_combo_box =
                    GET_WIDGET_BY_ID(builder, "gray_scale_combo_box");

    widgets.difference_of_gaussians_dialog =
                    GET_WIDGET_BY_ID(builder, "difference_of_gaussians_dialog");
    widgets.difference_of_gaussians_first =
                    GET_WIDGET_BY_ID(builder, "difference_of_gaussians_first");
    widgets.difference_of_gaussians_second =
                    GET_WIDGET_BY_ID(builder, "difference_of_gaussians_second");

    widgets.gaussian_blur_dialog =
                    GET_WIDGET_BY_ID(builder, "gaussian_blur_dialog");
    widgets.gaussian_blur_horizontal =
                    GET_WIDGET_BY_ID(builder, "gaussian_blur_horizontal");
    widgets.gaussian_blur_vertical =
                    GET_WIDGET_BY_ID(builder, "gaussian_blur_vertical");

    widgets.sharpen_dialog =
                    GET_WIDGET_BY_ID(builder, "sharpen_dialog");
    widgets.sharpen_amount =
                    GET_WIDGET_BY_ID(builder, "sharpen_amount");



    /* Connect signals. */
    gtk_builder_connect_signals(builder, &widgets);
    g_object_unref(builder);

    /* Display and run. */
    gtk_widget_show_all(widgets.window);
    gtk_main();

    return EXIT_SUCCESS;
}
static GtkWidget *
ap_assistant_create (AcctPeriodInfo *info)
{
    GtkBuilder *builder;
    GtkWidget *window;
    GtkWidget *box;

    builder = gtk_builder_new();
    gnc_builder_add_from_file  (builder , "assistant-acct-period.glade", "account_period_assistant");
    window = GTK_WIDGET(gtk_builder_get_object (builder, "account_period_assistant"));
    info->window = window;

    // Set the style context for this assistant so it can be easily manipulated with css
    gnc_widget_set_style_context (GTK_WIDGET(window), "GncAssistAccountPeriod");

    /* Enable all pages except menu page. */
    gtk_assistant_set_page_complete (GTK_ASSISTANT (window),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "start_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (window),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "book_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (window),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "finish_page")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (window),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "summary_page")),
                                     TRUE);

    info->close_status = -1;

    /* Find the date of the earliest transaction in the book.
     * Add a year minus a day as the first guess for book closing,
     * and use that to set up the freq spec widget. */
    info->earliest = get_earliest_in_book (gnc_get_current_book());
    info->earliest_str = qof_print_date(info->earliest);
    PINFO ("date of earliest transaction is %" G_GINT64_FORMAT " %s",
           info->earliest, gnc_ctime (&info->earliest));

    g_date_clear (&info->closing_date, 1);
    gnc_gdate_set_time64 (&info->closing_date, info->earliest);
    g_date_clear (&info->prev_closing_date, 1);
    info->prev_closing_date = info->closing_date;
    g_date_add_years (&info->closing_date, 1);

    {
        Recurrence *r = g_new0(Recurrence, 1);
        recurrenceSet(r, 1, PERIOD_MONTH, &info->closing_date, WEEKEND_ADJ_NONE);
        info->period = NULL;
        info->period = g_list_append(info->period, r);
    }

    info->period_menu = GNC_FREQUENCY(
                            gnc_frequency_new_from_recurrence(info->period, &info->closing_date));

    /* Change the text so that its more mainingful for this assistant */
    gnc_frequency_set_frequency_label_text(info->period_menu, _("Period:"));
    gnc_frequency_set_date_label_text(info->period_menu, _("Closing Date:"));

    /* Reparent to the correct location */

    box = GTK_WIDGET(gtk_builder_get_object(builder, "period_hbox"));
    gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (info->period_menu), TRUE, TRUE, 0);
    g_signal_connect (info->period_menu, "changed",
                      G_CALLBACK (ap_assistant_menu_changed_cb), info);

    /* Get handles to all of the other widgets we'll need */
    info->period_remarks = GTK_WIDGET(gtk_builder_get_object(builder, "remarks_label"));

    info->close_results = GTK_WIDGET(gtk_builder_get_object(builder, "results_label"));

    info->book_details = GTK_WIDGET(gtk_builder_get_object(builder, "book_label"));

    info->book_title = GTK_WIDGET(gtk_builder_get_object(builder, "book_title_entry"));

    info->book_notes = GTK_TEXT_VIEW(gtk_builder_get_object(builder, "book_notes_view"));

    info->apply_label = GTK_WIDGET(gtk_builder_get_object(builder, "finish_page"));

    info->summary = GTK_WIDGET(gtk_builder_get_object(builder, "summary_label"));

    g_signal_connect (G_OBJECT(window), "destroy",
                      G_CALLBACK (ap_assistant_destroy_cb), info);

    gtk_builder_connect_signals(builder, info);
    g_object_unref(G_OBJECT(builder));
    return window;
}
Exemplo n.º 12
0
int main(int argc, char *argv[]) {
    gtk_init(&argc, &argv);

    GtkBuilder *builder = gtk_builder_new();
    AuthManager *authManager = g_slice_new(AuthManager);
    GError *error = NULL;

    if (!gtk_builder_add_from_file(builder, "authmanager.glade", &error)) {
        g_print(
                "Error occurred while loading UI description from file (authmanager.glade)!\n");
        g_print("Message: %s\n", error->message);
        g_free(error);
        g_slice_free(AuthManager, authManager);
        return (1);
    }

    authManager->window = GTK_WIDGET(
            gtk_builder_get_object(builder, "mainwindow"));
    authManager->key_store = GTK_LIST_STORE(
            gtk_builder_get_object(builder, "KeyStore"));
    authManager->key_view = GTK_TREE_VIEW(
            gtk_builder_get_object(builder, "KeyView"));

    authManager->errordialog_nodir = GTK_WIDGET(
            gtk_builder_get_object(builder, "errordialog_nodir"));

    authManager->enabled_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrenderertoggle_enabled"));
    authManager->info_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrendererpixbuf_info"));
    authManager->edit_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrendererpixbuf_edit"));
    authManager->delete_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrendererpixbuf_delete"));

    authManager->newdialog.window = GTK_WIDGET(
            gtk_builder_get_object(builder, "newdialog_window"));
    authManager->newdialog.entry_authname = GTK_ENTRY(
            gtk_builder_get_object(builder, "newdialog_entry_authname"));
    authManager->newdialog.entry_privkey = GTK_ENTRY(
            gtk_builder_get_object(builder, "newdialog_entry_privkey"));
    authManager->newdialog.entry_domain = GTK_ENTRY(
            gtk_builder_get_object(builder, "newdialog_entry_domain"));

    authManager->editdialog.window = GTK_WIDGET(
            gtk_builder_get_object(builder, "editdialog_window"));
    authManager->editdialog.entry_authname = GTK_ENTRY(
            gtk_builder_get_object(builder, "editdialog_entry_authname"));
    authManager->editdialog.entry_privkey = GTK_ENTRY(
            gtk_builder_get_object(builder, "editdialog_entry_privkey"));
    authManager->editdialog.entry_domain = GTK_ENTRY(
            gtk_builder_get_object(builder, "editdialog_entry_domain"));

    authManager->infodialog.window = GTK_WIDGET(
            gtk_builder_get_object(builder, "infodialog_window"));

    authManager->infodialog.label_authname = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_authname"));
    authManager->infodialog.label_privkey = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_privkey"));
    authManager->infodialog.label_pubkey = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_pubkey"));
    authManager->infodialog.label_domain = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_domain"));
    authManager->infodialog.label_location = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_location"));

    gtk_builder_connect_signals(builder, authManager);

    g_object_unref(G_OBJECT(builder));

    gtk_widget_show(authManager->window);

    GTK_CELL_RENDERER_TOGGLE(authManager->enabled_renderer)->activatable = true;

    GtkIconTheme *icon_theme = gtk_icon_theme_get_default();

    authManager->info_icon_pixbuf = get_stock_icon(icon_theme,
            "Icons"FS_DELIM"200px-Gnome-dialog-information.png");
    authManager->edit_icon_pixbuf = get_stock_icon(icon_theme,
            "Icons"FS_DELIM"200px-Gnome-accessories-text-editor.png");
    authManager->delete_icon_pixbuf = get_stock_icon(icon_theme,
            "Icons"FS_DELIM"200px-Gnome-edit-delete.png");

    if (!authManager->info_icon_pixbuf || !authManager->edit_icon_pixbuf
            || !authManager->delete_icon_pixbuf) {
        if (authManager->info_icon_pixbuf)
            g_object_unref(authManager->info_icon_pixbuf);
        if (authManager->edit_icon_pixbuf)
            g_object_unref(authManager->edit_icon_pixbuf);
        if (authManager->delete_icon_pixbuf)
            g_object_unref(authManager->delete_icon_pixbuf);
        g_slice_free(AuthManager, authManager);
        return (1);
    }

    if (!load_auth_information(authManager)) {
        gtk_dialog_run(GTK_DIALOG(authManager->errordialog_nodir));
    } else {
        gtk_main();
    }

    gtk_list_store_clear(authManager->key_store);

    freefb(&authManager->auth_cfg_buffer);
    freefb(&authManager->autoexec_cfg_buffer);

    if (authManager->auth_cfg_file)
        g_object_unref(authManager->auth_cfg_file);
    if (authManager->autoexec_cfg_file)
        g_object_unref(authManager->autoexec_cfg_file);

    if (authManager->auth_cfg_monitor)
        g_object_unref(authManager->auth_cfg_monitor);
    if (authManager->autoexec_cfg_monitor)
        g_object_unref(authManager->autoexec_cfg_monitor);

	if (authManager->sauer_home)
		free(authManager->sauer_home);
		
    if (authManager->info_icon_pixbuf)
        g_object_unref(authManager->info_icon_pixbuf);
    if (authManager->edit_icon_pixbuf)
        g_object_unref(authManager->edit_icon_pixbuf);
    if (authManager->delete_icon_pixbuf)
        g_object_unref(authManager->delete_icon_pixbuf);

    g_slice_free(AuthManager, authManager);
    return 0;
}
Exemplo n.º 13
0
void GTKGui::setUpGTK()
{
  GdkGLConfig *glconfig;
  GtkBuilder  *builder;
  GError      *error = NULL;

  gtk_init(0, NULL);
  gtk_gl_init(0, NULL);

  //Try double-buffered visual
  glconfig = gdk_gl_config_new_by_mode (static_cast<GdkGLConfigMode> (
								                      GDK_GL_MODE_RGB    |
                                      GDK_GL_MODE_DEPTH  |
                                      GDK_GL_MODE_DOUBLE));
  if (glconfig == NULL)
  {
   	g_print ("*** Cannot find the double-buffered visual.\n");
   	g_print ("*** Trying single-buffered visual.\n");

    // Try single-buffered visual
   	glconfig = gdk_gl_config_new_by_mode (static_cast<GdkGLConfigMode> (
									                        GDK_GL_MODE_RGB   |
                                          GDK_GL_MODE_DEPTH));
    if (glconfig == NULL)
	    g_print ("*** No appropriate OpenGL-capable visual found.\n");
  }

  // Create new GtkBuilder object
  builder = gtk_builder_new();
  if( ! gtk_builder_add_from_file(builder, "../../carmen/data/gui/cvis.glade", &error ) )
  {
    g_warning( "%s", error->message );
    g_free( error );
  }

  sleep(1.0);

  controls_.winMain  = GTK_WIDGET(gtk_builder_get_object(builder, "winMain" ));
  controls_.drawArea = GTK_WIDGET(gtk_builder_get_object(builder, "drawArea"));


  controls_.btnView2D = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnView2D"));
  controls_.btnView3D = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnView3D"));

  controls_.btnEfeito1 = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnEfeito1"));
  controls_.btnEfeito2 = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnEfeito2"));
  controls_.btnEfeito3 = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnEfeito3"));
  controls_.btnEfeito4 = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnEfeito4"));
  controls_.btnEfeito5 = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnEfeito5"));
  controls_.btnEfeito10 = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnEfeito10"));

  controls_.frameCamera         = GTK_WIDGET(gtk_builder_get_object(builder, "frameCamera"));
  controls_.frame3DMapOptions   = GTK_WIDGET(gtk_builder_get_object(builder, "frame3DMapOptions"));
  controls_.frame3DOtherOptions = GTK_WIDGET(gtk_builder_get_object(builder, "frame3DOtherOptions"));

  controls_.vboxRawOptions           = GTK_WIDGET(gtk_builder_get_object(builder, "vboxRawOptions" ));
  controls_.vboxObstacleOptions      = GTK_WIDGET(gtk_builder_get_object(builder, "vboxObstacleOptions" ));
  controls_.vboxColorByHeightOptions = GTK_WIDGET(gtk_builder_get_object(builder, "vboxColorByHeightOptions" ));

  controls_.ntbkViewOptions = GTK_NOTEBOOK(gtk_builder_get_object(builder, "ntbkViewOptions"));

  controls_.txtCamPosX = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamPosX"));
  controls_.txtCamPosY = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamPosY"));
  controls_.txtCamPosZ = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamPosZ"));

  controls_.txtCamLookX = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamLookX"));
  controls_.txtCamLookY = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamLookY"));
  controls_.txtCamLookZ = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamLookZ"));

  controls_.tbxCloudR = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCloudR"));
  controls_.tbxCloudG = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCloudG"));
  controls_.tbxCloudB = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCloudB"));

  controls_.tbxBackgroundR = GTK_ENTRY(gtk_builder_get_object(builder, "tbxBackgroundR"));
  controls_.tbxBackgroundG = GTK_ENTRY(gtk_builder_get_object(builder, "tbxBackgroundG"));
  controls_.tbxBackgroundB = GTK_ENTRY(gtk_builder_get_object(builder, "tbxBackgroundB"));

  controls_.tbxCor1R = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor1R"));
  controls_.tbxCor1G = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor1G"));
  controls_.tbxCor1B = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor1B"));

  controls_.tbxCor2R = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor2R"));
  controls_.tbxCor2G = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor2G"));
  controls_.tbxCor2B = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor2B"));

  controls_.tbxCor3R = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor3R"));
  controls_.tbxCor3G = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor3G"));
  controls_.tbxCor3B = GTK_ENTRY(gtk_builder_get_object(builder, "tbxCor3B"));

  controls_.spbChangeSpeed = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spbChangeSpeed"));
  controls_.spbForeRange = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spbForeRange"));
  controls_.spbBackRange = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spbBackRange"));

  controls_.spbCloudDensity = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spbCloudDensity"));
  controls_.spbPointSize = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spbPointSize"));

  controls_.spbVelTranslation = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spbVelTranslation"));
  controls_.spbVelZoom = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spbVelZoom"));

  controls_.btnAutoZoom = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnAutoZoom"));

  // Connect signals
  gtk_builder_connect_signals(builder, this);

  // Redraws
  gtk_container_set_reallocate_redraws (GTK_CONTAINER(controls_.winMain), TRUE);

  // Add OpenGL-capability to drawArea.
  if(!gtk_widget_set_gl_capability (controls_.drawArea, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE))
	  return;

  // Register idle function
  g_idle_add (on_drawArea_idle, this);

  // Destroy builder, since we don't need it anymore
  g_object_unref( G_OBJECT( builder ) );

  // Show window. All other widgets are automatically shown by GtkBuilder
  gtk_widget_show(controls_.winMain);
}
Exemplo n.º 14
0
static GtkWidget *
gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFinishedCallback when_completed)
{
    hierarchy_data *data;
    GtkWidget *dialog;
    GtkTreeView *tree_view;
    GtkWidget *box;
    GtkBuilder *builder;

    data = g_new0 (hierarchy_data, 1);

    /* Presumably this assistant is only used to create a new book but we check.
     * When gnucash is started with --nofile, there is initially no session (and
     * no book), but by the time we get here, one could have been created (for
     * example, if an empty account tree tab is opened, a session is created
     * which creates a new, but empty, book). */
    data->new_book = gnc_is_new_book();

    builder = gtk_builder_new();
    gnc_builder_add_from_file (builder, "assistant-hierarchy.glade", "Hierarchy Assistant");

    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Hierarchy Assistant"));
    data->dialog = dialog;

    /* If we have a callback, make this window stay on top */
    if (when_completed != NULL)
        gtk_window_set_keep_above (GTK_WINDOW(data->dialog), TRUE);

    /* Enable buttons on first and last page. */
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "intro_page_label")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "currency_book_option_page_vbox")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "final_account_vbox")),
                                     TRUE);
    gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                     GTK_WIDGET(gtk_builder_get_object(builder, "finish_page_label")),
                                     TRUE);

    /* Currency Page */
    data->currency_selector = gnc_currency_edit_new();
    gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(data->currency_selector), gnc_default_currency());
    gtk_widget_show (data->currency_selector);
    box = GTK_WIDGET(gtk_builder_get_object (builder, "currency_chooser_hbox"));
    gtk_box_pack_start(GTK_BOX(box), data->currency_selector, TRUE, TRUE, 0);

    /* Categories Page */
    tree_view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "account_categories_tree_view"));
    g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (tree_view)), "changed",
                      G_CALLBACK (categories_tree_selection_changed), data);
    gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree_view), GTK_SELECTION_SINGLE);
    data->categories_tree = tree_view;

    data->category_accounts_label = GTK_LABEL(gtk_builder_get_object (builder, "accounts_in_category_label"));
    data->category_accounts_container = GTK_WIDGET(gtk_builder_get_object (builder, "accounts_in_category"));
    data->category_description = GTK_TEXT_VIEW(gtk_builder_get_object (builder, "account_types_description"));
    data->account_list_added = FALSE;

    /* Book options page - only on new books */
    if (data->new_book)
        assistant_instert_book_options_page (data);

    /* Final Accounts Page */
    data->final_account_tree_container = GTK_WIDGET(gtk_builder_get_object (builder, "final_account_tree_box"));
    data->final_account_tree = NULL;

    data->balance_hash = g_hash_table_new(NULL, NULL);

    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(data->dialog));

    g_signal_connect (G_OBJECT(dialog), "destroy",
                      G_CALLBACK (gnc_hierarchy_destroy_cb), data);

    gtk_builder_connect_signals(builder, data);
    g_object_unref(G_OBJECT(builder));

    data->when_completed = when_completed;
    data->use_defaults = use_defaults;
    return dialog;
}
Exemplo n.º 15
0
int main(int argc, char *argv[])
{
	GtkBuilder *builder;
	GtkWidget *window;
	//int resource_page_timer;

	/*
	   GtkWidget * label_vendor_id;
	   GtkWidget * label_model_name;
	   GtkWidget * label_cpu_mhz;
	   GtkWidget * label_cache_size;
	   GtkWidget * label_address_sizes;
	 */
	gtk_init(&argc, &argv);

	builder = gtk_builder_new();
	gtk_builder_add_from_file(builder, "task.xml", NULL);

	window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
	gtk_widget_set_size_request(GTK_WIDGET(window), 600, 400);
	gtk_window_set_title(GTK_WINDOW(window), "Task Manager");
	gtk_container_set_border_width(GTK_CONTAINER(window), 5);	//设置窗口边框宽度


    g_timeout_add(3, (GtkFunction) refresh_ui, NULL);
    /*===========================system页======================================*/

	system_info.label_vendor_id =
	    GTK_WIDGET(gtk_builder_get_object(builder, "vendor_id"));
	system_info.label_model_name =
	    GTK_WIDGET(gtk_builder_get_object(builder, "model_name"));
	system_info.label_cpu_mhz =
	    GTK_WIDGET(gtk_builder_get_object(builder, "cpu_mhz"));
	system_info.label_cache_size =
	    GTK_WIDGET(gtk_builder_get_object(builder, "cache_size"));
	system_info.label_address_sizes =
	    GTK_WIDGET(gtk_builder_get_object(builder, "address_sizes"));

	system_info.label_mem_total =
	    GTK_WIDGET(gtk_builder_get_object(builder, "mem_total"));

	system_info.label_os_version =
	    GTK_WIDGET(gtk_builder_get_object(builder, "os_version"));
	system_info.label_kernel_version =
	    GTK_WIDGET(gtk_builder_get_object(builder, "kernel_version"));
	system_info.label_host_name =
	    GTK_WIDGET(gtk_builder_get_object(builder, "host_name"));

	//system_page_timer =
	//g_timeout_add(5, (GtkFunction) get_system_page_info, NULL);

    /*===========================device页======================================*/
	device_text =
	    (GtkTextBuffer *) gtk_builder_get_object(builder,
						     "device_text_buffer");

	//device_page_timer =
	g_timeout_add(10000, (GtkFunction) get_device_page_info, NULL);

     /*===========================resource页======================================*/
	resource_info.cpu_resource_curve =
	    (GtkCurve *) gtk_builder_get_object(builder, "cpu_curve");
	resource_info.mem_progress_bar =
	    (GtkProgressBar *) gtk_builder_get_object(builder, "mem_progress");

	//resource_page_timer = 
	g_timeout_add(1000, (GtkFunction) get_resource_page_info, NULL);

    /*===========================status栏======================================*/
	status_bar.cpu =
	    (GtkLabel *) gtk_builder_get_object(builder, "cpu_status_bar");
	status_bar.mem =
	    (GtkLabel *) gtk_builder_get_object(builder, "mem_status_bar");
	status_bar.time =
	    (GtkLabel *) gtk_builder_get_object(builder, "now_time");

	g_timeout_add(1000, (GtkFunction) get_now_time, NULL);
    /*==============================progress项=========================================*/
	progress_text = (GtkTextBuffer *) gtk_builder_get_object(builder,
								 "progress_text_buffer");

	g_timeout_add(15000, (GtkFunction) get_progress_page_info, NULL);

	gtk_builder_connect_signals(builder, NULL);
	g_object_unref(G_OBJECT(builder));

	gtk_widget_show(window);

	gtk_main();

	return 0;
}
Exemplo n.º 16
0
int main(int argc, char* argv[]) {
	// The main function
	
	GError *error = NULL;
	
	// Initialize GTK+
	gtk_init(&argc, &argv);
	
	// Create new GtkBuilder
	builder = gtk_builder_new();
	
	// Load UI from a file
	if (!gtk_builder_add_from_file(builder, "gtk/cirugia.ui", &error)) {
		g_warning("%s", error->message);
		g_free(error);
		return(1);
	}
	
	// Get pointers from UI
	mainwindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainwindow"));
	statusbar = GTK_WIDGET(gtk_builder_get_object(builder, "statusbar"));
	
	filesaveas = GTK_WIDGET(gtk_builder_get_object(builder, "filesaveas"));
	fileapplyips = GTK_WIDGET(gtk_builder_get_object(builder, "fileapplyips"));
	filecreateips = GTK_WIDGET(gtk_builder_get_object(builder, "filecreateips"));
	
	radiobutton1 = GTK_WIDGET(gtk_builder_get_object(builder, "radiobutton1"));
	radiobutton2 = GTK_WIDGET(gtk_builder_get_object(builder, "radiobutton2"));
	
	spinbuttonmapper = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonmapper"));
	spinbuttonsubmapper = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonsubmapper"));
	
	spinbuttonprgrom = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonprgrom"));
	spinbuttonprgram = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonprgram"));
	spinbuttonprgnvram = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonprgnvram"));
	
	spinbuttonchrrom = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonchrrom"));
	spinbuttonchrram = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonchrram"));
	spinbuttonchrnvram = GTK_WIDGET(gtk_builder_get_object(builder, "spinbuttonchrnvram"));
	
	radiobuttonh = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonh"));
	radiobuttonv = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonv"));
	radiobuttonf = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonf"));
	
	radiobuttonntsc = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonntsc"));
	radiobuttonpal = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonpal"));
	radiobuttonboth = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonboth"));
	
	radiobuttonhomeconsole = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonhomeconsole"));
	radiobuttonvssystem = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonvssystem"));
	radiobuttonpc10 = GTK_WIDGET(gtk_builder_get_object(builder, "radiobuttonpc10"));
	
	comboboxvsppu = GTK_WIDGET(gtk_builder_get_object(builder, "comboboxvsppu"));
	comboboxvsmode = GTK_WIDGET(gtk_builder_get_object(builder, "comboboxvsmode"));
	
	checkbuttontrainer = GTK_WIDGET(gtk_builder_get_object(builder, "checkbuttontrainer"));
	
	// Connect signals
	gtk_builder_connect_signals(builder, NULL);
	
	// Destroy builder
	g_object_unref(G_OBJECT(builder));
	
	// Show the window
	gtk_widget_show(mainwindow);
	
	// Start GTK+ main loop
	gtk_main();
	
	// Do cleanups
	if (romloaded) { cir_rom_cleanup(); }
	
	return 0;
}
Exemplo n.º 17
0
Arquivo: prefs.c Projeto: Cw1X/pnmixer
GtkWidget* create_prefs_window (void) {
  GtkBuilder *builder;
  GError     *error = NULL;

  GdkColor   vol_meter_color_button_color;
  gint       *vol_meter_clrs;
  gchar      *vol_cmd,*uifile,*custcmd;

  PrefsData  *prefs_data;

  uifile = get_ui_file("prefs.xml");
  if (!uifile) {
    report_error(_("Can't find preferences user interface file.  Please insure PNMixer is installed correctly.\n"));
    return NULL;
  }

  builder = gtk_builder_new();
  if (!gtk_builder_add_from_file( builder, uifile, &error)) {
    g_warning("%s",error->message);
    report_error(error->message);
    g_error_free(error);
    g_free(uifile);
    g_object_unref (G_OBJECT (builder));
    return NULL;
  }
  
  g_free(uifile);

  prefs_data = g_slice_new(PrefsData);
#define GO(name) prefs_data->name = GTK_WIDGET(gtk_builder_get_object(builder,#name))
  GO(prefs_window);
  GO(card_combo);
  GO(chan_combo);
  GO(vol_pos_label);
  GO(vol_pos_combo);
  GO(vol_meter_pos_label);
  GO(vol_meter_pos_spin);
  GO(vol_meter_color_label);
  GO(vol_meter_color_button);
  GO(custom_label);
  GO(custom_entry);
  GO(vol_text_check);
  GO(draw_vol_check);
  GO(icon_theme_combo);
  GO(vol_control_entry);
  GO(scroll_step_spin);
  GO(middle_click_combo);
  GO(enable_hotkeys_check);
  GO(hotkey_spin);
  GO(hotkey_dialog);
  GO(hotkey_key_label);
  GO(mute_hotkey_label);
  GO(up_hotkey_label);
  GO(down_hotkey_label);
#ifdef HAVE_LIBN
  GO(enable_noti_check);
  GO(hotkey_noti_check);
  GO(mouse_noti_check);
  GO(popup_noti_check);
  GO(external_noti_check);
#endif
#undef GO

  // vol text display
  gtk_toggle_button_set_active
    (GTK_TOGGLE_BUTTON(prefs_data->vol_text_check),
     g_key_file_get_boolean_with_default(keyFile,"PNMixer","DisplayTextVolume",FALSE));
  gtk_combo_box_set_active
    (GTK_COMBO_BOX (prefs_data->vol_pos_combo),
     g_key_file_get_integer_with_default(keyFile,"PNMixer","TextVolumePosition",0));

  // volume meter
  gtk_toggle_button_set_active
    (GTK_TOGGLE_BUTTON(prefs_data->draw_vol_check),
     g_key_file_get_boolean_with_default(keyFile,"PNMixer","DrawVolMeter",FALSE));
  gtk_adjustment_set_upper
    (GTK_ADJUSTMENT(gtk_builder_get_object(builder,"vol_meter_pos_adjustment")),
     tray_icon_size()-10);
  gtk_spin_button_set_value
    (GTK_SPIN_BUTTON(prefs_data->vol_meter_pos_spin),
     g_key_file_get_integer_with_default(keyFile,"PNMixer","VolMeterPos",0));

  // load available icon themes into icon theme combo box.  also sets active
  load_icon_themes(prefs_data->icon_theme_combo,
		   GTK_LIST_STORE(gtk_builder_get_object(builder,"icon_theme_liststore")));


  // set color button color
  vol_meter_clrs = get_vol_meter_colors();
  vol_meter_color_button_color.red = vol_meter_clrs[0];
  vol_meter_color_button_color.green = vol_meter_clrs[1];
  vol_meter_color_button_color.blue = vol_meter_clrs[2];
  gtk_color_button_set_color(GTK_COLOR_BUTTON(prefs_data->vol_meter_color_button),
			     &vol_meter_color_button_color);
  g_free(vol_meter_clrs);

  // fill in card/channel combo boxes
  fill_card_combo(prefs_data->card_combo,prefs_data->chan_combo);


  // volume command
  vol_cmd = get_vol_command();
  if (vol_cmd) {
    gtk_entry_set_text(GTK_ENTRY(prefs_data->vol_control_entry), vol_cmd);
    g_free(vol_cmd);
  }

  // mouse scroll step
  gtk_spin_button_set_value(GTK_SPIN_BUTTON(prefs_data->scroll_step_spin),
			    g_key_file_get_integer_with_default(keyFile,"PNMixer","MouseScrollStep",1));

  //  middle click
  gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_data->middle_click_combo),
			   g_key_file_get_integer_with_default(keyFile,"PNMixer","MiddleClickAction",0));

  // custom command
  gtk_entry_set_invisible_char(GTK_ENTRY(prefs_data->custom_entry), 8226);

  custcmd =  g_key_file_get_string(keyFile,"PNMixer","CustomCommand",NULL);
  if (custcmd) {
    gtk_entry_set_text(GTK_ENTRY(prefs_data->custom_entry),custcmd);
    g_free(custcmd);
  }

  on_vol_text_toggle(GTK_TOGGLE_BUTTON(prefs_data->vol_text_check),
		     prefs_data);
  on_draw_vol_toggle(GTK_TOGGLE_BUTTON(prefs_data->draw_vol_check),
		     prefs_data);
  on_middle_changed(GTK_COMBO_BOX(prefs_data->middle_click_combo),
		    prefs_data);

  // hotkeys
  gtk_toggle_button_set_active
    (GTK_TOGGLE_BUTTON(prefs_data->enable_hotkeys_check),
     g_key_file_get_boolean_with_default(keyFile,"PNMixer","EnableHotKeys",FALSE));
  
  // hotkey step
  gtk_spin_button_set_value(GTK_SPIN_BUTTON(prefs_data->hotkey_spin),
			    g_key_file_get_integer_with_default(keyFile,"PNMixer","HotkeyVolumeStep",1));


  if (g_key_file_has_key(keyFile,"PNMixer","VolMuteKey",NULL)) 
    set_label_for_keycode(prefs_data->mute_hotkey_label,
			  g_key_file_get_integer(keyFile,"PNMixer", "VolMuteKey", NULL),
			  g_key_file_get_integer_with_default(keyFile,"PNMixer", "VolMuteMods", 0));

  if (g_key_file_has_key(keyFile,"PNMixer","VolUpKey",NULL)) 
    set_label_for_keycode(prefs_data->up_hotkey_label,
			  g_key_file_get_integer(keyFile,"PNMixer", "VolUpKey", NULL),
			  g_key_file_get_integer_with_default(keyFile,"PNMixer", "VolUpMods", 0));
  if (g_key_file_has_key(keyFile,"PNMixer","VolDownKey",NULL)) 
    set_label_for_keycode(prefs_data->down_hotkey_label,
			  g_key_file_get_integer(keyFile,"PNMixer", "VolDownKey", NULL),
			  g_key_file_get_integer_with_default(keyFile,"PNMixer", "VolDownMods", 0));


  gtk_notebook_append_page(GTK_NOTEBOOK(gtk_builder_get_object(builder,"notebook1")),
#ifdef HAVE_LIBN
			   GTK_WIDGET(gtk_builder_get_object(builder,"notification_vbox")),			   
#else
			   GTK_WIDGET(gtk_builder_get_object(builder,"no_notification_label")),
#endif
			   gtk_label_new("Notifications"));

#ifdef HAVE_LIBN
  // notification checkboxes
  set_notifications_booleans();
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_data->enable_noti_check),enable_noti);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_data->hotkey_noti_check),hotkey_noti);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_data->mouse_noti_check),mouse_noti);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_data->popup_noti_check),popup_noti);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_data->external_noti_check),external_noti);
  on_notification_toggle(GTK_TOGGLE_BUTTON(prefs_data->enable_noti_check),prefs_data);
#endif

  gtk_builder_connect_signals(builder, prefs_data);
  g_object_unref (G_OBJECT (builder));

  return prefs_data->prefs_window;
}
Exemplo n.º 18
0
gboolean
init_ui (gint   *argc,
         gchar **argv[])
{
        GtkWidget *about_dialog;
        GdkPixbuf *icon_pixbuf;
        GtkWidget *hpaned;
        GtkWidget *vpaned;
        gint       window_width, window_height;
        gint       position;
        GError    *error = NULL;
        double     w,h;

        gtk_init (argc, argv);

        builder = gtk_builder_new ();
        g_assert (builder != NULL);
        gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);

        if (!gtk_builder_add_from_file (builder, UI_FILE, &error)) {
                g_critical ("Unable to load the GUI file %s: %s",
                            UI_FILE,
                            error->message);

                g_error_free (error);
                return FALSE;
        }

        main_window = GTK_WIDGET (gtk_builder_get_object (builder,
                                                          "main-window"));
        about_dialog = GTK_WIDGET (gtk_builder_get_object (builder,
                                                           "about-dialog"));
        hpaned = GTK_WIDGET (gtk_builder_get_object (builder,
                                                     "main-window-hpaned"));
        vpaned = GTK_WIDGET (gtk_builder_get_object (builder,
                                                     "main-window-vpaned"));

        g_assert (main_window != NULL);
        g_assert (about_dialog != NULL);
        g_assert (hpaned != NULL);
        g_assert (vpaned != NULL);

        /* 80% of the screen but don't get bigger than 1000x800 */
        /* FIXME: Replace with proper functions */
        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
        w = gdk_screen_width () * 0.8;
        h = gdk_screen_height () * 0.8;
        G_GNUC_END_IGNORE_DEPRECATIONS

        /* Keep 5/4 aspect */
        if (w/h > 1.25) {
                h = w / 1.25;
        } else {
                w = h * 1.25;
        }

        window_width = CLAMP ((int) w, 10, 1000);
        window_height = CLAMP ((int) h, 10, 800);

        gtk_window_set_default_size (GTK_WINDOW (main_window),
                                     window_width,
                                     window_height);

        gtk_window_resize (GTK_WINDOW (main_window),
                                     window_width,
                                     window_height);


        icon_pixbuf = load_pixbuf_file (ICON_FILE);
        if (icon_pixbuf == NULL) {
                return FALSE;
        }

        gtk_window_set_icon (GTK_WINDOW (main_window), icon_pixbuf);
        gtk_window_set_icon (GTK_WINDOW (about_dialog), icon_pixbuf);
        gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG (about_dialog),
                                   icon_pixbuf);
        gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (about_dialog),
                                      VERSION);

        g_object_unref (icon_pixbuf);

        gtk_builder_connect_signals (builder, NULL);

        init_icons ();
        setup_treeviews ();
        init_action_dialog (builder);

        gtk_widget_show_all (main_window);

        /* Give device treeview 40% of the main window */
        g_object_get (hpaned, "max-position", &position, NULL);
        position = position * 40 / 100;
        g_object_set (hpaned, "position", position, NULL);

        /* Give details treeview 60% of 60% of the main window */
        g_object_get (vpaned, "max-position", &position, NULL);
        position = position * 60 / 100;
        g_object_set (vpaned, "position", position, NULL);

        return TRUE;
}
Exemplo n.º 19
0
gint display_manpage_dbox()
{
	GtkBuilder *builder;
	GError* error = NULL;
	GtkWidget *dbox;
	GtkTextBuffer *txtbuf;
	GtkWidget *text;
	FILE *fd;
	gchar *filename;
	gchar buffer[32768];
	gint len = 0;
	struct stat stbuf;
	gint result;
	PangoFontDescription *font_desc;

	filename = g_strconcat(inst_paths.manpage_dir, "Manpage.txt", NULL);

	if (access(filename, F_OK) == 0) 
	{
		if (stat(filename, &stbuf) != -1) 
		{
			len = stbuf.st_size;
			len -= 2;
		}
		if ((fd = fopen(filename, "r")) != NULL) 
		{
			memset(buffer, 0, sizeof(buffer));
			len = fread(buffer, 1, len, fd);
			fclose(fd);
		}
	}

	builder = gtk_builder_new();
	if (!gtk_builder_add_from_file (builder, tilp_paths_build_builder("manpage.ui"), &error))
	{
		g_warning (_("Couldn't load builder file: %s\n"), error->message);
		g_error_free (error);
		return 0; // THIS RETURNS !
	}
	gtk_builder_connect_signals(builder, NULL);

	dbox = GTK_WIDGET (gtk_builder_get_object (builder, "manpage_dbox"));
	text = GTK_WIDGET (gtk_builder_get_object (builder, "textview1"));

	// Change font
	font_desc = pango_font_description_from_string ("Courier");
	gtk_widget_modify_font (text, font_desc);
	pango_font_description_free (font_desc);

	// Set text
	txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
	gtk_text_buffer_set_text(txtbuf, buffer, len);

	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Exemplo n.º 20
0
int main ( int argc , char **argv )
{
	fprintf(stdout,"\n===== SIMPLE UI TOOLKIT =====\n\n");
	 const char *wrong_arg = 0;
	 char *output_model_file = 0;
	 char *xforms_text = 0;
	 char *input_xml_file = 0;
	 sXformsNode *head;
	 struct sCbData *CallBackData;
	 xmlDoc *modelDocPtr;
    GtkBuilder *builder;
    GtkWidget  *window;
    GError     *error = NULL;
	if(argc)
	{
		#define OY_PARSE_STRING_ARG( opt ) \
                        if( pos + 1 < argc && argv[pos][i+1] == 0 ) \
                        { opt = argv[pos+1]; \
                          if( opt == 0 && strcmp(argv[pos+1],"0") ) \
                            wrong_arg = "-" #opt; \
                          ++pos; \
                          i = 1000; \
                        } else if(argv[pos][i+1] == '=') \
                        { opt = &argv[pos][i+2]; \
                          if( opt == 0 && strcmp(&argv[pos][i+2],"0") ) \
                            wrong_arg = "-" #opt; \
                          i = 1000; \
                        } else wrong_arg = "-" #opt; \
                        
                        
  	if(argc != 1)
  	{
    		int pos = 1, i;
    		while(pos < argc)
    		{
      			switch(argv[pos][0])
      			{
			case '-':
			    for(i = 1; i < (int)strlen(argv[pos]); ++i)
			    switch (argv[pos][i])
			    {
			      case 'o': OY_PARSE_STRING_ARG( output_model_file ); break;
			      case 'i': OY_PARSE_STRING_ARG( input_xml_file ); break;
			      case 'v': break;//oy_debug += 1; break;
			      case 'h': /* only for compatibility with cmd line */ break;
			      case 'l': /* only for compatibility with cmd line */ break;
#if 0
			      case '-':
				        if(strcmp(&argv[pos][2],"verbose") == 0)
				        { 
						//oy_debug += 1; 
						i=100; 
						break;
				        }
				        STRING_ADD( t, &argv[pos][2] );
				        text = oyStrrchr_(t, '=');
				        /* get the key only */
				        if(text)
				          text[0] = 0;
				        oyStringListAddStaticString_( &other_args,&other_args_n,
				                                      t,
				                            oyAllocateFunc_,oyDeAllocateFunc_ );
				        if(text)
				        oyStringListAddStaticString_( &other_args,&other_args_n,
				                            oyStrrchr_(&argv[pos][2], '=') + 1,
				                            oyAllocateFunc_,oyDeAllocateFunc_ );
				        else {
				          if(argv[pos+1])
				          {
				            oyStringListAddStaticString_( &other_args,
				                                          &other_args_n,
				                                          argv[pos+1],
				                            oyAllocateFunc_,oyDeAllocateFunc_ );
				            ++pos;
				          } else wrong_arg = argv[pos];
				        }
				        if(t) oyDeAllocateFunc_( t );
				        t = 0;
				        i=100; 
					break;
#endif
			      case '?':
			      default:
				        fprintf(stderr, "%s -%c\n", ("Unknown argument"), argv[pos][i]);
				        usage(argc, argv);
				        exit (0);
				        break;
			    }
            		break;
        		default:
           		wrong_arg = argv[pos];
	      		}
			if( wrong_arg )
			{
				fprintf(stderr, "%s %s\n", ("wrong argument to option:"), wrong_arg);
				exit(1);
			}
	     		++pos;
    		}

  	}
  	}
	


fprintf(stdout,"INPUT FILE = %s\n",input_xml_file);

#if 0
  if(!input_xml_file)
  {
    size_t text_size = 0;
    text = oyReadStdinToMem_(&text_size, oyAllocateFunc_);

    if(text_size == 0)
    {
                        usage(argc, argv);
                        exit (0);
    }
  }

#endif

  
  if(input_xml_file)
  {
   xforms_text =  sReadFileToMem(input_xml_file);
  }
  head = ParseXformsToTree( xforms_text,&modelDocPtr);
  //sPrintsXformsTree(head);
  gtk_init( &argc, &argv );
  builder = gtk_builder_new();
  //cb_data = sGenerateGladeFile(head);
  CallBackData = sGenerateGladeFile(head,modelDocPtr,&DummyIfFunction);
  //print_user_data(CallBackData);
  if( ! gtk_builder_add_from_file( builder, sGTK_UI_FILE, &error ) )
    {
        g_warning( "%s", error->message );
        g_free( error );
        return( 1 );
    }
    
     //Get main window pointer from UI 
    window = GTK_WIDGET( gtk_builder_get_object( builder, sGTK_GLADE_MAIN_WINDOW_NAME) );
    // = MakeDummy();
    gtk_builder_connect_signals( builder, CallBackData);
    g_object_unref( G_OBJECT( builder ) );
    gtk_widget_show( window );
    gtk_main();
  if(output_model_file)
  {
      FILE *fp = fopen(output_model_file,"w");
      if( fp != NULL )
      xmlDocDump(fp, modelDocPtr);
      fclose(fp);
  }
  xmlDocDump(stdout, modelDocPtr);
    fprintf(stdout,"\n");
    return( 0 );
}
Exemplo n.º 21
0
		CVoxelView::CVoxelView(CVoxelDisplay& rVoxelDisplay) :
			m_rVoxelDisplay(rVoxelDisplay),
			m_pBuilderInterface(NULL),
			m_pCubeButton(NULL),
			m_pSphereButton(NULL),
			m_pMinScaleFactorSpinButton(NULL),
			m_pMaxScaleFactorSpinButton(NULL),
			m_f64MinScaleFactor(1),
			m_f64MaxScaleFactor(2),
			m_pThresholdRangeAndOrLabel(NULL),
			m_pMinDisplayThresholdBoundaryButton(NULL),
			m_pMaxDisplayThresholdBoundaryButton(NULL),
			m_pMinDisplayThresholdScale(NULL),
			m_pMaxDisplayThresholdScale(NULL),
			m_f64MinDisplayThreshold(0.25),
			m_f64MaxDisplayThreshold(0.75)
		{
			//load the gtk builder interface
			m_pBuilderInterface=gtk_builder_new(); // glade_xml_new("../share/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL, NULL);
			gtk_builder_add_from_file(m_pBuilderInterface, "../share/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL);

			if(!m_pBuilderInterface)
			{
				g_warning("Couldn't load the interface!");
				return;
			}

			gtk_builder_connect_signals(m_pBuilderInterface, NULL);

			//toolbar
			//-------

			//voxel object buttons
			m_pCubeButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "CubeButton"));
			m_pSphereButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "SphereButton"));

			g_signal_connect(G_OBJECT(m_pCubeButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this);
			g_signal_connect(G_OBJECT(m_pSphereButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this);

			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")), "toggled", G_CALLBACK(toggleColorModificationCallback), this);
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")), "toggled", G_CALLBACK(toggleTransparencyModificationCallback), this);
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")), "toggled", G_CALLBACK(toggleSizeModificationCallback), this);

			//min voxel scale factor
			m_pMinScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinScaleFactorSpinButton"));
			m_rVoxelDisplay.setMinScaleFactor(m_f64MinScaleFactor);
			gtk_spin_button_configure(
				m_pMinScaleFactorSpinButton,
				GTK_ADJUSTMENT(gtk_adjustment_new(
					m_f64MinScaleFactor, //initial value
					0, //lower
					5, //upper
					0.1, //step increment
					0.5, //page increment
					0)), //page size - deprecated
					0.1, //climb rate
					1); //digits
			g_signal_connect(G_OBJECT(m_pMinScaleFactorSpinButton), "value-changed", G_CALLBACK(setMinScaleFactorCallback), this);

			//max voxel scale factor
			m_pMaxScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxScaleFactorSpinButton"));
			m_rVoxelDisplay.setMaxScaleFactor(m_f64MaxScaleFactor);
			gtk_spin_button_configure(
				m_pMaxScaleFactorSpinButton,
				GTK_ADJUSTMENT(gtk_adjustment_new(
					m_f64MaxScaleFactor, //initial value
					0, //lower
					5, //upper
					0.1, //step increment
					0.5, //page increment
					0)), //page size - deprecated
					0.1, //climb rate
					1); //digits
			g_signal_connect(G_OBJECT(m_pMaxScaleFactorSpinButton), "value-changed", G_CALLBACK(setMaxScaleFactorCallback), this);

			boolean l_bInclusiveDisplayThresholdBoundary = true;
			m_rVoxelDisplay.setDisplayThresholdBoundaryType(l_bInclusiveDisplayThresholdBoundary);

			//AND/OR label
			m_pThresholdRangeAndOrLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilderInterface, "ThresholdRangeAndOrLabel"));
			gtk_label_set_label(m_pThresholdRangeAndOrLabel, l_bInclusiveDisplayThresholdBoundary? "AND" : "OR");

			//min display threshold boundary type
			m_pMinDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdBoundaryButton"));
			gtk_button_set_label(m_pMinDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? ">" : "<");
			g_signal_connect(G_OBJECT(m_pMinDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMinDisplayThresholdBoundaryTypeCallback), this);

			//max display threshold boundary type
			m_pMaxDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdBoundaryButton"));
			gtk_button_set_label(m_pMaxDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? "<" : ">");
			g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMaxDisplayThresholdBoundaryTypeCallback), this);

			//min display threshold slider
			m_pMinDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01));
			m_rVoxelDisplay.setMinDisplayThreshold(m_f64MinDisplayThreshold);
			gtk_range_set_value(GTK_RANGE(m_pMinDisplayThresholdScale), m_f64MinDisplayThreshold);
			gtk_scale_set_value_pos(m_pMinDisplayThresholdScale, GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(m_pMinDisplayThresholdScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(GTK_WIDGET(m_pMinDisplayThresholdScale), 100, -1);
			gtk_widget_show_all(GTK_WIDGET(m_pMinDisplayThresholdScale));
			g_signal_connect(G_OBJECT(m_pMinDisplayThresholdScale), "value_changed", G_CALLBACK(setMinDisplayThresholdCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldMinScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdScale"));
			GtkWidget* l_pMinScaleParent = gtk_widget_get_parent(l_pOldMinScale);
			if(l_pMinScaleParent != NULL && GTK_IS_CONTAINER(l_pMinScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pMinScaleParent), l_pOldMinScale);
				if(GTK_IS_BOX(l_pMinScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), 1);
				}
			}

			//max display threshold slider
			m_pMaxDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01));
			m_rVoxelDisplay.setMaxDisplayThreshold(m_f64MaxDisplayThreshold);
			gtk_range_set_value(GTK_RANGE(m_pMaxDisplayThresholdScale), m_f64MaxDisplayThreshold);
			gtk_scale_set_value_pos(m_pMaxDisplayThresholdScale, GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(m_pMaxDisplayThresholdScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(GTK_WIDGET(m_pMaxDisplayThresholdScale), 100, -1);
			gtk_widget_show_all(GTK_WIDGET(m_pMaxDisplayThresholdScale));
			g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdScale), "value_changed", G_CALLBACK(setMaxDisplayThresholdCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldMaxScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdScale"));
			GtkWidget* l_pMaxScaleParent = gtk_widget_get_parent(l_pOldMaxScale);
			if(l_pMaxScaleParent != NULL && GTK_IS_CONTAINER(l_pMaxScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pMaxScaleParent), l_pOldMaxScale);
				if(GTK_IS_BOX(l_pMaxScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), 1);
				}
			}

			//skull opacity slider
			GtkWidget* l_pSkullOpacityScale = gtk_hscale_new_with_range(0.0, 1.0, 0.05);
			float64 l_f64SkullOpacity = 0.07;
			gtk_range_set_value(GTK_RANGE(l_pSkullOpacityScale), l_f64SkullOpacity);
			m_rVoxelDisplay.setSkullOpacity(l_f64SkullOpacity);
			gtk_scale_set_value_pos(GTK_SCALE(l_pSkullOpacityScale), GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(l_pSkullOpacityScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(l_pSkullOpacityScale, 100, -1);
			gtk_widget_show_all(l_pSkullOpacityScale);
			g_signal_connect(G_OBJECT(l_pSkullOpacityScale), "value_changed", G_CALLBACK(setSkullOpacityCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "SkullOpacityScale"));
			GtkWidget* l_pScaleParent = gtk_widget_get_parent(l_pOldScale);
			if(l_pScaleParent != NULL && GTK_IS_CONTAINER(l_pScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pScaleParent), l_pOldScale);
				if(GTK_IS_BOX(l_pScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, 0);
				}
			}

			//camera animation button
			GtkToggleToolButton* l_pAnimateCameraButton = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton"));
			g_signal_connect(G_OBJECT(l_pAnimateCameraButton), "toggled", G_CALLBACK(toggleAnimateCameraCallback), this);

			//reposition camera
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "RepositionCamera")),	"clicked", G_CALLBACK(repositionCameraCallback), this);

			this->toggleColorModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")))?true:false);
			this->toggleTransparencyModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")))?true:false);
			this->toggleSizeModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")))?true:false);
			this->enableAutoCameraMovementCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton")))?true:false);
		}
Exemplo n.º 22
0
Arquivo: main.c Projeto: HrTran/Dict
main (int argc, char *argv[])
{
	printf("\nHelpful Dictionary Program\n");

	btinit();
	sug = btopn("data/tudienanhviet.old", 0, 0);	

    GtkBuilder      *builder; 
    
    GError     *error = NULL;

    widget = g_slice_new(Widgets);
    
    gtk_init (&argc, &argv);
    

    //init btree, mo file .dat
    
    //tree = btopn("data/tudienanhviet.dat", 0, 0);	//file nay ko can mo nua
    

    //khoi tao builder va cac widget
    builder = gtk_builder_new ();
    gtk_builder_add_from_file (builder, "dict.glade", NULL);
    window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));

    aboutdialog = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog"));

    restore = GTK_WIDGET (gtk_builder_get_object (builder, "restore"));
    about = GTK_WIDGET (gtk_builder_get_object (builder, "about"));
	dev = GTK_WIDGET (gtk_builder_get_object (builder, "dev"));

	search = GTK_WIDGET (gtk_builder_get_object (builder, "search"));

	add = GTK_WIDGET (gtk_builder_get_object (builder, "add"));
	edit = GTK_WIDGET (gtk_builder_get_object (builder, "edit"));
	del = GTK_WIDGET (gtk_builder_get_object (builder, "del"));
    undo = GTK_WIDGET (gtk_builder_get_object (builder, "undo"));

    treeview=GTK_WIDGET (gtk_builder_get_object (builder, "treeview"));

    thongbao=GTK_WIDGET (gtk_builder_get_object (builder, "thongbao"));
	

	widget->searchentry = GTK_WIDGET( gtk_builder_get_object( builder, "searchentry" ) );
    widget->textview = GTK_WIDGET( gtk_builder_get_object( builder, "textview" ) );
    widget->foundlist = GTK_LIST_STORE( gtk_builder_get_object( builder, "foundlist" ) );
    widget->suggests = GTK_WIDGET( gtk_builder_get_object( builder, "suggests" ) );

    // buff=gtk_text_view_get_buffer(widget->textview);
    // g_signal_connect(G_OBJECT(buff) , "changed", G_CALLBACK(showUndo), (gpointer) window);

    //tao ket noi singal 
    gtk_builder_connect_signals (builder, widget);

    g_object_unref (G_OBJECT (builder));
        
    gtk_widget_show (window);   

    gtk_main ();
   
    btcls(tree);   
    btcls(sug);

    return 0;
}
Exemplo n.º 23
0
int
main (int argc, char *argv[])
{
        GtkBuilder              *builder;
        GtkWidget               *window, *window_paint, * fullscreen;
		  GtkWidget     			  *canvas, *canvas_screen;
        GdkGLConfig *gl_config;

	//we need to initialize all these functions so that gtk knows
	//to be thread-aware
	if (!g_thread_supported ()){ 
		g_thread_init(NULL); 
	}
	gdk_threads_init(); 
	gdk_threads_enter();


        gtk_init (&argc, &argv);

		  //opengl
//        gtk_gl_init (&argc, &argv);

//		  gl_config = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB | GDK_GL_MODE_ALPHA | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE);

        builder = gtk_builder_new ();
        gtk_builder_add_from_file (builder, "gui/settings.builder", NULL);

        window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
        canvas = GTK_WIDGET (gtk_builder_get_object (builder, "canvas"));
		  window_paint = GTK_WIDGET (gtk_builder_get_object (builder, "windowscreen"));
		  canvas_screen = GTK_WIDGET (gtk_builder_get_object (builder, "canvasscreen")); 

		  fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen"));
        gtk_builder_connect_signals (builder, NULL);          
        g_object_unref (G_OBJECT (builder));

	//signals for event
	g_signal_connect (G_OBJECT (canvas), "expose-event",
                G_CALLBACK (paints_video), NULL
                  );


	g_signal_connect (G_OBJECT (canvas_screen), "expose-event",
                G_CALLBACK (paints_anime), NULL
                  );

	g_signal_connect(G_OBJECT(window), "destroy", 
		G_CALLBACK(on_window_destroy), NULL
		);

   //g_signal_connect(G_OBJECT(window_paint), "expose_event", G_CALLBACK(on_window_expose_event), NULL);
   // g_signal_connect(G_OBJECT(window_paint), "configure_event", G_CALLBACK(on_window_configure_event), NULL);

	g_signal_connect(G_OBJECT(fullscreen), "clicked", 
		G_CALLBACK(click_fullcreen ), (gpointer) window_paint
		);

   gtk_widget_set_size_request(canvas_screen,500,500);

// opencv 
	CvCapture * capture = cvCaptureFromCAM(-1);      
   detec = new Detection(capture);

	//we can turn off gtk's automatic painting and double buffering routines.
	//gtk_widget_set_app_paintable(window_paint, TRUE);
	//gtk_widget_set_double_buffered(window_paint, FALSE);

	g_timeout_add(D_TIMER_ANIME, (GSourceFunc) timer_anime2, (gpointer) canvas_screen);
	g_timeout_add(D_TIMER_VIDEO, (GSourceFunc) timer_frame, (gpointer) canvas);

   gtk_widget_show (window_paint);   
   gtk_widget_show(window);
//	time_handler(window);    

	//pixmap = gdk_pixmap_new(window_paint->window,500,500,-1);

        gtk_main ();
	gdk_threads_leave();
        
        return 0;
}
Exemplo n.º 24
0
/* Create the ardesia bar window. */
GtkWidget *
create_bar_window (CommandLine *commandline,
                   GtkWidget   *parent)
{
  GtkWidget *bar_window = (GtkWidget *) NULL;
  BarData *bar_data = (BarData *) NULL;
  GError *error = (GError *) NULL;
  gchar *file = UI_FILE;
  gint x = 0;
  gint y = 0;
  gint width = 0;
  gint height = 0;


  /* Set up style for ardesia */
  gchar* gtkcss_file = get_xdg_config_file("ardesia/gtk.css");
  if (gtkcss_file)
    {
      GtkCssProvider *css = gtk_css_provider_new ();
      gtk_css_provider_load_from_path (css, gtkcss_file, NULL);
      g_free (gtkcss_file);
      gtk_style_context_add_provider_for_screen (gdk_screen_get_default(),
                                                 GTK_STYLE_PROVIDER(css),
                                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
    }
    
  bar_gtk_builder = gtk_builder_new ();

  if (commandline->position>2)
    {
      /* North or south. */
      file = UI_HOR_FILE;
    }
  else
    {

      /* East or west. */
      if (gdk_screen_height () < 720)
        {
          /* 
           * The bar is too long and then I use an horizontal layout;
           * this is done to have the full bar for net book and screen
           * with low vertical resolution.
           */
          file = UI_HOR_FILE;
          commandline->position=NORTH;
        }

    }


  /* Load the bar_gtk_builder file with the definition of the ardesia bar gui. */
  gtk_builder_add_from_file (bar_gtk_builder, file, &error);
  if (error)
    {
      g_warning ("Failed to load builder file: %s", error->message);
      g_error_free (error);
      g_object_unref (bar_gtk_builder);
      bar_gtk_builder = NULL;
      return bar_window;
    }

  bar_data = init_bar_data ();

  bar_window = GTK_WIDGET (gtk_builder_get_object (bar_gtk_builder, BAR_WIDGET_NAME));
  gtk_widget_set_name (bar_window, BAR_WIDGET_NAME);
    
  /* Connect all the callback from bar_gtk_builder xml file. */
  gtk_builder_connect_signals (bar_gtk_builder, (gpointer) bar_data);

  //gtk_window_set_transient_for (GTK_WINDOW (bar_window), GTK_WINDOW (parent));

  if (commandline->decorated)
    {
      gtk_window_set_decorated (GTK_WINDOW (bar_window), TRUE);
    }

  gtk_window_get_size (GTK_WINDOW (bar_window) , &width, &height);

  /* x and y will be the bar left corner coordinates. */
  calculate_initial_position (bar_window,
                              &x,
                              &y,
                              width,
                              height,
                              commandline->position);

  /* The position is calculated respect the top left corner
   * and then I set the north west gravity. 
   */
  gtk_window_set_gravity (GTK_WINDOW (bar_window), GDK_GRAVITY_NORTH_WEST);

  /* Move the window in the desired position. */
  gtk_window_move (GTK_WINDOW (bar_window), x, y);


  return bar_window;
}
Exemplo n.º 25
0
int main(int argc, char *argv[]) {
    GtkBuilder *builder;
    GString *txt = g_string_new_len("", 20);
    char filepad[100];
    unsigned short i, mask=0;
    GdkScreen* screen = NULL;
	int xx, yy, screen_width, screen_height;

	InitAudio();

	pad = get_real_path();					// get the path of the executable

	sprintf(filepad, "%s/.lock", pad);
	setlock(filepad, 10, TRUE);				// disable multiple instances for at least 10 seconds

	g_thread_init (NULL);

    display = XOpenDisplay(0);
    if (display == NULL)
        exit(1);

    gtk_set_locale();

    gtk_init(&argc, &argv);

    builder = gtk_builder_new ();

    sprintf(filepad, "%s/%s.glade", pad, SKIN);

    gtk_builder_add_from_file(builder, filepad, NULL);

    gtk_builder_connect_signals (builder, NULL);

    // set widgets to be handled by the event handlers
    window 			= GW ("window");
    preferences 	= GW ("preferences");
    lookup		 	= GW ("lookup");
    fontbutton 		= GW ("fontbutton1");
    drag 			= GW ("dragbar");
    debug 			= GW ("debug");
	papier 			= GW ("drawingarea1");
    colorbutton1 	= GW ("colorbutton1");
    colorbutton2 	= GW ("colorbutton2");
    checkbutton1	= GW ("checkbutton1");
    entry1 			= GW ("entry1");
    entry2 			= GW ("entry2");
    gtktable1 		= GW ("table1");
    checkbutton8	= GW ("checkbutton8");
    checkbutton9	= GW ("checkbutton9");
    textview1 		= GW ("textview1");
    entry16 		= GW ("entry16");
    combobox1 		= GW ("combobox1");
    scrolled		= GW ("scrolledwindow2");
    opacity 		= GTK_ADJUSTMENT (gtk_builder_get_object (builder, "adjustment1"));
    speed 			= GTK_ADJUSTMENT (gtk_builder_get_object (builder, "adjustment2"));
    textbuffer1		= GTK_TEXT_BUFFER(gtk_builder_get_object (builder, "textbuffer1"));

	for (i=0; i<sizeof(unsigned short); i++) {	// set each bit of mask
		mask <<= 8;
		mask |= 0xFF;
	}

	// fill the struct that keeps the 7 recognize buttons & checkboxes (in preferences)
    for (i=0; i<7; i++) {
    	g_string_sprintf(txt, "checkbutton%d", i+2);
		modebits[i].check = GTK_WIDGET(gtk_builder_get_object (builder, txt->str));
		g_string_sprintf(txt, "button%d", i+3);
		modebits[i].button = GTK_WIDGET(gtk_builder_get_object (builder, txt->str));
		switch (i) {
			case 0: modebits[i].bit = (GB1|GB2);	modebits[i].mask = ((GB1|GB2) ^ mask);	break;
			case 1: modebits[i].bit = BIG5;			modebits[i].mask = (BIG5 ^ mask);		break;
			case 2: modebits[i].bit = DIGITS;		modebits[i].mask = (DIGITS ^ mask);		break;
			case 3: modebits[i].bit = LOWERCASE;	modebits[i].mask = (LOWERCASE ^ mask);	break;
			case 4: modebits[i].bit = UPPERCASE;	modebits[i].mask = (UPPERCASE ^ mask);	break;
			case 5: modebits[i].bit = PUNC;			modebits[i].mask = (PUNC ^ mask);		break;
			case 6: modebits[i].bit = DEFAULT;		modebits[i].mask = (DEFAULT ^ mask);	break;
		}
	}

	// fill the structure that keeps the 13 labels for the keys (preferences)
    for (i=0; i<13; i++) {
    	g_string_sprintf(txt, "button%d", i+10);
		conf.defkey[i].button = GTK_WIDGET(gtk_builder_get_object (builder, txt->str));
    	g_string_sprintf(txt, "entry%d", i+3);
		conf.defkey[i].entry = GTK_WIDGET(gtk_builder_get_object (builder, txt->str));
		conf.defkey[i].key = 0;
    }

    // place a simple combobox for the input selection (preferences)
    combo = gtk_combo_box_new_text();
    gtk_table_attach_defaults(GTK_TABLE(gtktable1), combo, 1, 2, 2, 3);
    gtk_widget_show (combo);

    // get events and labels for the 9 candidates
    for (int i=0; i< 9; i++) {
        g_string_sprintf(txt, "knop%d", i+1);
        knop[i] = GTK_WIDGET (gtk_builder_get_object (builder, txt->str));
        g_string_sprintf(txt, "event%d", i+1);
        event[i] = GTK_WIDGET (gtk_builder_get_object (builder, txt->str));
    }

    // set events for paste and backspace entries (preferences)
    g_signal_connect(entry1, "key_press_event", G_CALLBACK(on_key_press), NULL);
    g_signal_connect(entry1, "key_release_event", G_CALLBACK(on_key_release), NULL);
    g_signal_connect(entry2, "key_press_event", G_CALLBACK(on_key_press), NULL);
    g_signal_connect(entry2, "key_release_event", G_CALLBACK(on_key_release), NULL);

    if (!create_wtpen_window())
        exit(1);

    wtpen_init();

	g_object_unref (G_OBJECT (builder));

    gtk_widget_show_all(GTK_WIDGET(window));

	for (i=0; i<NUMKEYS; i++)	hotkey[i] = 0;	// reset all hotkeys

    // load cedict from file
    sprintf(filepad, "%s/data", pad);
    import_cedict(filepad);

    // load settings from file
    sprintf(filepad, "%s/xpen.cfg", pad);
    load_preferences(filepad);

    // set background and shape
    sprintf(filepad, "%s/%s.png", pad, SKIN);
    set_window_shape(filepad);

	// some styles to be used in the cedict browser (lookup window)一
	gtk_text_buffer_create_tag(textbuffer1, "mark", "background", "yellow", "foreground", "black", NULL);
	gtk_text_buffer_create_tag(textbuffer1, "bold", "weight", PANGO_WEIGHT_BOLD, NULL);
	gtk_text_buffer_create_tag(textbuffer1, "character", "font", conf.font, "scale", 1.3, NULL);
	gtk_text_buffer_create_tag(textbuffer1, "translation", "scale", 0.9, NULL);
	gtk_text_buffer_create_tag(textbuffer1, "pinyin", "scale", 1.1, NULL);

    ready = TRUE;	// let_configure_event() know that it can start its setup

	// start monitoring system-wide keypresses
	g_thread_create (intercept_key_thread, NULL, FALSE, NULL);

	// make sure the window positions and size are legal
	screen = gtk_window_get_screen(GTK_WINDOW(window));		// get screen size
	screen_width = gdk_screen_get_width(screen);
	screen_height = gdk_screen_get_height(screen);

    xx = MAX(MIN(screen_width-width, conf.x), 0);			// set the position of the main window
    yy = MAX(MIN(screen_height-height, conf.y), 0);
	gtk_widget_set_uposition(window, xx, yy);

    xx = MIN(screen_width, conf.dx);						// set the size of the lookup window
    yy = MIN(screen_height, conf.dy);
	gtk_widget_set_usize(lookup, xx, yy);

	xx = MAX(MIN(screen_width-conf.dx, conf.lx), 0);		// set the position of the lookup window
	yy = MAX(MIN(screen_height-conf.dy, conf.ly), 0);
	gtk_widget_set_uposition(lookup, xx, yy);

	g_timeout_add (100, checkfocus, NULL);	// check the inputfocus (each 1/10s)

//////////////////////////////////////////////////////////////
//on_full_screen_button_pressed();	// start the full screen mode
//////////////////////////////////////////////////////////////

    gtk_main();						// start the main loop

	sprintf(filepad, "%s/.lock", pad);		// remove the lock
	setlock(filepad, 0, FALSE);

	// save all settings to file
    sprintf(filepad, "%s/xpen.cfg", pad);
	save_preferences (filepad);

    g_free(pad);
	free_all();

    wtpen_window_done();
    wtlib_done();

    SDL_CloseAudio();
    SDL_Quit();

//on_full_screen_button_pressed();

    return 0;
}
Exemplo n.º 26
0
static GtkWidget*
create_test2_window (void)
{
	GtkWidget *window;
	GtkImage *imageClient, *imageWellth, *imageTest, *imageBG;
	GtkWidget *timer_label;
		
	GError** error = NULL;
	

	/* Load UI from file */

	/* Auto-connect signal handlers */
	gtk_builder_connect_signals (Test2Builder, NULL);

	/* Get the window object from the ui file */
	window = GTK_WIDGET (gtk_builder_get_object (Test2Builder, TEST2_WINDOW));
        if (!window)
        {
                g_critical ("Widget \"%s\" is missing in file %s.",
				TEST2_WINDOW,
				TEST2_UI_FILE);
        }

	GdkPixbufAnimation * pixbufclntanm = gdk_pixbuf_animation_new_from_file(CLIENT_LOGO, error);
	GdkPixbufAnimation * pixbufwlthanm = gdk_pixbuf_animation_new_from_file(WELLTH_LOGO, error);
	imageClient = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2Builder, "clnt_logo"));
	imageWellth = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2Builder, "wellth_logo"));
	gtk_image_set_from_animation(GTK_IMAGE(imageClient), pixbufclntanm);
	gtk_image_set_from_animation (GTK_IMAGE(imageWellth), pixbufwlthanm);

	//GdkPixbufAnimation * pixbufBGanm = gdk_pixbuf_animation_new_from_file(BG, error);
	imageBG = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2Builder, "image1"));
	gtk_image_set_from_animation(GTK_IMAGE(imageBG), pixbufBGanm);

	GdkPixbufAnimation * pixbufTestanm = gdk_pixbuf_animation_new_from_file(TEST2, error);
	imageTest = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2Builder, "image2"));
	gtk_image_set_from_animation(GTK_IMAGE(imageTest), pixbufTestanm);

	GdkPixbufAnimation * pixbufaddanm = gdk_pixbuf_animation_new_from_file(ADDS2, error);
	GtkImage *adds = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2Builder, "adds"));
	gtk_image_set_from_animation(GTK_IMAGE(adds), pixbufaddanm);

	//GdkPixbufAnimation * pixbuf1 = gdk_pixbuf_animation_new_from_file(GRAPH, error);
	//GtkImage * grf = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2Builder, "graph"));
	//gtk_image_set_from_animation(GTK_IMAGE(grf), pixbuf1);
	
	
	button1 = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "exit"));
 	 g_signal_connect (G_OBJECT (button1), "clicked",
                    G_CALLBACK (test_exit_btnclicked),
                    NULL);

	profileBtnClickedFrom = test2_pro_btn;
	button2 = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "profile"));
 	 g_signal_connect (G_OBJECT (button2), "clicked",
                    G_CALLBACK (test_profile_btnclicked),
                    profileBtnClickedFrom);
	bodyFatLabel = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "label5"));
	//test2_msg = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "label7"));
	
	button3 = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "click_to_measure"));

	button4 = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "repeate"));
		g_signal_connect (G_OBJECT (button4), "clicked",
                    G_CALLBACK (test2_click_to_measure_btnclicked),
                    NULL);
	
	timer_label = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "timer_label"));
 	 g_signal_connect (G_OBJECT (button3), "clicked",
                    G_CALLBACK (test2_click_to_measure_btnclicked),
                    NULL);
	//g_object_set_property (G_OBJECT(button3), "label", "Repeate");
	continue_timer = TRUE;
    start_timer = TRUE;

	//g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(_start_timer), timer_label);
	//g_signal_connect(G_OBJECT(button31), "clicked", G_CALLBACK(_start_timer), timer_label);
	/*
	button4 = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "set"));
 	 g_signal_connect (G_OBJECT (button4), "clicked",
                    G_CALLBACK (test2_set_btnclicked),
                    NULL);
*/
	button5 = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "next"));
 	 g_signal_connect (G_OBJECT (button5), "clicked",
                    G_CALLBACK (test2_next_btnclicked),
                    NULL);
	
	priv = g_malloc (sizeof (struct _Private));
	/* ANJUTA: Widgets initialization for WindowMain.ui - DO NOT REMOVE */

	//g_object_unref (InitialBuilder);
	
	return window;
}
Exemplo n.º 27
0
Arquivo: main.c Projeto: Cmarone/xlook
int main(
	int argc, 
	char *argv[])
{
	int exit_code= 0;
	
	initialize_globals();
	if(initialize(argc, argv))
	{
		GtkBuilder *builder;
		GError *error= NULL;
		
		gtk_init (&argc, &argv);

		builder = gtk_builder_new ();
#ifdef STATIC_UI
		if(!gtk_builder_add_from_string(builder,  xlook_glade_data, -1, &error))
		{
			if (error != NULL)
			{
				/* Report error to user, and free error */
				fprintf (stderr, "Unable to add from string: %s\n", error->message);
				g_error_free (error);
			}
		}
#else
		gtk_builder_add_from_file (builder, "xlook.glade", NULL);
#endif
		// load the rest of them...
		ui_globals.main_window = (struct GtkWidget *)(gtk_builder_get_object (builder, "mainWindow"));
		ui_globals.command_history = (struct GtkWidget *)(gtk_builder_get_object (builder, "commandWindow"));


		// set the font.
		PangoFontDescription *desc= pango_font_description_from_string("Monospace 9");
		char *names[]= { "textview_FileInfo", "textview_Message"};
		int ii;
		for(ii= 0; ii<ARRAY_SIZE(names); ii++)
		{
			GtkWidget *w = (struct GtkWidget *)(gtk_builder_get_object (builder, names[ii]));
			gtk_widget_modify_font(w, desc);
		}

		setup_command_window(GTK_WINDOW(ui_globals.command_history));

		gtk_builder_connect_signals (builder, NULL);          
		g_object_unref (G_OBJECT (builder));

		// set the messages appropriately
		display_active_window(0);
		display_active_plot(0);
		display_active_file(0);

		gtk_widget_show(GTK_WIDGET(ui_globals.main_window));       
		
		// set the font..
//		GtkWidget *fileInfo= lookup_widget_by_name(ui_globals.main_window, "textview_FileInfo");
//		gtk_widget_modify_font(fileinfo, PangoFontDescription *font_desc);
		
		
		
		// open if we should from command line.
		if(strlen(delayed_file_to_open))
		{
			handle_open_filepath(delayed_file_to_open);
		}

		gtk_main ();
		exit_code= 0;
	} else {
		exit_code= -1;
	}
	
	return exit_code;
}
Exemplo n.º 28
0
static GtkWidget*
create_test2_b_window (void)
{
	GtkWidget *window; 
	GtkImage *imageClient, *imageWellth, *imageTest, *imageBG, *add;
	GtkWidget *timer_label;

	GtkWidget *vbox1;
	GError** error = NULL;
	int i=0;
	char buf[8];
	

	/* Load UI from file */

	/* Auto-connect signal handlers */
	gtk_builder_connect_signals (Test2bBuilder, NULL);

	/* Get the window object from the ui file */
	window = GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, TEST2_b_WINDOW));
        if (!window)
        {
                g_critical ("Widget \"%s\" is missing in file %s.",
				TEST2_b_WINDOW,
				TEST2B_UI_FILE);
        }
/*
	GdkPixbufAnimation * pixbufclntanm = gdk_pixbuf_animation_new_from_file(CLIENT_LOGO, error);
	GdkPixbufAnimation * pixbufwlthanm = gdk_pixbuf_animation_new_from_file(WELLTH_LOGO, error);
	imageClient = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test1Builder, "clnt_logo"));
	imageWellth = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test1Builder, "wellth_logo"));
	gtk_image_set_from_animation(GTK_IMAGE(imageClient), pixbufclntanm);
	gtk_image_set_from_animation (GTK_IMAGE(imageWellth), pixbufwlthanm);
*/
//	GdkPixbufAnimation * pixbufBGanm = gdk_pixbuf_animation_new_from_file(BG, error);
	imageBG = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "image1"));
	gtk_image_set_from_animation(GTK_IMAGE(imageBG), pixbufBGanm);
/*
	GdkPixbufAnimation * pixbufTestanm = gdk_pixbuf_animation_new_from_file(TEST1, error);
	imageTest = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "image2"));
	gtk_image_set_from_animation(GTK_IMAGE(imageTest), pixbufTestanm);
*/
	
	GdkPixbufAnimation * pixbufaddanm = gdk_pixbuf_animation_new_from_file(ADDS2, error);
	add = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "adds"));
	gtk_image_set_from_animation(GTK_IMAGE(add), pixbufaddanm);
	
//#endif
	
	//GdkPixbufAnimation * pixbuf1 = gdk_pixbuf_animation_new_from_file(GRAPH, error);
	//GtkImage * grf = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test1Builder, "graph"));
	//gtk_image_set_from_animation(GTK_IMAGE(grf), pixbuf1);
	
	/*GdkPixbufAnimation * pixbuf2 = gdk_pixbuf_animation_new_from_file(T1_NEXT_ICON, error);
	GtkImage * nxt_icon = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "next_icon"));
	gtk_image_set_from_animation(GTK_IMAGE(nxt_icon), pixbuf2);
	*/
		GdkPixbufAnimation * pixbuf2 = gdk_pixbuf_animation_new_from_file(T2_NEXT_ICON, error);
	GtkImage * nxt_icon = (GtkImage *) GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "next_icon"));
	gtk_image_set_from_animation(GTK_IMAGE(nxt_icon), pixbuf2);
	
	button1 = GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "exit"));
 	 g_signal_connect (G_OBJECT (button1), "clicked",
                    G_CALLBACK (test_exit_btnclicked),
                    NULL);

	home_button = GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "home"));
 	 g_signal_connect (G_OBJECT (home_button), "clicked",
                    G_CALLBACK (test_home_btnclicked),
                    NULL);
	
	button5 = GTK_WIDGET (gtk_builder_get_object (Test2bBuilder, "next"));
 	 g_signal_connect (G_OBJECT (button5), "clicked",
                    G_CALLBACK (test2_b_next_btnclicked),
                    NULL);

	
	
	priv = g_malloc (sizeof (struct _Private));
	/* ANJUTA: Widgets initialization for WindowMain.ui - DO NOT REMOVE */

	//g_object_unref (InitialBuilder);
	
	return window;
}
Exemplo n.º 29
0
void GtkGui::setUpGTK()
{
	GdkGLConfig *glconfig;
	GtkBuilder  *builder;
	GError      *error = NULL;

	gtk_init(0, NULL);
	gtk_gl_init(0, NULL);

	//Try double-buffered visual
	glconfig = gdk_gl_config_new_by_mode (static_cast<GdkGLConfigMode> (GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE));

	if (glconfig == NULL)
	{
		g_print ("*** Cannot find the double-buffered visual.\n");
		g_print ("*** Trying single-buffered visual.\n");

		// Try single-buffered visual
		glconfig = gdk_gl_config_new_by_mode (static_cast<GdkGLConfigMode> (GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH));

		if (glconfig == NULL)
			g_print ("*** No appropriate OpenGL-capable visual found.\n");
	}

	// Create new GtkBuilder object
	builder = gtk_builder_new();
	if( ! gtk_builder_add_from_file(builder, "../../carmen/data/gui/laslam.glade", &error ) )
	{
		g_warning( "%s", error->message );
		g_free( error );
	}

	controls_.winMain  = GTK_WIDGET(gtk_builder_get_object(builder, "winMain" ));
	controls_.drawArea = GTK_WIDGET(gtk_builder_get_object(builder, "drawArea"));

	controls_.btnDrawRobot = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnDrawRobot"));
	controls_.btnDrawVisualOdometryPath = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnDrawVisualOdometry"));
	controls_.btnDrawCorrectedPath = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnDrawCorrectedPath"));
	controls_.btnDrawLandmarkPoints = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnDrawLandmarks"));
	controls_.btnDrawDistanceInformation = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnDrawDistanceInformation"));
	controls_.btnDrawParticles = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "btnDrawParticles"));

	controls_.rdbStaticCamera = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "rdbStaticCamera"));
	controls_.rdbFollowCamera = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "rdbFollowCamera"));
	controls_.rdbDriverCamera = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "rdbDriverCamera"));

	controls_.frameCamera         = GTK_WIDGET(gtk_builder_get_object(builder, "frameCamera"));
	controls_.frame3DMapOptions   = GTK_WIDGET(gtk_builder_get_object(builder, "frame3DMapOptions"));
	controls_.frame3DOtherOptions = GTK_WIDGET(gtk_builder_get_object(builder, "frame3DOtherOptions"));

	controls_.txtCamPosX = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamPosX"));
	controls_.txtCamPosY = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamPosY"));
	controls_.txtCamPosZ = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamPosZ"));

	controls_.txtCamLookX = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamLookX"));
	controls_.txtCamLookY = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamLookY"));
	controls_.txtCamLookZ = GTK_ENTRY(gtk_builder_get_object(builder, "txtCamLookZ"));

	controls_.lblX = GTK_LABEL(gtk_builder_get_object(builder, "lblX"));
	controls_.lblY = GTK_LABEL(gtk_builder_get_object(builder, "lblY"));
	controls_.lblZ = GTK_LABEL(gtk_builder_get_object(builder, "lblZ"));
	controls_.lblYaw = GTK_LABEL(gtk_builder_get_object(builder, "lblYaw"));
	controls_.lblPitch = GTK_LABEL(gtk_builder_get_object(builder, "lblPitch"));
	controls_.lblRoll = GTK_LABEL(gtk_builder_get_object(builder, "lblRoll"));

	// Connect signals
	gtk_builder_connect_signals(builder, this);

	// Redraws
	gtk_container_set_reallocate_redraws (GTK_CONTAINER(controls_.winMain), TRUE);

	// Add OpenGL-capability to drawArea.
	if(!gtk_widget_set_gl_capability (controls_.drawArea, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE))
		return;

	// Register idle function
	g_idle_add (on_drawArea_idle, this);

	// Destroy builder, since we don't need it anymore
	g_object_unref( G_OBJECT( builder ) );

	// Show window. All other widgets are automatically shown by GtkBuilder
	gtk_widget_show(controls_.winMain);
}
gtk_gui::gtk_gui(const char* title, const char* initfile)
:
	m_programfilename(NULL),
	m_smilfilename(NULL),
	m_settings(NULL),
	m_toplevelcontainer(NULL),
	m_guicontainer(NULL),
	m_documentcontainer(NULL),
#if  GTK_MAJOR_VERSION >= 3
	m_play(NULL),
	m_pause(NULL),
	m_stop(NULL),
	m_reload(NULL),
#else // GTK_MAJOR_VERSION < 3
	menubar(NULL),
	m_actions(NULL),
#endif // GTK_MAJOR_VERSION < 3
#ifdef	LOCK_MESSAGE
	m_gui_thread(0),
#endif/*LOCK_MESSAGE*/
	m_file_chooser(NULL),
	m_settings_chooser(NULL),
	m_url_text_entry(NULL),
	m_mainloop(NULL)
{

	GError *error = NULL;

	// Initialization of the Menu Bar Items
	// There is a problem in here because the callbacks in Actions go like g_signal_connect (but, we need g_sginal_connect_swapped)
#if  GTK_MAJOR_VERSION >= 3
#else // GTK_MAJOR_VERSION < 3
	static GtkActionEntry entries[] = {
	{ "FileMenu", NULL, gettext_noop("_File")},
	{ "open", GTK_STOCK_OPEN, gettext_noop("_Open..."),
		"<Control>O", gettext_noop("Open a document from local disk"), NULL},
	{ "openurl", NULL, gettext_noop("Open _URL..."),
		"<Control>L", gettext_noop("Open a document from the network"), NULL},
	{ "reload", GTK_STOCK_REFRESH, gettext_noop("_Reload"),
		NULL, gettext_noop("Reload current document"), NULL},
	{ "preferences", GTK_STOCK_PREFERENCES , gettext_noop("_Preferences"),
		NULL, gettext_noop("Change application preferences"), NULL},
	{ "loadsettings", GTK_STOCK_PROPERTIES, gettext_noop("_Load Settings..."),
		NULL, gettext_noop("Open SMIL playback settings document"), NULL},
	{ "quit", GTK_STOCK_QUIT, gettext_noop("_Quit"),
		"<Control>Q", gettext_noop("Quit Ambulant Player"), NULL},

	// Play Menu
	{ "PlayMenu", NULL, gettext_noop("Pla_y")},
	{ "play", GTK_STOCK_MEDIA_PLAY, gettext_noop("Pla_y"),
		"<Control>P", gettext_noop("Start document playback"), NULL},
	{ "pause", GTK_STOCK_MEDIA_PAUSE, gettext_noop("_Pause"),
		"<Control><Shift>P", gettext_noop("Pause document playback"), NULL},
	{ "stop", GTK_STOCK_MEDIA_STOP, gettext_noop("_Stop"),
		"<Control>S", gettext_noop("Stop document playback"), NULL},
	// View Menu
	{ "ViewMenu", NULL, gettext_noop("_View")},
	{ "fullscreen", NULL, gettext_noop("_Full Screen"),
		"<Control>F", gettext_noop("Full Screen"), NULL},
	{ "window", NULL, gettext_noop("_Window"),
		"<Control><Alt>F", gettext_noop("Normal Screen"), NULL},
	{ "logwindow", NULL, gettext_noop("_Log Window..."),
		"<Control>L", gettext_noop("Show status output window"), NULL},
	// Help Menu
	{ "HelpMenu", NULL, gettext_noop("_Help")},
	{ "about", GTK_STOCK_ABOUT, gettext_noop("_About AmbulantPlayer"),
		NULL, gettext_noop("Information about Ambulant"), NULL},
	{ "help", GTK_STOCK_HELP, gettext_noop("AmbulantPlayer _Help..."),
		NULL, gettext_noop("Help in AmbulantPlayer Webpage"), NULL},
	{ "website", NULL, gettext_noop("AmbulantPlayer _Website..."),
		NULL, gettext_noop("Open the Ambulant Webpage"), NULL},
	{ "welcome", GTK_STOCK_HOME, gettext_noop("_Play Welcome Document"),
		"<Control><shift>H", gettext_noop("Plays a simple SMIL file"), NULL}
	};
	int n_entries = G_N_ELEMENTS(entries);
#endif  // GTK_MAJOR_VERSION < 3

	m_programfilename = title;
#ifdef	LOCK_MESSAGE
	pthread_cond_init(&m_cond_message, NULL);
	pthread_mutex_init(&m_lock_message, NULL);
	m_gui_thread = pthread_self();
#endif/*LOCK_MESSAGE*/
	// If the URL starts with "ambulant:" this is the trick-uri-scheme to
	// open URLs in Ambulant from the browser. Remove the trick.
	if (strncmp(initfile, "ambulant:", 9) == 0)
		initfile += 9;
	if (initfile != NULL && initfile != "")
		m_smilfilename = strdup(initfile);

	/*Initialization of the Main Window */
#if GTK_MAJOR_VERSION >= 3
#else // GTK_MAJOR_VERSION < 3
	m_toplevelcontainer = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
	gtk_window_set_title(m_toplevelcontainer, initfile);
	gtk_window_set_resizable(m_toplevelcontainer, true);
//	gtk_widget_set_size_request(GTK_WIDGET (m_toplevelcontainer), 200, 150);
//	gtk_widget_set_uposition(GTK_WIDGET (m_toplevelcontainer), 240, 320);	deprecated
	gtk_window_set_position(GTK_WINDOW (m_toplevelcontainer), GTK_WIN_POS_MOUSE);

	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "delete-event", G_CALLBACK (gtk_C_callback_quit), (void *) this);
	// Callback for the resize events
//	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "draw", G_CALLBACK (gtk_C_callback_resize), (void *) this);
	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "expose-event", G_CALLBACK (gtk_C_callback_resize), (void *) this);
#endif  // GTK_MAJOR_VERSION < 3

	/* Initialization of the signals */
#if GTK_MAJOR_VERSION >= 3
	signal_player_done_id = g_signal_new ("signal-player-done", gtk_window_get_type(), G_SIGNAL_RUN_LAST, 0, 0, 0, 0, G_TYPE_NONE, 0, NULL);

	signal_need_redraw_id = g_signal_new ("signal-need-redraw", gtk_window_get_type(), G_SIGNAL_RUN_LAST, 0, 0, 0, 0, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);

	signal_internal_message_id = g_signal_new ("signal-internal-message", gtk_window_get_type(), G_SIGNAL_RUN_LAST, 0, 0, 0, 0, G_TYPE_NONE, 1, G_TYPE_POINTER);
#else // GTK_MAJOR_VERSION < 3
	signal_player_done_id = g_signal_new ("signal-player-done", gtk_window_get_type(), G_SIGNAL_RUN_LAST, 0, 0, 0, g_cclosure_marshal_VOID__VOID,GTK_TYPE_NONE, 0, NULL);

	signal_need_redraw_id = g_signal_new ("signal-need-redraw", gtk_window_get_type(), G_SIGNAL_RUN_LAST, 0, 0, 0, gtk_marshal_NONE__POINTER_POINTER_POINTER,GTK_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);

	signal_internal_message_id = g_signal_new ("signal-internal-message", gtk_window_get_type(), G_SIGNAL_RUN_LAST, 0, 0, 0, 0, G_TYPE_NONE, 1, G_TYPE_POINTER);

	// Signal connections
	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "signal-player-done",  G_CALLBACK (gtk_C_callback_do_player_done), (void*)this);

	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "signal-need-redraw",  G_CALLBACK (gtk_C_callback_do_player_done), (void*)this);

	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "signal-internal-message", G_CALLBACK (gtk_C_callback_do_internal_message), (void*)this);

	/* VBox (m_guicontainer) to place the Menu bar in the correct place */
	m_guicontainer = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(m_toplevelcontainer), GTK_WIDGET (m_guicontainer));
#endif // GTK_MAJOR_VERSION < 3

#if GTK_MAJOR_VERSION >= 3
	GtkBuilder* builder = gtk_builder_new ();
	// The layout of the GUI is made using 'glade'
        gtk_builder_add_from_file (builder, AMBULANT_DATADIR "/ambulant-gtk_gui.xml", NULL);
       
	m_toplevelcontainer = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
        gtk_builder_connect_signals (builder, NULL);          
	// The remove window button
	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "delete-event", G_CALLBACK (gtk_C_callback_quit), (void *) this);
	// The actual activation calls for selected menu items, as found by name in the processed .xml file
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "open_menu_item")), "activate", G_CALLBACK (gtk_C_callback_open), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "url_menu_item")), "activate", G_CALLBACK (gtk_C_callback_open_url), (void *) this );
	g_signal_connect_swapped ((GObject*)(m_reload = gtk_builder_find_menu_item(builder, "reload_menu_item")), "activate", G_CALLBACK (gtk_C_callback_reload), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "preferences_menu_item")), "activate", G_CALLBACK (gtk_C_callback_settings_select), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "settings_menu_item")), "activate", G_CALLBACK (gtk_C_callback_load_settings), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "quit_menu_item")), "activate", G_CALLBACK (gtk_C_callback_quit), (void *) this );
	g_signal_connect_swapped ((GObject*)(m_play = gtk_builder_find_menu_item(builder, "play_menu_item")), "activate", G_CALLBACK (gtk_C_callback_play), (void *) this );
	g_signal_connect_swapped ((GObject*)(m_pause = gtk_builder_find_menu_item(builder, "pause_menu_item")), "activate", G_CALLBACK (gtk_C_callback_pause), (void *) this );
	g_signal_connect_swapped ((GObject*)(m_stop = gtk_builder_find_menu_item(builder, "stop_menu_item")), "activate", G_CALLBACK (gtk_C_callback_stop), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "fullscreen_menu_item")), "activate", G_CALLBACK (gtk_C_callback_full_screen), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "normalscreen_menu_item")), "activate", G_CALLBACK (gtk_C_callback_normal_screen), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "logger_window_menu_item")), "activate", G_CALLBACK (gtk_C_callback_logger_window), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "about_menu_item")), "activate", G_CALLBACK (gtk_C_callback_about), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "help_menu_item")), "activate", G_CALLBACK (gtk_C_callback_help), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "homepage_menu_item")), "activate", G_CALLBACK (gtk_C_callback_homepage), (void *) this );
	g_signal_connect_swapped (G_OBJECT (gtk_builder_find_menu_item(builder, "play_welcome_menu_item")), "activate", G_CALLBACK (gtk_C_callback_welcome), (void *) this );
	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "signal-player-done",  G_CALLBACK (gtk_C_callback_do_player_done), (void*)this);
	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "signal-need-redraw",  G_CALLBACK (gtk_C_callback_do_player_done), (void*)this);
	g_signal_connect_swapped (G_OBJECT (m_toplevelcontainer), "signal-internal-message", G_CALLBACK (gtk_C_callback_do_internal_message), (void*)this);
        
        gtk_widget_show (m_toplevelcontainer);       
	/* VBox (m_guicontainer) to place the Menu bar in the correct place */
	m_guicontainer = gtk_builder_find_menu_item (builder, "topbox");
        g_object_unref (G_OBJECT (builder));
	gtk_box_set_homogeneous ((GtkBox*) m_guicontainer, false);
#else // GTK_MAJOR_VERSION < 3
	/* The Action Group that includes the menu bar */
	m_actions = gtk_action_group_new("Actions");
	gtk_action_group_set_translation_domain(m_actions, PACKAGE);
	gtk_action_group_add_actions(m_actions, entries, n_entries, (void*)this);

	/* The Gtk UI Manager */
	GtkUIManager *ui = gtk_ui_manager_new();

	if (!gtk_ui_manager_add_ui_from_string(ui, ui_description, -1, &error))
		g_error("Could not merge UI, error was: %s\n", error->message);
	gtk_ui_manager_insert_action_group(ui, m_actions, 0);
	gtk_window_add_accel_group(m_toplevelcontainer, gtk_ui_manager_get_accel_group(ui));

	// The actual activation calls
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "open"), "activate",	G_CALLBACK (gtk_C_callback_open), (void *) this );
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "openurl"), "activate",  G_CALLBACK (gtk_C_callback_open_url), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "reload"), "activate",  G_CALLBACK (gtk_C_callback_reload), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "preferences"), "activate",  G_CALLBACK (gtk_C_callback_settings_select), (void *) this );
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "loadsettings"), "activate",	G_CALLBACK (gtk_C_callback_load_settings), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "quit"), "activate",	G_CALLBACK (gtk_C_callback_quit), (void*)this);

	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "play"), "activate",	G_CALLBACK (gtk_C_callback_play), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "pause"), "activate",	 G_CALLBACK (gtk_C_callback_pause), (void*)this );
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "stop"), "activate",	G_CALLBACK (gtk_C_callback_stop), (void*)this);

	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "fullscreen"), "activate",  G_CALLBACK (gtk_C_callback_full_screen), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "window"), "activate",  G_CALLBACK (gtk_C_callback_normal_screen), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "logwindow"), "activate",	 G_CALLBACK (gtk_C_callback_logger_window), (void*)this);

	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "about"), "activate",	 G_CALLBACK (gtk_C_callback_about), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "help"), "activate",	G_CALLBACK (gtk_C_callback_help), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "website"), "activate",  G_CALLBACK (gtk_C_callback_homepage), (void*)this);
	g_signal_connect_swapped (gtk_action_group_get_action (m_actions, "welcome"), "activate",  G_CALLBACK (gtk_C_callback_welcome), (void*)this);


	/* Creation of the Menubar and Menu Items */
	menubar = gtk_ui_manager_get_widget (ui, "/MenuBar");
	gtk_box_pack_start (GTK_BOX (m_guicontainer), menubar, FALSE, FALSE, 0);
	gtk_widget_show_all(GTK_WIDGET (m_toplevelcontainer));
#endif // GTK_MAJOR_VERSION < 3

	/* Creation of the document area */
	m_documentcontainer = gtk_drawing_area_new();
	gtk_widget_hide(m_documentcontainer);
	gtk_box_pack_start (GTK_BOX (m_guicontainer), m_documentcontainer, TRUE, TRUE, 0);

#if GTK_MAJOR_VERSION >= 3
	_update_menus();
#else // GTK_MAJOR_VERSION < 3
	// creates the main loop
	main_loop = g_main_loop_new(NULL, FALSE);
	_update_menus();
#endif // GTK_MAJOR_VERSION < 3
}