Ejemplo n.º 1
0
static void
gb_editor_view_class_init (GbEditorViewClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
  GbViewClass *view_class = GB_VIEW_CLASS (klass);

  object_class->constructed = gb_editor_view_constructed;
  object_class->finalize = gb_editor_view_finalize;
  object_class->get_property = gb_editor_view_get_property;
  object_class->set_property = gb_editor_view_set_property;

  widget_class->grab_focus = gb_editor_view_grab_focus;
  widget_class->get_request_mode = gb_editor_view_get_request_mode;
  widget_class->get_preferred_height = gb_editor_view_get_preferred_height;

  view_class->create_split = gb_editor_view_create_split;
  view_class->get_document = gb_editor_view_get_document;
  view_class->get_modified = gb_editor_view_get_modified;
  view_class->set_split_view = gb_editor_view_set_split_view;
  view_class->set_back_forward_list = gb_editor_view_set_back_forward_list;
  view_class->navigate_to = gb_editor_view_navigate_to;

  gParamSpecs [PROP_DOCUMENT] =
    g_param_spec_object ("document",
                         _("Document"),
                         _("The editor document."),
                         GB_TYPE_EDITOR_DOCUMENT,
                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);

  GB_WIDGET_CLASS_TEMPLATE (klass, "gb-editor-view.ui");

  GB_WIDGET_CLASS_BIND (klass, GbEditorView, frame1);
  GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_cancel_button);
  GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_revealer);
  GB_WIDGET_CLASS_BIND (klass, GbEditorView, paned);
  GB_WIDGET_CLASS_BIND (klass, GbEditorView, progress_bar);
  GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_button);
  GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_widget);

  g_type_ensure (GB_TYPE_EDITOR_FRAME);
  g_type_ensure (GB_TYPE_EDITOR_TWEAK_WIDGET);
}
Ejemplo n.º 2
0
static void
gb_terminal_view_class_init (GbTerminalViewClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
  GbViewClass *view_class = GB_VIEW_CLASS (klass);

  object_class->finalize = gb_terminal_view_finalize;
  object_class->get_property = gb_terminal_view_get_property;
  object_class->set_property = gb_terminal_view_set_property;

  widget_class->realize = gb_terminal_realize;
  widget_class->get_preferred_width = gb_terminal_get_preferred_width;
  widget_class->get_preferred_height = gb_terminal_get_preferred_height;
  widget_class->grab_focus = gb_terminal_grab_focus;

  view_class->get_title = gb_terminal_get_title;
  view_class->get_document = gb_terminal_view_get_document;
  view_class->create_split = gb_terminal_create_split;
  view_class->set_split_view =  gb_terminal_set_split_view;

  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/plugins/terminal/gb-terminal-view.ui");
  gtk_widget_class_bind_template_child (widget_class, GbTerminalView, terminal_top);
  gtk_widget_class_bind_template_child (widget_class, GbTerminalView, scrolled_window_bottom);

  g_type_ensure (VTE_TYPE_TERMINAL);

  properties [PROP_DOCUMENT] =
    g_param_spec_object ("document",
                         "Document",
                         "The document for the VTE terminal view.",
                         GB_TYPE_TERMINAL_DOCUMENT,
                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  properties [PROP_FONT_NAME] =
    g_param_spec_string ("font-name",
                         "Font Name",
                         "Font Name",
                         NULL,
                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, properties);
}
Ejemplo n.º 3
0
/**
 * gb_view_source_class_init:
 * @klass: (in): A #GbViewSourceClass.
 *
 * Initializes the #GbViewSourceClass and prepares the vtable.
 */
static void
gb_view_source_class_init (GbViewSourceClass *klass)
{
    GbViewClass *view_class;
    GObjectClass *object_class;
    GtkWidgetClass *widget_class;
    GtkSourceStyleSchemeManager *schemes;

    object_class = G_OBJECT_CLASS(klass);
    object_class->finalize = gb_view_source_finalize;
    object_class->get_property = gb_view_source_get_property;
    object_class->set_property = gb_view_source_set_property;
    g_type_class_add_private(object_class, sizeof(GbViewSourcePrivate));

    widget_class = GTK_WIDGET_CLASS(klass);
    widget_class->grab_focus = gb_view_source_grab_focus;
    widget_class->style_set = gb_view_source_style_set;

    view_class = GB_VIEW_CLASS(klass);
    view_class->is_file = gb_view_source_is_file;
    view_class->save = gb_view_source_save;

    /**
     * GbViewSource:buffer:
     *
     * The "buffer" property is the #GtkSourceBuffer being visualized by
     * the editor.
     */
    gParamSpecs[PROP_BUFFER] =
        g_param_spec_object("buffer",
                            _("Buffer"),
                            _("The text buffer."),
                            GTK_SOURCE_TYPE_BUFFER,
                            G_PARAM_READABLE);
    g_object_class_install_property(object_class, PROP_BUFFER,
                                    gParamSpecs[PROP_BUFFER]);

    /**
     * GbViewSource:file:
     *
     * The "file" property is a #GFile that represents the target path.
     */
    gParamSpecs[PROP_FILE] =
        g_param_spec_object("file",
                            _("File"),
                            _("A GFile to display."),
                            G_TYPE_FILE,
                            G_PARAM_READWRITE);
    g_object_class_install_property(object_class, PROP_FILE,
                                    gParamSpecs[PROP_FILE]);

    /**
     * GbViewSource:path:
     *
     * The "path" property is the path to the destination file.
     */
    gParamSpecs[PROP_PATH] =
        g_param_spec_string("path",
                            _("Path"),
                            _("The path of the file."),
                            NULL,
                            G_PARAM_READABLE);
    g_object_class_install_property(object_class, PROP_PATH,
                                    gParamSpecs[PROP_PATH]);

    /**
     * GbViewSource:source-view:
     *
     * The "source-view" property is the #GtkSourceView widget.
     */
    gParamSpecs[PROP_SOURCE_VIEW] =
        g_param_spec_object("source-view",
                            _("Source View"),
                            _("The GtkSourceView widget."),
                            GTK_SOURCE_TYPE_VIEW,
                            G_PARAM_READABLE);
    g_object_class_install_property(object_class, PROP_SOURCE_VIEW,
                                    gParamSpecs[PROP_SOURCE_VIEW]);

    /**
     * GbViewSource::pre-save:
     *
     * The "pre-save" signal is emitted before saving a buffer.
     */
    gSignals[PRE_SAVE] = g_signal_new("pre-save",
                                      GB_TYPE_VIEW_SOURCE,
                                      G_SIGNAL_RUN_LAST,
                                      0,
                                      NULL,
                                      NULL,
                                      g_cclosure_marshal_VOID__VOID,
                                      G_TYPE_NONE,
                                      0);

    /*
     * Add search paths for our custom style schemes.
     */
    schemes = gtk_source_style_scheme_manager_get_default();
    gtk_source_style_scheme_manager_prepend_search_path(
        schemes, PACKAGE_DATA_DIR"/data/schemes");
    gtk_source_style_scheme_manager_prepend_search_path(schemes, "data/schemes");
}