Browse Source

Added initial mainWindow

newfile
Markus Koch 5 years ago
parent
commit
8b75d7f037
  1. 1
      .gitignore
  2. 2
      CMakeLists.txt
  3. 191
      glade/mainWindow.glade
  4. 15
      main.c
  5. 18
      src/main.c
  6. 23
      src/mainwindow.c
  7. 18
      src/mainwindow.h

1
.gitignore vendored

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
*.user
*~
Makefile
*.autosave

2
CMakeLists.txt

@ -12,6 +12,6 @@ INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLU @@ -12,6 +12,6 @@ INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLU
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER})
aux_source_directory(. SRC_LIST)
aux_source_directory(./src SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${PC_LIBSOUP_LIBRARIES})

191
glade/mainWindow.glade

@ -0,0 +1,191 @@ @@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="entryListStore">
<columns>
<!-- column-name test1 -->
<column type="test"/>
<!-- column-name vfg1 -->
<column type="vfg"/>
</columns>
<data>
<row/>
<row/>
</data>
</object>
<object class="GtkTextBuffer" id="entryTextBuffer">
<property name="text" translatable="yes">Test text for debugging.</property>
</object>
<object class="GtkEntryCompletion" id="searchEntryCompletion"/>
<object class="GtkApplicationWindow" id="mainWindow">
<property name="can_focus">False</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child>
<object class="GtkPaned" id="mainPane">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">2</property>
<property name="margin_right">2</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="wide_handle">True</property>
<child>
<object class="GtkBox" id="leftPaneBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">2</property>
<property name="margin_right">2</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<object class="GtkSearchEntry" id="searchEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="completion">searchEntryCompletion</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="boxDateEntry">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
<object class="GtkEntry" id="dateStart">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">9</property>
<property name="text" translatable="yes">00.00.0000</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_date_to_date">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">to</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="dateEnd">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">9</property>
<property name="text" translatable="yes">00.00.0000</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkPaned" id="rightPane">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">2</property>
<property name="margin_right">2</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="orientation">vertical</property>
<property name="wide_handle">True</property>
<child>
<object class="GtkTreeView" id="entryListView">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">entryListStore</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="entryListSelection"/>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="entryText">
<property name="width_request">640</property>
<property name="height_request">480</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
<property name="buffer">entryTextBuffer</property>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title">MDiary</property>
<property name="subtitle">No workspace opened.</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
<object class="GtkButton" id="buttonChooseWorkspace">
<property name="label" translatable="yes">Choose workspace</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

15
main.c

@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
#include <stdio.h>
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
GtkWidget *mainWindow;
gtk_init(&argc, &argv);
mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(mainWindow);
g_signal_connect (G_OBJECT (mainWindow), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_main();
return 0;
}

18
src/main.c

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
#include <stdio.h>
#include <gtk/gtk.h>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
struct mainWindow *mainWindow;
gtk_init(&argc, &argv);
mainWindow = mainWindow_new();
gtk_widget_show(mainWindow->mainWindow);
gtk_main();
return 0;
}

23
src/mainwindow.c

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
#include "mainwindow.h"
struct mainWindow *mainWindow_new()
{
GtkBuilder *builder;
struct mainWindow *mainWindow;
builder = gtk_builder_new_from_file("glade/mainWindow.glade");
mainWindow = malloc(sizeof(struct mainWindow));
mainWindow->mainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainWindow"));
mainWindow->buttonChooseWorkspace = GTK_WIDGET(gtk_builder_get_object(builder, "buttonChooseWorkspace"));
mainWindow->searchEntry = GTK_WIDGET(gtk_builder_get_object(builder, "searchEntry"));
mainWindow->dateStart = GTK_WIDGET(gtk_builder_get_object(builder, "dateStart"));
mainWindow->dateEnd = GTK_WIDGET(gtk_builder_get_object(builder, "dateEnd"));
mainWindow->entryText = GTK_WIDGET(gtk_builder_get_object(builder, "entryText"));
gtk_builder_connect_signals(builder, NULL);
g_object_unref(G_OBJECT(builder));
return mainWindow;
}

18
src/mainwindow.h

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <stdlib.h>
#include <gtk/gtk.h>
struct mainWindow {
GtkWidget *mainWindow;
GtkWidget *buttonChooseWorkspace;
GtkWidget *searchEntry;
GtkWidget *dateStart;
GtkWidget *dateEnd;
GtkWidget *entryText;
};
struct mainWindow *mainWindow_new();
#endif // MAINWINDOW_H
Loading…
Cancel
Save