Ejemplo n.º 1
0
/**
 * _mate_vfs_url_show_using_handler_with_env:
 * @url: the url to show
 * @envp: environment for the handler
 * 
 * Same as mate_url_show_using_handler except that the handler
 * will be launched with the given environment.
 *
 * Return value: MATE_VFS_OK on success.
 * MATE_VFS_ERROR_BAD_PAREMETER if the URL is invalid.
 * MATE_VFS_ERROR_NOT_SUPPORTED if no handler is defined.
 * MATE_VFS_ERROR_PARSE if the handler command can not be parsed.
 * MATE_VFS_ERROR_LAUNCH if the handler command can not be launched.
 * MATE_VFS_ERROR_INTERNAL for internal/MateConf errors.
 *
 * Since: 2.4
 */
MateVFSResult
_mate_vfs_url_show_using_handler_with_env (const char  *url,
			                    char       **envp)
{
	MateConfClient *client;
	char *path;
	char *scheme;
	char *template;
	char **argv;
	int argc;
	int i;
	gboolean ret;
	
	g_return_val_if_fail (url != NULL, MATE_VFS_ERROR_BAD_PARAMETERS);
	
	scheme = mate_vfs_get_uri_scheme (url);
	
	g_return_val_if_fail (scheme != NULL, MATE_VFS_ERROR_BAD_PARAMETERS);
	
	if (!mateconf_is_initialized ()) {
		if (!mateconf_init (0, NULL, NULL)) {
			g_free (scheme);
			return MATE_VFS_ERROR_INTERNAL;
		}
	}

	client = mateconf_client_get_default ();
	path = g_strconcat (MATECONF_URL_HANDLER_PATH, scheme, "/command", NULL);
int
main (int argc, char** argv)
{
  MateConfEngine* conf;
  GError* err = NULL;

  setlocale (LC_ALL, "");

  if (!mateconf_init(argc, argv, &err))
    {
      fprintf(stderr, "Failed to init MateConf: %s\n", err->message);
      g_error_free(err);
      err = NULL;
      return 1;
    }

  conf = mateconf_engine_get_default();

  check(conf != NULL, "create the default conf engine");

  printf("\nChecking string storage via MateConfChangeSet:");

  check_string_storage(conf);

  mateconf_engine_unref(conf);

  printf("\n\n");

  return 0;
}
int 
main (int argc, char** argv)
{
  MateConfEngine* conf;
  GError* err = NULL;

  setlocale (LC_ALL, "");
  
  if (!mateconf_init(argc, argv, &err))
    {
      g_assert(err != NULL);
      fprintf(stderr, "Failed to init MateConf: %s\n", err->message);
      fflush(stderr);
      g_error_free(err);
      err = NULL;
      return 1;
    }
  
  conf = mateconf_engine_get_default();

  check(conf != NULL, "create the default conf engine");
  
  check_dir_listing(conf);
  
  mateconf_engine_unref(conf);

  printf("\n\n");
  
  return 0;
}
Ejemplo n.º 4
0
int
main(int argc, char** argv)
{
  GtkWidget* window;
  GtkWidget* entry;
  MateConfClient* client;

  gtk_init(&argc, &argv);
  mateconf_init(argc, argv, NULL);
  
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  entry = gtk_entry_new();

  gtk_container_add(GTK_CONTAINER(window), entry);  

  client = mateconf_client_get_default();

  mateconf_client_add_dir(client,
                       "/extra/test/directory",
                       MATECONF_CLIENT_PRELOAD_NONE,
                       NULL);


  g_signal_connect (G_OBJECT (entry), "activate",
                    G_CALLBACK (entry_activated_callback),
                    client);

  /* If key isn't writable, then set insensitive */
  gtk_widget_set_sensitive (entry,
                            mateconf_client_key_is_writable (client,
                                                          "/extra/test/directory/key", NULL));
  
  gtk_widget_show_all(window);

  gtk_main();

  return 0;
}
Ejemplo n.º 5
0
/**
 * _mate_vfs_use_handler_for_scheme:
 * @scheme: the URI scheme
 *
 * Checks MateConf to see if there is a URL handler
 * defined for this scheme and if it is enabled.
 *
 * Return value: TRUE if handler is defined and enabled,
 * FALSE otherwise.
 *
 * Since: 2.4
 */
gboolean
_mate_vfs_use_handler_for_scheme (const char *scheme)
{
	MateConfClient *client;
	gboolean ret;
	char *path;
	
	g_return_val_if_fail (scheme != NULL, FALSE);
	
	if (!mateconf_is_initialized ()) {
		if (!mateconf_init (0, NULL, NULL)) {
			return FALSE;
		}
	}
	
	client = mateconf_client_get_default ();
	path = g_strconcat (MATECONF_URL_HANDLER_PATH, scheme, "/enabled", NULL);
	ret = mateconf_client_get_bool (client, path, NULL);
	
	g_free (path);
	g_object_unref (G_OBJECT (client));
	
	return ret;
}
int
main (int argc, char **argv)
{
	MatekbdIndicatorPluginsCapplet gipc;

	GError *mateconf_error = NULL;
	MateConfClient *confClient;

	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	memset (&gipc, 0, sizeof (gipc));
	gtk_init_with_args (&argc, &argv, "matekbd", NULL, NULL, NULL);
	if (!mateconf_init (argc, argv, &mateconf_error)) {
		g_warning (_("Failed to init MateConf: %s\n"),
			   mateconf_error->message);
		g_error_free (mateconf_error);
		return 1;
	}
	mateconf_error = NULL;
	/*MatekbdIndicatorInstallGlibLogAppender(  ); */
	gipc.engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
	gipc.config_registry =
	    xkl_config_registry_get_instance (gipc.engine);

	confClient = mateconf_client_get_default ();
	matekbd_indicator_plugin_container_init (&gipc.plugin_container,
					      confClient);
	g_object_unref (confClient);

	matekbd_keyboard_config_init (&gipc.kbd_cfg, confClient, gipc.engine);
	matekbd_keyboard_config_init (&initialSysKbdConfig, confClient,
				   gipc.engine);

	matekbd_indicator_config_init (&gipc.applet_cfg, confClient,
				    gipc.engine);

	matekbd_indicator_plugin_manager_init (&gipc.plugin_manager);

	matekbd_keyboard_config_load_from_x_initial (&initialSysKbdConfig,
						  NULL);
	matekbd_keyboard_config_load_from_mateconf (&gipc.kbd_cfg,
					      &initialSysKbdConfig);

	matekbd_indicator_config_load_from_mateconf (&gipc.applet_cfg);

	loop = g_main_loop_new (NULL, TRUE);

	CappletSetup (&gipc);

	g_main_loop_run (loop);

	matekbd_indicator_plugin_manager_term (&gipc.plugin_manager);

	matekbd_indicator_config_term (&gipc.applet_cfg);

	matekbd_keyboard_config_term (&gipc.kbd_cfg);
	matekbd_keyboard_config_term (&initialSysKbdConfig);

	matekbd_indicator_plugin_container_term (&gipc.plugin_container);
	g_object_unref (G_OBJECT (gipc.config_registry));
	g_object_unref (G_OBJECT (gipc.engine));
	return 0;
}