int clip_GTK_ACCELMAPSAVEFD(ClipMachine * ClipMachineMemory) { gint fd = _clip_parni(ClipMachineMemory, 1); CHECKARG(1, NUMERIC_type_of_ClipVarType); gtk_accel_map_save_fd(fd); return 0; err: return 1; }
/** * gtk_accel_map_save: * @file_name: (type filename): the name of the file to contain * accelerator specifications, in the GLib file name encoding * * Saves current accelerator specifications (accelerator path, key * and modifiers) to @file_name. * The file is written in a format suitable to be read back in by * gtk_accel_map_load(). */ void gtk_accel_map_save (const gchar *file_name) { gint fd; g_return_if_fail (file_name != NULL); fd = g_open (file_name, O_CREAT | O_TRUNC | O_WRONLY, 0644); if (fd < 0) return; gtk_accel_map_save_fd (fd); close (fd); }
static void ev_application_accel_map_save(EvApplication* application) { gchar* accel_map_file; gchar* tmp_filename; gint fd; if (userdir) { accel_map_file = g_build_filename(userdir, "atril", "accels", NULL); } else { accel_map_file = g_build_filename(g_get_user_config_dir(), "accels", "atril", NULL); } tmp_filename = g_strdup_printf("%s.XXXXXX", accel_map_file); fd = g_mkstemp(tmp_filename); if (fd == -1) { g_free(accel_map_file); g_free(tmp_filename); return; } gtk_accel_map_save_fd(fd); close(fd); if (g_rename(tmp_filename, accel_map_file) == -1) { /* FIXME: win32? */ g_unlink(tmp_filename); } g_free(accel_map_file); g_free(tmp_filename); }