Browse Source

Started webkit renderer

newfile
Markus Koch 5 years ago
parent
commit
cc6bfe82a1
  1. 9
      CMakeLists.txt
  2. 32
      glade/mainWindow.glade
  3. 19
      src/mainwindow.c
  4. 3
      src/mainwindow.h

9
CMakeLists.txt

@ -7,11 +7,12 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.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} )
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER})
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} ${WEBKIT_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER} ${WEBKIT_CFLAGS_OTHER})
aux_source_directory(./src 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})

32
glade/mainWindow.glade

@ -357,22 +357,32 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<object class="GtkStack" id="stackRenderMode">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="can_focus">False</property>
<child>
<object class="GtkTextView" id="entryText">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="wrap_mode">word-char</property>
<property name="left_margin">4</property>
<property name="right_margin">4</property>
<property name="top_margin">4</property>
<property name="bottom_margin">4</property>
<property name="buffer">entryTextBuffer</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="entryText">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="wrap_mode">word-char</property>
<property name="left_margin">4</property>
<property name="right_margin">4</property>
<property name="top_margin">4</property>
<property name="bottom_margin">4</property>
<property name="buffer">entryTextBuffer</property>
</object>
</child>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
</object>
<packing>

19
src/mainwindow.c

@ -424,6 +424,23 @@ static void mainWindow_init_to_default(struct mainWindow *mainWindow)
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.
* @return Returns struct mainWindow *
@ -453,6 +470,7 @@ struct mainWindow *mainWindow_new()
mainWindow->headerBar = GTK_WIDGET(gtk_builder_get_object(builder, "headerBar"));
mainWindow->labelDateToDate = GTK_WIDGET(gtk_builder_get_object(builder, "label_date_to_date"));
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->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection"));
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));
mainWindow_configure_treeView(mainWindow);
mainWindow_webkit_init(mainWindow);
mainWindow_connect_signals(mainWindow);
mainWindow_configure_workspaceTreeView(mainWindow);
mainWindow_init_to_default(mainWindow);

3
src/mainwindow.h

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

Loading…
Cancel
Save