Create MyPrefs.cpp

This commit is contained in:
daleclack 2023-06-10 10:07:19 +08:00
parent 001175d550
commit a32ac09b34
6 changed files with 36 additions and 1 deletions

View File

@ -24,7 +24,7 @@ include_directories (${GTK_INCLUDE_DIRS})
link_directories (${GTK_LIBRARY_DIRS})
set(SOURCES src/core/main.cpp src/core/MainWin.cpp src/core/MyStack.cpp
src/ui/MyDock.cpp src/ui/MyFinder.cpp)
src/ui/MyDock.cpp src/ui/MyFinder.cpp src/ui/MyPrefs.cpp)
#Compile resources with GCR_CMake

View File

@ -1,5 +1,6 @@
#include "MyStack.h"
#include "MyDock.h"
#include "MyPrefs.h"
#include "winpe.xpm"
static GtkWidget *dock;

View File

@ -126,6 +126,10 @@ static void my_dock_class_init(MyDockClass *klass)
{
}
GtkWidget *my_dock_get_background(MyDock *dock){
return dock->main_pic;
}
GtkWidget *my_dock_new()
{
return GTK_WIDGET(g_object_new(my_dock_get_type(), NULL));

View File

@ -7,3 +7,5 @@ G_DECLARE_FINAL_TYPE(MyDock, my_dock, MY, DOCK, GtkBox)
GtkWidget *my_dock_new(); // Create a new MyDock
void hide_launchpad(MyDock *dock); // Hide the launchpad
GtkWidget *my_dock_get_background(MyDock *dock); // Get Background widget

View File

@ -0,0 +1,21 @@
#include "MyPrefs.h"
struct _MyPrefs{
GtkWindow parent_instance;
GtkBuilder *prefs_builder;
GtkWidget *background;
};
G_DEFINE_TYPE(MyPrefs, my_prefs, GTK_TYPE_WINDOW)
static void my_prefs_init(MyPrefs *self){}
static void my_prefs_class_init(MyPrefsClass *klass)
{}
GtkWidget *my_prefs_new(GtkWidget *back)
{
GtkWidget *prefs_win = GTK_WIDGET(g_object_new(my_prefs_get_type(), NULL));
MY_PREFS(prefs_win)->background = back;
return prefs_win;
}

View File

@ -0,0 +1,7 @@
#pragma once
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE(MyPrefs, my_prefs, MY, PREFS, GtkWindow)
GtkWidget *my_prefs_new(GtkWidget *back);