本文整理汇总了C++中GEDIT_IS_DOCUMENT函数的典型用法代码示例。如果您正苦于以下问题:C++ GEDIT_IS_DOCUMENT函数的具体用法?C++ GEDIT_IS_DOCUMENT怎么用?C++ GEDIT_IS_DOCUMENT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GEDIT_IS_DOCUMENT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _gedit_document_get_empty_search
gboolean
_gedit_document_get_empty_search (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
return doc->priv->empty_search;
}
示例2: gedit_document_get_language
/**
* gedit_document_get_language:
* @doc:
*
* Return value: (transfer none):
*/
GtkSourceLanguage *
gedit_document_get_language (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc));
}
示例3: _gedit_document_needs_saving
/*
* Deletion and external modification is only checked for local files.
*/
gboolean
_gedit_document_needs_saving (GeditDocument *doc)
{
GeditDocumentPrivate *priv;
gboolean externally_modified = FALSE;
gboolean deleted = FALSE;
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
priv = gedit_document_get_instance_private (doc);
if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))
{
return TRUE;
}
if (gtk_source_file_is_local (priv->file))
{
gtk_source_file_check_file_on_disk (priv->file);
externally_modified = gtk_source_file_is_externally_modified (priv->file);
deleted = gtk_source_file_is_deleted (priv->file);
}
return (externally_modified || deleted) && !priv->create;
}
示例4: gedit_document_get_compression_type
/**
* gedit_document_get_compression_type:
* @doc: a #GeditDocument.
*
* Returns: the compression type.
* Deprecated: 3.14: use gtk_source_file_get_compression_type() instead.
*/
GtkSourceCompressionType
gedit_document_get_compression_type (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), 0);
return gtk_source_file_get_compression_type (doc->priv->file);
}
示例5: gedit_document_set_metadata
void
gedit_document_set_metadata (GeditDocument *doc,
const gchar *first_key,
...)
{
GFile *location;
const gchar *key;
const gchar *value;
va_list var_args;
g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
g_return_if_fail (first_key != NULL);
location = gtk_source_file_get_location (doc->priv->file);
if (location == NULL)
{
/* Can't set metadata for untitled documents */
return;
}
va_start (var_args, first_key);
for (key = first_key; key; key = va_arg (var_args, const gchar *))
{
value = va_arg (var_args, const gchar *);
gedit_metadata_manager_set (location, key, value);
}
va_end (var_args);
}
示例6: gedit_document_get_newline_type
/**
* gedit_document_get_newline_type:
* @doc: a #GeditDocument.
*
* Returns: the newline type.
* Deprecated: 3.14: use gtk_source_file_get_newline_type() instead.
*/
GtkSourceNewlineType
gedit_document_get_newline_type (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), 0);
return gtk_source_file_get_newline_type (doc->priv->file);
}
示例7: gedit_document_get_encoding
/**
* gedit_document_get_encoding:
* @doc: a #GeditDocument.
*
* Returns: the encoding.
* Deprecated: 3.14: use gtk_source_file_get_encoding() instead.
*/
const GtkSourceEncoding *
gedit_document_get_encoding (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
return gtk_source_file_get_encoding (doc->priv->file);
}
示例8: gedit_document_is_untitled
gboolean
gedit_document_is_untitled (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
return gtk_source_file_get_location (doc->priv->file) == NULL;
}
示例9: gedit_document_get_file
/**
* gedit_document_get_file:
* @doc: a #GeditDocument.
*
* Gets the associated #GtkSourceFile. You should use it only for reading
* purposes, not for creating a #GtkSourceFileLoader or #GtkSourceFileSaver,
* because gedit does some extra work when loading or saving a file and
* maintains an internal state. If you use in a plugin a file loader or saver on
* the returned #GtkSourceFile, the internal state of gedit won't be updated.
*
* If you want to save the #GeditDocument to a secondary file, you can create a
* new #GtkSourceFile and use a #GtkSourceFileSaver.
*
* Returns: (transfer none): the associated #GtkSourceFile.
* Since: 3.14
*/
GtkSourceFile *
gedit_document_get_file (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
return doc->priv->file;
}
示例10: gedit_document_get_search_context
/**
* gedit_document_get_search_context:
* @doc: a #GeditDocument
*
* Gets the search context. Use this function only if you have used
* gedit_document_set_search_context() before. You should not alter other search
* contexts, so you have to verify that the returned search context is yours.
* One way to verify that is to compare the search settings object, or to mark
* the search context with g_object_set_data().
*
* Returns: (transfer none): the current search context of the document, or NULL
* if there is no current search context.
*/
GtkSourceSearchContext *
gedit_document_get_search_context (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
return doc->priv->search_context;
}
示例11: gedit_document_get_short_name_for_display
/**
* gedit_document_get_short_name_for_display:
* @doc: a #GeditDocument.
*
* Note: this never returns %NULL.
**/
gchar *
gedit_document_get_short_name_for_display (GeditDocument *doc)
{
GeditDocumentPrivate *priv;
GFile *location;
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
priv = gedit_document_get_instance_private (doc);
location = gtk_source_file_get_location (priv->file);
if (priv->short_name != NULL)
{
return g_strdup (priv->short_name);
}
else if (location == NULL)
{
return g_strdup_printf (_("Unsaved Document %d"),
priv->untitled_number);
}
else
{
return gedit_utils_basename_for_display (location);
}
}
示例12: gedit_document_get_content_type
gchar *
gedit_document_get_content_type (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
return g_strdup (doc->priv->content_type);
}
示例13: gedit_document_get_readonly
gboolean
gedit_document_get_readonly (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
return doc->priv->readonly;
}
示例14: gedit_document_goto_line
/* If @line is bigger than the lines of the document, the cursor is moved
* to the last line and FALSE is returned.
*/
gboolean
gedit_document_goto_line (GeditDocument *doc,
gint line)
{
gboolean ret = TRUE;
guint line_count;
GtkTextIter iter;
gedit_debug (DEBUG_DOCUMENT);
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
g_return_val_if_fail (line >= -1, FALSE);
line_count = gtk_text_buffer_get_line_count (GTK_TEXT_BUFFER (doc));
if (line >= line_count)
{
ret = FALSE;
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc),
&iter);
}
else
{
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc),
&iter,
line);
}
gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
return ret;
}
示例15: gedit_document_set_content_type
/**
* gedit_document_set_content_type:
* @doc:
* @content_type: (allow-none):
*/
void
gedit_document_set_content_type (GeditDocument *doc,
const gchar *content_type)
{
g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
gedit_debug (DEBUG_DOCUMENT);
if (content_type == NULL)
{
GFile *location;
gchar *guessed_type = NULL;
/* If content type is null, we guess from the filename */
location = gtk_source_file_get_location (doc->priv->file);
if (location != NULL)
{
gchar *basename;
basename = g_file_get_basename (location);
guessed_type = g_content_type_guess (basename, NULL, 0, NULL);
g_free (basename);
}
set_content_type_no_guess (doc, guessed_type);
g_free (guessed_type);
}
else
{
set_content_type_no_guess (doc, content_type);
}
}