Update dock and launchpad

This commit is contained in:
daleclack 2022-02-06 16:08:59 +08:00
parent 60043e19aa
commit 2dea7a8c84
8 changed files with 910 additions and 55 deletions

View File

@ -58,11 +58,14 @@ set(RESOURCE_LIST
icons/48x48/actions/btnabout.png icons/48x48/actions/btnabout.png
icons/48x48/actions/My_GtkUI.png icons/48x48/actions/My_GtkUI.png
icons/scalable/status/my_prefs.svg icons/scalable/status/my_prefs.svg
icons/scalable/status/my_prefs_running.svg
icons/scalable/status/drawing_app.svg icons/scalable/status/drawing_app.svg
icons/scalable/status/drawing_app_running.svg icons/scalable/status/drawing_app_running.svg
icons/scalable/status/finder-find.svg icons/scalable/status/finder-find.svg
icons/scalable/status/file-app.svg
icons/scalable/status/file-app_running.svg
icons/scalable/status/display_prefs.svg icons/scalable/status/display_prefs.svg
icons/scalable/status/file-app.svg) icons/scalable/status/myrunner.svg)
compile_gresources(RESOURCE_FILE compile_gresources(RESOURCE_FILE
XML_OUT XML_OUT

View File

@ -11,6 +11,10 @@ box{
background-color:alpha(white,0.3); background-color:alpha(white,0.3);
} }
separator{
background-color:alpha(white,0.3);
}
grid{ grid{
background-color:alpha(rgb(49, 48, 48),0.3); background-color:alpha(rgb(49, 48, 48),0.3);
} }

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 128 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -2,21 +2,6 @@
<!-- Generated with glade 3.38.2 --> <!-- Generated with glade 3.38.2 -->
<interface> <interface>
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkWindow">
<property name="can-focus">False</property>
<child>
<object class="GtkButton" id="btnnote">
<property name="label" translatable="yes">Notepad</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image15</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
</child>
</object>
<object class="GtkImage" id="image1"> <object class="GtkImage" id="image1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@ -62,12 +47,42 @@
<property name="pixel-size">48</property> <property name="pixel-size">48</property>
<property name="icon-name">gedit</property> <property name="icon-name">gedit</property>
</object> </object>
<object class="GtkImage" id="image16">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">gedit</property>
</object>
<object class="GtkImage" id="image17">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">vlc</property>
</object>
<object class="GtkImage" id="image18">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">vlc</property>
</object>
<object class="GtkImage" id="image19">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">myrunner</property>
</object>
<object class="GtkImage" id="image2"> <object class="GtkImage" id="image2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="pixel-size">48</property> <property name="pixel-size">48</property>
<property name="icon-name">drawing_app</property> <property name="icon-name">drawing_app</property>
</object> </object>
<object class="GtkImage" id="image20">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">my_prefs</property>
</object>
<object class="GtkImage" id="image3"> <object class="GtkImage" id="image3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@ -145,6 +160,19 @@
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkSeparator" id="separator_start">
<property name="height-request">5</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="btnlaunch"> <object class="GtkButton" id="btnlaunch">
<property name="visible">True</property> <property name="visible">True</property>
@ -157,7 +185,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -172,7 +200,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -187,7 +215,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -202,7 +230,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">3</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -217,7 +245,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">4</property> <property name="position">5</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -232,7 +260,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">5</property> <property name="position">6</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -247,11 +275,23 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">6</property> <property name="position">7</property>
</packing> </packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkSeparator" id="separator_end">
<property name="height-request">5</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<style>
<class name="separator1"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">8</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
@ -318,7 +358,7 @@
<property name="row-homogeneous">True</property> <property name="row-homogeneous">True</property>
<property name="column-homogeneous">True</property> <property name="column-homogeneous">True</property>
<child> <child>
<object class="GtkButton" id="btnabout"> <object class="GtkButton" id="padabout">
<property name="label" translatable="yes">about</property> <property name="label" translatable="yes">about</property>
<property name="width-request">64</property> <property name="width-request">64</property>
<property name="height-request">64</property> <property name="height-request">64</property>
@ -337,7 +377,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btnaud"> <object class="GtkButton" id="padaud">
<property name="label" translatable="yes">audacious</property> <property name="label" translatable="yes">audacious</property>
<property name="width-request">64</property> <property name="width-request">64</property>
<property name="height-request">64</property> <property name="height-request">64</property>
@ -355,7 +395,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btndra"> <object class="GtkButton" id="paddraw">
<property name="label" translatable="yes">Drawing</property> <property name="label" translatable="yes">Drawing</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
@ -371,7 +411,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btnfile"> <object class="GtkButton" id="padfile">
<property name="label" translatable="yes">MyFinder</property> <property name="label" translatable="yes">MyFinder</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
@ -387,7 +427,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btngedit"> <object class="GtkButton" id="padgedit">
<property name="label" translatable="yes">Gedit</property> <property name="label" translatable="yes">Gedit</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
@ -403,7 +443,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btngam"> <object class="GtkButton" id="padgame">
<property name="label" translatable="yes">Guess game</property> <property name="label" translatable="yes">Guess game</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
@ -419,7 +459,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btnimag"> <object class="GtkButton" id="padimage">
<property name="label" translatable="yes">Image Viewer</property> <property name="label" translatable="yes">Image Viewer</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
@ -435,22 +475,100 @@
</packing> </packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkButton" id="padnote">
<property name="label" translatable="yes">Notepad(win)</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image15</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkButton" id="padedit">
<property name="label" translatable="yes">TextEditor</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image16</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">1</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkButton" id="padvlc">
<property name="label" translatable="yes">VLC(linux)</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image17</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">4</property>
<property name="top-attach">1</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkButton" id="padvlc_win32">
<property name="label" translatable="yes">VLC(win32)</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image18</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkButton" id="padrun">
<property name="label" translatable="yes">Run App</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image19</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkButton" id="padset">
<property name="label" translatable="yes">Preferences</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image20</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <placeholder/>
@ -588,7 +706,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <placeholder/>

View File

@ -6,7 +6,7 @@ MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Gl
ref_builder(ref_Glade), ref_builder(ref_Glade),
launchpad_shown(false) launchpad_shown(false)
{ {
// Get Widget // Get Widgets
ref_builder->get_widget("finder_box", finder_box); ref_builder->get_widget("finder_box", finder_box);
ref_builder->get_widget("dock_box", dock_box); ref_builder->get_widget("dock_box", dock_box);
ref_builder->get_widget("btnlaunch",btnlaunch); ref_builder->get_widget("btnlaunch",btnlaunch);
@ -16,23 +16,28 @@ MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Gl
ref_builder->get_widget("btnedit",btnedit); ref_builder->get_widget("btnedit",btnedit);
ref_builder->get_widget("btnimage",btnimage); ref_builder->get_widget("btnimage",btnimage);
ref_builder->get_widget("btnset",btnset); ref_builder->get_widget("btnset",btnset);
ref_builder->get_widget("separator_start",separator_start);
ref_builder->get_widget("separator_end",separator_end);
ref_builder->get_widget("launchpad_stack",launchpad_stack); ref_builder->get_widget("launchpad_stack",launchpad_stack);
ref_builder->get_widget("default_page",default_page); ref_builder->get_widget("default_page",default_page);
ref_builder->get_widget("launchpad_page",launchpad_page); ref_builder->get_widget("launchpad_page",launchpad_page);
ref_builder->get_widget("btnabout",btnabout); ref_builder->get_widget("padaud",padaud);
ref_builder->get_widget("btnaud",btnaud); ref_builder->get_widget("padgedit",padgedit);
ref_builder->get_widget("padvlc",padvlc);
ref_builder->get_widget("padnote",padnote);
ref_builder->get_widget("padvlc_win32",padvlc_win32);
ref_builder->get_widget("padset",padset);
// Add Buttons for launchpad // Link signals
// launchpad_page->attach(*btnabout,0,0);
// launchpad_page->attach(*btnaud,1,0);
// label1.set_label(" ");
// label1.set_hexpand();
// label1.set_vexpand();
// launchpad_page->attach(label1,2,1);
//Link signals
btnset->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::btnset_clicked));
btnlaunch->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::btnlaunch_clicked)); btnlaunch->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::btnlaunch_clicked));
padaud->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::padaud_clicked));
padgedit->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::padgedit_clicked));
padvlc->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::padvlc_clicked));
padnote->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::padnote_clicked));
padvlc_win32->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::padvlc_win32_clicked));
btnset->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::btnset_clicked));
padset->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::padset_clicked));
prefs_win.signal_delete_event().connect(sigc::mem_fun(*this,&MyDock::prefs_win_closed));
finder_box->pack_start(finder); finder_box->pack_start(finder);
// Add Style for MyFinder // Add Style for MyFinder
@ -42,6 +47,8 @@ MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Gl
style->add_provider(provider, G_MAXUINT); style->add_provider(provider, G_MAXUINT);
auto style1 = launchpad_page->get_style_context(); auto style1 = launchpad_page->get_style_context();
style1->add_provider(provider,G_MAXUINT); style1->add_provider(provider,G_MAXUINT);
auto style2 = separator_end->get_style_context();
style2->add_provider(provider,G_MAXUINT);
show_all_children(); show_all_children();
} }
@ -64,9 +71,75 @@ void MyDock::mydock_init(Gtk::Window *window, Gtk::Image *background1)
parent_win = window; parent_win = window;
} }
void MyDock::padaud_clicked(){
std::thread first(system,"audacious");
first.detach();
btnlaunch_clicked();
}
void MyDock::padgedit_clicked(){
std::thread second(system,"gedit");
second.detach();
btnlaunch_clicked();
}
void MyDock::padvlc_clicked(){
std::thread third(system,"vlc");
third.detach();
btnlaunch_clicked();
}
void MyDock::padvlc_win32_clicked(){
std::thread fourth(system,"start notepad");
fourth.detach();
btnlaunch_clicked();
}
void MyDock::padnote_clicked(){
std::thread fifth(system,"start ..\\vlc\\vlc.exe");
fifth.detach();
btnlaunch_clicked();
}
bool MyDock::prefs_win_closed(GdkEventAny * event){
btnset->set_image_from_icon_name("my_prefs",Gtk::ICON_SIZE_DIALOG);
prefs_win.hide();
return true;
}
void MyDock::btnset_clicked() void MyDock::btnset_clicked()
{ {
prefs_win.show_all(); btnset->set_image_from_icon_name("my_prefs_running",Gtk::ICON_SIZE_DIALOG);
window_ctrl(prefs_win);
}
void MyDock::padset_clicked(){
btnset->set_image_from_icon_name("my_prefs_running",Gtk::ICON_SIZE_DIALOG);
window_ctrl(prefs_win,false);
}
void MyDock::window_ctrl(Gtk::Window &window, bool on_dock){
auto gdk_win = window.get_window();
if(gdk_win){
auto state = gdk_win->get_state();
switch(state){
case Gdk::WINDOW_STATE_WITHDRAWN:
window.show_all();
break;
case Gdk::WINDOW_STATE_ICONIFIED:
window.set_transient_for(*parent_win);
window.deiconify();
break;
default:
if(on_dock){
window.unset_transient_for();
window.iconify();
break;
}
}
}else{
window.show_all();
}
} }
MyDock *MyDock::create() MyDock *MyDock::create()

View File

@ -10,13 +10,14 @@ public:
MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Glade); MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Glade);
static MyDock *create(); static MyDock *create();
void btnset_clicked(); void btnset_clicked();
void mydock_init(Gtk::Window * window, Gtk::Image *background1); void mydock_init(Gtk::Window *window, Gtk::Image *background1);
private: private:
// Child widgets // Child widgets
Gtk::Box *finder_box, *dock_box; Gtk::Box *finder_box, *dock_box;
Gtk::Button *btnlaunch, *btndraw, *btnfiles, Gtk::Button *btnlaunch, *btndraw, *btnfiles,
*btngame, *btnedit, *btnimage, *btnset; *btngame, *btnedit, *btnimage, *btnset;
Gtk::Separator *separator_start, *separator_end;
// Finder // Finder
MyFinder finder; MyFinder finder;
@ -25,11 +26,16 @@ private:
bool launchpad_shown; bool launchpad_shown;
Gtk::Stack *launchpad_stack; Gtk::Stack *launchpad_stack;
Gtk::Grid *default_page, *launchpad_page; Gtk::Grid *default_page, *launchpad_page;
Gtk::Button *btnabout, *btnaud; Gtk::Button *padaud, *paddraw, *padfile, *padgedit, *padgame, *padset,
*padimage, *padnote, *padedit, *padvlc, *padvlc_win32, *padrun;
Gtk::Label label1; Gtk::Label label1;
//Window Preferences // Window Preferences
MyPrefs prefs_win; MyPrefs prefs_win;
bool prefs_win_closed(GdkEventAny *event);
// Window Control
void window_ctrl(Gtk::Window &window, bool on_dock = true);
// Other // Other
Gtk::Window *parent_win; Gtk::Window *parent_win;
@ -38,4 +44,10 @@ private:
// Signal Handlers // Signal Handlers
void btnlaunch_clicked(); void btnlaunch_clicked();
void padaud_clicked();
void padgedit_clicked();
void padvlc_clicked();
void padvlc_win32_clicked();
void padnote_clicked();
void padset_clicked();
}; };