Пример #1
0
static int
save_state (GnomeClient *client,
	    gint phase,
	    GnomeSaveStyle save_style,
	    gint shutdown, 
	    GnomeInteractStyle interact_style,
	    gint fast,
	    gpointer client_data)
{
	gchar *prefix = gnome_client_get_config_prefix (client);
	gchar *argv []= { "rm", "-r", NULL };
	gchar *buf;
	struct ball *f = (struct ball*) field;
	int i;  
	
	if (debugging)
		g_print ("Saving state\n");
	
	gnome_config_push_prefix (prefix);
	
	gnome_config_set_int ("Game/Score", score);
	gnome_config_set_int ("Game/NStones", sync_stones ? 1 : nstones);
	
	buf= g_malloc (STONE_COLS*STONE_LINES+1);
	
	for (i = 0 ; i < (STONE_COLS*STONE_LINES); i++){
		buf [i]= f [i].color + 'a';
	}
	buf [STONE_COLS*STONE_LINES]= '\0';
	gnome_config_set_string ("Game/Field", buf);
	g_free(buf);
	
	gnome_config_pop_prefix ();
	gnome_config_sync();
	
	argv[2]= gnome_config_get_real_path (prefix);
	gnome_client_set_discard_command (client, 3, argv);
	
	return TRUE;
}
Пример #2
0
void
confsection_t::set_int(const char *name, int value)
{
    string_var key = make_key(name);

#if HAVE_LIBGCONF
    GError *e = 0;
    gconf_client_set_int(gconf_client_get_default(),
			 key, value, &e);
    handle_error(secname_, e);
#else
    gnome_config_set_int(key.data(), value);
#endif
}
Пример #3
0
static void
memoconduit_save_configuration (EMemoConduitCfg *c)
{
	gchar prefix[256];

	g_snprintf (prefix, 255, "/gnome-pilot.d/e-memo-conduit/Pilot_%u/",
		    c->pilot_id);

	gnome_config_push_prefix (prefix);
	e_pilot_set_sync_source (c->source_list, c->source);
	gnome_config_set_bool ("secret", c->secret);
	gnome_config_set_int ("priority", c->priority);
	gnome_config_set_string ("last_uri", c->last_uri);
	gnome_config_pop_prefix ();

	gnome_config_sync ();
	gnome_config_drop_all ();
}
Пример #4
0
void preferences_save (void)
{
  if (preferences)
    {
      gnome_config_set_bool ("/atomix/Global/EnableScoreAndTimeLimit",
			     preferences->score_time_enabled);
      gnome_config_set_bool ("/atomix/Control/MouseControl",
			     preferences->mouse_control);
      gnome_config_set_bool ("/atomix/Control/KeyboardControl",
			     preferences->keyboard_control);
      gnome_config_set_bool ("/atomix/Control/HideCursor",
			     preferences->hide_cursor);
      gnome_config_set_bool ("/atomix/Control/LazyDragging",
			     preferences->lazy_dragging);
      gnome_config_set_int ("/atomix/Control/MouseSensitivitiy",
			    preferences->mouse_sensitivity);
      gnome_config_sync ();
    }
}
Пример #5
0
static void
save_session (GnomeClient *client)
{
	const char  *prefix;
	GList       *scan;
	int          i = 0;

	prefix = gnome_client_get_config_prefix (client);
	gnome_config_push_prefix (prefix);

	for (scan = gth_window_get_window_list (); scan; scan = scan->next) {
		GthWindow  *window = scan->data;
		char       *uri = NULL;
		const char *location;
		char       *key;

		if (GTH_IS_VIEWER (window)) {
			location = gth_window_get_image_filename (window);
			if (location == NULL)
				continue;
			uri = add_scheme_if_absent (location);
		} 
		else {
			GthBrowser *browser = (GthBrowser*) window;

			switch (gth_browser_get_sidebar_content (browser)) {
			case GTH_SIDEBAR_DIR_LIST:
				location = gth_browser_get_current_directory (browser);
				if (location == NULL)
					continue;
				uri = add_scheme_if_absent (location);
				break;

			case GTH_SIDEBAR_CATALOG_LIST:
				location = gth_browser_get_current_catalog (browser);
				if (location == NULL)
					continue;
				uri = add_scheme_if_absent (location);
				break;

			default:
				break;
			}
		}

		if (uri == NULL)
			continue;

		key = g_strdup_printf ("Session/location%d", i);
		gnome_config_set_string (key, uri);

		g_free (uri);
		g_free (key);

		i++;
	}

	gnome_config_set_int ("Session/locations", i);

	gnome_config_pop_prefix ();
	gnome_config_sync ();
}