Started webkit renderer

This commit is contained in:
Markus Koch 2017-02-16 18:26:38 +01:00
parent 0a6beb710c
commit cc6bfe82a1
4 changed files with 48 additions and 15 deletions

View File

@ -7,11 +7,12 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0) pkg_check_modules(GLIB2 REQUIRED glib-2.0)
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0) pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0) pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(WEBKIT REQUIRED webkitgtk-3.0)
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ) INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${WEBKIT_INCLUDE_DIRS})
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS}) LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS} ${WEBKIT_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER}) add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER} ${WEBKIT_CFLAGS_OTHER})
aux_source_directory(./src SRC_LIST) aux_source_directory(./src SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST}) add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${PC_LIBSOUP_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES})

View File

@ -356,6 +356,10 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkStack" id="stackRenderMode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
@ -375,6 +379,12 @@
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
</object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>

View File

@ -424,6 +424,23 @@ static void mainWindow_init_to_default(struct mainWindow *mainWindow)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchText), 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchText), 0);
} }
static void mainWindow_webkit_init(struct mainWindow *mainWindow)
{
GtkWidget *scrollArea;
mainWindow->webkitView = webkit_web_view_new();
/* webkit_web_view_load_uri(WEBKIT_WEB_VIEW(mainWindow->webkitView), "https://notsyncing.net/"); */
webkit_web_view_load_html(WEBKIT_WEB_VIEW(mainWindow->webkitView), "test", "");
gtk_widget_show(mainWindow->webkitView);
scrollArea = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add(GTK_CONTAINER(scrollArea), mainWindow->webkitView);
gtk_stack_add_titled(GTK_STACK(mainWindow->stackRenderMode), scrollArea, "webkit", "webkit");
gtk_widget_show(scrollArea);
gtk_stack_set_visible_child(GTK_STACK(mainWindow->stackRenderMode), scrollArea);
}
/** /**
* @brief mainWindow_new creates a new mainWindow. * @brief mainWindow_new creates a new mainWindow.
* @return Returns struct mainWindow * * @return Returns struct mainWindow *
@ -453,6 +470,7 @@ struct mainWindow *mainWindow_new()
mainWindow->headerBar = GTK_WIDGET(gtk_builder_get_object(builder, "headerBar")); mainWindow->headerBar = GTK_WIDGET(gtk_builder_get_object(builder, "headerBar"));
mainWindow->labelDateToDate = GTK_WIDGET(gtk_builder_get_object(builder, "label_date_to_date")); mainWindow->labelDateToDate = GTK_WIDGET(gtk_builder_get_object(builder, "label_date_to_date"));
mainWindow->buttonDecrypt = GTK_WIDGET(gtk_builder_get_object(builder, "buttonDecrypt")); mainWindow->buttonDecrypt = GTK_WIDGET(gtk_builder_get_object(builder, "buttonDecrypt"));
mainWindow->stackRenderMode = GTK_WIDGET(gtk_builder_get_object(builder, "stackRenderMode"));
mainWindow->entryListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "entryListView")); mainWindow->entryListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "entryListView"));
mainWindow->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection")); mainWindow->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection"));
mainWindow->textBuffer = GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "entryTextBuffer")); mainWindow->textBuffer = GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "entryTextBuffer"));
@ -476,6 +494,7 @@ struct mainWindow *mainWindow_new()
g_object_unref(G_OBJECT(builder)); g_object_unref(G_OBJECT(builder));
mainWindow_configure_treeView(mainWindow); mainWindow_configure_treeView(mainWindow);
mainWindow_webkit_init(mainWindow);
mainWindow_connect_signals(mainWindow); mainWindow_connect_signals(mainWindow);
mainWindow_configure_workspaceTreeView(mainWindow); mainWindow_configure_workspaceTreeView(mainWindow);
mainWindow_init_to_default(mainWindow); mainWindow_init_to_default(mainWindow);

View File

@ -4,6 +4,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <webkit2/webkit2.h>
#include "mdiary.h" #include "mdiary.h"
#define FILE_LIST_MAX_LEN 5 #define FILE_LIST_MAX_LEN 5
@ -32,6 +33,8 @@ struct mainWindow {
GtkWidget *headerBar; GtkWidget *headerBar;
GtkWidget *labelDateToDate; GtkWidget *labelDateToDate;
GtkWidget *buttonDecrypt; GtkWidget *buttonDecrypt;
GtkWidget *webkitView;
GtkWidget *stackRenderMode;
GtkTreeView *entryListView; GtkTreeView *entryListView;
GtkTreeSelection *entryListSelection; GtkTreeSelection *entryListSelection;
GtkTextBuffer *textBuffer; GtkTextBuffer *textBuffer;