• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GTK_IS_TEXT_BUFFER函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_IS_TEXT_BUFFER函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_IS_TEXT_BUFFER函数的具体用法?C++ GTK_IS_TEXT_BUFFER怎么用?C++ GTK_IS_TEXT_BUFFER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_IS_TEXT_BUFFER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: remove_tag_cb

static void
remove_tag_cb (GbColorPickerDocumentMonitor *self,
               GtkTextTag                   *tag,
               GtkTextIter                  *start,
               GtkTextIter                  *end,
               GtkTextBuffer                *buffer)
{
  GtkTextTagTable *tag_table;
  g_autofree gchar *name = NULL;
  Position spos;
  Position epos;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));
  g_assert (GTK_IS_TEXT_TAG (tag));

  position_save (&spos, start);
  position_save (&epos, end);

  tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (self->buffer));
  g_object_get (G_OBJECT (tag), "name", &name, NULL);

  if (!dzl_str_empty0 (name) &&
      g_str_has_prefix (name, COLOR_TAG_PREFIX) &&
      gtk_text_tag_table_lookup (tag_table, name))
    gtk_text_tag_table_remove (tag_table, tag);

  position_restore (&spos, buffer, start);
  position_restore (&epos, buffer, end);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:30,代码来源:gb-color-picker-document-monitor.c


示例2: text_inserted_after_cb

static void
text_inserted_after_cb (GbColorPickerDocumentMonitor *self,
                        GtkTextIter                  *iter,
                        gchar                        *text,
                        gint                          len,
                        GtkTextBuffer                *buffer)
{
  GtkTextIter begin, end;
  gint offset;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));
  g_assert (iter != NULL);

  begin = *iter;
  offset = gtk_text_iter_get_offset (&begin);
  gtk_text_iter_set_offset (&begin, offset - len);
  gtk_text_iter_set_line_offset (&begin, 0);

  end = *iter;
  if (!gtk_text_iter_ends_line (&end))
    gtk_text_iter_forward_to_line_end (&end);

  gb_color_picker_document_monitor_queue_colorize (self, &begin, &end);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:25,代码来源:gb-color-picker-document-monitor.c


示例3: cursor_moved_cb

static void
cursor_moved_cb (GbColorPickerDocumentMonitor *self,
                 const GtkTextIter            *location,
                 GtkTextBuffer                *buffer)
{
  g_autoptr(GstyleColor) current_color = NULL;
  GtkTextTag *tag;
  GtkTextIter cursor;
  GtkTextIter begin, end;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));

  if (self->is_in_user_action)
    {
      gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (self->buffer));
      self->is_in_user_action = FALSE;
    }

  cursor = *location;

  /* TODO: fast path: check if we are in the last already detected color tag */
  tag = gb_color_picker_helper_get_tag_at_iter (&cursor, &current_color, &begin, &end);
  if (tag != NULL)
    g_signal_emit (self, signals [COLOR_FOUND], 0, current_color);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:26,代码来源:gb-color-picker-document-monitor.c


示例4: text_inserted_cb

static void
text_inserted_cb (GbColorPickerDocumentMonitor *self,
                  GtkTextIter                  *cursor,
                  gchar                        *text,
                  gint                          len,
                  GtkTextBuffer                *buffer)
{
  g_autoptr(GstyleColor) color = NULL;
  GtkTextTag *tag;
  GtkTextIter begin, end;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));
  g_assert (cursor != NULL);

  tag = gb_color_picker_helper_get_tag_at_iter (cursor, &color, &begin, &end);

  if (tag != NULL )
    {
      gtk_text_iter_set_line_offset (&begin, 0);
      if (!gtk_text_iter_ends_line (&end))
        gtk_text_iter_forward_to_line_end (&end);

      gb_color_picker_document_monitor_queue_uncolorize (self, &begin, &end);
    }
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:26,代码来源:gb-color-picker-document-monitor.c


示例5: wikipad_document_notify_cursor_position

static void
wikipad_document_notify_cursor_position (GtkTextBuffer    *buffer,
                                          GParamSpec       *pspec,
                                          WikipadDocument *document)
{
  GtkTextIter iter;
  gint        line, column, selection;
  gint        tab_size;

  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (WIKIPAD_IS_DOCUMENT (document));

  /* get the current iter position */
  gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));

  /* get the current line number */
  line = gtk_text_iter_get_line (&iter) + 1;

  /* get the tab size */
  tab_size = WIKIPAD_SETTING_GET_INT (TAB_WIDTH);

  /* get the column */
  column = wikipad_util_get_real_line_offset (&iter, tab_size);

  /* get length of the selection */
  selection = wikipad_view_get_selection_length (document->textview, NULL);

  /* emit the signal */
  g_signal_emit (G_OBJECT (document), document_signals[CURSOR_CHANGED], 0, line, column, selection);
}
开发者ID:paulmadore,项目名称:wikipad,代码行数:30,代码来源:wikipad-document.c


示例6: gsc_utils_replace_word

void
gsc_utils_replace_word (GtkTextBuffer *text_buffer,
                        GtkTextIter     *iter,
                        const gchar     *text,
                        gint             len)
{
    GtkTextBuffer *buffer;
    gchar *word;
    GtkTextIter word_start;
    GtkTextIter word_end;
    GtkTextMark *mark;

    g_return_if_fail (GTK_IS_TEXT_BUFFER (text_buffer));

    buffer = GTK_TEXT_BUFFER (text_buffer);
    gtk_text_buffer_begin_user_action (buffer);

    mark = gtk_text_buffer_create_mark (buffer, NULL, iter, TRUE);
    word = gsc_utils_get_word_iter (text_buffer, iter, &word_start, &word_end);
    g_free (word);

    gtk_text_buffer_delete (buffer, &word_start, &word_end);

    if (text != NULL)
    {
        gtk_text_buffer_insert (buffer, &word_start, text, len);
    }

    /* Reinitialize iter */
    gtk_text_buffer_get_iter_at_mark (buffer, iter, mark);
    gtk_text_buffer_delete_mark (buffer, mark);
    gtk_text_buffer_end_user_action (buffer);
}
开发者ID:chuchiperriman,项目名称:gtksourcecompletion,代码行数:33,代码来源:gsc-utils.c


示例7: wikipad_document_label_color

static void
wikipad_document_label_color (WikipadDocument *document)
{
  GdkColor  green = {0, 0x0000, 0x9999, 0x0000};
  GdkColor  red   = {0, 0xffff, 0x0000, 0x0000};
  GdkColor *color;

  g_return_if_fail (WIKIPAD_IS_DOCUMENT (document));
  g_return_if_fail (GTK_IS_TEXT_BUFFER (document->buffer));
  g_return_if_fail (WIKIPAD_IS_FILE (document->file));

  if (document->priv->label)
    {
      /* label color */
      if (gtk_text_buffer_get_modified (document->buffer))
        color = &red;
      else if (wikipad_file_get_read_only (document->file))
        color = &green;
      else
        color = NULL;

      /* update colors */
      gtk_widget_modify_fg (document->priv->label, GTK_STATE_NORMAL, color);
      gtk_widget_modify_fg (document->priv->label, GTK_STATE_ACTIVE, color);
    }
}
开发者ID:paulmadore,项目名称:wikipad,代码行数:26,代码来源:wikipad-document.c


示例8: gtk_text_buffer_deserialize_get_can_create_tags

/**
 * gtk_text_buffer_deserialize_get_can_create_tags:
 * @buffer: a #GtkTextBuffer
 * @format: a #GdkAtom representing a registered rich text format
 *
 * This functions returns the value set with
 * gtk_text_buffer_deserialize_set_can_create_tags()
 *
 * Return value: whether deserializing this format may create tags
 *
 * Since: 2.10
 **/
gboolean
gtk_text_buffer_deserialize_get_can_create_tags (GtkTextBuffer *buffer,
                                                 GdkAtom        format)
{
  GList *formats;
  GList *list;
  gchar *format_name;

  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
  g_return_val_if_fail (format != GDK_NONE, FALSE);

  formats = g_object_get_qdata (G_OBJECT (buffer), deserialize_quark ());

  for (list = formats; list; list = g_list_next (list))
    {
      GtkRichTextFormat *fmt = list->data;

      if (fmt->atom == format)
        {
          return fmt->can_create_tags;
        }
    }

  format_name = gdk_atom_name (format);
  g_warning ("%s: \"%s\" is not registered as deserializable format "
             "with text buffer %p",
             G_STRFUNC, format_name ? format_name : "not a GdkAtom", buffer);
  g_free (format_name);

  return FALSE;
}
开发者ID:BYC,项目名称:gtk,代码行数:43,代码来源:gtktextbufferrichtext.c


示例9: wikipad_document_notify_has_selection

static void
wikipad_document_notify_has_selection (GtkTextBuffer    *buffer,
                                        GParamSpec       *pspec,
                                        WikipadDocument *document)
{
  gint     selection;
  gboolean is_column_selection;

  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (WIKIPAD_IS_DOCUMENT (document));

  /* get length of the selection */
  selection = wikipad_view_get_selection_length (document->textview, &is_column_selection);

  /* don't send large numbers */
  if (selection > 1)
    selection = 1;

  /* if it's a column selection with content */
  if (selection == 1 && is_column_selection)
    selection = 2;

  /* emit the signal */
  g_signal_emit (G_OBJECT (document), document_signals[SELECTION_CHANGED], 0, selection);
}
开发者ID:paulmadore,项目名称:wikipad,代码行数:25,代码来源:wikipad-document.c


示例10: ide_highlight_engine__buffer_delete_range_cb

static void
ide_highlight_engine__buffer_delete_range_cb (IdeHighlightEngine *self,
        GtkTextIter        *range_begin,
        GtkTextIter        *range_end,
        IdeBuffer          *buffer)
{
    GtkTextBuffer *text_buffer = (GtkTextBuffer *)buffer;
    GtkTextIter begin;
    GtkTextIter end;

    IDE_ENTRY;

    g_assert (IDE_IS_HIGHLIGHT_ENGINE (self));
    g_assert (range_begin);
    g_assert (IDE_IS_BUFFER (buffer));
    g_assert (GTK_IS_TEXT_BUFFER (text_buffer));

    /*
     * No need to use the range_end since everything that
     * was after range_end will now be after range_begin
     */
    begin = *range_begin;
    end = *range_begin;

    invalidate_and_highlight (self, &begin, &end);

    IDE_EXIT;
}
开发者ID:sramkrishna,项目名称:gnome-builder,代码行数:28,代码来源:ide-highlight-engine.c


示例11: xfce_about_copyright

static void
xfce_about_copyright (GtkTextBuffer *buffer)
{
  GtkTextIter end;

  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));

  gtk_text_buffer_get_end_iter (buffer, &end);

  gtk_text_buffer_insert (buffer, &end,
      _("Xfce 4 is copyright Olivier Fourdan ([email protected]). The different "
        "components are copyrighted by their respective authors."), -1);

  gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
  gtk_text_buffer_insert (buffer, &end,
      _("The libxfce4ui, libxfce4util and exo packages are "
        "distributed under the terms of the GNU Library General Public License as "
        "published by the Free Software Foundation; either version 2 of the License, or "
        "(at your option) any later version."), -1);

  gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
  gtk_text_buffer_insert (buffer, &end,
      _("The packages thunar, xfce4-appfinder, xfce4-panel, xfce4-session, "
        "xfce4-settings, xfconf, xfdesktop and xfwm4 are "
        "distributed under the terms of the GNU General Public License as "
        "published by the Free Software Foundation; either version 2 of the "
        "License, or (at your option) any later version."), -1);

  gtk_text_buffer_insert (buffer, &end, "\n", -1);
}
开发者ID:xfce-mirror,项目名称:libxfce4ui,代码行数:30,代码来源:main.c


示例12: xfce_about_license

static void
xfce_about_license (GtkBuilder *builder,
                    GObject    *buffer)
{
  GObject         *dialog;
  GObject         *object;
  static gboolean  initial = TRUE;

  g_return_if_fail (GTK_IS_BUILDER (builder));
  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));

  object = gtk_builder_get_object (builder, "license-textview");
  gtk_text_view_set_buffer (GTK_TEXT_VIEW (object), GTK_TEXT_BUFFER (buffer));

  dialog = gtk_builder_get_object (builder, "license-dialog");
  if (initial)
    {
      g_signal_connect (G_OBJECT (dialog), "delete-event",
           G_CALLBACK (gtk_widget_hide_on_delete), NULL);

      object = gtk_builder_get_object (builder, "license-close-button");
      g_signal_connect_swapped (G_OBJECT (object), "clicked",
          G_CALLBACK (gtk_widget_hide), dialog);

      object = gtk_builder_get_object (builder, "window");
      gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (object));

      initial = FALSE;
    }

  gtk_widget_show (GTK_WIDGET (dialog));
}
开发者ID:xfce-mirror,项目名称:libxfce4ui,代码行数:32,代码来源:main.c


示例13: ide_highlight_engine__buffer_insert_text_cb

static void
ide_highlight_engine__buffer_insert_text_cb (IdeHighlightEngine *self,
        GtkTextIter        *location,
        gchar              *text,
        gint                len,
        IdeBuffer          *buffer)
{
    GtkTextBuffer *text_buffer = (GtkTextBuffer *)buffer;
    GtkTextIter begin;
    GtkTextIter end;

    IDE_ENTRY;

    g_assert (IDE_IS_HIGHLIGHT_ENGINE (self));
    g_assert (location);
    g_assert (text);
    g_assert (IDE_IS_BUFFER (buffer));
    g_assert (GTK_IS_TEXT_BUFFER (text_buffer));

    /*
     * Backward the begin iter len characters from location
     * (location points to the end of the string) in order to get
     * the iter position where our inserted text was started.
     */
    begin = *location;
    gtk_text_iter_backward_chars (&begin, g_utf8_strlen (text, len));

    end = *location;

    invalidate_and_highlight (self, &begin, &end);

    IDE_EXIT;
}
开发者ID:sramkrishna,项目名称:gnome-builder,代码行数:33,代码来源:ide-highlight-engine.c


示例14: gtk_text_buffer_register_serialize_format

/**
 * gtk_text_buffer_register_serialize_format:
 * @buffer: a #GtkTextBuffer
 * @mime_type: the format's mime-type
 * @function: the serialize function to register
 * @user_data: %function's user_data
 * @user_data_destroy: a function to call when @user_data is no longer needed
 *
 * This function registers a rich text serialization @function along with
 * its @mime_type with the passed @buffer.
 *
 * Return value: (transfer none): the #GdkAtom that corresponds to the
 *               newly registered format's mime-type.
 *
 * Since: 2.10
 **/
GdkAtom
gtk_text_buffer_register_serialize_format (GtkTextBuffer              *buffer,
                                           const gchar                *mime_type,
                                           GtkTextBufferSerializeFunc  function,
                                           gpointer                    user_data,
                                           GDestroyNotify              user_data_destroy)
{
  GList   *formats;
  GdkAtom  atom;

  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), GDK_NONE);
  g_return_val_if_fail (mime_type != NULL && *mime_type != '\0', GDK_NONE);
  g_return_val_if_fail (function != NULL, GDK_NONE);

  formats = g_object_steal_qdata (G_OBJECT (buffer), serialize_quark ());

  formats = register_format (formats, mime_type,
                             (gpointer) function,
                             user_data, user_data_destroy,
                             &atom);

  g_object_set_qdata_full (G_OBJECT (buffer), serialize_quark (),
                           formats, (GDestroyNotify) free_format_list);

  g_object_notify (G_OBJECT (buffer), "copy-target-list");

  return atom;
}
开发者ID:BYC,项目名称:gtk,代码行数:44,代码来源:gtktextbufferrichtext.c


示例15: ide_source_snippet_after_delete_range

void
ide_source_snippet_after_delete_range (IdeSourceSnippet *self,
                                       GtkTextBuffer    *buffer,
                                       GtkTextIter      *begin,
                                       GtkTextIter      *end)
{
  GtkTextMark *here;

  g_return_if_fail (IDE_IS_SOURCE_SNIPPET (self));
  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (begin);
  g_return_if_fail (end);

  here = gtk_text_buffer_create_mark (buffer, NULL, begin, TRUE);

  ide_source_snippet_update_context (self);
  ide_source_snippet_update_context (self);
  ide_source_snippet_rewrite_updated_chunks (self);

  gtk_text_buffer_get_iter_at_mark (buffer, begin, here);
  gtk_text_buffer_get_iter_at_mark (buffer, end, here);
  gtk_text_buffer_delete_mark (buffer, here);

#if 0
  ide_source_snippet_context_dump (self->snippet_context);
#endif
}
开发者ID:meghprkh,项目名称:gnome-builder,代码行数:27,代码来源:ide-source-snippet.c


示例16: ide_source_snippet_before_insert_text

void
ide_source_snippet_before_insert_text (IdeSourceSnippet *self,
                                       GtkTextBuffer    *buffer,
                                       GtkTextIter      *iter,
                                       gchar            *text,
                                       gint              len)
{
  gint utf8_len;
  gint n;

  g_return_if_fail (IDE_IS_SOURCE_SNIPPET (self));
  g_return_if_fail (self->current_chunk >= 0);
  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (iter);

  n = ide_source_snippet_get_index (self, iter);
  utf8_len = g_utf8_strlen (text, len);
  g_array_index (self->runs, gint, n) += utf8_len;

#if 0
  g_print ("I: ");
  for (n = 0; n < self->runs->len; n++)
    g_print ("%d ", g_array_index (self->runs, gint, n));
  g_print ("\n");
#endif
}
开发者ID:meghprkh,项目名称:gnome-builder,代码行数:26,代码来源:ide-source-snippet.c


示例17: gimp_text_buffer_save

gboolean
gimp_text_buffer_save (GtkTextBuffer  *buffer,
                       const gchar    *filename,
                       gboolean        selection_only,
                       GError        **error)
{
  GtkTextIter  start_iter;
  GtkTextIter  end_iter;
  gint         fd;
  gchar       *text_contents;

  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
  g_return_val_if_fail (filename != NULL, FALSE);
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

  fd = g_open (filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);

  if (fd == -1)
    {
      g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
                   g_strerror (errno));
      return FALSE;
    }

  if (selection_only)
    gtk_text_buffer_get_selection_bounds (buffer, &start_iter, &end_iter);
  else
    gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);

  text_contents = gtk_text_buffer_get_text (buffer,
                                            &start_iter, &end_iter, TRUE);

  if (text_contents)
    {
      gint text_length = strlen (text_contents);

      if (text_length > 0)
        {
          gint bytes_written;

          bytes_written = write (fd, text_contents, text_length);

          if (bytes_written != text_length)
            {
              g_free (text_contents);
              close (fd);
              g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
                           g_strerror (errno));
              return FALSE;
            }
        }

      g_free (text_contents);
    }

  close (fd);

  return TRUE;
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:59,代码来源:gimpwidgets-utils.c


示例18: ide_source_snippet_before_delete_range

void
ide_source_snippet_before_delete_range (IdeSourceSnippet *self,
                                        GtkTextBuffer    *buffer,
                                        GtkTextIter      *begin,
                                        GtkTextIter      *end)
{
  IdeSourceSnippetChunk *chunk;
  gchar *new_text;
  gint *run;
  gint len;
  gint n;
  gint i;
  gint lower_bound = -1;
  gint upper_bound = -1;

  g_return_if_fail (IDE_IS_SOURCE_SNIPPET (self));
  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (begin);
  g_return_if_fail (end);

  len = gtk_text_iter_get_offset (end) - gtk_text_iter_get_offset (begin);
  n = ide_source_snippet_get_index (self, begin);
  self->current_chunk = n;

  while (len && n < self->runs->len)
    {
      if (lower_bound == -1 || n < lower_bound)
        lower_bound = n;
      if (n > upper_bound)
        upper_bound = n;
      run = &g_array_index (self->runs, gint, n);
      if (len > *run)
        {
          len -= *run;
          *run = 0;
          n++;
          continue;
        }
      *run -= len;
      len = 0;
      break;
    }

  for (i = lower_bound; i <= upper_bound; i++)
    {
      chunk = g_ptr_array_index (self->chunks, i);
      new_text = ide_source_snippet_get_nth_text (self, i);
      ide_source_snippet_chunk_set_text (chunk, new_text);
      ide_source_snippet_chunk_set_text_set (chunk, TRUE);
      g_free (new_text);
    }

#if 0
  g_print ("D: ");
  for (n = 0; n < self->runs->len; n++)
    g_print ("%d ", g_array_index (self->runs, gint, n));
  g_print ("\n");
#endif
}
开发者ID:meghprkh,项目名称:gnome-builder,代码行数:59,代码来源:ide-source-snippet.c


示例19: get_state

static guint32
get_state (GtkTextBuffer *buffer)
{
	g_return_val_if_fail (buffer != NULL, E_BUFFER_TAGGER_STATE_NONE);
	g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), E_BUFFER_TAGGER_STATE_NONE);

	return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (buffer), E_BUFFER_TAGGER_DATA_STATE));
}
开发者ID:UIKit0,项目名称:evolution,代码行数:8,代码来源:e-buffer-tagger.c


示例20: ide_source_snippet_begin

gboolean
ide_source_snippet_begin (IdeSourceSnippet *self,
                          GtkTextBuffer    *buffer,
                          GtkTextIter      *iter)
{
  IdeSourceSnippetContext *context;
  IdeSourceSnippetChunk *chunk;
  const gchar *text;
  gboolean ret;
  gint len;
  gint i;

  g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET (self), FALSE);
  g_return_val_if_fail (!self->buffer, FALSE);
  g_return_val_if_fail (!self->mark_begin, FALSE);
  g_return_val_if_fail (!self->mark_end, FALSE);
  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
  g_return_val_if_fail (iter, FALSE);

  self->inserted = TRUE;

  context = ide_source_snippet_get_context (self);

  ide_source_snippet_update_context (self);
  ide_source_snippet_context_emit_changed (context);
  ide_source_snippet_update_context (self);

  self->buffer = g_object_ref (buffer);
  self->mark_begin = gtk_text_buffer_create_mark (buffer, NULL, iter, TRUE);
  g_object_add_weak_pointer (G_OBJECT (self->mark_begin),
                             (gpointer *) &self->mark_begin);

  gtk_text_buffer_begin_user_action (buffer);

  for (i = 0; i < self->chunks->len; i++)
    {
      chunk = g_ptr_array_index (self->chunks, i);
      if ((text = ide_source_snippet_chunk_get_text (chunk)))
        {
          len = g_utf8_strlen (text, -1);
          g_array_append_val (self->runs, len);
          gtk_text_buffer_insert (buffer, iter, text, -1);
        }
    }

  self->mark_end = gtk_text_buffer_create_mark (buffer, NULL, iter, FALSE);
  g_object_add_weak_pointer (G_OBJECT (self->mark_end),
                             (gpointer *) &self->mark_end);

  g_object_ref (self->mark_begin);
  g_object_ref (self->mark_end);

  gtk_text_buffer_end_user_action (buffer);

  ret = ide_source_snippet_move_next (self);

  return ret;
}
开发者ID:meghprkh,项目名称:gnome-builder,代码行数:58,代码来源:ide-source-snippet.c



注:本文中的GTK_IS_TEXT_BUFFER函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_IS_TREE_VIEW函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_IS_MENU_ITEM函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap