2

I made a *.ui file in glade, and it won't load with GtkBuilder. "Invalid object type 'GtkSourceView'"

GEdit uses GtkSourceMap, and I was not able to do that either. I've scoured the internet, and none of the answers worked, i.e., installing libgtksourceviewmm, etc.

...
<object class="GtkSourceMap" id="editor">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="editable">False</property>
                <property name="left_margin">2</property>
                <property name="right_margin">2</property>
                <property name="monospace">True</property>
                <property name="show_line_numbers">True</property>
                <property name="show_line_marks">True</property>
                <property name="tab_width">4</property>
                <property name="indent_width">4</property>
                <property name="auto_indent">True</property>
                <property name="insert_spaces_instead_of_tabs">True</property>
                <property name="smart_home_end">always</property>
                <property name="highlight_current_line">True</property>
                <property name="smart_backspace">True</property>
              </object>
...
gtk_builder_add_from_file (builder, SHARE "main.ui", &error);
// share is the prefix for the file, right now it's the 
//  project dir, but it will be "/usr/share/"
cmake_minimum_required(VERSION 3.3)
project(textpad)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

file(GLOB_RECURSE textpad_SOURCES "src/*.cpp")
file(GLOB_RECURSE textpad_HEADERS "src/*.h")
file(GLOB_RECURSE textpad_SOURCES "dep/gtksourceview-4.0.0/*.cpp")
file(GLOB_RECURSE textpad_HEADERS "dep/gtksourceview-4.0.0/*.h")
add_executable(textpad src/main.cpp)

find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(GTK3 REQUIRED gtksourceview-4)

include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})

add_definitions(${GTK3_CFLAGS_OTHER})

target_link_libraries(textpad ${GTK3_LIBRARIES})

set(PREFIX /)

I expected to be able to use it, but it failed with an error: Invalid object type 'GtkSourceView'.

EDIT: Added cmake file

  • Which is the platform that you're working on? What headers are you including? Also did you do the your OS/Compiler alternative for `pkg-config --cflags --libs gtksourceview-4`? – sjsam May 31 '19 at 13:35
  • As and aside are your working with `gtk` or `gtkmm`? You've mentioned you downloaded `libgtksourceviewmm`which probably is the `mm` library and your program looks more like `gtk` code. – sjsam May 31 '19 at 13:38
  • 1
    I am using CLion on Ubuntu Studio 19.04, and `gtk`, I wasn't sure what the difference was until I did some digging last night. I included: ``, ``, and ``. I edited the question to include my CMake file, if that helps. – Daniel Nash May 31 '19 at 17:33

0 Answers0