Add launchpad

This commit is contained in:
daleclack 2022-02-06 12:30:31 +08:00
parent e5ecb46534
commit ef9fd5bde5
4 changed files with 276 additions and 3 deletions

View File

@ -9,4 +9,8 @@
box{
background-color:alpha(white,0.3);
}
grid{
background-color:alpha(rgb(49, 48, 48),0.3);
}

View File

@ -193,13 +193,255 @@
</packing>
</child>
<child>
<object class="GtkStack">
<object class="GtkStack" id="launchpad_stack">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="transition-type">crossfade</property>
<child>
<placeholder/>
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="default_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<!-- n-columns=8 n-rows=8 -->
<object class="GtkGrid" id="launchpad_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="row-homogeneous">True</property>
<property name="column-homogeneous">True</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>

View File

@ -2,7 +2,8 @@
MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Glade)
: Gtk::Box(cobject),
ref_builder(ref_Glade)
ref_builder(ref_Glade),
launchpad_shown(false)
{
// Get Widget
ref_builder->get_widget("finder_box", finder_box);
@ -14,9 +15,13 @@ MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Gl
ref_builder->get_widget("btnedit",btnedit);
ref_builder->get_widget("btnimage",btnimage);
ref_builder->get_widget("btnset",btnset);
ref_builder->get_widget("launchpad_stack",launchpad_stack);
ref_builder->get_widget("default_page",default_page);
ref_builder->get_widget("launchpad_page",launchpad_page);
//Link signals
btnset->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::btnset_clicked));
btnlaunch->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::btnlaunch_clicked));
finder_box->pack_start(finder);
// Add Style for MyFinder
@ -24,10 +29,24 @@ MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Gl
provider->load_from_resource("/org/gtk/daleclack/dock_style.css");
auto style = dock_box->get_style_context();
style->add_provider(provider, G_MAXUINT);
auto style1 = launchpad_page->get_style_context();
style1->add_provider(provider,G_MAXUINT);
show_all_children();
}
void MyDock::btnlaunch_clicked(){
if(launchpad_shown){
finder_box->set_visible();
launchpad_stack->set_visible_child(*default_page);
launchpad_shown = false;
}else{
finder_box->set_visible(false);
launchpad_stack->set_visible_child(*launchpad_page);
launchpad_shown = true;
}
}
void MyDock::mydock_init(Gtk::Window *window, Gtk::Image *background1)
{
// Initalize Preference window

View File

@ -21,6 +21,11 @@ private:
// Finder
MyFinder finder;
// LaunchPad
bool launchpad_shown;
Gtk::Stack *launchpad_stack;
Gtk::Grid *default_page, *launchpad_page;
//Window Preferences
MyPrefs prefs_win;
@ -28,4 +33,7 @@ private:
Gtk::Window *parent_win;
Glib::RefPtr<Gtk::Builder> ref_builder;
Glib::RefPtr<Gtk::CssProvider> provider;
// Signal Handlers
void btnlaunch_clicked();
};