Esempio n. 1
0
static void
ide_editor_frame_set_property (GObject      *object,
                               guint         prop_id,
                               const GValue *value,
                               GParamSpec   *pspec)
{
  IdeEditorFrame *self = IDE_EDITOR_FRAME (object);

  switch (prop_id)
    {
    case PROP_AUTO_HIDE_MAP:
      ide_editor_frame_set_auto_hide_map (self, g_value_get_boolean (value));
      break;

    case PROP_DOCUMENT:
      ide_editor_frame_set_document (self, g_value_get_object (value));
      break;

    case PROP_BACK_FORWARD_LIST:
      ide_source_view_set_back_forward_list (self->source_view, g_value_get_object (value));
      break;

    case PROP_SHOW_MAP:
      ide_editor_frame_set_show_map (self, g_value_get_boolean (value));
      break;

    case PROP_SHOW_RULER:
      ide_editor_frame_set_show_ruler (self, g_value_get_boolean (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
    }
}
Esempio n. 2
0
static void
ide_editor_view_set_document (IdeEditorView *self,
                              IdeBuffer     *document)
{
  g_return_if_fail (IDE_IS_EDITOR_VIEW (self));
  g_return_if_fail (IDE_IS_BUFFER (document));

  if (g_set_object (&self->document, document))
    {
      if (self->frame1)
        ide_editor_frame_set_document (self->frame1, document);

      if (self->frame2)
        ide_editor_frame_set_document (self->frame2, document);

      g_settings_bind (self->settings, "style-scheme-name",
                       document, "style-scheme-name",
                       G_SETTINGS_BIND_GET);
      g_settings_bind (self->settings, "highlight-matching-brackets",
                       document, "highlight-matching-brackets",
                       G_SETTINGS_BIND_GET);

      g_signal_connect_object (document,
                               "cursor-moved",
                               G_CALLBACK (ide_editor_view__buffer_cursor_moved),
                               self,
                               G_CONNECT_SWAPPED);

      g_object_bind_property_full (document, "language", self->tweak_button,
                                   "label", G_BINDING_SYNC_CREATE,
                                   language_to_string, NULL, NULL, NULL);

      g_signal_connect_object (document,
                               "modified-changed",
                               G_CALLBACK (ide_editor_view__buffer_modified_changed),
                               self,
                               G_CONNECT_SWAPPED);

      g_signal_connect_object (document,
                               "notify::title",
                               G_CALLBACK (ide_editor_view__buffer_notify_title),
                               self,
                               G_CONNECT_SWAPPED);

      g_signal_connect_object (document,
                               "notify::language",
                               G_CALLBACK (ide_editor_view__buffer_notify_language),
                               self,
                               G_CONNECT_SWAPPED);

      g_signal_connect_object (document,
                               "notify::changed-on-volume",
                               G_CALLBACK (ide_editor_view__buffer_changed_on_volume),
                               self,
                               G_CONNECT_SWAPPED);

      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DOCUMENT]);

      g_object_bind_property (document, "has-diagnostics",
                              self->warning_button, "visible",
                              G_BINDING_SYNC_CREATE);

      ide_editor_view__buffer_notify_language (self, NULL, document);
      ide_editor_view__buffer_notify_title (self, NULL, IDE_BUFFER (document));

      ide_editor_view_actions_update (self);
    }
}