static void gedit_document_end_user_action (GtkTextBuffer *buffer) { GeditDocumentPrivate *priv; priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (buffer)); --priv->user_action; if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action != NULL) { GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action (buffer); } }
static void gedit_document_changed (GtkTextBuffer *buffer) { g_signal_emit (GEDIT_DOCUMENT (buffer), document_signals[CURSOR_MOVED], 0); GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->changed (buffer); }
static void gedit_document_mark_set (GtkTextBuffer *buffer, const GtkTextIter *iter, GtkTextMark *mark) { GeditDocument *doc = GEDIT_DOCUMENT (buffer); if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set != NULL) { GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set (buffer, iter, mark); } if (mark == gtk_text_buffer_get_insert (buffer)) { g_signal_emit (doc, document_signals[CURSOR_MOVED], 0); } }
static void gimp_text_buffer_mark_set (GtkTextBuffer *buffer, const GtkTextIter *location, GtkTextMark *mark) { gimp_text_buffer_clear_insert_tags (GIMP_TEXT_BUFFER (buffer)); GTK_TEXT_BUFFER_CLASS (parent_class)->mark_set (buffer, location, mark); }
static void gimp_text_buffer_class_init (GimpTextBufferClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkTextBufferClass *buffer_class = GTK_TEXT_BUFFER_CLASS (klass); object_class->constructed = gimp_text_buffer_constructed; object_class->dispose = gimp_text_buffer_dispose; object_class->finalize = gimp_text_buffer_finalize; buffer_class->mark_set = gimp_text_buffer_mark_set; }
static void gedit_document_class_init (GeditDocumentClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkTextBufferClass *buf_class = GTK_TEXT_BUFFER_CLASS (klass); object_class->dispose = gedit_document_dispose; object_class->finalize = gedit_document_finalize; object_class->get_property = gedit_document_get_property; object_class->set_property = gedit_document_set_property; object_class->constructed = gedit_document_constructed; buf_class->begin_user_action = gedit_document_begin_user_action; buf_class->end_user_action = gedit_document_end_user_action; buf_class->mark_set = gedit_document_mark_set; buf_class->changed = gedit_document_changed; klass->loaded = gedit_document_loaded_real; klass->saved = gedit_document_saved_real; g_object_class_install_property (object_class, PROP_SHORTNAME, g_param_spec_string ("shortname", "Short Name", "The document's short name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_CONTENT_TYPE, g_param_spec_string ("content-type", "Content Type", "The document's Content Type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_MIME_TYPE, g_param_spec_string ("mime-type", "MIME Type", "The document's MIME Type", "text/plain", G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** * GeditDocument:read-only: * * Whether the document is read-only or not. * * Deprecated: 3.18: Use the #GtkSourceFile API. */ g_object_class_install_property (object_class, PROP_READ_ONLY, g_param_spec_boolean ("read-only", "Read Only", "Whether the document is read-only or not", FALSE, G_PARAM_READABLE | G_PARAM_DEPRECATED | G_PARAM_STATIC_STRINGS)); /** * GeditDocument:empty-search: * * <warning> * The property is used internally by gedit. It must not be used in a * gedit plugin. The property can be modified or removed at any time. * </warning> */ g_object_class_install_property (object_class, PROP_EMPTY_SEARCH, g_param_spec_boolean ("empty-search", "Empty search", "Whether the search is empty", TRUE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** * GeditDocument:use-gvfs-metadata: * * Whether to use GVFS metadata. If %FALSE, use the gedit metadata * manager that stores the metadata in an XML file in the user cache * directory. * * <warning> * The property is used internally by gedit. It must not be used in a * gedit plugin. The property can be modified or removed at any time. * </warning> */ g_object_class_install_property (object_class, PROP_USE_GVFS_METADATA, g_param_spec_boolean ("use-gvfs-metadata", "Use GVFS metadata", "", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); /* This signal is used to update the cursor position in the statusbar, * it's emitted either when the insert mark is moved explicitely or * when the buffer changes (insert/delete). * FIXME When the replace_all was implemented in gedit, this signal was * not emitted during the replace_all to improve performance. Now the * replace_all is implemented in GtkSourceView, so the signal is * emitted. */ document_signals[CURSOR_MOVED] = g_signal_new ("cursor-moved", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GeditDocumentClass, cursor_moved), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * GeditDocument::load: * @document: the #GeditDocument. * * The "load" signal is emitted at the beginning of a file loading. * * Before gedit 3.14 this signal contained parameters to configure the * file loading (the location, encoding, etc). Plugins should not need * those parameters. * * Since: 2.22 */ document_signals[LOAD] = g_signal_new ("load", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GeditDocumentClass, load), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * GeditDocument::loaded: * @document: the #GeditDocument. * * The "loaded" signal is emitted at the end of a successful file * loading. * * Before gedit 3.14 this signal contained a #GError parameter, and the * signal was also emitted if an error occurred. Plugins should not need * the error parameter. */ document_signals[LOADED] = g_signal_new ("loaded", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GeditDocumentClass, loaded), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * GeditDocument::save: * @document: the #GeditDocument. * * The "save" signal is emitted at the beginning of a file saving. * * Before gedit 3.14 this signal contained parameters to configure the * file saving (the location, encoding, etc). Plugins should not need * those parameters. * * Since: 2.20 */ document_signals[SAVE] = g_signal_new ("save", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GeditDocumentClass, save), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * GeditDocument::saved: * @document: the #GeditDocument. * * The "saved" signal is emitted at the end of a successful file saving. * * Before gedit 3.14 this signal contained a #GError parameter, and the * signal was also emitted if an error occurred. To save a document, a * plugin can use the gedit_commands_save_document_async() function and * get the result of the operation with * gedit_commands_save_document_finish(). */ document_signals[SAVED] = g_signal_new ("saved", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GeditDocumentClass, saved), NULL, NULL, NULL, G_TYPE_NONE, 0); }