mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-05-01 11:41:30 +00:00
Prelim: OOBE scaffold
This commit is contained in:
78
base/setup/oobe/CMakeLists.txt
Normal file
78
base/setup/oobe/CMakeLists.txt
Normal file
@@ -0,0 +1,78 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(
|
||||
wintc-setup-oobe
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Windows Total Conversion out-of-box experience."
|
||||
LANGUAGES C
|
||||
)
|
||||
|
||||
set(PROJECT_ANYARCH false)
|
||||
set(PROJECT_FREESTATUS false)
|
||||
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
|
||||
|
||||
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include(../../../packaging/cmake-inc/common/CMakeLists.txt)
|
||||
include(../../../packaging/cmake-inc/linking/CMakeLists.txt)
|
||||
include(../../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
|
||||
wintc_resolve_library(glib-2.0 GLIB)
|
||||
wintc_resolve_library(gtk+-3.0 GTK3)
|
||||
wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
|
||||
wintc_resolve_library(wintc-shelldpa WINTC_SHELLDPA)
|
||||
|
||||
add_executable(
|
||||
wintc-setup-oobe
|
||||
src/main.c
|
||||
src/window.c
|
||||
src/window.h
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
wintc-setup-oobe
|
||||
PROPERTIES
|
||||
OUTPUT_NAME msoobe
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
wintc-setup-oobe
|
||||
PRIVATE ${WINTC_COMPILE_OPTIONS}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
wintc-setup-oobe
|
||||
SYSTEM
|
||||
BEFORE
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_SHELLDPA_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_directories(
|
||||
wintc-setup-oobe
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_SHELLDPA_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
wintc-setup-oobe
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARIES}
|
||||
PRIVATE ${WINTC_SHELLDPA_LIBRARIES}
|
||||
)
|
||||
|
||||
# Installation
|
||||
#
|
||||
wintc_configure_and_install_packaging()
|
||||
|
||||
install(
|
||||
TARGETS wintc-setup-oobe
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
59
base/setup/oobe/src/main.c
Normal file
59
base/setup/oobe/src/main.c
Normal file
@@ -0,0 +1,59 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc/comgtk.h>
|
||||
#include <wintc/shelldpa.h>
|
||||
|
||||
#include "window.h"
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void on_window_destroyed(
|
||||
GtkWidget* widget,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
//
|
||||
// ENTRY POINT
|
||||
//
|
||||
int main(
|
||||
int argc,
|
||||
char* argv[]
|
||||
)
|
||||
{
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
if (!wintc_init_display_protocol_apis())
|
||||
{
|
||||
g_critical("%s", "Failed to resolve display protocol APIs.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create OOBE window
|
||||
//
|
||||
GtkWidget* wnd_oobe = wintc_oobe_window_new();
|
||||
|
||||
g_signal_connect(
|
||||
wnd_oobe,
|
||||
"destroy",
|
||||
G_CALLBACK(on_window_destroyed),
|
||||
NULL
|
||||
);
|
||||
|
||||
gtk_widget_show_all(wnd_oobe);
|
||||
|
||||
gtk_main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// CALLBACKS
|
||||
//
|
||||
static void on_window_destroyed(
|
||||
WINTC_UNUSED(GtkWidget* widget),
|
||||
WINTC_UNUSED(gpointer user_data)
|
||||
)
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
61
base/setup/oobe/src/window.c
Normal file
61
base/setup/oobe/src/window.c
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc/comgtk.h>
|
||||
|
||||
#include "window.h"
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
//
|
||||
struct _WinTCOobeWindowClass
|
||||
{
|
||||
GtkWindowClass __parent__;
|
||||
};
|
||||
|
||||
struct _WinTCOobeWindow
|
||||
{
|
||||
GtkWindow __parent__;
|
||||
};
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
G_DEFINE_TYPE(
|
||||
WinTCOobeWindow,
|
||||
wintc_oobe_window,
|
||||
GTK_TYPE_WINDOW
|
||||
)
|
||||
|
||||
static void wintc_oobe_window_class_init(
|
||||
WINTC_UNUSED(WinTCOobeWindowClass* klass)
|
||||
) {}
|
||||
|
||||
static void wintc_oobe_window_init(
|
||||
WinTCOobeWindow* self
|
||||
)
|
||||
{
|
||||
gtk_window_set_default_size(
|
||||
GTK_WINDOW(self),
|
||||
320,
|
||||
200
|
||||
);
|
||||
|
||||
gtk_container_add(
|
||||
GTK_CONTAINER(self),
|
||||
gtk_label_new("Hello Windows!")
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* wintc_oobe_window_new(void)
|
||||
{
|
||||
return GTK_WIDGET(
|
||||
g_object_new(
|
||||
WINTC_TYPE_OOBE_WINDOW,
|
||||
"title", "Hello Windows!",
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
27
base/setup/oobe/src/window.h
Normal file
27
base/setup/oobe/src/window.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __WINDOW_H__
|
||||
#define __WINDOW_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _WinTCOobeWindowClass WinTCOobeWindowClass;
|
||||
typedef struct _WinTCOobeWindow WinTCOobeWindow;
|
||||
|
||||
#define WINTC_TYPE_OOBE_WINDOW (wintc_oobe_window_get_type())
|
||||
#define WINTC_OOBE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WINTC_TYPE_OOBE_WINDOW, WinTCOobeWindow))
|
||||
#define WINTC_OOBE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WINTC_TYPE_OOBE_WINDOW, WinTCOobeWindowClass))
|
||||
#define IS_WINTC_OOBE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WINTC_TYPE_OOBE_WINDOW))
|
||||
#define IS_WINTC_OOBE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WINTC_TYPE_OOBE_WINDOW))
|
||||
#define WINTC_OOBE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WINTC_TYPE_OOBE_WINDOW, WinTCOobeWindowClass))
|
||||
|
||||
GType wintc_oobe_window_get_type(void) G_GNUC_CONST;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* wintc_oobe_window_new(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user