[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 06/20: Use null pointer constant.
noreply at xfce.org
noreply at xfce.org
Thu Feb 6 12:03:23 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 dcce62f184fd4795aca11a62597525e0cf3bdb19
Author: Graeme Gott <graeme at gottcode.org>
Date: Tue Jan 21 12:51:26 2020 -0500
Use null pointer constant.
---
panel-plugin/applications-page.cpp | 40 +++++++++++------------
panel-plugin/category.cpp | 42 ++++++++++++------------
panel-plugin/command-edit.cpp | 8 ++---
panel-plugin/command.cpp | 18 +++++------
panel-plugin/command.h | 4 +--
panel-plugin/configuration-dialog.cpp | 42 ++++++++++++------------
panel-plugin/configuration-dialog.h | 4 +--
panel-plugin/element.cpp | 4 +--
panel-plugin/element.h | 12 +++----
panel-plugin/favorites-page.cpp | 8 ++---
panel-plugin/icon-renderer.cpp | 8 ++---
panel-plugin/launcher-icon-view.cpp | 26 +++++++--------
panel-plugin/launcher-tree-view.cpp | 32 +++++++++----------
panel-plugin/launcher-view.h | 4 +--
panel-plugin/launcher.cpp | 36 ++++++++++-----------
panel-plugin/launcher.h | 8 ++---
panel-plugin/page.cpp | 60 +++++++++++++++++------------------
panel-plugin/plugin.cpp | 28 ++++++++--------
panel-plugin/profile-picture.cpp | 10 +++---
panel-plugin/recent-page.cpp | 8 ++---
panel-plugin/resizer-widget.cpp | 4 +--
panel-plugin/run-action.cpp | 10 +++---
panel-plugin/search-action.cpp | 24 +++++++-------
panel-plugin/search-page.cpp | 8 ++---
panel-plugin/search-page.h | 6 ++--
panel-plugin/section-button.cpp | 4 +--
panel-plugin/settings.cpp | 8 ++---
panel-plugin/window.cpp | 28 ++++++++--------
28 files changed, 247 insertions(+), 247 deletions(-)
diff --git a/panel-plugin/applications-page.cpp b/panel-plugin/applications-page.cpp
index ef66936..46a1c96 100644
--- a/panel-plugin/applications-page.cpp
+++ b/panel-plugin/applications-page.cpp
@@ -48,8 +48,8 @@ enum
ApplicationsPage::ApplicationsPage(Window* window) :
Page(window),
- m_garcon_menu(NULL),
- m_garcon_settings_menu(NULL),
+ m_garcon_menu(nullptr),
+ m_garcon_settings_menu(nullptr),
m_load_status(STATUS_INVALID)
{
// Set desktop environment for applications
@@ -60,7 +60,7 @@ ApplicationsPage::ApplicationsPage(Window* window) :
}
else if (*desktop == '\0')
{
- desktop = NULL;
+ desktop = nullptr;
}
garcon_set_environment(desktop);
}
@@ -96,7 +96,7 @@ GtkTreeModel* ApplicationsPage::create_launcher_model(std::vector<std::string>&
if (launcher)
{
gtk_list_store_insert_with_values(
- store, NULL, G_MAXINT,
+ store, nullptr, G_MAXINT,
LauncherView::COLUMN_ICON, launcher->get_icon(),
LauncherView::COLUMN_TEXT, launcher->get_text(),
LauncherView::COLUMN_TOOLTIP, launcher->get_tooltip(),
@@ -119,7 +119,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);
- return (i != m_items.end()) ? i->second : NULL;
+ return (i != m_items.end()) ? i->second : nullptr;
}
//-----------------------------------------------------------------------------
@@ -133,7 +133,7 @@ void ApplicationsPage::apply_filter(GtkToggleButton* togglebutton)
}
// Find category matching button
- Category* category = NULL;
+ Category* category = nullptr;
for (auto test_category : m_categories)
{
if (GTK_TOGGLE_BUTTON(test_category->get_button()->get_widget()) == togglebutton)
@@ -187,8 +187,8 @@ bool ApplicationsPage::load_applications()
clear_applications();
// Load contents in thread if possible
- GTask* task = g_task_new(NULL, NULL, &ApplicationsPage::load_contents_slot, this);
- g_task_set_task_data(task, this, NULL);
+ GTask* task = g_task_new(nullptr, nullptr, &ApplicationsPage::load_contents_slot, this);
+ g_task_set_task_data(task, this, nullptr);
g_task_run_in_thread(task, &ApplicationsPage::load_garcon_menu_slot);
g_object_unref(task);
@@ -230,14 +230,14 @@ void ApplicationsPage::clear_applications()
if (G_LIKELY(m_garcon_menu))
{
g_object_unref(m_garcon_menu);
- m_garcon_menu = NULL;
+ m_garcon_menu = nullptr;
}
// Free settings menu
if (G_LIKELY(m_garcon_settings_menu))
{
g_object_unref(m_garcon_settings_menu);
- m_garcon_settings_menu = NULL;
+ m_garcon_settings_menu = nullptr;
}
}
@@ -256,10 +256,10 @@ void ApplicationsPage::load_garcon_menu()
}
// Load menu
- if (m_garcon_menu && !garcon_menu_load(m_garcon_menu, NULL, NULL))
+ if (m_garcon_menu && !garcon_menu_load(m_garcon_menu, nullptr, nullptr))
{
g_object_unref(m_garcon_menu);
- m_garcon_menu = NULL;
+ m_garcon_menu = nullptr;
}
if (!m_garcon_menu)
@@ -268,11 +268,11 @@ void ApplicationsPage::load_garcon_menu()
}
g_signal_connect_slot<GarconMenu*>(m_garcon_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
- load_menu(m_garcon_menu, NULL);
+ load_menu(m_garcon_menu, nullptr);
// Create settings menu
gchar* path = xfce_resource_lookup(XFCE_RESOURCE_CONFIG, "menus/xfce-settings-manager.menu");
- m_garcon_settings_menu = garcon_menu_new_for_path(path != NULL ? path : SETTINGS_MENUFILE);
+ m_garcon_settings_menu = garcon_menu_new_for_path(path ? path : SETTINGS_MENUFILE);
g_free(path);
if (m_garcon_settings_menu)
@@ -281,9 +281,9 @@ void ApplicationsPage::load_garcon_menu()
}
// Load settings menu
- if (m_garcon_settings_menu && garcon_menu_load(m_garcon_settings_menu, NULL, NULL))
+ if (m_garcon_settings_menu && garcon_menu_load(m_garcon_settings_menu, nullptr, nullptr))
{
- load_menu(m_garcon_settings_menu, NULL);
+ load_menu(m_garcon_settings_menu, nullptr);
}
// Sort items and categories
@@ -297,7 +297,7 @@ void ApplicationsPage::load_garcon_menu()
}
// Create all items category
- Category* category = new Category(NULL);
+ Category* category = new Category(nullptr);
for (const auto& i : m_items)
{
category->append_item(i.second);
@@ -356,7 +356,7 @@ void ApplicationsPage::load_menu(GarconMenu* menu, Category* parent_category)
// Track categories
bool first_level = directory && (garcon_menu_get_parent(menu) == m_garcon_menu);
- Category* category = NULL;
+ Category* category = nullptr;
if (directory)
{
if (first_level)
@@ -376,7 +376,7 @@ void ApplicationsPage::load_menu(GarconMenu* menu, Category* parent_category)
// Add menu elements
GList* elements = garcon_menu_get_elements(menu);
- for (GList* li = elements; li != NULL; li = li->next)
+ for (GList* li = elements; li; li = li->next)
{
if (GARCON_IS_MENU_ITEM(li->data))
{
@@ -398,7 +398,7 @@ void ApplicationsPage::load_menu(GarconMenu* menu, Category* parent_category)
{
m_categories.erase(std::find(m_categories.begin(), m_categories.end(), category));
delete category;
- category = NULL;
+ category = nullptr;
}
// Listen for menu changes
diff --git a/panel-plugin/category.cpp b/panel-plugin/category.cpp
index 1a291f2..6cf8ae6 100644
--- a/panel-plugin/category.cpp
+++ b/panel-plugin/category.cpp
@@ -30,14 +30,14 @@ using namespace WhiskerMenu;
//-----------------------------------------------------------------------------
Category::Category(GarconMenuDirectory* directory) :
- m_button(NULL),
- m_model(NULL),
+ m_button(nullptr),
+ m_model(nullptr),
m_has_separators(false),
m_has_subcategories(false)
{
- const gchar* icon = NULL;
- const gchar* text = NULL;
- const gchar* tooltip = NULL;
+ const gchar* icon = nullptr;
+ const gchar* text = nullptr;
+ const gchar* tooltip = nullptr;
if (directory)
{
icon = garcon_menu_directory_get_icon_name(directory);
@@ -96,7 +96,7 @@ GtkTreeModel* Category::get_model()
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_POINTER);
- insert_items(model, NULL);
+ insert_items(model, nullptr);
m_model = GTK_TREE_MODEL(model);
}
else
@@ -149,7 +149,7 @@ void Category::append_separator()
if (!m_items.empty() && m_items.back())
{
unset_model();
- m_items.push_back(NULL);
+ m_items.push_back(nullptr);
m_has_separators = true;
}
}
@@ -189,7 +189,7 @@ void Category::insert_items(GtkTreeStore* model, GtkTreeIter* parent)
LauncherView::COLUMN_ICON, category->get_icon(),
LauncherView::COLUMN_TEXT, text,
LauncherView::COLUMN_TOOLTIP, tooltip,
- LauncherView::COLUMN_LAUNCHER, NULL,
+ LauncherView::COLUMN_LAUNCHER, nullptr,
-1);
g_free(text);
category->insert_items(model, &iter);
@@ -197,7 +197,7 @@ void Category::insert_items(GtkTreeStore* model, GtkTreeIter* parent)
else if (Launcher* launcher = dynamic_cast<Launcher*>(element))
{
gtk_tree_store_insert_with_values(model,
- NULL, parent, INT_MAX,
+ nullptr, parent, INT_MAX,
LauncherView::COLUMN_ICON, launcher->get_icon(),
LauncherView::COLUMN_TEXT, launcher->get_text(),
LauncherView::COLUMN_TOOLTIP, launcher->get_tooltip(),
@@ -207,11 +207,11 @@ void Category::insert_items(GtkTreeStore* model, GtkTreeIter* parent)
else
{
gtk_tree_store_insert_with_values(model,
- NULL, parent, INT_MAX,
- LauncherView::COLUMN_ICON, NULL,
- LauncherView::COLUMN_TEXT, NULL,
- LauncherView::COLUMN_TOOLTIP, NULL,
- LauncherView::COLUMN_LAUNCHER, NULL,
+ nullptr, parent, INT_MAX,
+ LauncherView::COLUMN_ICON, nullptr,
+ LauncherView::COLUMN_TEXT, nullptr,
+ LauncherView::COLUMN_TOOLTIP, nullptr,
+ LauncherView::COLUMN_LAUNCHER, nullptr,
-1);
}
}
@@ -231,7 +231,7 @@ void Category::insert_items(GtkListStore* model)
if (Launcher* launcher = dynamic_cast<Launcher*>(element))
{
gtk_list_store_insert_with_values(model,
- NULL, INT_MAX,
+ nullptr, INT_MAX,
LauncherView::COLUMN_ICON, launcher->get_icon(),
LauncherView::COLUMN_TEXT, launcher->get_text(),
LauncherView::COLUMN_TOOLTIP, launcher->get_tooltip(),
@@ -241,11 +241,11 @@ void Category::insert_items(GtkListStore* model)
else
{
gtk_list_store_insert_with_values(model,
- NULL, INT_MAX,
- LauncherView::COLUMN_ICON, NULL,
- LauncherView::COLUMN_TEXT, NULL,
- LauncherView::COLUMN_TOOLTIP, NULL,
- LauncherView::COLUMN_LAUNCHER, NULL,
+ nullptr, INT_MAX,
+ LauncherView::COLUMN_ICON, nullptr,
+ LauncherView::COLUMN_TEXT, nullptr,
+ LauncherView::COLUMN_TOOLTIP, nullptr,
+ LauncherView::COLUMN_LAUNCHER, nullptr,
-1);
}
}
@@ -258,7 +258,7 @@ void Category::unset_model()
if (m_model)
{
g_object_unref(m_model);
- m_model = NULL;
+ m_model = nullptr;
}
}
diff --git a/panel-plugin/command-edit.cpp b/panel-plugin/command-edit.cpp
index c6b55ca..fb50173 100644
--- a/panel-plugin/command-edit.cpp
+++ b/panel-plugin/command-edit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2016 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -66,19 +66,19 @@ void CommandEdit::browse_clicked()
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_ACCEPT,
- NULL));
+ nullptr));
gtk_file_chooser_set_local_only(chooser, true);
gtk_file_chooser_set_current_folder(chooser, BINDIR);
// Select current command
gchar* filename = g_strdup(m_command->get());
- if (filename != NULL)
+ if (filename)
{
// Make sure command is absolute path
if (!g_path_is_absolute(filename))
{
gchar* absolute_path = g_find_program_in_path(filename);
- if (absolute_path != NULL)
+ if (absolute_path)
{
g_free(filename);
filename = absolute_path;
diff --git a/panel-plugin/command.cpp b/panel-plugin/command.cpp
index ef6a022..97ee450 100644
--- a/panel-plugin/command.cpp
+++ b/panel-plugin/command.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2016, 2018, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,15 +39,15 @@ enum
//-----------------------------------------------------------------------------
Command::Command(const gchar* icon, const gchar* text, const gchar* command, const gchar* error_text, const gchar* confirm_question, const gchar* confirm_status) :
- m_button(NULL),
- m_menuitem(NULL),
+ m_button(nullptr),
+ m_menuitem(nullptr),
m_icon(g_strdup(icon)),
m_mnemonic(g_strdup(text)),
m_command(g_strdup(command)),
m_error_text(g_strdup(error_text)),
m_status(WHISKERMENU_COMMAND_UNCHECKED),
m_shown(true),
- m_timeout_details({NULL, g_strdup(confirm_question), g_strdup(confirm_status), 0})
+ m_timeout_details({nullptr, g_strdup(confirm_question), g_strdup(confirm_status), 0})
{
std::string tooltip(text ? text : "");
for (auto i = tooltip.begin(); i != tooltip.end(); ++i)
@@ -175,7 +175,7 @@ void Command::check()
if (m_status == WHISKERMENU_COMMAND_UNCHECKED)
{
gchar** argv;
- if (g_shell_parse_argv(m_command, NULL, &argv, NULL))
+ if (g_shell_parse_argv(m_command, nullptr, &argv, nullptr))
{
gchar* path = g_find_program_in_path(argv[0]);
m_status = path ? WHISKERMENU_COMMAND_VALID : WHISKERMENU_COMMAND_INVALID;
@@ -212,10 +212,10 @@ void Command::activate()
return;
}
- GError* error = NULL;
+ GError* error = nullptr;
if (!g_spawn_command_line_async(m_command, &error))
{
- xfce_dialog_show_error(NULL, error, m_error_text, NULL);
+ xfce_dialog_show_error(nullptr, error, m_error_text, nullptr);
g_error_free(error);
}
}
@@ -226,7 +226,7 @@ void Command::activate()
bool Command::confirm()
{
// Create dialog
- m_timeout_details.dialog = gtk_message_dialog_new(NULL, GtkDialogFlags(0),
+ m_timeout_details.dialog = gtk_message_dialog_new(nullptr, GtkDialogFlags(0),
GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,
"%s", m_timeout_details.question);
GtkDialog* dialog = GTK_DIALOG(m_timeout_details.dialog);
@@ -266,7 +266,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_source_remove(timeout_id);
gtk_widget_destroy(m_timeout_details.dialog);
- m_timeout_details.dialog = NULL;
+ m_timeout_details.dialog = nullptr;
return result == GTK_RESPONSE_ACCEPT;
}
diff --git a/panel-plugin/command.h b/panel-plugin/command.h
index 549cc52..c7097ce 100644
--- a/panel-plugin/command.h
+++ b/panel-plugin/command.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2018, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ namespace WhiskerMenu
class Command
{
public:
- Command(const gchar* icon, const gchar* text, const gchar* command, const gchar* error_text, const gchar* confirm_question = NULL, const gchar* confirm_status = NULL);
+ Command(const gchar* icon, const gchar* text, const gchar* command, const gchar* error_text, const gchar* confirm_question = nullptr, const gchar* confirm_status = nullptr);
~Command();
GtkWidget* get_button();
diff --git a/panel-plugin/configuration-dialog.cpp b/panel-plugin/configuration-dialog.cpp
index b1eef5f..776a093 100644
--- a/panel-plugin/configuration-dialog.cpp
+++ b/panel-plugin/configuration-dialog.cpp
@@ -61,12 +61,12 @@ static GtkWidget* make_aligned_frame(const gchar* text, GtkWidget* content)
{
// Create bold label
gchar* markup = g_markup_printf_escaped("<b>%s</b>", text);
- GtkWidget* label = gtk_label_new(NULL);
+ GtkWidget* label = gtk_label_new(nullptr);
gtk_label_set_markup(GTK_LABEL(label), markup);
g_free(markup);
// Create frame
- GtkWidget* frame = gtk_frame_new(NULL);
+ GtkWidget* frame = gtk_frame_new(nullptr);
gtk_frame_set_label_widget(GTK_FRAME(frame), label);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE);
@@ -84,7 +84,7 @@ ConfigurationDialog::ConfigurationDialog(Plugin* plugin) :
m_plugin(plugin)
{
// Create dialog window
- GtkWindow* window = NULL;
+ GtkWindow* window = nullptr;
GtkWidget* toplevel = gtk_widget_get_toplevel(m_plugin->get_button());
if (gtk_widget_is_toplevel(toplevel))
{
@@ -96,14 +96,14 @@ ConfigurationDialog::ConfigurationDialog(Plugin* plugin) :
GtkDialogFlags(0),
"help-browser", _("_Help"), GTK_RESPONSE_HELP,
"window-close", _("_Close"), GTK_RESPONSE_CLOSE,
- NULL);
+ nullptr);
#else
m_window = xfce_titled_dialog_new_with_buttons(_("Whisker Menu"),
window,
GtkDialogFlags(0),
_("_Help"), GTK_RESPONSE_HELP,
_("_Close"), GTK_RESPONSE_CLOSE,
- NULL);
+ nullptr);
#endif
gtk_window_set_icon_name(GTK_WINDOW(m_window), "xfce4-whiskermenu");
gtk_window_set_position(GTK_WINDOW(m_window), GTK_WIN_POS_CENTER);
@@ -303,7 +303,7 @@ void ConfigurationDialog::choose_icon()
GTK_WINDOW(m_window),
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_ACCEPT,
- NULL);
+ nullptr);
gtk_dialog_set_default_response(GTK_DIALOG(chooser), GTK_RESPONSE_ACCEPT);
exo_icon_chooser_dialog_set_icon(EXO_ICON_CHOOSER_DIALOG(chooser), m_plugin->get_button_icon_name().c_str());
@@ -391,9 +391,9 @@ SearchAction* ConfigurationDialog::get_selected_action(GtkTreeIter* iter) const
iter = &selected_iter;
}
- SearchAction* action = NULL;
+ SearchAction* action = nullptr;
GtkTreeSelection* selection = gtk_tree_view_get_selection(m_actions_view);
- GtkTreeModel* model = NULL;
+ GtkTreeModel* model = nullptr;
if (gtk_tree_selection_get_selected(selection, &model, iter))
{
gtk_tree_model_get(model, iter, COLUMN_ACTION, &action, -1);
@@ -482,7 +482,7 @@ void ConfigurationDialog::add_action(GtkButton*)
COLUMN_ACTION, action,
-1);
GtkTreePath* path = gtk_tree_model_get_path(GTK_TREE_MODEL(m_actions_model), &iter);
- gtk_tree_view_set_cursor(m_actions_view, path, NULL, false);
+ gtk_tree_view_set_cursor(m_actions_view, path, nullptr, false);
gtk_tree_path_free(path);
// Make sure editing is allowed
@@ -520,7 +520,7 @@ void ConfigurationDialog::remove_action(GtkButton* button)
if (!gtk_tree_path_prev(path))
{
gtk_tree_path_free(path);
- path = NULL;
+ path = nullptr;
}
// Remove from model
@@ -541,7 +541,7 @@ void ConfigurationDialog::remove_action(GtkButton* button)
// Select next action
if (path)
{
- gtk_tree_view_set_cursor(m_actions_view, path, NULL, false);
+ gtk_tree_view_set_cursor(m_actions_view, path, nullptr, false);
gtk_tree_path_free(path);
}
else
@@ -565,7 +565,7 @@ void ConfigurationDialog::response(GtkDialog*, int response_id)
{
if (response_id == GTK_RESPONSE_HELP)
{
- bool result = g_spawn_command_line_async("exo-open --launch WebBrowser " PLUGIN_WEBSITE, NULL);
+ bool result = g_spawn_command_line_async("exo-open --launch WebBrowser " PLUGIN_WEBSITE, nullptr);
if (G_UNLIKELY(!result))
{
@@ -610,12 +610,12 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
gtk_grid_attach(page, GTK_WIDGET(display_box), 0, 0, 2, 1);
// Add option to show as icons
- m_show_as_icons = gtk_radio_button_new_with_mnemonic(NULL, _("Show as _icons"));
+ m_show_as_icons = gtk_radio_button_new_with_mnemonic(nullptr, _("Show as _icons"));
{
gchar* icons[] = {
g_strdup("view-list-icons"),
g_strdup("view-grid"),
- NULL
+ nullptr
};
GIcon* gicon = g_themed_icon_new_from_names(icons, -1);
gtk_button_set_image(GTK_BUTTON(m_show_as_icons), gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_DND));
@@ -633,7 +633,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
g_strdup("view-list-compact"),
g_strdup("view-list-details"),
g_strdup("view-list"),
- NULL
+ nullptr
};
GIcon* gicon = g_themed_icon_new_from_names(icons, -1);
gtk_button_set_image(GTK_BUTTON(m_show_as_list), gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_DND));
@@ -651,7 +651,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
g_strdup("view-list-tree"),
g_strdup("view-list-details"),
g_strdup("pan-end"),
- NULL
+ nullptr
};
GIcon* gicon = g_themed_icon_new_from_names(icons, -1);
gtk_button_set_image(GTK_BUTTON(m_show_as_tree), gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_DND));
@@ -968,7 +968,7 @@ GtkWidget* ConfigurationDialog::init_search_actions_tab()
for (auto action : wm_settings->search_actions)
{
gtk_list_store_insert_with_values(m_actions_model,
- NULL, G_MAXINT,
+ nullptr, G_MAXINT,
COLUMN_NAME, action->get_name(),
COLUMN_PATTERN, action->get_pattern(),
COLUMN_ACTION, action,
@@ -981,18 +981,18 @@ GtkWidget* ConfigurationDialog::init_search_actions_tab()
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(_("Name"),
- renderer, "text", COLUMN_NAME, NULL);
+ renderer, "text", COLUMN_NAME, nullptr);
gtk_tree_view_append_column(m_actions_view, column);
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(_("Pattern"),
- renderer, "text", COLUMN_PATTERN, NULL);
+ renderer, "text", COLUMN_PATTERN, nullptr);
gtk_tree_view_append_column(m_actions_view, column);
GtkTreeSelection* selection = gtk_tree_view_get_selection(m_actions_view);
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
- GtkWidget* scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ GtkWidget* scrolled_window = gtk_scrolled_window_new(nullptr, nullptr);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_ETCHED_IN);
gtk_container_add(GTK_CONTAINER(scrolled_window), GTK_WIDGET(m_actions_view));
@@ -1080,7 +1080,7 @@ GtkWidget* ConfigurationDialog::init_search_actions_tab()
if (!wm_settings->search_actions.empty())
{
GtkTreePath* path = gtk_tree_path_new_first();
- gtk_tree_view_set_cursor(m_actions_view, path, NULL, false);
+ gtk_tree_view_set_cursor(m_actions_view, path, nullptr, false);
gtk_tree_path_free(path);
}
else
diff --git a/panel-plugin/configuration-dialog.h b/panel-plugin/configuration-dialog.h
index 1be181e..81fa338 100644
--- a/panel-plugin/configuration-dialog.h
+++ b/panel-plugin/configuration-dialog.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2015, 2016, 2018, 2019, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ private:
void toggle_confirm_session_command(GtkToggleButton* button);
- SearchAction* get_selected_action(GtkTreeIter* iter = NULL) const;
+ SearchAction* get_selected_action(GtkTreeIter* iter = nullptr) const;
void action_selected(GtkTreeView* view);
void action_name_changed(GtkEditable* editable);
void action_pattern_changed(GtkEditable* editable);
diff --git a/panel-plugin/element.cpp b/panel-plugin/element.cpp
index 86737d2..744627a 100644
--- a/panel-plugin/element.cpp
+++ b/panel-plugin/element.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2017-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ void Element::set_icon(const gchar* icon)
if (m_icon)
{
g_object_unref(m_icon);
- m_icon = NULL;
+ m_icon = nullptr;
}
if (G_UNLIKELY(!icon))
diff --git a/panel-plugin/element.h b/panel-plugin/element.h
index 88adf1c..a59c9fc 100644
--- a/panel-plugin/element.h
+++ b/panel-plugin/element.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2015, 2016, 2019, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,10 +30,10 @@ class Element
{
public:
Element() :
- m_icon(NULL),
- m_text(NULL),
- m_tooltip(NULL),
- m_sort_key(NULL)
+ m_icon(nullptr),
+ m_text(nullptr),
+ m_tooltip(nullptr),
+ m_sort_key(nullptr)
{
}
@@ -99,7 +99,7 @@ protected:
void set_tooltip(const gchar* tooltip)
{
g_free(m_tooltip);
- m_tooltip = !exo_str_is_empty(tooltip) ? g_markup_escape_text(tooltip, -1) : NULL;
+ m_tooltip = !exo_str_is_empty(tooltip) ? g_markup_escape_text(tooltip, -1) : nullptr;
}
private:
diff --git a/panel-plugin/favorites-page.cpp b/panel-plugin/favorites-page.cpp
index 70f0b0c..4b8452a 100644
--- a/panel-plugin/favorites-page.cpp
+++ b/panel-plugin/favorites-page.cpp
@@ -73,7 +73,7 @@ void FavoritesPage::add(Launcher* launcher)
// Append to list of items
GtkListStore* store = GTK_LIST_STORE(get_view()->get_model());
gtk_list_store_insert_with_values(
- store, NULL, G_MAXINT,
+ store, nullptr, G_MAXINT,
LauncherView::COLUMN_ICON, launcher->get_icon(),
LauncherView::COLUMN_TEXT, launcher->get_text(),
LauncherView::COLUMN_TOOLTIP, launcher->get_tooltip(),
@@ -93,7 +93,7 @@ void FavoritesPage::remove(Launcher* launcher)
GtkTreeModel* model = GTK_TREE_MODEL(get_view()->get_model());
GtkListStore* store = GTK_LIST_STORE(model);
GtkTreeIter iter;
- Launcher* test_launcher = NULL;
+ Launcher* test_launcher = nullptr;
bool valid = gtk_tree_model_get_iter_first(model, &iter);
while (valid)
@@ -170,7 +170,7 @@ void FavoritesPage::on_row_changed(GtkTreeModel* model, GtkTreePath* path, GtkTr
return;
}
- Element* element = NULL;
+ Element* element = nullptr;
gtk_tree_model_get(model, iter, LauncherView::COLUMN_LAUNCHER, &element, -1);
if (Launcher* launcher = dynamic_cast<Launcher*>(element))
{
@@ -186,7 +186,7 @@ void FavoritesPage::on_row_inserted(GtkTreeModel* model, GtkTreePath* path, GtkT
size_t pos = gtk_tree_path_get_indices(path)[0];
std::string desktop_id;
- Element* element = NULL;
+ Element* element = nullptr;
gtk_tree_model_get(model, iter, LauncherView::COLUMN_LAUNCHER, &element, -1);
if (Launcher* launcher = dynamic_cast<Launcher*>(element))
{
diff --git a/panel-plugin/icon-renderer.cpp b/panel-plugin/icon-renderer.cpp
index 2293eb2..a08c5d0 100644
--- a/panel-plugin/icon-renderer.cpp
+++ b/panel-plugin/icon-renderer.cpp
@@ -115,7 +115,7 @@ static void whiskermenu_icon_renderer_render(GtkCellRenderer* renderer, cairo_t*
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen(gtk_widget_get_screen(widget));
GdkWindow* window = gtk_widget_get_window(widget);
- cairo_surface_t* surface = NULL;
+ cairo_surface_t* surface = nullptr;
GtkIconInfo* icon_info = gtk_icon_theme_lookup_by_gicon_for_scale(icon_theme,
icon_renderer->gicon,
@@ -124,7 +124,7 @@ static void whiskermenu_icon_renderer_render(GtkCellRenderer* renderer, cairo_t*
GtkIconLookupFlags(GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_FORCE_SIZE));
if (icon_info)
{
- surface = gtk_icon_info_load_surface(icon_info, window, NULL);
+ surface = gtk_icon_info_load_surface(icon_info, window, nullptr);
g_object_unref(icon_info);
}
@@ -137,7 +137,7 @@ static void whiskermenu_icon_renderer_render(GtkCellRenderer* renderer, cairo_t*
GtkIconLookupFlags(GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_FORCE_SIZE));
if (icon_info)
{
- surface = gtk_icon_info_load_surface(icon_info, window, NULL);
+ surface = gtk_icon_info_load_surface(icon_info, window, nullptr);
g_object_unref(icon_info);
}
}
@@ -275,7 +275,7 @@ static void whiskermenu_icon_renderer_init(WhiskerMenuIconRenderer*)
GtkCellRenderer* whiskermenu_icon_renderer_new()
{
- return GTK_CELL_RENDERER(g_object_new(WHISKERMENU_TYPE_ICON_RENDERER, NULL));
+ return GTK_CELL_RENDERER(g_object_new(WHISKERMENU_TYPE_ICON_RENDERER, nullptr));
}
//-----------------------------------------------------------------------------
diff --git a/panel-plugin/launcher-icon-view.cpp b/panel-plugin/launcher-icon-view.cpp
index 8c7c27e..e849800 100644
--- a/panel-plugin/launcher-icon-view.cpp
+++ b/panel-plugin/launcher-icon-view.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2019-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ using namespace WhiskerMenu;
//-----------------------------------------------------------------------------
LauncherIconView::LauncherIconView() :
- m_icon_renderer(NULL),
+ m_icon_renderer(nullptr),
m_icon_size(-1)
{
// Create the view
@@ -38,10 +38,10 @@ LauncherIconView::LauncherIconView() :
g_object_set(m_icon_renderer,
"xalign", 0.5,
"yalign", 1.0,
- NULL);
+ nullptr);
GtkCellLayout* cell_layout = GTK_CELL_LAYOUT(m_view);
gtk_cell_layout_pack_start(cell_layout, m_icon_renderer, false);
- gtk_cell_layout_set_attributes(cell_layout, m_icon_renderer, "gicon", COLUMN_ICON, "launcher", COLUMN_LAUNCHER, NULL);
+ gtk_cell_layout_set_attributes(cell_layout, m_icon_renderer, "gicon", COLUMN_ICON, "launcher", COLUMN_LAUNCHER, nullptr);
gtk_icon_view_set_markup_column(m_view, COLUMN_TEXT);
@@ -74,8 +74,8 @@ LauncherIconView::~LauncherIconView()
GtkTreePath* LauncherIconView::get_cursor() const
{
- GtkTreePath* path = NULL;
- gtk_icon_view_get_cursor(m_view, &path, NULL);
+ GtkTreePath* path = nullptr;
+ gtk_icon_view_get_cursor(m_view, &path, nullptr);
return path;
}
@@ -90,9 +90,9 @@ GtkTreePath* LauncherIconView::get_path_at_pos(int x, int y) const
GtkTreePath* LauncherIconView::get_selected_path() const
{
- GtkTreePath* path = NULL;
+ GtkTreePath* path = nullptr;
GList* selection = gtk_icon_view_get_selected_items(m_view);
- if (selection != NULL)
+ if (selection)
{
path = gtk_tree_path_copy(static_cast<GtkTreePath*>(selection->data));
}
@@ -125,7 +125,7 @@ void LauncherIconView::select_path(GtkTreePath* path)
void LauncherIconView::set_cursor(GtkTreePath* path)
{
- gtk_icon_view_set_cursor(m_view,path, NULL, false);
+ gtk_icon_view_set_cursor(m_view,path, nullptr, false);
}
//-----------------------------------------------------------------------------
@@ -180,8 +180,8 @@ void LauncherIconView::set_model(GtkTreeModel* model)
void LauncherIconView::unset_model()
{
- m_model = NULL;
- gtk_icon_view_set_model(m_view, NULL);
+ m_model = nullptr;
+ gtk_icon_view_set_model(m_view, nullptr);
}
//-----------------------------------------------------------------------------
@@ -226,11 +226,11 @@ void LauncherIconView::reload_icon_size()
// Configure icon renderer
if (m_icon_size > 1)
{
- g_object_set(m_icon_renderer, "size", m_icon_size, "visible", true, NULL);
+ g_object_set(m_icon_renderer, "size", m_icon_size, "visible", true, nullptr);
}
else
{
- g_object_set(m_icon_renderer, "visible", false, NULL);
+ g_object_set(m_icon_renderer, "visible", false, nullptr);
}
// Adjust item size
diff --git a/panel-plugin/launcher-tree-view.cpp b/panel-plugin/launcher-tree-view.cpp
index 77417ad..c74be51 100644
--- a/panel-plugin/launcher-tree-view.cpp
+++ b/panel-plugin/launcher-tree-view.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2016, 2018, 2019, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ LauncherTreeView::LauncherTreeView() :
gtk_tree_view_set_hover_selection(m_view, true);
gtk_tree_view_set_enable_search(m_view, false);
gtk_tree_view_set_fixed_height_mode(m_view, true);
- gtk_tree_view_set_row_separator_func(m_view, &is_separator, NULL, NULL);
+ gtk_tree_view_set_row_separator_func(m_view, &is_separator, nullptr, nullptr);
create_column();
g_signal_connect_slot(m_view, "key-press-event", &LauncherTreeView::on_key_press_event, this);
g_signal_connect_slot(m_view, "key-release-event", &LauncherTreeView::on_key_release_event, this);
@@ -76,8 +76,8 @@ LauncherTreeView::~LauncherTreeView()
GtkTreePath* LauncherTreeView::get_cursor() const
{
- GtkTreePath* path = NULL;
- gtk_tree_view_get_cursor(m_view, &path, NULL);
+ GtkTreePath* path = nullptr;
+ gtk_tree_view_get_cursor(m_view, &path, nullptr);
return path;
}
@@ -85,8 +85,8 @@ GtkTreePath* LauncherTreeView::get_cursor() const
GtkTreePath* LauncherTreeView::get_path_at_pos(int x, int y) const
{
- GtkTreePath* path = NULL;
- gtk_tree_view_get_path_at_pos(m_view, x, y, &path, NULL, NULL, NULL);
+ GtkTreePath* path = nullptr;
+ gtk_tree_view_get_path_at_pos(m_view, x, y, &path, nullptr, nullptr, nullptr);
return path;
}
@@ -94,10 +94,10 @@ GtkTreePath* LauncherTreeView::get_path_at_pos(int x, int y) const
GtkTreePath* LauncherTreeView::get_selected_path() const
{
- GtkTreePath* path = NULL;
+ GtkTreePath* path = nullptr;
GtkTreeSelection* selection = gtk_tree_view_get_selection(m_view);
GtkTreeIter iter;
- if (gtk_tree_selection_get_selected(selection, NULL, &iter))
+ if (gtk_tree_selection_get_selected(selection, nullptr, &iter))
{
path = gtk_tree_model_get_path(m_model, &iter);
}
@@ -116,7 +116,7 @@ void LauncherTreeView::activate_path(GtkTreePath* path)
void LauncherTreeView::scroll_to_path(GtkTreePath* path)
{
- gtk_tree_view_scroll_to_cell(m_view, path, NULL, true, 0.5f, 0.5f);
+ gtk_tree_view_scroll_to_cell(m_view, path, nullptr, true, 0.5f, 0.5f);
}
//-----------------------------------------------------------------------------
@@ -134,7 +134,7 @@ void LauncherTreeView::set_cursor(GtkTreePath* path)
GtkTreeSelection* selection = gtk_tree_view_get_selection(m_view);
GtkSelectionMode mode = gtk_tree_selection_get_mode(selection);
gtk_tree_selection_set_mode(selection, GTK_SELECTION_NONE);
- gtk_tree_view_set_cursor(m_view, path, NULL, false);
+ gtk_tree_view_set_cursor(m_view, path, nullptr, false);
gtk_tree_selection_set_mode(selection, mode);
}
@@ -194,8 +194,8 @@ void LauncherTreeView::set_model(GtkTreeModel* model)
void LauncherTreeView::unset_model()
{
- m_model = NULL;
- gtk_tree_view_set_model(m_view, NULL);
+ m_model = nullptr;
+ gtk_tree_view_set_model(m_view, nullptr);
}
//-----------------------------------------------------------------------------
@@ -251,13 +251,13 @@ void LauncherTreeView::create_column()
if (m_icon_size > 1)
{
GtkCellRenderer* icon_renderer = whiskermenu_icon_renderer_new();
- g_object_set(icon_renderer, "size", m_icon_size, NULL);
+ g_object_set(icon_renderer, "size", m_icon_size, nullptr);
gtk_tree_view_column_pack_start(m_column, icon_renderer, false);
- gtk_tree_view_column_set_attributes(m_column, icon_renderer, "gicon", COLUMN_ICON, "launcher", COLUMN_LAUNCHER, NULL);
+ gtk_tree_view_column_set_attributes(m_column, icon_renderer, "gicon", COLUMN_ICON, "launcher", COLUMN_LAUNCHER, nullptr);
}
GtkCellRenderer* text_renderer = gtk_cell_renderer_text_new();
- g_object_set(text_renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ g_object_set(text_renderer, "ellipsize", PANGO_ELLIPSIZE_END, nullptr);
gtk_tree_view_column_pack_start(m_column, text_renderer, true);
gtk_tree_view_column_add_attribute(m_column, text_renderer, "markup", COLUMN_TEXT);
@@ -294,7 +294,7 @@ gboolean LauncherTreeView::on_key_release_event(GtkWidget*, GdkEvent* event)
void LauncherTreeView::on_row_activated(GtkTreeView* tree_view, GtkTreePath* path, GtkTreeViewColumn*)
{
- Element* element = NULL;
+ Element* element = nullptr;
GtkTreeIter iter;
gtk_tree_model_get_iter(m_model, &iter, path);
gtk_tree_model_get(m_model, &iter, COLUMN_LAUNCHER, &element, -1);
diff --git a/panel-plugin/launcher-view.h b/panel-plugin/launcher-view.h
index 976f686..ef96751 100644
--- a/panel-plugin/launcher-view.h
+++ b/panel-plugin/launcher-view.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2016, 2019 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ class LauncherView
{
public:
LauncherView() :
- m_model(NULL)
+ m_model(nullptr)
{
}
diff --git a/panel-plugin/launcher.cpp b/panel-plugin/launcher.cpp
index 52dfbc7..2130aba 100644
--- a/panel-plugin/launcher.cpp
+++ b/panel-plugin/launcher.cpp
@@ -109,13 +109,13 @@ Launcher::Launcher(GarconMenuItem* item) :
// Fetch text
const gchar* name = garcon_menu_item_get_name(m_item);
- if (G_UNLIKELY(!name) || !g_utf8_validate(name, -1, NULL))
+ if (G_UNLIKELY(!name) || !g_utf8_validate(name, -1, nullptr))
{
name = "";
}
const gchar* generic_name = garcon_menu_item_get_generic_name(m_item);
- if (G_UNLIKELY(!generic_name) || !g_utf8_validate(generic_name, -1, NULL))
+ if (G_UNLIKELY(!generic_name) || !g_utf8_validate(generic_name, -1, nullptr))
{
generic_name = "";
}
@@ -127,7 +127,7 @@ Launcher::Launcher(GarconMenuItem* item) :
m_display_name = name;
const gchar* details = garcon_menu_item_get_comment(m_item);
- if (!details || !g_utf8_validate(details, -1, NULL))
+ if (!details || !g_utf8_validate(details, -1, nullptr))
{
details = generic_name;
}
@@ -152,10 +152,10 @@ Launcher::Launcher(GarconMenuItem* item) :
// Create search text for keywords
#if GARCON_CHECK_VERSION(0,6,2)
GList* keywords = garcon_menu_item_get_keywords(m_item);
- for (GList* i = keywords; i != NULL; i = i->next)
+ for (GList* i = keywords; i; i = i->next)
{
const gchar* keyword = static_cast<gchar*>(i->data);
- if (!exo_str_is_empty(keyword) && g_utf8_validate(keyword, -1, NULL))
+ if (!exo_str_is_empty(keyword) && g_utf8_validate(keyword, -1, nullptr))
{
m_search_keywords.push_back(normalize(keyword));
}
@@ -164,7 +164,7 @@ Launcher::Launcher(GarconMenuItem* item) :
// Create search text for command
const gchar* command = garcon_menu_item_get_command(m_item);
- if (!exo_str_is_empty(command) && g_utf8_validate(command, -1, NULL))
+ if (!exo_str_is_empty(command) && g_utf8_validate(command, -1, nullptr))
{
m_search_command = normalize(command);
}
@@ -172,7 +172,7 @@ Launcher::Launcher(GarconMenuItem* item) :
// Fetch desktop actions
#ifdef GARCON_TYPE_MENU_ITEM_ACTION
GList* actions = garcon_menu_item_get_actions(m_item);
- for (GList* i = actions; i != NULL; i = i->next)
+ for (GList* i = actions; i; i = i->next)
{
GarconMenuItemAction* action = garcon_menu_item_get_action(m_item, static_cast<gchar*>(i->data));
if (action)
@@ -200,12 +200,12 @@ Launcher::~Launcher()
void Launcher::hide()
{
// Look up the correct relative path
- const gchar* relpath = NULL;
+ const gchar* relpath = nullptr;
gchar* uri = get_uri();
if (uri)
{
gchar** dirs = xfce_resource_lookup_all(XFCE_RESOURCE_DATA, "applications/");
- for (guint i = 0; dirs[i] != NULL; i++)
+ for (guint i = 0; dirs[i]; i++)
{
if (g_str_has_prefix(uri + 7, dirs[i]))
{
@@ -228,7 +228,7 @@ void Launcher::hide()
"remove the line \"%s\"."), path, "Hidden=true");
g_free(path);
- if (xfce_dialog_confirm(NULL, NULL, _("Hide Application"), message,
+ if (xfce_dialog_confirm(nullptr, nullptr, _("Hide Application"), message,
_("Are you sure you want to hide \"%s\"?"), m_display_name))
{
XfceRc* rc = xfce_rc_config_open(XFCE_RESOURCE_DATA, relpath, false);
@@ -300,12 +300,12 @@ void Launcher::run(GdkScreen* screen) const
// Parse and spawn command
gchar** argv;
gboolean result = false;
- GError* error = NULL;
- if (g_shell_parse_argv(command.c_str(), NULL, &argv, &error))
+ GError* error = nullptr;
+ if (g_shell_parse_argv(command.c_str(), nullptr, &argv, &error))
{
result = xfce_spawn_on_screen(screen,
garcon_menu_item_get_path(m_item),
- argv, NULL, G_SPAWN_SEARCH_PATH,
+ argv, nullptr, G_SPAWN_SEARCH_PATH,
garcon_menu_item_supports_startup_notification(m_item),
gtk_get_current_event_time(),
garcon_menu_item_get_icon_name(m_item),
@@ -315,7 +315,7 @@ void Launcher::run(GdkScreen* screen) const
if (G_UNLIKELY(!result))
{
- xfce_dialog_show_error(NULL, error, _("Failed to execute command \"%s\"."), string);
+ xfce_dialog_show_error(nullptr, error, _("Failed to execute command \"%s\"."), string);
g_error_free(error);
}
}
@@ -374,12 +374,12 @@ void Launcher::run(GdkScreen* screen, DesktopAction* action) const
// Parse and spawn command
gchar** argv;
gboolean result = false;
- GError* error = NULL;
- if (g_shell_parse_argv(command.c_str(), NULL, &argv, &error))
+ GError* error = nullptr;
+ if (g_shell_parse_argv(command.c_str(), nullptr, &argv, &error))
{
result = xfce_spawn_on_screen(screen,
garcon_menu_item_get_path(m_item),
- argv, NULL, G_SPAWN_SEARCH_PATH,
+ argv, nullptr, G_SPAWN_SEARCH_PATH,
garcon_menu_item_supports_startup_notification(m_item),
gtk_get_current_event_time(),
action->get_icon(),
@@ -389,7 +389,7 @@ void Launcher::run(GdkScreen* screen, DesktopAction* action) const
if (G_UNLIKELY(!result))
{
- xfce_dialog_show_error(NULL, error, _("Failed to execute command \"%s\"."), string);
+ xfce_dialog_show_error(nullptr, error, _("Failed to execute command \"%s\"."), string);
g_error_free(error);
}
}
diff --git a/panel-plugin/launcher.h b/panel-plugin/launcher.h
index a023831..db3a0d0 100644
--- a/panel-plugin/launcher.h
+++ b/panel-plugin/launcher.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2015, 2016, 2019, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,17 +61,17 @@ private:
public:
const gchar* get_name() const
{
- return NULL;
+ return nullptr;
}
const gchar* get_icon() const
{
- return NULL;
+ return nullptr;
}
const gchar* get_command() const
{
- return NULL;
+ return nullptr;
}
#endif
diff --git a/panel-plugin/page.cpp b/panel-plugin/page.cpp
index c68ff65..3260fdc 100644
--- a/panel-plugin/page.cpp
+++ b/panel-plugin/page.cpp
@@ -37,7 +37,7 @@ using namespace WhiskerMenu;
Page::Page(Window* window) :
m_window(window),
- m_selected_launcher(NULL),
+ m_selected_launcher(nullptr),
m_drag_enabled(true),
m_launcher_dragged(false),
m_reorderable(false)
@@ -46,7 +46,7 @@ Page::Page(Window* window) :
create_view();
// Add scrolling to view
- m_widget = gtk_scrolled_window_new(NULL, NULL);
+ m_widget = gtk_scrolled_window_new(nullptr, nullptr);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(m_widget), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_ETCHED_IN);
gtk_container_add(GTK_CONTAINER(m_widget), m_view->get_widget());
@@ -183,7 +183,7 @@ void Page::launcher_activated(GtkTreePath* path)
gtk_tree_model_get_iter(model, &iter, path);
// Find element
- Element* element = NULL;
+ Element* element = nullptr;
gtk_tree_model_get(model, &iter, LauncherView::COLUMN_LAUNCHER, &element, -1);
if (!element)
{
@@ -210,7 +210,7 @@ void Page::launcher_activated(GtkTreePath* path)
void Page::launcher_action_activated(GtkMenuItem* menuitem, DesktopAction* action)
{
- g_assert(m_selected_launcher != NULL);
+ g_assert(m_selected_launcher);
// Add to recent
if (remember_launcher(m_selected_launcher))
@@ -250,7 +250,7 @@ gboolean Page::view_button_press_event(GtkWidget*, GdkEvent* event)
return false;
}
- Element* element = NULL;
+ Element* element = nullptr;
GtkTreeModel* model = m_view->get_model();
GtkTreeIter iter;
gtk_tree_model_get_iter(model, &iter, path);
@@ -299,8 +299,8 @@ void Page::view_drag_data_get(GtkWidget*, GdkDragContext*, GtkSelectionData* dat
return;
}
- gchar* uris[2] = { m_selected_launcher->get_uri(), NULL };
- if (uris[0] != NULL)
+ gchar* uris[2] = { m_selected_launcher->get_uri(), nullptr };
+ if (uris[0])
{
gtk_selection_data_set_uris(data, uris);
g_free(uris[0]);
@@ -330,7 +330,7 @@ gboolean Page::view_popup_menu_event(GtkWidget*)
return false;
}
- create_context_menu(path, NULL);
+ create_context_menu(path, nullptr);
return true;
}
@@ -340,7 +340,7 @@ gboolean Page::view_popup_menu_event(GtkWidget*)
void Page::create_context_menu(GtkTreePath* path, GdkEvent* event)
{
// Get selected launcher
- Element* element = NULL;
+ Element* element = nullptr;
GtkTreeModel* model = m_view->get_model();
GtkTreeIter iter;
gtk_tree_model_get_iter(model, &iter, path);
@@ -414,7 +414,7 @@ void Page::create_context_menu(GtkTreePath* path, GdkEvent* event)
gtk_widget_show_all(menu);
// Show context menu
- gtk_menu_attach_to_widget(GTK_MENU(menu), m_view->get_widget(), NULL);
+ gtk_menu_attach_to_widget(GTK_MENU(menu), m_view->get_widget(), nullptr);
gtk_menu_popup_at_pointer(GTK_MENU(menu), event);
// Keep selection
@@ -426,7 +426,7 @@ void Page::create_context_menu(GtkTreePath* path, GdkEvent* event)
void Page::destroy_context_menu(GtkMenuShell* menu)
{
- m_selected_launcher = NULL;
+ m_selected_launcher = nullptr;
gtk_widget_destroy(GTK_WIDGET(menu));
@@ -448,7 +448,7 @@ void Page::add_selected_to_desktop()
GFile* desktop_folder = g_file_new_for_path(desktop_path);
// Fetch launcher source
- g_assert(m_selected_launcher != NULL);
+ g_assert(m_selected_launcher);
GFile* source_file = m_selected_launcher->get_file();
// Fetch launcher destination
@@ -457,8 +457,8 @@ void Page::add_selected_to_desktop()
g_free(basename);
// Copy launcher to desktop folder
- GError* error = NULL;
- if (g_file_copy(source_file, destination_file, G_FILE_COPY_NONE, NULL, NULL, NULL, &error))
+ GError* error = nullptr;
+ if (g_file_copy(source_file, destination_file, G_FILE_COPY_NONE, nullptr, nullptr, nullptr, &error))
{
// Make launcher executable
gchar* path = g_file_get_path(destination_file);
@@ -467,7 +467,7 @@ void Page::add_selected_to_desktop()
}
else
{
- xfce_dialog_show_error(NULL, error, _("Unable to add launcher to desktop."));
+ xfce_dialog_show_error(nullptr, error, _("Unable to add launcher to desktop."));
g_error_free(error);
}
@@ -481,20 +481,20 @@ void Page::add_selected_to_desktop()
void Page::add_selected_to_panel()
{
// Connect to Xfce panel through D-Bus
- GError* error = NULL;
+ GError* error = nullptr;
GDBusProxy* proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
- NULL,
+ nullptr,
"org.xfce.Panel",
"/org/xfce/Panel",
"org.xfce.Panel",
- NULL,
+ nullptr,
&error);
if (proxy)
{
// Fetch launcher desktop ID
- g_assert(m_selected_launcher != NULL);
- const gchar* parameters[] = { m_selected_launcher->get_desktop_id(), NULL };
+ g_assert(m_selected_launcher);
+ const gchar* parameters[] = { m_selected_launcher->get_desktop_id(), nullptr };
// Tell panel to add item
if (!g_dbus_proxy_call_sync(proxy,
@@ -502,10 +502,10 @@ void Page::add_selected_to_panel()
g_variant_new("(s^as)", "launcher", parameters),
G_DBUS_CALL_FLAGS_NONE,
-1,
- NULL,
+ nullptr,
&error))
{
- xfce_dialog_show_error(NULL, error, _("Unable to add launcher to panel."));
+ xfce_dialog_show_error(nullptr, error, _("Unable to add launcher to panel."));
g_error_free(error);
}
@@ -514,7 +514,7 @@ void Page::add_selected_to_panel()
}
else
{
- xfce_dialog_show_error(NULL, error, _("Unable to add launcher to panel."));
+ xfce_dialog_show_error(nullptr, error, _("Unable to add launcher to panel."));
g_error_free(error);
}
}
@@ -523,7 +523,7 @@ void Page::add_selected_to_panel()
void Page::add_selected_to_favorites()
{
- g_assert(m_selected_launcher != NULL);
+ g_assert(m_selected_launcher);
m_window->get_favorites()->add(m_selected_launcher);
}
@@ -531,19 +531,19 @@ void Page::add_selected_to_favorites()
void Page::edit_selected()
{
- g_assert(m_selected_launcher != NULL);
+ g_assert(m_selected_launcher);
m_window->hide();
- GError* error = NULL;
+ GError* error = nullptr;
gchar* uri = m_selected_launcher->get_uri();
gchar* quoted_uri = g_shell_quote(uri);
- gchar* command = g_strconcat("exo-desktop-item-edit ", quoted_uri, NULL);
+ gchar* command = g_strconcat("exo-desktop-item-edit ", quoted_uri, nullptr);
g_free(uri);
g_free(quoted_uri);
if (!g_spawn_command_line_async(command, &error))
{
- xfce_dialog_show_error(NULL, error, _("Unable to edit launcher."));
+ xfce_dialog_show_error(nullptr, error, _("Unable to edit launcher."));
g_error_free(error);
}
g_free(command);
@@ -553,7 +553,7 @@ void Page::edit_selected()
void Page::hide_selected()
{
- g_assert(m_selected_launcher != NULL);
+ g_assert(m_selected_launcher);
m_window->hide();
@@ -564,7 +564,7 @@ void Page::hide_selected()
void Page::remove_selected_from_favorites()
{
- g_assert(m_selected_launcher != NULL);
+ g_assert(m_selected_launcher);
m_window->get_favorites()->remove(m_selected_launcher);
}
diff --git a/panel-plugin/plugin.cpp b/panel-plugin/plugin.cpp
index 05fefc1..e37784f 100644
--- a/panel-plugin/plugin.cpp
+++ b/panel-plugin/plugin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,14 +51,14 @@ static bool panel_utils_grab_available()
{
bool grab_succeed = false;
- GdkWindow* root = gdk_screen_get_root_window(xfce_gdk_screen_get_active(NULL));
+ GdkWindow* root = gdk_screen_get_root_window(xfce_gdk_screen_get_active(nullptr));
GdkDisplay* display = gdk_display_get_default();
GdkSeat* seat = gdk_display_get_default_seat(display);
// Don't try to get the grab for longer then 1/4 second
for (guint i = 0; i < (G_USEC_PER_SEC / 400); ++i)
{
- if (gdk_seat_grab(seat, root, GDK_SEAT_CAPABILITY_ALL, true, NULL, NULL, NULL, NULL))
+ if (gdk_seat_grab(seat, root, GDK_SEAT_CAPABILITY_ALL, true, nullptr, nullptr, nullptr, nullptr))
{
gdk_seat_ungrab(seat);
grab_succeed = true;
@@ -79,7 +79,7 @@ static bool panel_utils_grab_available()
static void widget_add_css(GtkWidget* widget, const gchar* css)
{
GtkCssProvider* provider = gtk_css_provider_new();
- gtk_css_provider_load_from_data(provider, css, -1, NULL);
+ gtk_css_provider_load_from_data(provider, css, -1, nullptr);
gtk_style_context_add_provider(gtk_widget_get_style_context(widget),
GTK_STYLE_PROVIDER(provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
@@ -91,7 +91,7 @@ static void widget_add_css(GtkWidget* widget, const gchar* css)
Plugin::Plugin(XfcePanelPlugin* plugin) :
m_plugin(plugin),
- m_window(NULL),
+ m_window(nullptr),
m_opacity(100),
m_file_icon(false)
{
@@ -141,7 +141,7 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
}
gtk_widget_set_sensitive(GTK_WIDGET(m_button_icon), false);
- m_button_label = GTK_LABEL(gtk_label_new(NULL));
+ m_button_label = GTK_LABEL(gtk_label_new(nullptr));
gtk_label_set_markup(m_button_label, wm_settings->button_title.c_str());
gtk_box_pack_start(m_button_box, GTK_WIDGET(m_button_label), true, true, 0);
if (wm_settings->button_title_visible)
@@ -184,12 +184,12 @@ Plugin::~Plugin()
save();
delete m_window;
- m_window = NULL;
+ m_window = nullptr;
gtk_widget_destroy(m_button);
delete wm_settings;
- wm_settings = NULL;
+ wm_settings = nullptr;
}
//-----------------------------------------------------------------------------
@@ -401,10 +401,10 @@ void Plugin::show_about()
{
const gchar* authors[] = {
"Graeme Gott <graeme at gottcode.org>",
- NULL };
+ nullptr };
gtk_show_about_dialog
- (NULL,
+ (nullptr,
"authors", authors,
"comments", _("Alternate application launcher for Xfce"),
"copyright", _("Copyright \302\251 2013-2020 Graeme Gott"),
@@ -414,7 +414,7 @@ void Plugin::show_about()
"translator-credits", _("translator-credits"),
"version", PACKAGE_VERSION,
"website", PLUGIN_WEBSITE,
- NULL);
+ nullptr);
}
//-----------------------------------------------------------------------------
@@ -465,11 +465,11 @@ gboolean Plugin::size_changed(XfcePanelPlugin*, gint size)
max_height *= 6;
}
- GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(wm_settings->button_icon_name.c_str(), max_width, max_height, NULL);
+ GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(wm_settings->button_icon_name.c_str(), max_width, max_height, nullptr);
if (pixbuf)
{
// Handle high dpi
- cairo_surface_t* surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, scale, NULL);
+ cairo_surface_t* surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, scale, nullptr);
gtk_image_set_from_surface(m_button_icon, surface);
cairo_surface_destroy(surface);
g_object_unref(pixbuf);
@@ -491,7 +491,7 @@ gboolean Plugin::size_changed(XfcePanelPlugin*, gint size)
// Put title next to icon if panel is wide enough
GtkRequisition label_size;
- gtk_widget_get_preferred_size(GTK_WIDGET(m_button_label), NULL, &label_size);
+ gtk_widget_get_preferred_size(GTK_WIDGET(m_button_label), nullptr, &label_size);
if (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR &&
wm_settings->button_title_visible &&
wm_settings->button_icon_visible &&
diff --git a/panel-plugin/profile-picture.cpp b/panel-plugin/profile-picture.cpp
index d217b68..f8a24aa 100644
--- a/panel-plugin/profile-picture.cpp
+++ b/panel-plugin/profile-picture.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014, 2016, 2017, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2014-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,13 +47,13 @@ ProfilePicture::ProfilePicture(Window* window) :
Command* command = wm_settings->command[Settings::CommandProfile];
gtk_widget_set_tooltip_text(m_container, command->get_tooltip());
- gchar* path = g_build_filename(g_get_home_dir(), ".face", NULL);
+ gchar* path = g_build_filename(g_get_home_dir(), ".face", nullptr);
GFile* file = g_file_new_for_path(path);
g_free(path);
- m_file_monitor = g_file_monitor_file(file, G_FILE_MONITOR_NONE, NULL, NULL);
+ m_file_monitor = g_file_monitor_file(file, G_FILE_MONITOR_NONE, nullptr, nullptr);
g_signal_connect_slot(m_file_monitor, "changed", &ProfilePicture::on_file_changed, this);
- on_file_changed(m_file_monitor, file, NULL, G_FILE_MONITOR_EVENT_CHANGED);
+ on_file_changed(m_file_monitor, file, nullptr, G_FILE_MONITOR_EVENT_CHANGED);
g_object_unref(file);
}
@@ -78,7 +78,7 @@ void ProfilePicture::reset_tooltip()
void ProfilePicture::on_file_changed(GFileMonitor*, GFile* file, GFile*, GFileMonitorEvent)
{
- if (g_file_query_exists(file, NULL))
+ if (g_file_query_exists(file, nullptr))
{
GIcon* icon = g_file_icon_new(file);
gtk_image_set_from_gicon(GTK_IMAGE(m_image), icon, GTK_ICON_SIZE_DND);
diff --git a/panel-plugin/recent-page.cpp b/panel-plugin/recent-page.cpp
index 6bbdffb..a8d62f4 100644
--- a/panel-plugin/recent-page.cpp
+++ b/panel-plugin/recent-page.cpp
@@ -76,8 +76,8 @@ void RecentPage::add(Launcher* launcher)
{
GtkTreeModel* model = get_view()->get_model();
GtkTreeIter iter;
- gtk_tree_model_iter_nth_child(model, &iter, NULL, std::distance(wm_settings->recent.begin(), i));
- gtk_list_store_move_after(GTK_LIST_STORE(model), &iter, NULL);
+ gtk_tree_model_iter_nth_child(model, &iter, nullptr, std::distance(wm_settings->recent.begin(), i));
+ gtk_list_store_move_after(GTK_LIST_STORE(model), &iter, nullptr);
wm_settings->recent.erase(i);
wm_settings->recent.insert(wm_settings->recent.begin(), desktop_id);
wm_settings->set_modified();
@@ -88,7 +88,7 @@ void RecentPage::add(Launcher* launcher)
// Prepend to list of items
GtkListStore* store = GTK_LIST_STORE(get_view()->get_model());
gtk_list_store_insert_with_values(
- store, NULL, 0,
+ store, nullptr, 0,
LauncherView::COLUMN_ICON, launcher->get_icon(),
LauncherView::COLUMN_TEXT, launcher->get_text(),
LauncherView::COLUMN_TOOLTIP, launcher->get_tooltip(),
@@ -120,7 +120,7 @@ void RecentPage::enforce_item_count()
}
GtkTreeIter iter;
- if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, i))
+ if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, nullptr, i))
{
gtk_list_store_remove(store, &iter);
}
diff --git a/panel-plugin/resizer-widget.cpp b/panel-plugin/resizer-widget.cpp
index 9cede9f..5ad0304 100644
--- a/panel-plugin/resizer-widget.cpp
+++ b/panel-plugin/resizer-widget.cpp
@@ -26,7 +26,7 @@ using namespace WhiskerMenu;
ResizerWidget::ResizerWidget(GtkWindow* window) :
m_window(window),
- m_cursor(NULL),
+ m_cursor(nullptr),
m_shape(3)
{
m_drawing = gtk_drawing_area_new();
@@ -131,7 +131,7 @@ gboolean ResizerWidget::on_enter_notify_event(GtkWidget* widget, GdkEvent*)
gboolean ResizerWidget::on_leave_notify_event(GtkWidget* widget, GdkEvent*)
{
GdkWindow* window = gtk_widget_get_window(widget);
- gdk_window_set_cursor(window, NULL);
+ gdk_window_set_cursor(window, nullptr);
return false;
}
diff --git a/panel-plugin/run-action.cpp b/panel-plugin/run-action.cpp
index b412367..362417d 100644
--- a/panel-plugin/run-action.cpp
+++ b/panel-plugin/run-action.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2015, 2016 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,10 +35,10 @@ RunAction::RunAction()
void RunAction::run(GdkScreen* screen) const
{
- GError* error = NULL;
+ GError* error = nullptr;
if (!xfce_spawn_command_line_on_screen(screen, m_command_line.c_str(), false, false, &error))
{
- xfce_dialog_show_error(NULL, error, _("Failed to execute command \"%s\"."), m_command_line.c_str());
+ xfce_dialog_show_error(nullptr, error, _("Failed to execute command \"%s\"."), m_command_line.c_str());
g_error_free(error);
}
}
@@ -51,10 +51,10 @@ guint RunAction::search(const Query& query)
bool valid = false;
gchar** argv;
- if (g_shell_parse_argv(query.raw_query().c_str(), NULL, &argv, NULL))
+ if (g_shell_parse_argv(query.raw_query().c_str(), nullptr, &argv, nullptr))
{
gchar* path = g_find_program_in_path(argv[0]);
- valid = path != NULL;
+ valid = path;
g_free(path);
g_strfreev(argv);
}
diff --git a/panel-plugin/search-action.cpp b/panel-plugin/search-action.cpp
index e898089..602f81d 100644
--- a/panel-plugin/search-action.cpp
+++ b/panel-plugin/search-action.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2015, 2016 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ using namespace WhiskerMenu;
SearchAction::SearchAction() :
m_is_regex(false),
m_show_description(true),
- m_regex(NULL)
+ m_regex(nullptr)
{
set_icon("folder-saved-search");
update_text();
@@ -43,7 +43,7 @@ SearchAction::SearchAction(const gchar* name, const gchar* pattern, const gchar*
m_command(command ? command : ""),
m_is_regex(is_regex),
m_show_description(show_description),
- m_regex(NULL)
+ m_regex(nullptr)
{
set_icon("folder-saved-search");
update_text();
@@ -95,7 +95,7 @@ guint SearchAction::match_prefix(const gchar* haystack)
gchar* trimmed = g_strdup(haystack + m_pattern.length());
trimmed = g_strstrip(trimmed);
- gchar* uri = NULL;
+ gchar* uri = nullptr;
m_expanded_command = m_command;
std::string::size_type pos = 0, lastpos = m_expanded_command.length() - 1;
@@ -121,7 +121,7 @@ guint SearchAction::match_prefix(const gchar* haystack)
case 'u':
if (!uri)
{
- uri = g_uri_escape_string(trimmed, NULL, true);
+ uri = g_uri_escape_string(trimmed, nullptr, true);
}
m_expanded_command.replace(pos, 2, uri);
pos += strlen(uri) + 1;
@@ -152,16 +152,16 @@ guint SearchAction::match_regex(const gchar* haystack)
if (!m_regex)
{
- m_regex = g_regex_new(m_pattern.c_str(), G_REGEX_OPTIMIZE, GRegexMatchFlags(0), NULL);
+ m_regex = g_regex_new(m_pattern.c_str(), G_REGEX_OPTIMIZE, GRegexMatchFlags(0), nullptr);
if (!m_regex)
{
return found;
}
}
- GMatchInfo* match = NULL;
+ GMatchInfo* match = nullptr;
if (g_regex_match(m_regex, haystack, GRegexMatchFlags(0), &match))
{
- gchar* expanded = g_match_info_expand_references(match, m_command.c_str(), NULL);
+ gchar* expanded = g_match_info_expand_references(match, m_command.c_str(), nullptr);
if (expanded)
{
m_expanded_command = expanded;
@@ -169,7 +169,7 @@ guint SearchAction::match_regex(const gchar* haystack)
found = m_pattern.length();
}
}
- if (match != NULL)
+ if (match)
{
g_match_info_free(match);
}
@@ -181,12 +181,12 @@ guint SearchAction::match_regex(const gchar* haystack)
void SearchAction::run(GdkScreen* screen) const
{
- GError* error = NULL;
+ GError* error = nullptr;
gboolean result = xfce_spawn_command_line_on_screen(screen, m_expanded_command.c_str(), FALSE, FALSE, &error);
if (G_UNLIKELY(!result))
{
- xfce_dialog_show_error(NULL, error, _("Failed to execute command \"%s\"."), m_expanded_command.c_str());
+ xfce_dialog_show_error(nullptr, error, _("Failed to execute command \"%s\"."), m_expanded_command.c_str());
g_error_free(error);
}
}
@@ -222,7 +222,7 @@ void SearchAction::set_pattern(const gchar* pattern)
if (m_regex)
{
g_regex_unref(m_regex);
- m_regex = NULL;
+ m_regex = nullptr;
}
}
diff --git a/panel-plugin/search-page.cpp b/panel-plugin/search-page.cpp
index 9a16bc2..23aea3d 100644
--- a/panel-plugin/search-page.cpp
+++ b/panel-plugin/search-page.cpp
@@ -112,12 +112,12 @@ void SearchPage::set_filter(const gchar* filter)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_POINTER);
- Element* element;
+ Element* element = nullptr;
for (const auto& match : search_action_matches)
{
element = match.element();
gtk_list_store_insert_with_values(
- store, NULL, G_MAXINT,
+ store, nullptr, G_MAXINT,
LauncherView::COLUMN_ICON, element->get_icon(),
LauncherView::COLUMN_TEXT, element->get_text(),
LauncherView::COLUMN_TOOLTIP, element->get_tooltip(),
@@ -128,7 +128,7 @@ void SearchPage::set_filter(const gchar* filter)
{
element = match.element();
gtk_list_store_insert_with_values(
- store, NULL, G_MAXINT,
+ store, nullptr, G_MAXINT,
LauncherView::COLUMN_ICON, element->get_icon(),
LauncherView::COLUMN_TEXT, element->get_text(),
LauncherView::COLUMN_TOOLTIP, element->get_tooltip(),
@@ -161,7 +161,7 @@ void SearchPage::set_menu_items(GtkTreeModel* model)
bool valid = gtk_tree_model_get_iter_first(model, &iter);
while (valid)
{
- Launcher* launcher = NULL;
+ Launcher* launcher = nullptr;
gtk_tree_model_get(model, &iter, LauncherView::COLUMN_LAUNCHER, &launcher, -1);
if (launcher)
{
diff --git a/panel-plugin/search-page.h b/panel-plugin/search-page.h
index 9927e19..50c1986 100644
--- a/panel-plugin/search-page.h
+++ b/panel-plugin/search-page.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2015, 2019, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ private:
class Match
{
public:
- Match(Element* element = NULL) :
+ Match(Element* element = nullptr) :
m_element(element),
m_relevancy(G_MAXINT)
{
@@ -74,7 +74,7 @@ private:
void update(const Query& query)
{
- g_assert(m_element != NULL);
+ g_assert(m_element);
m_relevancy = m_element->search(query);
}
diff --git a/panel-plugin/section-button.cpp b/panel-plugin/section-button.cpp
index 069db7e..d71fe67 100644
--- a/panel-plugin/section-button.cpp
+++ b/panel-plugin/section-button.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2016, 2017, 2018, 2020 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013-2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ static gboolean on_focus_in_event(GtkWidget* widget, GdkEvent*, gpointer)
SectionButton::SectionButton(GIcon* icon, const gchar* text)
{
- m_button = GTK_RADIO_BUTTON(gtk_radio_button_new(NULL));
+ m_button = GTK_RADIO_BUTTON(gtk_radio_button_new(nullptr));
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(m_button), false);
gtk_button_set_relief(GTK_BUTTON(m_button), GTK_RELIEF_NONE);
gtk_widget_set_tooltip_text(GTK_WIDGET(m_button), text);
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index aa80f2a..19b79ee 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -31,7 +31,7 @@ using namespace WhiskerMenu;
//-----------------------------------------------------------------------------
-Settings* WhiskerMenu::wm_settings = NULL;
+Settings* WhiskerMenu::wm_settings = nullptr;
static const char* const settings_command[Settings::CountCommands][2] = {
{ "command-settings", "show-command-settings" },
@@ -59,7 +59,7 @@ static void read_vector_entry(XfceRc* rc, const char* key, std::vector<std::stri
desktop_ids.clear();
gchar** values = xfce_rc_read_list_entry(rc, key, ",");
- for (size_t i = 0; values[i] != NULL; ++i)
+ for (size_t i = 0; values[i]; ++i)
{
std::string desktop_id(values[i]);
if (std::find(desktop_ids.begin(), desktop_ids.end(), desktop_id) == desktop_ids.end())
@@ -219,7 +219,7 @@ void Settings::load(char* file)
{
return;
}
- xfce_rc_set_group(rc, NULL);
+ xfce_rc_set_group(rc, nullptr);
read_vector_entry(rc, "favorites", favorites);
read_vector_entry(rc, "recent", recent);
@@ -326,7 +326,7 @@ void Settings::save(char* file)
{
return;
}
- xfce_rc_set_group(rc, NULL);
+ xfce_rc_set_group(rc, nullptr);
write_vector_entry(rc, "favorites", favorites);
write_vector_entry(rc, "recent", recent);
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index b20abb7..bf42ed4 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -50,7 +50,7 @@ static void grab_pointer(GtkWidget* widget)
GdkDisplay* display = gdk_display_get_default();
GdkSeat* seat = gdk_display_get_default_seat(display);
GdkWindow* window = gtk_widget_get_window(widget);
- gdk_seat_grab(seat, window, GDK_SEAT_CAPABILITY_ALL_POINTING, true, NULL, NULL, NULL, NULL);
+ gdk_seat_grab(seat, window, GDK_SEAT_CAPABILITY_ALL_POINTING, true, nullptr, nullptr, nullptr, nullptr);
}
static void ungrab_pointer()
@@ -69,10 +69,10 @@ static void ungrab_pointer()
WhiskerMenu::Window::Window(Plugin* plugin) :
m_plugin(plugin),
- m_window(NULL),
+ m_window(nullptr),
m_search_cover(GTK_STACK_TRANSITION_TYPE_OVER_DOWN),
m_search_uncover(GTK_STACK_TRANSITION_TYPE_UNDER_UP),
- m_sidebar_size_group(NULL),
+ m_sidebar_size_group(nullptr),
m_layout_left(true),
m_layout_bottom(true),
m_layout_categories_alternate(false),
@@ -106,10 +106,10 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
g_signal_connect_slot(m_window, "map-event", &Window::on_map_event, this);
g_signal_connect_slot(m_window, "state-flags-changed", &Window::on_state_flags_changed_event, this);
g_signal_connect_slot(m_window, "configure-event", &Window::on_configure_event, this);
- g_signal_connect(m_window, "delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
+ g_signal_connect(m_window, "delete_event", G_CALLBACK(gtk_widget_hide_on_delete), nullptr);
// Create the border of the window
- GtkWidget* frame = gtk_frame_new(NULL);
+ GtkWidget* frame = gtk_frame_new(nullptr);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(m_window), frame);
@@ -133,7 +133,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
name = g_get_user_name();
}
gchar* username = g_markup_printf_escaped("<b><big>%s</big></b>", name);
- m_username = GTK_LABEL(gtk_label_new(NULL));
+ m_username = GTK_LABEL(gtk_label_new(nullptr));
gtk_label_set_markup(m_username, username);
gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_START);
g_free(username);
@@ -193,7 +193,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
// Create box for packing commands
m_commands_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
- m_commands_spacer = gtk_label_new(NULL);
+ m_commands_spacer = gtk_label_new(nullptr);
gtk_box_pack_start(m_commands_box, m_commands_spacer, true, true, 0);
for (auto command : m_commands_button)
{
@@ -233,7 +233,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
gtk_box_pack_start(m_sidebar_buttons, m_recent_button->get_widget(), false, false, 0);
gtk_box_pack_start(m_sidebar_buttons, gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), false, false, 4);
- m_sidebar = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL));
+ m_sidebar = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr));
gtk_box_pack_start(m_contents_box, GTK_WIDGET(m_sidebar), false, false, 0);
gtk_scrolled_window_set_shadow_type(m_sidebar, GTK_SHADOW_NONE);
gtk_scrolled_window_set_policy(m_sidebar, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@@ -250,7 +250,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
gtk_widget_set_app_paintable(GTK_WIDGET(m_window), true);
g_signal_connect_slot(m_window, "draw", &Window::on_draw_event, this);
g_signal_connect_slot(m_window, "screen-changed", &Window::on_screen_changed_event, this);
- on_screen_changed_event(GTK_WIDGET(m_window), NULL);
+ on_screen_changed_event(GTK_WIDGET(m_window), nullptr);
// Load applications
m_applications->load_applications();
@@ -383,7 +383,7 @@ void WhiskerMenu::Window::show(const Position position)
m_recent->get_view()->reload_icon_size();
m_applications->get_view()->reload_icon_size();
- GdkScreen* screen = NULL;
+ GdkScreen* screen = nullptr;
int parent_x = 0, parent_y = 0, parent_w = 0, parent_h = 0;
if (position != PositionAtCursor)
{
@@ -513,7 +513,7 @@ void WhiskerMenu::Window::show(const Position position)
gtk_size_group_remove_widget(m_sidebar_size_group, GTK_WIDGET(m_sidebar));
gtk_size_group_remove_widget(m_sidebar_size_group, GTK_WIDGET(m_commands_box));
g_object_unref(m_sidebar_size_group);
- m_sidebar_size_group = NULL;
+ m_sidebar_size_group = nullptr;
}
// Show window
@@ -681,7 +681,7 @@ gboolean WhiskerMenu::Window::on_key_press_event(GtkWidget* widget, GdkEvent* ev
return true;
}
- Page* page = NULL;
+ Page* page = nullptr;
if (gtk_stack_get_visible_child(m_contents_stack) == m_search_results->get_widget())
{
page = m_search_results;
@@ -856,7 +856,7 @@ void WhiskerMenu::Window::check_scrollbar_needed()
{
// Find height of sidebar buttons
int height = 0;
- gtk_widget_get_preferred_height(GTK_WIDGET(m_sidebar_buttons), NULL, &height);
+ gtk_widget_get_preferred_height(GTK_WIDGET(m_sidebar_buttons), nullptr, &height);
// Always show scrollbar if sidebar is shorter than buttons
int allocated = gtk_widget_get_allocated_height(GTK_WIDGET(m_sidebar));
@@ -929,7 +929,7 @@ void WhiskerMenu::Window::search()
const gchar* text = gtk_entry_get_text(m_search_entry);
if (exo_str_is_empty(text))
{
- text = NULL;
+ text = nullptr;
}
if (text)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list