Delete unused sources

This commit is contained in:
daleclack 2021-10-24 13:00:25 +08:00
parent bad30f6c2a
commit 15c9665da2
9 changed files with 129 additions and 409 deletions

View File

@ -68,7 +68,7 @@ compile_gresources(RESOURCE_FILE
# It depends on the output RESOURCE_FILE. # It depends on the output RESOURCE_FILE.
add_custom_target(resource ALL DEPENDS ${RESOURCE_FILE}) add_custom_target(resource ALL DEPENDS ${RESOURCE_FILE})
set(SOURCES src/main.cpp src/MainWin.cpp src/MainStack.cpp) set(SOURCES src/main.cpp src/MainWin.cpp src/MainStack.cpp src/LeftPanel.cpp)
# Step 4:Add the resource to compile list and compile # Step 4:Add the resource to compile list and compile
if(WIN32) if(WIN32)

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">start</property>
<child>
<object class="GtkLabel" id="labeltitle">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Gtk42 Desktop</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</interface>

View File

@ -1,197 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">ac-adapter-symbolic</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">system-help</property>
</object>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkPopover" id="popover1">
<property name="can-focus">False</property>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<property name="layout-style">start</property>
<child>
<object class="GtkButton" id="btnback">
<property name="label" translatable="yes">Change back</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image3</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnset">
<property name="label" translatable="yes">Win Settings</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image5</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="PanelExit">
<property name="label" translatable="yes">Exit mainwin</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image4</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkButtonBox" id="btnbox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label_time">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">20:00 2021/2/14</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image2</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">7</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkVolumeButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="orientation">vertical</property>
<property name="icons">audio-volume-muted-symbolic
audio-volume-high-symbolic
audio-volume-low-symbolic
audio-volume-medium-symbolic</property>
<child internal-child="plus_button">
<object class="GtkButton">
<property name="can-focus">False</property>
<property name="receives-default">False</property>
</object>
</child>
<child internal-child="minus_button">
<object class="GtkButton">
<property name="can-focus">False</property>
<property name="receives-default">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">8</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="popover">popover1</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">9</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
</object>
</interface>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkAboutDialog" id="window1">
<property name="can-focus">False</property>
<property name="type-hint">dialog</property>
<property name="program-name">Gtk Ui</property>
<property name="version">2.0</property>
<property name="copyright" translatable="yes">2020-2021 Xe Corporation</property>
<property name="website">github.com/daleclack</property>
<property name="authors">Dale </property>
<property name="logo-icon-name">org.gtk.daleclack</property>
<child internal-child="vbox">
<object class="GtkBox" id="window">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

121
Gtk4/src/LeftPanel.cpp Normal file
View File

@ -0,0 +1,121 @@
#include <cstdlib>
#include <thread>
#include "LeftPanel.h"
// #include "game.h"
// #include "TextEditor.h"
// #include "drawing.h"
// #include "FileWindow.h"
struct _LeftPanel{
GtkBox parent;
};
G_DEFINE_TYPE(LeftPanel,left_panel,GTK_TYPE_BOX)
static void btnvlc_clicked(GtkWidget *widget,gpointer data){
std::thread first(system,"vlc");
first.detach();
}
static void btngedit_clicked(GtkWidget *widget,gpointer data){
std::thread second(system,"gedit");
second.detach();
}
static void btnaud_clicked(GtkWidget *widget,gpointer data){
std::thread third(system,"audacious");
third.detach();
}
static void btnnote_clicked(GtkWidget *widget,gpointer data){
std::thread fourth(system,"start notepad");
fourth.detach();
}
static void btnvlc_win32(GtkWidget *widget,gpointer data){
std::thread fifth(system,"start ..\\vlc\\vlc.exe");
fifth.detach();
}
static void left_panel_init(LeftPanel * panel){}
static void left_panel_class_init(LeftPanelClass * klass){}
LeftPanel * left_panel_new(){
return (LeftPanel*)g_object_new(left_panel_get_type(),NULL);
}
// void btnfiles_clicked(GtkWidget *widget,GtkWindow *parent){
// FileWindow * window1 = file_window_new();
// gtk_window_set_transient_for(GTK_WINDOW(window1),parent);
// gtk_widget_show_all(GTK_WIDGET(window1));
// }
// void add_leftpanel(GtkBuilder *builder,GtkFixed *fixed){
// //Get Left panel
// GtkBuilder *panel2=gtk_builder_new_from_resource("/gtk42/leftpanel.ui");
// GObject *panel=gtk_builder_get_object(panel2,"left_panel");
// //Set start button and image
// GObject *btn_image=gtk_builder_get_object(panel2,"btn_image");
// GdkPixbuf *pixbuf=gdk_pixbuf_new_from_resource("/gtk42/icon.png",NULL);
// GdkPixbuf *sized=gdk_pixbuf_scale_simple(pixbuf,40,40,GDK_INTERP_BILINEAR);
// gtk_image_set_from_pixbuf(GTK_IMAGE(btn_image),sized);
// //Get popover window
// GObject *popover=gtk_builder_get_object(panel2,"popover1");
// //Button image
// GtkWidget *img_vlc=gtk_image_new_from_resource("/gtk42/vlc.png");
// GtkWidget *img_aud=gtk_image_new_from_resource("/gtk42/audacious.png");
// GtkWidget *img_gedit=gtk_image_new_from_resource("/gtk42/gedit.png");
// //Audacious bin exec
// GObject *btn_audacious=gtk_builder_get_object(panel2,"btnaud");
// gtk_button_set_image(GTK_BUTTON(btn_audacious),img_aud);
// g_signal_connect(btn_audacious,"clicked",G_CALLBACK(btnaud_clicked),NULL);
// g_signal_connect_swapped(btn_audacious,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //vlc exec button for linux
// GObject *btnvlc=gtk_builder_get_object(panel2,"btnvlc");
// GObject *img_vlc1=gtk_builder_get_object(panel2,"image1");
// gtk_image_set_from_resource(GTK_IMAGE(img_vlc1),"/gtk42/vlc.png");
// g_signal_connect(btnvlc,"clicked",G_CALLBACK(btnvlc_clicked),NULL);
// g_signal_connect_swapped(btnvlc,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //Start Gedit Text Editor
// GObject *btngedit=gtk_builder_get_object(panel2,"btngedit");
// GObject *img_gedit1=gtk_builder_get_object(panel2,"image2");
// gtk_image_set_from_resource(GTK_IMAGE(img_gedit1),"/gtk42/gedit.png");
// g_signal_connect(btngedit,"clicked",G_CALLBACK(btngedit_clicked),NULL);
// g_signal_connect_swapped(btngedit,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //Notepad on windows
// GObject *btnnote=gtk_builder_get_object(panel2,"btn_note");
// gtk_button_set_image(GTK_BUTTON(btnnote),img_gedit);
// g_signal_connect(btnnote,"clicked",G_CALLBACK(btnnote_clicked),NULL);
// g_signal_connect_swapped(btnnote,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //VLC on windows
// GObject *btn_vlc=gtk_builder_get_object(panel2,"btn_vlc");
// gtk_button_set_image(GTK_BUTTON(btn_vlc),img_vlc);
// g_signal_connect(btn_vlc,"clicked",G_CALLBACK(btnvlc_win32),NULL);
// g_signal_connect_swapped(btn_vlc,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //Get main window
// GObject *window=gtk_builder_get_object(builder,"window");
// //Gtk31 application
// GObject *btngame=gtk_builder_get_object(panel2,"btngame");
// g_signal_connect(btngame,"clicked",G_CALLBACK(gamemain),window);
// g_signal_connect_swapped(btngame,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //Text Editor(Gtk86)
// GObject *btnedit=gtk_builder_get_object(panel2,"btneditor");
// g_signal_connect(btnedit,"clicked",G_CALLBACK(text_editor),window);
// g_signal_connect_swapped(btnedit,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //Drawing application
// GObject *btndraw=gtk_builder_get_object(panel2,"btndraw");
// g_signal_connect(btndraw,"clicked",G_CALLBACK(drawing_main),window);
// g_signal_connect_swapped(btndraw,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //About window
// GObject *btn_about=gtk_builder_get_object(panel2,"btnabout");
// g_signal_connect(btn_about,"clicked",G_CALLBACK(win1_init),window);
// g_signal_connect_swapped(btn_about,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// //File Manager
// GObject *btnfiles=gtk_builder_get_object(panel2,"btnfiles");
// g_signal_connect(btnfiles,"clicked",G_CALLBACK(btnfiles_clicked),window);
// g_signal_connect_swapped(btnfiles,"clicked",G_CALLBACK(gtk_widget_hide),popover);
// gtk_fixed_put(fixed,GTK_WIDGET(panel),0,25);
// g_object_unref(pixbuf);
// g_object_unref(sized);
// }

View File

@ -1,11 +1,14 @@
#ifndef __PANEL2_H_ #pragma once
#define __PANEL2_H_
#include <gtk/gtk.h> #include <gtk/gtk.h>
void add_leftpanel(GtkBuilder *builder,GtkFixed *fixed); G_DECLARE_FINAL_TYPE(LeftPanel,left_panel,LEFT,PANEL,GtkBox)
void btnfiles_clicked(GtkWidget *widget,GtkWindow *parent); LeftPanel * left_panel_new();
// void add_leftpanel(GtkBuilder *builder,GtkFixed *fixed);
// void btnfiles_clicked(GtkWidget *widget,GtkWindow *parent);
//void btnvlc_clicked(GtkWidget *widget,gpointer data); //void btnvlc_clicked(GtkWidget *widget,gpointer data);
@ -16,5 +19,3 @@ void btnfiles_clicked(GtkWidget *widget,GtkWindow *parent);
//void btnnote_clicked(GtkWidget *widget,gpointer data); //void btnnote_clicked(GtkWidget *widget,gpointer data);
//void btnvlc_win32(GtkWidget *widget,gpointer data); //void btnvlc_win32(GtkWidget *widget,gpointer data);
#endif

View File

@ -1,108 +0,0 @@
#include <cstdlib>
#include <thread>
#include "panel2.h"
#include "win1.h"
#include "game.h"
#include "TextEditor.h"
#include "drawing.h"
#include "FileWindow.h"
static void btnvlc_clicked(GtkWidget *widget,gpointer data){
std::thread first(system,"vlc");
first.detach();
}
static void btngedit_clicked(GtkWidget *widget,gpointer data){
std::thread second(system,"gedit");
second.detach();
}
static void btnaud_clicked(GtkWidget *widget,gpointer data){
std::thread third(system,"audacious");
third.detach();
}
static void btnnote_clicked(GtkWidget *widget,gpointer data){
std::thread fourth(system,"start notepad");
fourth.detach();
}
static void btnvlc_win32(GtkWidget *widget,gpointer data){
std::thread fifth(system,"start ..\\vlc\\vlc.exe");
fifth.detach();
}
void btnfiles_clicked(GtkWidget *widget,GtkWindow *parent){
FileWindow * window1 = file_window_new();
gtk_window_set_transient_for(GTK_WINDOW(window1),parent);
gtk_widget_show_all(GTK_WIDGET(window1));
}
void add_leftpanel(GtkBuilder *builder,GtkFixed *fixed){
//Get Left panel
GtkBuilder *panel2=gtk_builder_new_from_resource("/gtk42/leftpanel.ui");
GObject *panel=gtk_builder_get_object(panel2,"left_panel");
//Set start button and image
GObject *btn_image=gtk_builder_get_object(panel2,"btn_image");
GdkPixbuf *pixbuf=gdk_pixbuf_new_from_resource("/gtk42/icon.png",NULL);
GdkPixbuf *sized=gdk_pixbuf_scale_simple(pixbuf,40,40,GDK_INTERP_BILINEAR);
gtk_image_set_from_pixbuf(GTK_IMAGE(btn_image),sized);
//Get popover window
GObject *popover=gtk_builder_get_object(panel2,"popover1");
//Button image
GtkWidget *img_vlc=gtk_image_new_from_resource("/gtk42/vlc.png");
GtkWidget *img_aud=gtk_image_new_from_resource("/gtk42/audacious.png");
GtkWidget *img_gedit=gtk_image_new_from_resource("/gtk42/gedit.png");
//Audacious bin exec
GObject *btn_audacious=gtk_builder_get_object(panel2,"btnaud");
gtk_button_set_image(GTK_BUTTON(btn_audacious),img_aud);
g_signal_connect(btn_audacious,"clicked",G_CALLBACK(btnaud_clicked),NULL);
g_signal_connect_swapped(btn_audacious,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//vlc exec button for linux
GObject *btnvlc=gtk_builder_get_object(panel2,"btnvlc");
GObject *img_vlc1=gtk_builder_get_object(panel2,"image1");
gtk_image_set_from_resource(GTK_IMAGE(img_vlc1),"/gtk42/vlc.png");
g_signal_connect(btnvlc,"clicked",G_CALLBACK(btnvlc_clicked),NULL);
g_signal_connect_swapped(btnvlc,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//Start Gedit Text Editor
GObject *btngedit=gtk_builder_get_object(panel2,"btngedit");
GObject *img_gedit1=gtk_builder_get_object(panel2,"image2");
gtk_image_set_from_resource(GTK_IMAGE(img_gedit1),"/gtk42/gedit.png");
g_signal_connect(btngedit,"clicked",G_CALLBACK(btngedit_clicked),NULL);
g_signal_connect_swapped(btngedit,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//Notepad on windows
GObject *btnnote=gtk_builder_get_object(panel2,"btn_note");
gtk_button_set_image(GTK_BUTTON(btnnote),img_gedit);
g_signal_connect(btnnote,"clicked",G_CALLBACK(btnnote_clicked),NULL);
g_signal_connect_swapped(btnnote,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//VLC on windows
GObject *btn_vlc=gtk_builder_get_object(panel2,"btn_vlc");
gtk_button_set_image(GTK_BUTTON(btn_vlc),img_vlc);
g_signal_connect(btn_vlc,"clicked",G_CALLBACK(btnvlc_win32),NULL);
g_signal_connect_swapped(btn_vlc,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//Get main window
GObject *window=gtk_builder_get_object(builder,"window");
//Gtk31 application
GObject *btngame=gtk_builder_get_object(panel2,"btngame");
g_signal_connect(btngame,"clicked",G_CALLBACK(gamemain),window);
g_signal_connect_swapped(btngame,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//Text Editor(Gtk86)
GObject *btnedit=gtk_builder_get_object(panel2,"btneditor");
g_signal_connect(btnedit,"clicked",G_CALLBACK(text_editor),window);
g_signal_connect_swapped(btnedit,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//Drawing application
GObject *btndraw=gtk_builder_get_object(panel2,"btndraw");
g_signal_connect(btndraw,"clicked",G_CALLBACK(drawing_main),window);
g_signal_connect_swapped(btndraw,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//About window
GObject *btn_about=gtk_builder_get_object(panel2,"btnabout");
g_signal_connect(btn_about,"clicked",G_CALLBACK(win1_init),window);
g_signal_connect_swapped(btn_about,"clicked",G_CALLBACK(gtk_widget_hide),popover);
//File Manager
GObject *btnfiles=gtk_builder_get_object(panel2,"btnfiles");
g_signal_connect(btnfiles,"clicked",G_CALLBACK(btnfiles_clicked),window);
g_signal_connect_swapped(btnfiles,"clicked",G_CALLBACK(gtk_widget_hide),popover);
gtk_fixed_put(fixed,GTK_WIDGET(panel),0,25);
g_object_unref(pixbuf);
g_object_unref(sized);
}

View File

@ -1,25 +0,0 @@
#include "win1.h"
void win1_init(GtkWidget *widget,GtkWindow *parent){
//"About" window
GtkBuilder *win1=gtk_builder_new_from_resource("/gtk42/win1.ui");
GObject *window1=gtk_builder_get_object(win1,"window1");
gtk_window_set_transient_for(GTK_WINDOW(window1),parent);
//Window icon fix for win32 platform
GdkPixbuf *logo=gdk_pixbuf_new_from_resource("/gtk42/icon.jpg",NULL);
GdkPixbuf *logo_sized=gdk_pixbuf_scale_simple(logo,100,100,GDK_INTERP_BILINEAR);
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(window1),logo_sized);
//Add version information
char *version;
version=g_strdup_printf("2.6\nRunning Against Gtk %d.%d.%d",
gtk_get_major_version(),
gtk_get_minor_version(),
gtk_get_micro_version());
gtk_about_dialog_set_version((GtkAboutDialog*)window1,version);
//Copyright,license and website information
gtk_about_dialog_set_copyright((GtkAboutDialog*)window1,"©2019—2021 The Xe Project");
gtk_about_dialog_set_license_type((GtkAboutDialog*)window1,GTK_LICENSE_GPL_3_0);
gtk_about_dialog_set_website((GtkAboutDialog*)window1,"https://github.com/daleclack/My_GtkUi");
g_signal_connect_swapped(window1,"response",G_CALLBACK(gtk_widget_destroy),window1);
gtk_widget_show_all(GTK_WIDGET(window1));
}

View File

@ -1,8 +0,0 @@
#ifndef __WIN1_H_
#define __WIN1_H_
#include <gtk/gtk.h>
void win1_init(GtkWidget *widget,GtkWindow *parent);
#endif