Exemplo n.º 1
0
static void
addrconduit_save_configuration (EAddrConduitCfg *c)
{
	gchar prefix[256];

	g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-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);
	switch (c->default_address) {
	case E_CONTACT_ADDRESS_WORK:
		gnome_config_set_string ("default_address", "business");
		break;
	case E_CONTACT_ADDRESS_HOME:
		gnome_config_set_string ("default_address", "home");
		break;
	case E_CONTACT_ADDRESS_OTHER:
		gnome_config_set_string ("default_address", "other");
		break;
	default:
		g_warning ("Unknown default_address value");
	}
	gnome_config_set_string ("last_uri", c->last_uri);
	gnome_config_pop_prefix ();

	gnome_config_sync ();
	gnome_config_drop_all ();
}
Exemplo n.º 2
0
static void
on_plugin_fortune_configure_ok_btn_clicked (void) {
  cmnd = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
  gnome_config_set_string ("/plugins/fortune/cmnd", cmnd);
  gnome_config_sync ();
  gtk_widget_destroy (window);
}
Exemplo n.º 3
0
void main_window_add_to_reopen_menu(gchar *full_filename)
{
	guint entry;
	gchar *found;
	GString *key;
	guint found_id;
	
	// Find current filename in list
	found_id = -1;
	for (entry=0; entry<NUM_REOPEN_MAX; entry++) {
		key = g_string_new("gPHPEdit/recent/");
		g_string_append_printf(key, "%d=NOTFOUND", entry);
		found = gnome_config_get_string (key->str);
		g_string_free(key, TRUE);
		
		if (strcmp(full_filename, found)==0) {
			found_id = entry;
			break;
		}
	}
	
	// if not found, drop the last one off the end (i.e. pretend it was found in the last position)
	if (found_id == -1) {
		found_id = NUM_REOPEN_MAX-1;
	}

	// replace from found_id to 1 with entry above
	for (entry=found_id; entry > 0; entry--) {
		key = g_string_new("gPHPEdit/recent/");
		g_string_append_printf(key, "%d=NOTFOUND", entry-1);
		found = gnome_config_get_string (key->str);
		g_string_free(key, TRUE);

		key = g_string_new("gPHPEdit/recent/");
		g_string_append_printf(key, "%d", entry);
		gnome_config_set_string (key->str, found);
		g_string_free(key, TRUE);
	}

	// set entry 0 to be new entry
	gnome_config_set_string ("gPHPEdit/recent/0", full_filename);
		
	main_window_update_reopen_menu();
	gnome_config_sync();	
}
Exemplo n.º 4
0
static void
load_scenario_callback (GtkWidget *widget, void *data)
{
	if (selected_scenario.scenario) {
		load_scenario (selected_scenario.scenario);
		if (selected_scenario.make_it_default) {
			gnome_config_set_string (
				"/same-gnome/Preferences/Scenario", 
				selected_scenario.scenario);
			gnome_config_sync();
		}
	}
	cancel (0,0);
}
Exemplo n.º 5
0
void
confsection_t::set_string(const char *name, const char *value)
{
    string_var key = make_key(name);

#if HAVE_LIBGCONF
    GError *e = 0;
    gconf_client_set_string(gconf_client_get_default(),
			    key.data(), value, &e);
    handle_error(secname_, e);
#else
    gnome_config_set_string(key.data(), value);
#endif
}
Exemplo n.º 6
0
static void
gmdb_prefs_save_cb(GtkWidget *w, GladeXML *xml)
{
	GtkWidget *entry;
	GtkWidget *win;
	gchar *str;

	entry = glade_xml_get_widget (xml, "maxrows_entry");
	str = (gchar *) gtk_entry_get_text(GTK_ENTRY(entry));
	printf("str = %s\n",str);
	gnome_config_set_string("/gmdb/prefs/maxrows", str);
	gnome_config_sync();
	win = glade_xml_get_widget (xml, "prefs_dialog");
	if (win) gtk_widget_destroy(win);
}
Exemplo n.º 7
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 ();
}
Exemplo n.º 8
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;
}
Exemplo n.º 9
0
GtkWidget *
gmdb_prefs_new()
{
	GtkWidget *prefswin, *button;
	GtkWidget *entry;
	gchar *str;

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

	entry = glade_xml_get_widget (prefswin_xml, "maxrows_entry");

	button = glade_xml_get_widget (prefswin_xml, "cancel_button");
	g_signal_connect (G_OBJECT (button), "clicked",
		G_CALLBACK (gmdb_prefs_cancel_cb), prefswin_xml);

	button = glade_xml_get_widget (prefswin_xml, "ok_button");
	g_signal_connect (G_OBJECT (button), "clicked",
		G_CALLBACK (gmdb_prefs_save_cb), prefswin_xml);

	button = glade_xml_get_widget (prefswin_xml, "help_button");
	g_signal_connect (G_OBJECT (button), "clicked",
		G_CALLBACK (gmdb_prefs_help_cb), prefswin_xml);

	str = gnome_config_get_string("/gmdb/prefs/maxrows");
	if (!str || !strlen(str)) {
		str = "1000";
		gnome_config_set_string("/gmdb/prefs/maxrows", str);
		gnome_config_sync();
	}
	gtk_entry_set_text(GTK_ENTRY(entry), str);

	prefswin = glade_xml_get_widget (prefswin_xml, "prefs_dialog");
	return prefswin;
}
Exemplo n.º 10
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 ();
}