[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 434/473: Move creating launcher model into applications page.
noreply at xfce.org
noreply at xfce.org
Tue Feb 17 00:00:04 CET 2015
This is an automated email from the git hooks/post-receive script.
gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit 3d15f39bfae6a411cf980f2481111c9d5e12245e
Author: Graeme Gott <graeme at gottcode.org>
Date: Tue Dec 31 09:37:17 2013 -0500
Move creating launcher model into applications page.
---
panel-plugin/applications-page.cpp | 40 ++++++++++++++++++++++++++++++++++++
panel-plugin/applications-page.h | 1 +
panel-plugin/list-page.cpp | 35 +------------------------------
3 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/panel-plugin/applications-page.cpp b/panel-plugin/applications-page.cpp
index c3712a9..e33058e 100644
--- a/panel-plugin/applications-page.cpp
+++ b/panel-plugin/applications-page.cpp
@@ -74,6 +74,46 @@ ApplicationsPage::~ApplicationsPage()
//-----------------------------------------------------------------------------
+GtkTreeModel* ApplicationsPage::create_launcher_model(std::vector<std::string>& desktop_ids) const
+{
+ // Create new model for treeview
+ GtkListStore* store = gtk_list_store_new(
+ LauncherView::N_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_POINTER);
+
+ // Fetch menu items or remove them from list if missing
+ for (std::vector<std::string>::iterator i = desktop_ids.begin(); i != desktop_ids.end(); ++i)
+ {
+ if (i->empty())
+ {
+ continue;
+ }
+
+ Launcher* launcher = get_application(*i);
+ if (launcher)
+ {
+ gtk_list_store_insert_with_values(
+ store, NULL, G_MAXINT,
+ LauncherView::COLUMN_ICON, launcher->get_icon(),
+ LauncherView::COLUMN_TEXT, launcher->get_text(),
+ LauncherView::COLUMN_LAUNCHER, launcher,
+ -1);
+ }
+ else
+ {
+ i = desktop_ids.erase(i);
+ --i;
+ wm_settings->set_modified();
+ }
+ }
+
+ return GTK_TREE_MODEL(store);
+}
+
+//-----------------------------------------------------------------------------
+
Launcher* ApplicationsPage::get_application(const std::string& desktop_id) const
{
std::map<std::string, Launcher*>::const_iterator i = m_items.find(desktop_id);
diff --git a/panel-plugin/applications-page.h b/panel-plugin/applications-page.h
index c3511f9..0a08706 100644
--- a/panel-plugin/applications-page.h
+++ b/panel-plugin/applications-page.h
@@ -39,6 +39,7 @@ public:
explicit ApplicationsPage(Window* window);
~ApplicationsPage();
+ GtkTreeModel* create_launcher_model(std::vector<std::string>& desktop_ids) const;
Launcher* get_application(const std::string& desktop_id) const;
void invalidate_applications();
diff --git a/panel-plugin/list-page.cpp b/panel-plugin/list-page.cpp
index 1508ff7..b1d628e 100644
--- a/panel-plugin/list-page.cpp
+++ b/panel-plugin/list-page.cpp
@@ -82,40 +82,7 @@ void ListPage::remove(Launcher* launcher)
void ListPage::set_menu_items()
{
- // Create new model for treeview
- GtkListStore* store = gtk_list_store_new(
- LauncherView::N_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_POINTER);
-
- // Fetch menu items or remove them from list if missing
- for (std::vector<std::string>::iterator i = m_desktop_ids.begin(); i != m_desktop_ids.end(); ++i)
- {
- if (i->empty())
- {
- continue;
- }
-
- Launcher* launcher = get_window()->get_applications()->get_application(*i);
- if (launcher)
- {
- gtk_list_store_insert_with_values(
- store, NULL, G_MAXINT,
- LauncherView::COLUMN_ICON, launcher->get_icon(),
- LauncherView::COLUMN_TEXT, launcher->get_text(),
- LauncherView::COLUMN_LAUNCHER, launcher,
- -1);
- }
- else
- {
- i = m_desktop_ids.erase(i);
- --i;
- }
- }
-
- // Replace treeview contents
- GtkTreeModel* model = GTK_TREE_MODEL(store);
+ GtkTreeModel* model = get_window()->get_applications()->create_launcher_model(m_desktop_ids);
get_view()->set_model(model);
g_signal_connect_slot(model, "row-changed", &ListPage::on_row_changed, this);
g_signal_connect_slot(model, "row-inserted", &ListPage::on_row_inserted, this);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list