Пример #1
0
static void
g_vfs_backend_http_init (GVfsBackendHttp *backend)
{
  g_vfs_backend_set_user_visible (G_VFS_BACKEND (backend), FALSE);

  backend->session = g_object_ref (the_session);
}
Пример #2
0
static void
g_vfs_backend_test_init (GVfsBackendTest *test_backend)
{
  GVfsBackend *backend = G_VFS_BACKEND (test_backend);
  GMountSpec *mount_spec;

  g_vfs_backend_set_display_name (backend, "test");

  mount_spec = g_mount_spec_new ("test");
  g_vfs_backend_set_mount_spec (backend, mount_spec);
  g_mount_spec_unref (mount_spec);
}
Пример #3
0
static GVfsMonitor *
recent_backend_get_dir_monitor (GVfsBackendRecent *backend,
                                gboolean           create)
{
  if (backend->dir_monitor == NULL && create == FALSE)
    return NULL;

  else if (backend->dir_monitor == NULL)
    {
      backend->dir_monitor = g_vfs_monitor_new (G_VFS_BACKEND (backend));
    }

  return g_object_ref (backend->dir_monitor);
}
Пример #4
0
static void
g_vfs_backend_trash_init (GVfsBackendTrash *backend)
{
  GVfsBackend *vfs_backend = G_VFS_BACKEND (backend);
  GMountSpec *mount_spec;

  /* translators: This is the name of the backend */
  g_vfs_backend_set_display_name (vfs_backend, _("Trash"));
  g_vfs_backend_set_icon_name (vfs_backend, "user-trash");
  g_vfs_backend_set_symbolic_icon_name (vfs_backend, "user-trash-symbolic");
  g_vfs_backend_set_user_visible (vfs_backend, FALSE);

  mount_spec = g_mount_spec_new ("trash");
  g_vfs_backend_set_mount_spec (vfs_backend, mount_spec);
  g_mount_spec_unref (mount_spec);
}
Пример #5
0
static GVfsMonitor *
recent_backend_get_file_monitor (GVfsBackendRecent *backend,
                                 gboolean           create)
{
  if (backend->file_monitor == NULL && create == FALSE)
    return NULL;

  else if (backend->file_monitor == NULL)
    {
      /* 'create' is only ever set in the main thread, so we will have
       * no possibility here for creating more than one new monitor.
       */
      /* FIXME */

      backend->file_monitor = g_vfs_monitor_new (G_VFS_BACKEND (backend));
    }

  return g_object_ref (backend->file_monitor);
}
Пример #6
0
static GVfsMonitor *
trash_backend_get_dir_monitor (GVfsBackendTrash *backend,
                               gboolean          create)
{
  if (backend->dir_monitor == NULL && create == FALSE)
    return NULL;

  else if (backend->dir_monitor == NULL)
    {
      /* 'create' is only ever set in the main thread, so we will have
       * no possibility here for creating more than one new monitor.
       */
      if (backend->file_monitor == NULL)
        trash_watcher_watch (backend->watcher);

      backend->dir_monitor = g_vfs_monitor_new (G_VFS_BACKEND (backend));
    }

  return g_object_ref (backend->dir_monitor);
}
Пример #7
0
static void
g_vfs_backend_recent_init (GVfsBackendRecent *backend)
{
  GVfsBackend *vfs_backend = G_VFS_BACKEND (backend);
  GMountSpec *mount_spec;

  backend->items = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify)recent_item_free);
  backend->uri_map = g_hash_table_new (g_str_hash, g_str_equal);

  gtk_init (NULL, NULL);

  /* translators: This is the name of the backend */
  g_vfs_backend_set_display_name (vfs_backend, _("Recent"));
  g_vfs_backend_set_icon_name (vfs_backend, "document-open-recent");
  g_vfs_backend_set_symbolic_icon_name (vfs_backend, "document-open-recent-symbolic");
  g_vfs_backend_set_user_visible (vfs_backend, FALSE);

  mount_spec = g_mount_spec_new ("recent");
  g_vfs_backend_set_mount_spec (vfs_backend, mount_spec);
  g_mount_spec_unref (mount_spec);
}
Пример #8
0
static void
g_vfs_backend_http_init (GVfsBackendHttp *backend)
{
  const char         *debug;
  SoupSessionFeature *proxy_resolver;
  SoupSessionFeature *cookie_jar;
  SoupSessionFeature *content_decoder;

  g_vfs_backend_set_user_visible (G_VFS_BACKEND (backend), FALSE);  

  backend->session = soup_session_sync_new_with_options ("user-agent",
                                                         "gvfs/" VERSION,
                                                         NULL);

  backend->session_async = soup_session_async_new_with_options ("user-agent",
                                                                "gvfs/" VERSION,
                                                                NULL);
  /* SoupRequester seems to depend on use-thread-context */
  g_object_set (G_OBJECT (backend->session_async), "use-thread-context", TRUE, NULL);

  /* Proxy handling */
  proxy_resolver = g_object_new (SOUP_TYPE_PROXY_RESOLVER_GNOME, NULL);
  soup_session_add_feature (backend->session, proxy_resolver);
  soup_session_add_feature (backend->session_async, proxy_resolver);
  g_object_unref (proxy_resolver);

  /* Cookie handling - stored temporarlly in memory, mostly useful for
   * authentication in WebDAV. */
  cookie_jar = g_object_new (SOUP_TYPE_COOKIE_JAR, NULL);
  soup_session_add_feature (backend->session, cookie_jar);
  soup_session_add_feature (backend->session_async, cookie_jar);
  g_object_unref (cookie_jar);

  /* Send Accept-Language header (see bug 166795) */
  g_object_set (backend->session, "accept-language-auto", TRUE, NULL);
  g_object_set (backend->session_async, "accept-language-auto", TRUE, NULL);

  /* Handle decompression automatically */
  content_decoder = g_object_new (SOUP_TYPE_CONTENT_DECODER, NULL);
  soup_session_add_feature (backend->session, content_decoder);
  soup_session_add_feature (backend->session_async, content_decoder);
  g_object_unref (content_decoder);

  /* Request API */
  soup_session_add_feature_by_type (backend->session, SOUP_TYPE_REQUESTER);
  soup_session_add_feature_by_type (backend->session_async, SOUP_TYPE_REQUESTER);

  /* Logging */
  debug = g_getenv ("GVFS_HTTP_DEBUG");
  if (debug)
    {
      SoupLogger         *logger;
      SoupLoggerLogLevel  level;

      if (g_ascii_strcasecmp (debug, "all") ||
          g_ascii_strcasecmp (debug, "body"))
        level = SOUP_LOGGER_LOG_BODY;
      else if (g_ascii_strcasecmp (debug, "header"))
        level = SOUP_LOGGER_LOG_HEADERS;
      else
        level = SOUP_LOGGER_LOG_MINIMAL;

      logger = soup_logger_new (level, DEBUG_MAX_BODY_SIZE);
      soup_session_add_feature (backend->session, SOUP_SESSION_FEATURE (logger));
      soup_session_add_feature (backend->session_async, SOUP_SESSION_FEATURE (logger));
      g_object_unref (logger);
    }

}