[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 10/20: Use automatically detected types.
noreply at xfce.org
noreply at xfce.org
Thu Feb 6 12:03:27 CET 2020
This is an automated email from the git hooks/post-receive script.
g o t t c o d e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit e3e56d250c81334162d0257623d170f14d438be9
Author: Graeme Gott <graeme at gottcode.org>
Date: Sat Feb 1 20:01:15 2020 -0500
Use automatically detected types.
---
panel-plugin/applications-page.cpp | 6 +++---
panel-plugin/configuration-dialog.cpp | 2 +-
panel-plugin/favorites-page.cpp | 12 ++++++------
panel-plugin/page.cpp | 2 +-
panel-plugin/query.cpp | 2 +-
panel-plugin/recent-page.cpp | 2 +-
panel-plugin/settings.cpp | 4 ++--
panel-plugin/settings.h | 2 +-
8 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/panel-plugin/applications-page.cpp b/panel-plugin/applications-page.cpp
index 46a1c96..8305ced 100644
--- a/panel-plugin/applications-page.cpp
+++ b/panel-plugin/applications-page.cpp
@@ -85,7 +85,7 @@ GtkTreeModel* ApplicationsPage::create_launcher_model(std::vector<std::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)
+ for (auto i = desktop_ids.begin(); i != desktop_ids.end(); ++i)
{
if (i->empty())
{
@@ -118,7 +118,7 @@ GtkTreeModel* ApplicationsPage::create_launcher_model(std::vector<std::string>&
Launcher* ApplicationsPage::get_application(const std::string& desktop_id) const
{
- std::map<std::string, Launcher*>::const_iterator i = m_items.find(desktop_id);
+ auto i = m_items.find(desktop_id);
return (i != m_items.end()) ? i->second : nullptr;
}
@@ -417,7 +417,7 @@ void ApplicationsPage::load_menu_item(GarconMenuItem* menu_item, Category* categ
// Add to map
std::string desktop_id(garcon_menu_item_get_desktop_id(menu_item));
- std::map<std::string, Launcher*>::iterator iter = m_items.find(desktop_id);
+ auto iter = m_items.find(desktop_id);
if (iter == m_items.end())
{
iter = m_items.insert(std::make_pair(desktop_id, new Launcher(menu_item))).first;
diff --git a/panel-plugin/configuration-dialog.cpp b/panel-plugin/configuration-dialog.cpp
index 776a093..008511a 100644
--- a/panel-plugin/configuration-dialog.cpp
+++ b/panel-plugin/configuration-dialog.cpp
@@ -742,7 +742,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
m_item_icon_size = gtk_combo_box_text_new();
gtk_widget_set_halign(m_item_icon_size, GTK_ALIGN_START);
gtk_widget_set_hexpand(m_item_icon_size, false);
- const std::vector<std::string> icon_sizes = IconSize::get_strings();
+ const auto icon_sizes = IconSize::get_strings();
for (const auto& icon_size : icon_sizes)
{
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(m_item_icon_size), icon_size.c_str());
diff --git a/panel-plugin/favorites-page.cpp b/panel-plugin/favorites-page.cpp
index 4d98ba0..bde3039 100644
--- a/panel-plugin/favorites-page.cpp
+++ b/panel-plugin/favorites-page.cpp
@@ -164,7 +164,7 @@ bool FavoritesPage::remember_launcher(Launcher* launcher)
void FavoritesPage::on_row_changed(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter)
{
- size_t pos = gtk_tree_path_get_indices(path)[0];
+ const decltype(wm_settings->favorites.size()) pos = gtk_tree_path_get_indices(path)[0];
if (pos >= wm_settings->favorites.size())
{
return;
@@ -183,7 +183,7 @@ void FavoritesPage::on_row_changed(GtkTreeModel* model, GtkTreePath* path, GtkTr
void FavoritesPage::on_row_inserted(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter)
{
- size_t pos = gtk_tree_path_get_indices(path)[0];
+ const decltype(wm_settings->favorites.size()) pos = gtk_tree_path_get_indices(path)[0];
std::string desktop_id;
Element* element = nullptr;
@@ -209,7 +209,7 @@ void FavoritesPage::on_row_inserted(GtkTreeModel* model, GtkTreePath* path, GtkT
void FavoritesPage::on_row_deleted(GtkTreeModel*, GtkTreePath* path)
{
- size_t pos = gtk_tree_path_get_indices(path)[0];
+ const decltype(wm_settings->favorites.size()) pos = gtk_tree_path_get_indices(path)[0];
if (pos < wm_settings->favorites.size())
{
wm_settings->favorites.erase(wm_settings->favorites.begin() + pos);
@@ -240,7 +240,7 @@ std::vector<Launcher*> FavoritesPage::sort() const
void FavoritesPage::sort_ascending()
{
- const std::vector<Launcher*> items = sort();
+ const auto items = sort();
wm_settings->favorites.clear();
for (auto launcher : items)
@@ -255,10 +255,10 @@ void FavoritesPage::sort_ascending()
void FavoritesPage::sort_descending()
{
- const std::vector<Launcher*> items = sort();
+ const auto items = sort();
wm_settings->favorites.clear();
- for (std::vector<Launcher*>::const_reverse_iterator i = items.rbegin(), end = items.rend(); i != end; ++i)
+ for (auto i = items.rbegin(), end = items.rend(); i != end; ++i)
{
wm_settings->favorites.push_back((*i)->get_desktop_id());
}
diff --git a/panel-plugin/page.cpp b/panel-plugin/page.cpp
index 3260fdc..1b495f8 100644
--- a/panel-plugin/page.cpp
+++ b/panel-plugin/page.cpp
@@ -363,7 +363,7 @@ void Page::create_context_menu(GtkTreePath* path, GdkEvent* event)
menuitem = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- const std::vector<DesktopAction*> actions = m_selected_launcher->get_actions();
+ const auto actions = m_selected_launcher->get_actions();
if (!actions.empty())
{
for (auto action : actions)
diff --git a/panel-plugin/query.cpp b/panel-plugin/query.cpp
index 589b0f9..d78e7b7 100644
--- a/panel-plugin/query.cpp
+++ b/panel-plugin/query.cpp
@@ -81,7 +81,7 @@ unsigned int Query::match(const std::string& haystack) const
}
// Check if haystack contains query as words in any order
- std::vector<std::string>::size_type found_words = 0;
+ decltype(m_query_words.size()) found_words = 0;
for (const auto& word : m_query_words)
{
search_pos = haystack.find(word);
diff --git a/panel-plugin/recent-page.cpp b/panel-plugin/recent-page.cpp
index a8d62f4..f56f95b 100644
--- a/panel-plugin/recent-page.cpp
+++ b/panel-plugin/recent-page.cpp
@@ -64,7 +64,7 @@ void RecentPage::add(Launcher* launcher)
std::string desktop_id = launcher->get_desktop_id();
if (!wm_settings->recent.empty())
{
- std::vector<std::string>::iterator i = std::find(wm_settings->recent.begin(), wm_settings->recent.end(), desktop_id);
+ auto i = std::find(wm_settings->recent.begin(), wm_settings->recent.end(), desktop_id);
// Skip if already first launcher
if (i == wm_settings->recent.begin())
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index b093897..2c7cd8d 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -74,9 +74,9 @@ static void read_vector_entry(XfceRc* rc, const char* key, std::vector<std::stri
static void write_vector_entry(XfceRc* rc, const char* key, const std::vector<std::string>& desktop_ids)
{
- const std::vector<std::string>::size_type size = desktop_ids.size();
+ const auto size = desktop_ids.size();
gchar** values = g_new0(gchar*, size + 1);
- for (std::vector<std::string>::size_type i = 0; i < size; ++i)
+ for (decltype(desktop_ids.size()) i = 0; i < size; ++i)
{
values[i] = g_strdup(desktop_ids[i].c_str());
}
diff --git a/panel-plugin/settings.h b/panel-plugin/settings.h
index 20f4d93..8f11458 100644
--- a/panel-plugin/settings.h
+++ b/panel-plugin/settings.h
@@ -80,7 +80,7 @@ public:
bool load_hierarchy;
bool view_as_icons;
- unsigned int recent_items_max;
+ decltype(recent.size()) recent_items_max;
bool favorites_in_recent;
bool display_recent;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list