本文整理汇总了C++中G_IS_FILE函数的典型用法代码示例。如果您正苦于以下问题:C++ G_IS_FILE函数的具体用法?C++ G_IS_FILE怎么用?C++ G_IS_FILE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_IS_FILE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ide_git_vcs_is_ignored
static gboolean
ide_git_vcs_is_ignored (IdeVcs *vcs,
GFile *file,
GError **error)
{
g_autofree gchar *name = NULL;
IdeGitVcs *self = (IdeGitVcs *)vcs;
gboolean ret = FALSE;
g_assert (IDE_IS_GIT_VCS (self));
g_assert (G_IS_FILE (file));
name = g_file_get_relative_path (self->working_directory, file);
if (g_strcmp0 (name, ".git") == 0)
return TRUE;
if (name != NULL)
return ggit_repository_path_is_ignored (self->repository, name, error);
return ret;
}
开发者ID:MaX121,项目名称:gnome-builder,代码行数:21,代码来源:ide-git-vcs.c
示例2: compare_to_file
static gboolean
compare_to_file (gconstpointer a,
gconstpointer b)
{
GFile *file = (GFile *)a;
GObject *item = (GObject *)b;
/*
* Our key (the GFile) is always @a.
* The potential match (maybe a GbProjectFile) is @b.
* @b may also be NULL.
*/
g_assert (G_IS_FILE (file));
g_assert (!item || G_IS_OBJECT (item));
if (GB_IS_PROJECT_FILE (item))
return g_file_equal (file, gb_project_file_get_file (GB_PROJECT_FILE (item)));
return FALSE;
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:21,代码来源:gb-project-tree.c
示例3: ide_build_system_new_async
/**
* ide_build_system_new_async:
* @context: #IdeBuildSystem
* @project_file: A #GFile containing the directory or project file.
* @cancellable: (allow-none): A #GCancellable
* @callback: A callback to execute upon completion
* @user_data: User data for @callback.
*
* Asynchronously creates a new #IdeBuildSystem instance using the registered
* #GIOExtensionPoint system. Each extension point will be tried asynchronously
* by priority until one has been found that supports @project_file.
*
* If no build system could be found, then ide_build_system_new_finish() will
* return %NULL.
*/
void
ide_build_system_new_async (IdeContext *context,
GFile *project_file,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_return_if_fail (IDE_IS_CONTEXT (context));
g_return_if_fail (G_IS_FILE (project_file));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
ide_object_new_for_extension_async (IDE_TYPE_BUILD_SYSTEM,
sort_priority, NULL,
G_PRIORITY_DEFAULT,
cancellable,
callback,
user_data,
"context", context,
"project-file", project_file,
NULL);
}
开发者ID:kakkilaya,项目名称:gnome-builder,代码行数:36,代码来源:ide-build-system.c
示例4: ide_project_files_find_file
/**
* ide_project_files_find_file:
* @self: (in): A #IdeProjectFiles.
* @file: A #GFile.
*
* Tries to locate an #IdeProjectFile matching the given file.
* If @file is the working directory, @self is returned.
*
* Returns: (transfer none) (nullable): An #IdeProjectItem or %NULL.
*/
IdeProjectItem *
ide_project_files_find_file (IdeProjectFiles *self,
GFile *file)
{
IdeProjectItem *item;
IdeContext *context;
IdeVcs *vcs;
GFile *workdir;
gchar **parts;
gchar *path;
gsize i;
g_return_val_if_fail (IDE_IS_PROJECT_FILES (self), NULL);
g_return_val_if_fail (G_IS_FILE (file), NULL);
item = IDE_PROJECT_ITEM (self);
context = ide_object_get_context (IDE_OBJECT (self));
vcs = ide_context_get_vcs (context);
workdir = ide_vcs_get_working_directory (vcs);
if (g_file_equal (workdir, file))
return IDE_PROJECT_ITEM (self);
path = g_file_get_relative_path (workdir, file);
if (path == NULL)
return NULL;
parts = g_strsplit (path, G_DIR_SEPARATOR_S, 0);
for (i = 0; parts [i]; i++)
{
if (!(item = ide_project_files_find_child (item, parts [i])))
break;
}
g_strfreev (parts);
g_free (path);
return item;
}
开发者ID:Dagal,项目名称:gnome-builder,代码行数:50,代码来源:ide-project-files.c
示例5: gimp_color_profile_combo_box_set_active_file
/**
* gimp_color_profile_combo_box_set_active_file:
* @combo: a #GimpColorProfileComboBox
* @file: file of the profile to select
* @label: label to use when adding a new entry (can be %NULL)
*
* Selects a color profile from the @combo and makes it the active
* item. If the profile is not listed in the @combo, then it is added
* with the given @label (or @file in case that @label is %NULL).
*
* Since: 2.10
**/
void
gimp_color_profile_combo_box_set_active_file (GimpColorProfileComboBox *combo,
GFile *file,
const gchar *label)
{
GimpColorProfile *profile = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
g_return_if_fail (GIMP_IS_COLOR_PROFILE_COMBO_BOX (combo));
g_return_if_fail (file == NULL || G_IS_FILE (file));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
if (file && ! (label && *label))
{
GError *error = NULL;
profile = gimp_color_profile_new_from_file (file, &error);
if (! profile)
{
g_message ("%s", error->message);
g_clear_error (&error);
}
else
{
label = gimp_color_profile_get_label (profile);
}
}
if (_gimp_color_profile_store_history_add (GIMP_COLOR_PROFILE_STORE (model),
file, label, &iter))
{
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
}
if (profile)
g_object_unref (profile);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:52,代码来源:gimpcolorprofilecombobox.c
示例6: gedit_recent_remove_if_local
void
gedit_recent_remove_if_local (GFile *location)
{
g_return_if_fail (G_IS_FILE (location));
/* If a file is local chances are that if load/save fails the file has
* beed removed and the failure is permanent so we remove it from the
* list of recent files. For remote files the failure may be just
* transitory and we keep the file in the list.
*/
if (g_file_has_uri_scheme (location, "file"))
{
GtkRecentManager *recent_manager;
gchar *uri;
recent_manager = gtk_recent_manager_get_default ();
uri = g_file_get_uri (location);
gtk_recent_manager_remove_item (recent_manager, uri, NULL);
g_free (uri);
}
}
开发者ID:tschoonj,项目名称:gedit,代码行数:22,代码来源:gedit-recent.c
示例7: gimp_config_serialize_to_gfile
/**
* gimp_config_serialize_to_gfile:
* @config: a #GObject that implements the #GimpConfigInterface.
* @file: the #GFile to write the configuration to.
* @header: optional file header (must be ASCII only)
* @footer: optional file footer (must be ASCII only)
* @data: user data passed to the serialize implementation.
* @error: return location for a possible error
*
* Serializes the object properties of @config to the file specified
* by @file. If a file with that name already exists, it is
* overwritten. Basically this function opens @file for you and calls
* the serialize function of the @config's #GimpConfigInterface.
*
* Return value: %TRUE if serialization succeeded, %FALSE otherwise.
*
* Since: 2.10
**/
gboolean
gimp_config_serialize_to_gfile (GimpConfig *config,
GFile *file,
const gchar *header,
const gchar *footer,
gpointer data,
GError **error)
{
GimpConfigWriter *writer;
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
writer = gimp_config_writer_new_gfile (file, TRUE, header, error);
if (!writer)
return FALSE;
GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
return gimp_config_writer_finish (writer, footer, error);
}
开发者ID:jiapei100,项目名称:gimp,代码行数:40,代码来源:gimpconfig-iface.c
示例8: photos_glib_file_create_async
void
photos_glib_file_create_async (GFile *file,
GFileCreateFlags flags,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr (GTask) task = NULL;
g_autoptr (PhotosGLibFileCreateData) data = NULL;
g_return_if_fail (G_IS_FILE (file));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
task = g_task_new (file, cancellable, callback, user_data);
g_task_set_source_tag (task, photos_glib_file_create_async);
data = photos_glib_file_create_data_new (file, flags, io_priority);
g_task_set_task_data (task, g_steal_pointer (&data), (GDestroyNotify) photos_glib_file_create_data_free);
g_file_create_async (file, flags, io_priority, cancellable, photos_glib_file_create_create, g_object_ref (task));
}
开发者ID:GNOME,项目名称:gnome-photos,代码行数:22,代码来源:photos-glib.c
示例9: gtk_hotkey_key_file_registry_real_has_hotkey
static gboolean
gtk_hotkey_key_file_registry_real_has_hotkey (GtkHotkeyRegistry *base,
const gchar *app_id,
const gchar *key_id)
{
GFile *file;
gboolean exists;
g_return_val_if_fail (app_id != NULL, FALSE);
g_return_val_if_fail (key_id != NULL, FALSE);
file = get_hotkey_file (app_id);
g_return_val_if_fail (G_IS_FILE(file), FALSE);
if (g_file_query_exists (file, NULL))
exists = TRUE;
else
exists = FALSE;
g_object_unref (file);
return exists;
}
开发者ID:SpOOnman,项目名称:claws,代码行数:22,代码来源:gtk-hotkey-key-file-registry.c
示例10: empathy_tp_file_offer
/**
* empathy_tp_file_offer:
* @self: an outgoing #EmpathyTpFile
* @gfile: the source #GFile for the transfer
* @cancellable: a #GCancellable
* @progress_callback: function to callback with progress information
* @progress_user_data: user_data to pass to @progress_callback
* @op_callback: function to callback when the transfer ends
* @op_user_data: user_data to pass to @op_callback
*
* Offers an outgoing file transfer, reading data from @gfile.
* The callback @op_callback will be called both when the transfer is
* successful and in case of an error. Note that cancelling @cancellable,
* closes the socket of the file operation in progress, but doesn't
* guarantee that the transfer channel will be closed as well. Thus,
* empathy_tp_file_cancel() or empathy_tp_file_close() should be used to
* actually cancel an ongoing #EmpathyTpFile.
*/
void
empathy_tp_file_offer (EmpathyTpFile *self,
GFile *gfile,
GCancellable *cancellable,
EmpathyTpFileProgressCallback progress_callback,
gpointer progress_user_data,
EmpathyTpFileOperationCallback op_callback,
gpointer op_user_data)
{
g_return_if_fail (EMPATHY_IS_TP_FILE (self));
g_return_if_fail (G_IS_FILE (gfile));
g_return_if_fail (G_IS_CANCELLABLE (cancellable));
self->priv->cancellable = g_object_ref (cancellable);
self->priv->progress_callback = progress_callback;
self->priv->progress_user_data = progress_user_data;
self->priv->op_callback = op_callback;
self->priv->op_user_data = op_user_data;
g_file_read_async (gfile, G_PRIORITY_DEFAULT, cancellable,
file_read_async_cb, self);
}
开发者ID:raluca-elena,项目名称:empathy-cheese,代码行数:40,代码来源:empathy-tp-file.c
示例11: empathy_ft_handler_incoming_set_destination
/**
* empathy_ft_handler_incoming_set_destination:
* @handler: an #EmpathyFTHandler
* @destination: the #GFile where the transfer should be saved
*
* Sets the destination of the incoming handler to be @destination.
* Note that calling this method is mandatory before starting the transfer
* for incoming handlers.
*/
void
empathy_ft_handler_incoming_set_destination (EmpathyFTHandler *handler,
GFile *destination)
{
EmpathyFTHandlerPriv *priv;
g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler));
g_return_if_fail (G_IS_FILE (destination));
priv = GET_PRIV (handler);
g_object_set (handler, "gfile", destination, NULL);
/* check if hash is supported. if it isn't, set use_hash to FALSE
* anyway, so that clients won't be expecting us to checksum.
*/
if (EMP_STR_EMPTY (priv->content_hash) ||
priv->content_hash_type == TP_FILE_HASH_TYPE_NONE)
priv->use_hash = FALSE;
else
priv->use_hash = TRUE;
}
开发者ID:sharat-dev,项目名称:empathy_sharat,代码行数:31,代码来源:empathy-ft-handler.c
示例12: what_failed_on_file_operation_failure
/*
* what_failed_on_file_operation_failure:
* @file: the file reference that failed.
* @transient: %TRUE if this failure is likely to be permanent, i.e. a malformed
* path. %FALSE if the action might succeed on subsequent attempts.
* @what: indicates whether it was an open, save, or other operation that
* failed.
*
* Helper function that picks a suitable error message describing what failed.
* Based on code from Conglomerate.
*
* Returns: (transfer full): a newly-allocated string.
*/
static char *
what_failed_on_file_operation_failure(GFile *file, gboolean transient, I7FileErrorWhat what)
{
char *displayname, *what_failed, *path;
GFile *parent;
g_return_val_if_fail(file || G_IS_FILE(file), NULL);
displayname = file_get_display_name(file);
parent = g_file_get_parent(file);
path = g_file_get_path(parent);
g_object_unref(parent);
if(what == I7_FILE_ERROR_OTHER) {
/* Generic file error */
what_failed = g_strdup_printf(_("Inform got an error while accessing \"%s\" from %s."), displayname, path);
} else if(transient) {
/* A "what failed" message when the failure is likely to be
permanent; this URI won't be accessible */
if(what == I7_FILE_ERROR_OPEN)
what_failed = g_strdup_printf(_("Inform cannot read \"%s\" from %s."), displayname, path);
else
what_failed = g_strdup_printf(_("Inform cannot save \"%s\" to %s."), displayname, path);
} else {
/* A "what failed" message when the failure is likely to be
transient; this URI might be accessible on subsequent attempts, or
with some troubleshooting. */
if(what == I7_FILE_ERROR_OPEN)
what_failed = g_strdup_printf(_("Inform could not read \"%s\" from %s."), displayname, path);
else
what_failed = g_strdup_printf(_("Inform could not save \"%s\" to %s."), displayname, path);
}
g_free(path);
g_free(displayname);
return what_failed;
}
开发者ID:ptomato,项目名称:gnome-inform7,代码行数:52,代码来源:error.c
示例13: photos_glib_file_copy_create
static void
photos_glib_file_copy_create (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
GCancellable *cancellable;
g_autoptr (GFile) unique_file = NULL;
GFile *destination = G_FILE (source_object);
GFile *source;
g_autoptr (GFileOutputStream) ostream = NULL;
g_autoptr (GTask) task = G_TASK (user_data);
PhotosGLibFileCopyData *data;
cancellable = g_task_get_cancellable (task);
data = (PhotosGLibFileCopyData *) g_task_get_task_data (task);
source = G_FILE (g_task_get_source_object (task));
{
g_autoptr (GError) error = NULL;
ostream = photos_glib_file_create_finish (destination, res, &unique_file, &error);
if (error != NULL)
{
g_task_return_error (task, g_steal_pointer (&error));
goto out;
}
}
g_assert_null (data->ostream);
g_assert_true (G_IS_FILE_OUTPUT_STREAM (ostream));
data->ostream = g_object_ref (ostream);
g_assert_null (data->unique_file);
g_assert_true (G_IS_FILE (unique_file));
data->unique_file = g_object_ref (unique_file);
g_file_read_async (source, data->io_priority, cancellable, photos_glib_file_copy_read, g_object_ref (task));
out:
return;
}
开发者ID:GNOME,项目名称:gnome-photos,代码行数:39,代码来源:photos-glib.c
示例14: xml_reader_load_from_file
gboolean
xml_reader_load_from_file (XmlReader *reader,
GFile *file,
GCancellable *cancellable,
GError **error)
{
GFileInputStream *stream;
gboolean ret;
g_return_val_if_fail (XML_IS_READER (reader), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE);
if (!(stream = g_file_read (file, cancellable, error)))
return FALSE;
ret = xml_reader_load_from_stream (reader, G_INPUT_STREAM (stream), error);
g_clear_object (&stream);
return ret;
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:22,代码来源:xml-reader.c
示例15: gimp_pattern_load_pixbuf
GList *
gimp_pattern_load_pixbuf (GimpContext *context,
GFile *file,
GInputStream *input,
GError **error)
{
GimpPattern *pattern;
GdkPixbuf *pixbuf;
gchar *name;
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
pixbuf = gdk_pixbuf_new_from_stream (input, NULL, error);
if (! pixbuf)
return NULL;
name = g_strdup (gdk_pixbuf_get_option (pixbuf, "tEXt::Title"));
if (! name)
name = g_strdup (gdk_pixbuf_get_option (pixbuf, "tEXt::Comment"));
if (! name)
name = g_path_get_basename (gimp_file_get_utf8_name (file));
pattern = g_object_new (GIMP_TYPE_PATTERN,
"name", name,
"mime-type", NULL, /* FIXME!! */
NULL);
g_free (name);
pattern->mask = gimp_temp_buf_new_from_pixbuf (pixbuf, NULL);
g_object_unref (pixbuf);
return g_list_prepend (NULL, pattern);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:38,代码来源:gimppattern-load.c
示例16: e_file_replace_contents_finish
/**
* e_file_replace_contents_finish:
* @file: input #GFile
* @result: a #GAsyncResult
* @new_etag: return location for a new entity tag
* @error: return location for a #GError, or %NULL
*
* Finishes an asynchronous replace of the given @file. See
* e_file_replace_contents_async(). Sets @new_etag to the new entity
* tag for the document, if present. Free it with g_free() when it is
* no longer needed.
*
* Returns: %TRUE on success, %FALSE on failure
**/
gboolean
e_file_replace_contents_finish (GFile *file,
GAsyncResult *result,
gchar **new_etag,
GError **error)
{
GSimpleAsyncResult *simple;
AsyncContext *context;
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
simple = G_SIMPLE_ASYNC_RESULT (result);
context = g_simple_async_result_get_op_res_gpointer (simple);
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
if (new_etag != NULL)
*new_etag = g_strdup (context->new_etag);
return TRUE;
}
开发者ID:jdapena,项目名称:evolution,代码行数:37,代码来源:e-file-utils.c
示例17: empathy_send_file
void
empathy_send_file (EmpathyContact *contact,
GFile *file)
{
EmpathyFTFactory *factory;
GtkRecentManager *manager;
gchar *uri;
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
g_return_if_fail (G_IS_FILE (file));
factory = empathy_ft_factory_dup_singleton ();
empathy_ft_factory_new_transfer_outgoing (factory, contact, file,
empathy_get_current_action_time ());
uri = g_file_get_uri (file);
manager = gtk_recent_manager_get_default ();
gtk_recent_manager_add_item (manager, uri);
g_free (uri);
g_object_unref (factory);
}
开发者ID:Dhinihan,项目名称:empathy,代码行数:23,代码来源:empathy-ui-utils.c
示例18: tmpl_template_parse_file
gboolean
tmpl_template_parse_file (TmplTemplate *self,
GFile *file,
GCancellable *cancellable,
GError **error)
{
GInputStream *stream;
gboolean ret = FALSE;
g_return_val_if_fail (TMPL_IS_TEMPLATE (self), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE);
stream = (GInputStream *)g_file_read (file, cancellable, error);
if (stream != NULL)
{
ret = tmpl_template_parse (self, stream, cancellable, error);
g_object_unref (stream);
}
return ret;
}
开发者ID:aissat,项目名称:gnome-builder,代码行数:23,代码来源:tmpl-template.c
示例19: file_remote_download_image
GFile *
file_remote_download_image (Gimp *gimp,
GFile *file,
gboolean *mounted,
GimpProgress *progress,
GError **error)
{
GFile *local_file;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (mounted != NULL, NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
local_file = file_remote_mount_file (gimp, file, progress);
if (local_file)
{
*mounted = TRUE;
}
else
{
*mounted = FALSE;
local_file = file_remote_get_temp_file (gimp, file);
if (! file_remote_copy_file (gimp, file, local_file, DOWNLOAD,
progress, error))
{
g_object_unref (local_file);
return NULL;
}
}
return local_file;
}
开发者ID:terminateden,项目名称:gimp,代码行数:37,代码来源:file-remote.c
示例20: gel_ui_pixbuf_from_file
/**
* gel_ui_pixbuf_from_file:
* @file: (transfer none): A #GFile
*
* Creates a #GdkPixbuf from a #GFile
*
* Returns: (transfer full): The new #GdkPixbuf or %NULL
*/
GdkPixbuf *
gel_ui_pixbuf_from_file(const GFile *file)
{
g_return_val_if_fail(G_IS_FILE(file), NULL);
GFile *f = (GFile *) file;
GError *error = NULL;
GInputStream *input = (GInputStream *) g_file_read(f, NULL, &error);
if (input == NULL)
{
gchar *uri = g_file_get_uri(f);
g_warning(_("Unable to read GFile('%s'): %s"), uri, error->message);
g_free(uri);
g_error_free(error);
return NULL;
}
GdkPixbuf *ret = gel_ui_pixbuf_from_stream(input);
g_object_unref(input);
return ret;
}
开发者ID:ldotlopez,项目名称:eina,代码行数:32,代码来源:gel-ui-utils.c
注:本文中的G_IS_FILE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论