/*! \brief Register some libgeda directories with Scheme. * \par Function Description * Ensures that the gEDA Scheme directories are added to the Guile * load path. */ void g_register_libgeda_dirs (void) { const gchar * const *sys_dirs = eda_get_system_data_dirs(); for (gint i = 0; sys_dirs[i]; ++i) { g_register_scheme_data_dir (sys_dirs[i]); } g_register_scheme_data_dir (eda_get_user_data_dir()); }
/*! \brief Create and attach the menu bar * * Create the menu bar and attach it to the main window. * * First, the GtkActionGroup object is created and filled with * entries of type GtkActionEntry (each entry specifies a single * action, such as opening a file). Then the GtkUIManager object * is created and used to load menus.xml file with the menu * description. Finally, the GtkAccelGroup is added to the * main window to enable keyboard accelerators and a pointer * to the menu bar is retrieved from the GtkUIManager object. * \param window Window to add the menubar to * \param [out] menubar Created menubar */ static void x_window_create_menu(GtkWindow *window, GtkWidget **menubar) { GtkUIManager *ui; GtkActionGroup *action_group; GError *error = NULL; /* Create and fill the action group object */ action_group = gtk_action_group_new(""); gtk_action_group_add_actions(action_group, actions, G_N_ELEMENTS(actions), NULL); /* Create the UI manager object */ ui = gtk_ui_manager_new(); gtk_ui_manager_insert_action_group(ui, action_group, 0); /* Load the menu path from the system data path */ gchar *menu_file = NULL; const gchar * const *sys_dirs = eda_get_system_data_dirs(); for (gint i = 0; sys_dirs[i]; ++i) { if (menu_file) { g_free(menu_file); menu_file = NULL; } menu_file = g_build_filename(sys_dirs[i], "gattrib-menus.xml", NULL); if (g_file_test(menu_file, G_FILE_TEST_IS_REGULAR)) { break; } } gtk_ui_manager_add_ui_from_file(ui, menu_file, &error); if(error != NULL) { /* An error occured, terminate */ fprintf(stderr, _("Error loading %1$s:\n%2$s\n"), menu_file, error->message); exit(1); } g_free(menu_file); gtk_window_add_accel_group (window, gtk_ui_manager_get_accel_group(ui)); *menubar = gtk_ui_manager_get_widget(ui, "/ui/menubar/"); }