[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 08/20: Use initializer lists.

noreply at xfce.org noreply at xfce.org
Thu Feb 6 12:03:25 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 8edf9e3c09f187b7da86edb94cf244165a574665
Author: Graeme Gott <graeme at gottcode.org>
Date:   Sat Feb 1 19:55:20 2020 -0500

    Use initializer lists.
---
 panel-plugin/icon-size.cpp      | 22 +++++++++++-----------
 panel-plugin/resizer-widget.cpp | 13 ++++---------
 panel-plugin/settings.cpp       | 26 +++++++++++++++-----------
 panel-plugin/window.cpp         |  6 +-----
 4 files changed, 31 insertions(+), 36 deletions(-)

diff --git a/panel-plugin/icon-size.cpp b/panel-plugin/icon-size.cpp
index 0d96b3a..1b41b10 100644
--- a/panel-plugin/icon-size.cpp
+++ b/panel-plugin/icon-size.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 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
@@ -45,16 +45,16 @@ int IconSize::get_size() const
 
 std::vector<std::string> IconSize::get_strings()
 {
-	std::vector<std::string> strings;
-	strings.push_back(_("None"));
-	strings.push_back(_("Very Small"));
-	strings.push_back(_("Smaller"));
-	strings.push_back(_("Small"));
-	strings.push_back(_("Normal"));
-	strings.push_back(_("Large"));
-	strings.push_back(_("Larger"));
-	strings.push_back(_("Very Large"));
-	return strings;
+	return {
+		_("None"),
+		_("Very Small"),
+		_("Smaller"),
+		_("Small"),
+		_("Normal"),
+		_("Large"),
+		_("Larger"),
+		_("Very Large")
+	};
 }
 
 //-----------------------------------------------------------------------------
diff --git a/panel-plugin/resizer-widget.cpp b/panel-plugin/resizer-widget.cpp
index 5ad0304..3fa542a 100644
--- a/panel-plugin/resizer-widget.cpp
+++ b/panel-plugin/resizer-widget.cpp
@@ -57,32 +57,27 @@ ResizerWidget::~ResizerWidget()
 
 void ResizerWidget::set_corner(Corner corner)
 {
-	static const GdkPoint bottomleft[] = { {10,10}, {0,10}, {0,0} };
-	static const GdkPoint topleft[] = { {10,0}, {0,10}, {0,0} };
-	static const GdkPoint bottomright[] = { {10,10}, {0,10}, {10,0} };
-	static const GdkPoint topright[] = { {10,0}, {10,10}, {0,0} };
-
 	GdkCursorType type;
 	switch (corner)
 	{
 	case BottomLeft:
 		gtk_widget_set_halign(m_drawing, GTK_ALIGN_START);
 		gtk_widget_set_valign(m_drawing, GTK_ALIGN_END);
-		m_shape.assign(bottomleft, bottomleft + 3);
+		m_shape = { {10,10}, {0,10}, {0,0} };
 		m_edge = GDK_WINDOW_EDGE_SOUTH_WEST;
 		type = GDK_BOTTOM_LEFT_CORNER;
 		break;
 	case TopLeft:
 		gtk_widget_set_halign(m_drawing, GTK_ALIGN_START);
 		gtk_widget_set_valign(m_drawing, GTK_ALIGN_START);
-		m_shape.assign(topleft, topleft + 3);
+		m_shape = { {10,0}, {0,10}, {0,0} };
 		m_edge = GDK_WINDOW_EDGE_NORTH_WEST;
 		type = GDK_TOP_LEFT_CORNER;
 		break;
 	case BottomRight:
 		gtk_widget_set_halign(m_drawing, GTK_ALIGN_END);
 		gtk_widget_set_valign(m_drawing, GTK_ALIGN_END);
-		m_shape.assign(bottomright, bottomright + 3);
+		m_shape = { {10,10}, {0,10}, {10,0} };
 		m_edge = GDK_WINDOW_EDGE_SOUTH_EAST;
 		type = GDK_BOTTOM_RIGHT_CORNER;
 		break;
@@ -90,7 +85,7 @@ void ResizerWidget::set_corner(Corner corner)
 	default:
 		gtk_widget_set_halign(m_drawing, GTK_ALIGN_END);
 		gtk_widget_set_valign(m_drawing, GTK_ALIGN_START);
-		m_shape.assign(topright, topright + 3);
+		m_shape = { {10,0}, {10,10}, {0,0} };
 		m_edge = GDK_WINDOW_EDGE_NORTH_EAST;
 		type = GDK_TOP_RIGHT_CORNER;
 		break;
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index 19b79ee..afeb7a9 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -89,6 +89,13 @@ static void write_vector_entry(XfceRc* rc, const char* key, const std::vector<st
 Settings::Settings() :
 	m_modified(false),
 
+	favorites {
+		"exo-web-browser.desktop",
+		"exo-mail-reader.desktop",
+		"exo-file-manager.desktop",
+		"exo-terminal-emulator.desktop"
+	},
+
 	button_title(Plugin::get_button_title_default()),
 	button_icon_name("xfce4-whiskermenu"),
 	button_title_visible(false),
@@ -118,15 +125,18 @@ Settings::Settings() :
 
 	confirm_session_command(true),
 
+	search_actions {
+		new SearchAction(_("Man Pages"), "#", "exo-open --launch TerminalEmulator man %s", false, true),
+		new SearchAction(_("Web Search"), "?", "exo-open --launch WebBrowser https://duckduckgo.com/?q=%u", false, true),
+		new SearchAction(_("Wikipedia"), "!w", "exo-open --launch WebBrowser https://en.wikipedia.org/wiki/%u", false, true),
+		new SearchAction(_("Run in Terminal"), "!", "exo-open --launch TerminalEmulator %s", false, true),
+		new SearchAction(_("Open URI"), "^(file|http|https):\\/\\/(.*)$", "exo-open \\0", true, true)
+	},
+
 	menu_width(450),
 	menu_height(500),
 	menu_opacity(100)
 {
-	favorites.push_back("exo-web-browser.desktop");
-	favorites.push_back("exo-mail-reader.desktop");
-	favorites.push_back("exo-file-manager.desktop");
-	favorites.push_back("exo-terminal-emulator.desktop");
-
 	command[CommandSettings] = new Command("preferences-desktop",
 			_("_Settings Manager"),
 			"xfce4-settings-manager",
@@ -181,12 +191,6 @@ Settings::Settings() :
 			_("Edit _Profile"),
 			"mugshot",
 			_("Failed to edit profile."));
-
-	search_actions.push_back(new SearchAction(_("Man Pages"), "#", "exo-open --launch TerminalEmulator man %s", false, true));
-	search_actions.push_back(new SearchAction(_("Web Search"), "?", "exo-open --launch WebBrowser https://duckduckgo.com/?q=%u", false, true));
-	search_actions.push_back(new SearchAction(_("Wikipedia"), "!w", "exo-open --launch WebBrowser https://en.wikipedia.org/wiki/%u", false, true));
-	search_actions.push_back(new SearchAction(_("Run in Terminal"), "!", "exo-open --launch TerminalEmulator %s", false, true));
-	search_actions.push_back(new SearchAction(_("Open URI"), "^(file|http|https):\\/\\/(.*)$", "exo-open \\0", true, true));
 }
 
 //-----------------------------------------------------------------------------
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index bf42ed4..1933486 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -73,6 +73,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
 	m_search_cover(GTK_STACK_TRANSITION_TYPE_OVER_DOWN),
 	m_search_uncover(GTK_STACK_TRANSITION_TYPE_UNDER_UP),
 	m_sidebar_size_group(nullptr),
+	m_geometry{0,0,wm_settings->menu_width,wm_settings->menu_height},
 	m_layout_left(true),
 	m_layout_bottom(true),
 	m_layout_categories_alternate(false),
@@ -80,11 +81,6 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
 	m_layout_commands_alternate(false),
 	m_supports_alpha(false)
 {
-	m_geometry.x = 0;
-	m_geometry.y = 0;
-	m_geometry.width = wm_settings->menu_width;
-	m_geometry.height = wm_settings->menu_height;
-
 	// Create the window
 	m_window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
 	gtk_widget_set_name(GTK_WIDGET(m_window), "whiskermenu-window");

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list