Add default resource

This commit is contained in:
daleclack 2021-10-17 20:40:21 +08:00
parent 0200924be5
commit 361b97e7b8
9 changed files with 113 additions and 8 deletions

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="org/gtk/daleclack">
<file>gnome-fs-directory.png</file>
<file>gnome-fs-regular.png</file>
<file>icons/24x24/actions/view-grid-symbolic.png</file>
<file>icons/24x24/actions/view-list-symbolic.png</file>
<file>icons/48x48/actions/dialog-error.png</file>
</gresource>
</gresources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -6,11 +6,11 @@ project('gtk113', 'cpp',
gnome=import('gnome')
#Compile Resource
# gresources = gnome.compile_resources(
# 'resources', 'res/gtk112.gresource.xml',
# source_dir: 'res',
# c_name: 'resources'
# )
gresources = gnome.compile_resources(
'resources', '../default_res/default.gresource.xml',
source_dir: '../default_res',
c_name: 'resources'
)
#compile schemas
# app_schemas = gnome.compile_schemas(depend_files: 'org.gtk.daleclack.gschema.xml')
@ -28,8 +28,8 @@ src = ['src/main.cc', 'src/FileWindow.cc']
if host_machine.system() == 'windows'
win=import('windows')
icon_res=win.compile_resources('../icon.rc')
executable('gtk113', icon_res, src, dependencies : gtkdep,
executable('gtk113', icon_res, src, dependencies : gtkdep, gresources,
win_subsystem : 'windows', include_directories : dir_include)
else
executable('gtk113', src, dependencies : gtkdep, include_directories : dir_include)
executable('gtk113', src, gresources, dependencies : gtkdep, include_directories : dir_include)
endif

View File

@ -1,3 +1,59 @@
#include "FileWindow.hh"
FileWindow::FileWindow(){}
FileWindow::FileWindow()
:vbox(Gtk::ORIENTATION_VERTICAL,5),
btnbox(Gtk::ORIENTATION_HORIZONTAL,5)
{
//Initalize Window
set_default_size(650,400);
set_icon_name("org.gtk.daleclack");
set_title("File Manager");
//Load Pixbufs
file_pixbuf=Gdk::Pixbuf::create_from_resource("/org/gtk/daleclack/gnome-fs-regular.png");
folder_pixbuf=Gdk::Pixbuf::create_from_resource("/org/gtk/daleclack/gnome-fs-directory.png");
//Create Child Widgets
vbox.pack_start(btnbox,Gtk::PACK_SHRINK);
add(vbox);
m_toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS);
btnbox.pack_start(m_toolbar,Gtk::PACK_SHRINK);
btnbox.pack_end(m_viewbar,Gtk::PACK_SHRINK);
//"Up" Button
up_button.set_icon_name("go-up");
up_button.set_is_important();
up_button.set_sensitive(false);
m_toolbar.insert(up_button,-1);
//"Home" Button
home_button.set_icon_name("go-home");
home_button.set_is_important();
m_toolbar.insert(home_button,-1);
//"New Folder" Button
new_button.set_icon_name("folder-new");
new_button.set_is_important();
m_toolbar.insert(new_button,-1);
//"Delete" Button
delete_button.set_icon_name("edit-delete");
delete_button.set_is_important();
m_toolbar.insert(delete_button,-1);
//"View Mode" Button
view_item.add(view_button);
view_mode=ViewMode::MODE_ICON;
view_button.set_relief(Gtk::RELIEF_NONE);
view_button.set_image_from_icon_name("view-grid-symbolic",Gtk::ICON_SIZE_LARGE_TOOLBAR);
m_viewbar.insert(view_item,-1);
//Menu Button
menu_item.add(menubtn);
menubtn.set_relief(Gtk::RELIEF_NONE);
m_viewbar.insert(menu_item,-1);
m_viewbar.set_toolbar_style(Gtk::TOOLBAR_ICONS);
show_all_children();
}

View File

@ -2,7 +2,46 @@
#include <gtkmm.h>
enum class ViewMode{
MODE_ICON,
MODE_GRID
};
class FileWindow : public Gtk::Window{
public:
FileWindow();
private:
//List Model
class ModelColumns : public Gtk::TreeModelColumnRecord{
public:
ModelColumns(){
add(m_col_path);add(m_col_display_name);add(m_col_pixbuf);add(m_col_is_dir);
}
Gtk::TreeModelColumn<Glib::ustring> m_col_path;
Gtk::TreeModelColumn<Glib::ustring> m_col_display_name;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>> m_col_pixbuf;
Gtk::TreeModelColumn<bool> m_col_is_dir;
};
Gtk::TreeView m_treeview;
Gtk::IconView m_iconview;
Glib::RefPtr<Gtk::TreeSelection> m_selection;
Glib::RefPtr<Gtk::ListStore> m_liststore;
//File Proprties
Glib::RefPtr<Gdk::Pixbuf> file_pixbuf;
Glib::RefPtr<Gdk::Pixbuf> folder_pixbuf;
Glib::ustring parent_str;
ViewMode view_mode;
//Child Widgets
Gtk::Box vbox,btnbox;
Gtk::Toolbar m_toolbar,m_viewbar;
Gtk::ToolButton up_button,home_button,new_button,delete_button;
Gtk::ToolItem view_item,menu_item;
Gtk::ScrolledWindow m_sw;
Gtk::Button view_button;
Gtk::MenuButton menubtn;
//Signal Handlers
};