コード例 #1
0
static EAddrConduitCfg *
addrconduit_load_configuration (guint32 pilot_id)
{
	EAddrConduitCfg *c;
	GnomePilotConduitManagement *management;
	GnomePilotConduitConfig *config;
	gchar *address, prefix[256];
	g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/",
		    pilot_id);

	c = g_new0 (EAddrConduitCfg,1);
	g_assert (c != NULL);

	c->pilot_id = pilot_id;
	management = gnome_pilot_conduit_management_new ("e_address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
	g_object_ref_sink (management);
	config = gnome_pilot_conduit_config_new (management, pilot_id);
	g_object_ref_sink (config);
	if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type))
		c->sync_type = GnomePilotConduitSyncTypeNotSet;
	g_object_unref (config);
	g_object_unref (management);

	/* Custom settings */
	gnome_config_push_prefix (prefix);

	if (!e_book_get_addressbooks (&c->source_list, NULL))
		c->source_list = NULL;
	if (c->source_list) {
		c->source = e_pilot_get_sync_source (c->source_list);
		if (!c->source)
			c->source = e_source_list_peek_source_any (c->source_list);
		if (c->source) {
			g_object_ref (c->source);
		} else {
			g_object_unref (c->source_list);
			c->source_list = NULL;
		}
	}

	c->secret = gnome_config_get_bool ("secret=FALSE");
	address = gnome_config_get_string ("default_address=business");
	if (!strcmp (address, "business"))
		c->default_address = E_CONTACT_ADDRESS_WORK;
	else if (!strcmp (address, "home"))
		c->default_address = E_CONTACT_ADDRESS_HOME;
	else if (!strcmp (address, "other"))
		c->default_address = E_CONTACT_ADDRESS_OTHER;
	g_free (address);
	c->last_uri = gnome_config_get_string ("last_uri");

	gnome_config_pop_prefix ();

	return c;
}
コード例 #2
0
ファイル: main.c プロジェクト: ChingezKhan/gthumb
static void
load_session (gboolean                  use_factory,
	      GNOME_GThumb_Application  app,
	      CORBA_Environment        *env)
{
	int i, n;

	gnome_config_push_prefix (gnome_client_get_config_prefix (master_client));

	n = gnome_config_get_int ("Session/locations");
	for (i = 0; i < n; i++) {
		char *key;
		char *location;

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

		if (uri_scheme_is_file (location) && path_is_file (location))
			open_viewer_window (location, use_factory, app, env);
		else
			open_browser_window (location, TRUE, use_factory, app, env);

		g_free (location);
		g_free (key);
	}

	gnome_config_pop_prefix ();
}
コード例 #3
0
ファイル: main2.c プロジェクト: ASAPPinc/mdbtools
void gmdb_load_recent_files()
{
GtkWidget *menuitem;
GtkWidget *menulabel;
char menuname[100];
char cfgname[100];
int i;
gchar *text, *text2;

	for (i=4;i>=1;i--) {	
		sprintf(menuname, "menu_recent%d",i);
		sprintf(cfgname, "/gmdb/RecentFiles/menu_recent%d.basename",i);
		menuitem = glade_xml_get_widget (mainwin_xml, menuname);
		menulabel = gtk_bin_get_child(GTK_BIN(menuitem));
		text = gnome_config_get_string(cfgname);
		if (!text) {
			gtk_widget_hide(menuitem);
		} else {
			text2 = g_malloc(strlen(text)+4);
			sprintf(text2,"%d. %s",i,text);
			gtk_label_set_text(GTK_LABEL(menulabel),text2);
			gtk_widget_show(menuitem);
			g_free(text2);
		}
		g_free(text);
	}
}
コード例 #4
0
ファイル: main_window.c プロジェクト: maheshmohanmu/gphpedit
void main_window_update_reopen_menu(void)
{
	gchar *full_filename;
	GString *key;
	//gchar *short_filename;
	guint entry;
	GtkBin *bin = NULL;
	
	for (entry=0; entry<NUM_REOPEN_MAX; entry++) {
		key = g_string_new("gPHPEdit/recent/");
		g_string_append_printf(key, "%d=NOTFOUND", entry);
		full_filename = gnome_config_get_string (key->str);
		g_string_free(key, TRUE);
		
		//g_print("Recent DEBUG: Entry %d: %s\n", entry, full_filename);
		
		if (strcmp(full_filename, "NOTFOUND")!=0) {
			bin = GTK_BIN(recent_menu[entry].widget);
			if (bin) {
				gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(bin)), full_filename);
				gtk_widget_show(recent_menu[entry].widget);
			}
		}
		else {
			gtk_widget_hide(recent_menu[entry].widget);
		}
	}
}
コード例 #5
0
ファイル: main_window.c プロジェクト: maheshmohanmu/gphpedit
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();	
}
コード例 #6
0
ファイル: prefs.c プロジェクト: agworld/mdbtools
unsigned long
gmdb_prefs_get_maxrows()
{
	gchar *str;

        str = gnome_config_get_string("/gmdb/prefs/maxrows");
	if (!str || !strlen(str)) 
		return 1000;
	else 
		return atol(str);
}
コード例 #7
0
ファイル: memo-conduit.c プロジェクト: ebbywiselyn/evolution
static EMemoConduitCfg *
memoconduit_load_configuration (guint32 pilot_id)
{
	EMemoConduitCfg *c;
	GnomePilotConduitManagement *management;
	GnomePilotConduitConfig *config;
	gchar prefix[256];


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

	c = g_new0 (EMemoConduitCfg,1);
	g_assert (c != NULL);

	c->pilot_id = pilot_id;

	management = gnome_pilot_conduit_management_new ("e_memo_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
	g_object_ref_sink (management);
	config = gnome_pilot_conduit_config_new (management, pilot_id);
	g_object_ref_sink (config);
	if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type))
		c->sync_type = GnomePilotConduitSyncTypeNotSet;
	g_object_unref (config);
	g_object_unref (management);

	/* Custom settings */
	gnome_config_push_prefix (prefix);

	if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL))
		c->source_list = NULL;
	if (c->source_list) {
		c->source = e_pilot_get_sync_source (c->source_list);
		if (!c->source)
			c->source = e_source_list_peek_source_any (c->source_list);
		if (c->source) {
			g_object_ref (c->source);
		} else {
			g_object_unref (c->source_list);
			c->source_list = NULL;
		}
	}

	c->secret = gnome_config_get_bool ("secret=FALSE");
	c->priority = gnome_config_get_int ("priority=3");
	c->last_uri = gnome_config_get_string ("last_uri");

	gnome_config_pop_prefix ();

	return c;
}
コード例 #8
0
ファイル: prefs.c プロジェクト: agworld/mdbtools
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;
}
コード例 #9
0
ファイル: fortune.c プロジェクト: heelhook/cronosII
/* Module Initializer */
char *
module_init (int major_version, int minor_version, int patch_version, C2DynamicModule *module) {
  /* Check if the version is correct */
  if (major_version < REQUIRE_MAJOR_VERSION)
    return g_strdup_printf ("The plugin %s requires at least Cronos II %d.%d.%d.", information[PLUGIN_NAME],
				REQUIRE_MAJOR_VERSION, REQUIRE_MINOR_VERSION, REQUIRE_MICRO_VERSION);
  if (major_version == REQUIRE_MAJOR_VERSION && minor_version < REQUIRE_MINOR_VERSION)
    return g_strdup_printf ("The plugin %s requires at least Cronos II %d.%d.%d.", information[PLUGIN_NAME],
				REQUIRE_MAJOR_VERSION, REQUIRE_MINOR_VERSION, REQUIRE_MICRO_VERSION);
  if (major_version == REQUIRE_MAJOR_VERSION &&
      minor_version == REQUIRE_MINOR_VERSION &&
      patch_version < REQUIRE_MICRO_VERSION)
    return g_strdup_printf ("The plugin %s requires at least Cronos II %d.%d.%d.", information[PLUGIN_NAME],
				REQUIRE_MAJOR_VERSION, REQUIRE_MINOR_VERSION, REQUIRE_MICRO_VERSION);

  /* Check if the module is already loaded */
  if (c2_dynamic_module_find (information[PLUGIN_NAME], config->module_head))
    return g_strdup_printf ("The plugin %s is already loaded.", information[PLUGIN_NAME]);

  /* Set up the module information */
  module->name		= information[PLUGIN_NAME];
  module->version	= information[PLUGIN_VERSION];
  module->author	= information[PLUGIN_AUTHOR];
  module->url		= information[PLUGIN_URL];
  module->description	= information[PLUGIN_DESCRIPTION];
  module->configure	= plugin_fortune_configure;
  module->configfile	= NULL;

  /* Load the configuration */
  cmnd = gnome_config_get_string ("/plugins/fortune/cmnd=fortune");

  /* Connect the signals */
  c2_dynamic_module_signal_connect (information[PLUGIN_NAME], C2_DYNAMIC_MODULE_COMPOSER_INSERT_SIGNATURE,
  				C2_DYNAMIC_MODULE_SIGNAL_FUNC (plugin_on_composer_insert_signature));

  return NULL;
}
コード例 #10
0
ファイル: same-gnome.c プロジェクト: cstrahan/aduni
int
main (int argc, char *argv [])
{
	GtkWidget *label;
	GnomeClient *client;

	gnome_score_init("same-gnome");

	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
	textdomain (PACKAGE);

	gnome_init_with_popt_table ("same-gnome", VERSION, argc, argv, options, 0, NULL);

	gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/gnome-gsame.png");
	client= gnome_master_client ();

	gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
			    GTK_SIGNAL_FUNC (save_state), argv[0]);
	gtk_signal_connect (GTK_OBJECT (client), "die",
			    GTK_SIGNAL_FUNC (client_die), NULL);

	if (GNOME_CLIENT_RESTARTED (client)){
		gnome_config_push_prefix (gnome_client_get_config_prefix (client));
	    
		restart ();
		restarted = 1;
		
		gnome_config_pop_prefix ();
	}

	srand (time (NULL));

	app = gnome_app_new("same-gnome", _("Same Gnome"));

        gtk_window_set_policy(GTK_WINDOW(app), FALSE, FALSE, TRUE);
	gtk_signal_connect (GTK_OBJECT(app), "delete_event",
			    (GtkSignalFunc)game_quit_callback, NULL);

	appbar = gnome_appbar_new(FALSE, TRUE, GNOME_PREFERENCES_USER);
	gnome_app_set_statusbar(GNOME_APP (app), GTK_WIDGET(appbar));

	gnome_appbar_set_status(GNOME_APPBAR (appbar),
				_("Welcome to Same Gnome!"));

	gnome_app_create_menus(GNOME_APP(app), mainmenu);

	gnome_app_install_menu_hints(GNOME_APP (app), mainmenu);
  
        vb = gtk_vbox_new (FALSE, 0);
	gnome_app_set_contents (GNOME_APP (app), vb);

	if (!fname) {
		fname = gnome_config_get_string
			("/same-gnome/Preferences/Scenario=stones.png");
	}

	create_same_board (fname);

	label = gtk_label_new (_("Score: "));
	scorew = gtk_label_new ("");
	set_score (score);

	gtk_box_pack_start(GTK_BOX(appbar), label, FALSE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(appbar), scorew, FALSE, TRUE, 0);
	
	if (!restarted)
		new_game ();
	
	g_free (fname);

	gtk_widget_show (vb);
	gtk_widget_show (GTK_WIDGET(label));
	gtk_widget_show (GTK_WIDGET(scorew));
        gtk_widget_show (app);

	gtk_main ();
	return 0;
}