这篇教程C++ G_IS_FILE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中G_IS_FILE函数的典型用法代码示例。如果您正苦于以下问题:C++ G_IS_FILE函数的具体用法?C++ G_IS_FILE怎么用?C++ G_IS_FILE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了G_IS_FILE函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ide_git_vcs_is_ignoredstatic gbooleanide_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,
示例2: compare_to_filestatic gbooleancompare_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,
示例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. */voidide_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,
示例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,
示例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 **/voidgimp_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,
示例6: gedit_recent_remove_if_localvoidgedit_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,
示例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 **/gbooleangimp_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,
示例8: photos_glib_file_create_asyncvoidphotos_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,
示例9: gtk_hotkey_key_file_registry_real_has_hotkeystatic gbooleangtk_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,
示例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. */voidempathy_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,
示例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. */voidempathy_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,
示例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,
示例13: photos_glib_file_copy_createstatic voidphotos_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,
示例14: xml_reader_load_from_filegbooleanxml_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,
示例15: gimp_pattern_load_pixbufGList *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,
示例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 **/gbooleane_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,
示例17: empathy_send_filevoidempathy_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,
示例18: tmpl_template_parse_filegbooleantmpl_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,
示例19: file_remote_download_imageGFile *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,
示例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,
示例21: _gtk_css_parser_newGtkCssParser *_gtk_css_parser_new (const char *data, GFile *file, GtkCssParserErrorFunc error_func, gpointer user_data){ GtkCssParser *parser; g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (file == NULL || G_IS_FILE (file), NULL); parser = g_slice_new0 (GtkCssParser); parser->data = data; if (file) parser->file = g_object_ref (file); parser->error_func = error_func; parser->user_data = user_data; parser->line_start = data; parser->line = 0; return parser;}
开发者ID:3v1n0,项目名称:gtk,代码行数:24,
示例22: reload_find_in_ancestors_cbstatic voidreload_find_in_ancestors_cb (GFile *workdir, GAsyncResult *result, gpointer user_data){ g_autoptr(IdeTask) task = user_data; g_autoptr(GError) error = NULL; g_autoptr(GFile) vagrantfile = NULL; g_assert (G_IS_FILE (workdir)); g_assert (G_IS_ASYNC_RESULT (result)); g_assert (IDE_IS_TASK (task)); if (!(vagrantfile = ide_g_file_find_in_ancestors_finish (result, &error))) ide_task_return_error (task, g_steal_pointer (&error)); else gbp_vagrant_runtime_provider_command_async (ide_task_get_source_object (task), (const gchar * const *)cmd_vagrant_status, ide_task_get_cancellable (task), (GAsyncReadyCallback) vagrant_status_cb, g_object_ref (task));}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:24,
示例23: empathy_tp_file_accept/** * empathy_tp_file_accept: * @self: an incoming #EmpathyTpFile * @offset: the offset of @gfile where we should start writing * @gfile: the destination #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 * * Accepts an incoming file transfer, saving the result into @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. */voidempathy_tp_file_accept (EmpathyTpFile *self, guint64 offset, 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; self->priv->offset = offset; g_file_replace_async (gfile, NULL, FALSE, G_FILE_CREATE_NONE, G_PRIORITY_DEFAULT, cancellable, file_replace_async_cb, self);}
开发者ID:raluca-elena,项目名称:empathy-cheese,代码行数:43,
示例24: gimp_color_profile_store_history_insertstatic gbooleangimp_color_profile_store_history_insert (GimpColorProfileStore *store, GtkTreeIter *iter, GFile *file, const gchar *label, gint index){ GtkTreeModel *model = GTK_TREE_MODEL (store); GtkTreeIter sibling; gboolean iter_valid; g_return_val_if_fail (G_IS_FILE (file), FALSE); g_return_val_if_fail (label != NULL, FALSE); g_return_val_if_fail (index > -1, FALSE); gimp_color_profile_store_get_separator (store, iter, FALSE); for (iter_valid = gtk_tree_model_get_iter_first (model, &sibling); iter_valid; iter_valid = gtk_tree_model_iter_next (model, &sibling)) { gint type; gint this_index; gtk_tree_model_get (model, &sibling, GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, &type, GIMP_COLOR_PROFILE_STORE_INDEX, &this_index, -1); if (type == GIMP_COLOR_PROFILE_STORE_ITEM_SEPARATOR_BOTTOM) { gtk_list_store_insert_before (GTK_LIST_STORE (store), iter, &sibling); break; } if (type == GIMP_COLOR_PROFILE_STORE_ITEM_FILE && this_index > -1) { gchar *this_label; gtk_tree_model_get (model, &sibling, GIMP_COLOR_PROFILE_STORE_LABEL, &this_label, -1); if (this_label && g_utf8_collate (label, this_label) < 0) { gtk_list_store_insert_before (GTK_LIST_STORE (store), iter, &sibling); g_free (this_label); break; } g_free (this_label); } } if (iter_valid) gtk_list_store_set (GTK_LIST_STORE (store), iter, GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, GIMP_COLOR_PROFILE_STORE_ITEM_FILE, GIMP_COLOR_PROFILE_STORE_FILE, file, GIMP_COLOR_PROFILE_STORE_LABEL, label, GIMP_COLOR_PROFILE_STORE_INDEX, index, -1); return iter_valid;}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:67,
示例25: rygel_media_export_harvester_on_file_addedstatic voidrygel_media_export_harvester_on_file_added (RygelMediaExportHarvester *self, GFile *file) { gchar *uri; GError *error; RygelMediaExportMediaCache *cache; GFileInfo *info; RygelMediaExportHarvesterPrivate *priv; g_return_if_fail (RYGEL_MEDIA_EXPORT_IS_HARVESTER (self)); g_return_if_fail (G_IS_FILE (file)); uri = g_file_get_uri (file); g_debug ("Filesystem events settled for %s, scheduling extraction…", uri); g_free (uri); cache = rygel_media_export_media_cache_get_default (); priv = self->priv; error = NULL; info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, priv->cancellable, &error); if (error) { g_warning ("Failed to query file: %s", error->message); g_error_free (error); error = NULL; goto out; } if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY || rygel_media_export_harvester_is_eligible (info)) { RygelMediaContainer *parent_container = NULL; GFile *current = g_object_ref (file); GeeAbstractCollection *abstract_locations = GEE_ABSTRACT_COLLECTION (priv->locations); do { GFile *parent = g_file_get_parent (current); gchar *id = rygel_media_export_media_cache_get_id (parent); RygelMediaObject *tmp_object = rygel_media_export_media_cache_get_object (cache, id, &error); if (error) { g_warning (_("Error fetching object '%s' from database: %s"), id, error->message); g_free (id); g_object_unref (parent); g_error_free (error); error = NULL; goto inner_out; } g_free (id); if (parent_container) { g_object_unref (parent_container); parent_container = NULL; } if (RYGEL_IS_MEDIA_CONTAINER (tmp_object)) { parent_container = RYGEL_MEDIA_CONTAINER (tmp_object); } else { g_object_unref (tmp_object); } if (!parent_container) { g_object_ref (parent); g_object_unref (current); current = parent; } g_object_unref (parent); if (!parent_container && gee_abstract_collection_contains (abstract_locations, current)) { RygelMediaObject* another_object = rygel_media_export_media_cache_get_object (cache, RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID, &error); if (error) { goto inner_out; } if (parent_container) { g_object_unref (parent_container); parent_container = NULL; } if (RYGEL_IS_MEDIA_CONTAINER (another_object)) { parent_container = RYGEL_MEDIA_CONTAINER (another_object); } break; } } while (!parent_container); rygel_media_export_harvester_schedule (self, current, parent_container, NULL); inner_out: g_object_unref (current); if (parent_container) { g_object_unref (parent_container); } } else { gchar* file_uri = g_file_get_uri (file); g_debug ("%s is not eligible for extraction", file_uri);//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:rygel-gst-0-10-plugins,代码行数:101,
示例26: gimp_brush_generated_loadGList *gimp_brush_generated_load (GimpContext *context, GFile *file, GInputStream *input, GError **error){ GimpBrush *brush; GDataInputStream *data_input; gchar *string; gsize string_len; gint linenum; gchar *name = NULL; GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE; gboolean have_shape = FALSE; gint spikes = 2; gdouble spacing; gdouble radius; gdouble hardness; gdouble aspect_ratio; gdouble angle; 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); data_input = g_data_input_stream_new (input); /* make sure the file we are reading is the right type */ linenum = 1; string_len = 256; string = g_data_input_stream_read_line (data_input, &string_len, NULL, error); if (! string) goto failed; if (! g_str_has_prefix (string, "GIMP-VBR")) { g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, _("Not a GIMP brush file.")); g_free (string); goto failed; } g_free (string); /* make sure we are reading a compatible version */ linenum++; string_len = 256; string = g_data_input_stream_read_line (data_input, &string_len, NULL, error); if (! string) goto failed; if (! g_str_has_prefix (string, "1.0")) { if (! g_str_has_prefix (string, "1.5")) { g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, _("Unknown GIMP brush version.")); g_free (string); goto failed; } else { have_shape = TRUE; } } g_free (string); /* read name */ linenum++; string_len = 256; string = g_data_input_stream_read_line (data_input, &string_len, NULL, error); if (! string) goto failed; g_strstrip (string); /* the empty string is not an allowed name */ if (strlen (string) < 1) { name = g_strdup (_("Untitled")); } else { name = gimp_any_to_utf8 (string, -1, _("Invalid UTF-8 string in brush file '%s'."), gimp_file_get_utf8_name (file)); } g_free (string); if (have_shape) { GEnumClass *enum_class; GEnumValue *shape_val; enum_class = g_type_class_peek (GIMP_TYPE_BRUSH_GENERATED_SHAPE);//.........这里部分代码省略.........
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:101,
示例27: file_import_imagevoidfile_import_image (GimpImage *image, GimpContext *context, GFile *file, gboolean interactive, GimpProgress *progress){ GimpCoreConfig *config; g_return_if_fail (GIMP_IS_IMAGE (image)); g_return_if_fail (GIMP_IS_CONTEXT (context)); g_return_if_fail (G_IS_FILE (file)); g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); config = image->gimp->config; if (interactive && gimp_image_get_base_type (image) != GIMP_INDEXED) { if (config->import_promote_float) { GimpPrecision old_precision = gimp_image_get_precision (image); if (old_precision != GIMP_PRECISION_FLOAT_LINEAR) { gimp_image_convert_precision (image, GIMP_PRECISION_FLOAT_LINEAR, GEGL_DITHER_NONE, GEGL_DITHER_NONE, GEGL_DITHER_NONE, progress); if (config->import_promote_dither && old_precision == GIMP_PRECISION_U8_NON_LINEAR) { gimp_image_convert_dither_u8 (image, progress); } } } if (config->import_add_alpha) { GList *layers = gimp_image_get_layer_list (image); GList *list; for (list = layers; list; list = g_list_next (list)) { if (! gimp_viewable_get_children (list->data) && ! gimp_item_is_text_layer (list->data) && ! gimp_drawable_has_alpha (list->data)) { gimp_layer_add_alpha (list->data); } } g_list_free (layers); } } gimp_image_import_color_profile (image, context, progress, interactive); /* Remember the import source */ gimp_image_set_imported_file (image, file); /* We shall treat this file as an Untitled file */ gimp_image_set_file (image, NULL);}
开发者ID:jiapei100,项目名称:gimp,代码行数:66,
注:本文中的G_IS_FILE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ G_IS_OBJECT函数代码示例 C++ G_IS_DRIVE函数代码示例 |