Skip to content

[rpiclient-gtk] Updated compile switch verbose #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions rpiclient/src/exit/rpi_exit_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "rpi_exit_dialog.h"

#if RPI_VERBOSE == 1
#define EXIT_FROM_RPI_CLIENT_EXIT_DIALOG "Exit from RPIClient.\n"
#define DO_NOT_EXIT_FROM_RPI_CLIENT_EXIT_DIALOG "Don't exit from RPIClient.\n"
#endif

#define MISSING_PARENT_EXIT_DIALOG "Missing parent widget parameter.\n"

#define FAILED_MALLOC_EXIT_DIALOG "Failed to allocate memory for exit dialog.\n"
Expand Down Expand Up @@ -138,6 +144,10 @@ gint show_exit_dialog(ExitDialog *instance)
if (result == GTK_RESPONSE_ACCEPT)
{
hide_exit_dialog(instance);

#if RPI_VERBOSE == 1
g_debug(EXIT_FROM_RPI_CLIENT_EXIT_DIALOG);
#endif
return CLOSE_ON_EXIT_DIALOG;
}

Expand All @@ -148,6 +158,10 @@ gint show_exit_dialog(ExitDialog *instance)
#error "Supported GTK+ version: gtk+-3.0 gtk+-4.0!"
#endif

#if RPI_VERBOSE == 1
g_debug(DO_NOT_EXIT_FROM_RPI_CLIENT_EXIT_DIALOG);
#endif

return NOT_CLOSE_ON_EXIT_DIALOG;
}

Expand Down
16 changes: 16 additions & 0 deletions rpiclient/src/format/rpi_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "rpi_format.h"

#if RPI_VERBOSE == 1
#define ENCRYPTED_FORMAT "Input sequence: %s encrypted: %s.\n"
#define DECRYPTED_FORMAT "Input sequence: %s decrypted: %s.\n"
#endif

#define MISSING_IN_SEQ_ENC_FORMAT "Missing input sequence for encrypt.\n"
#define MISSING_IN_SEQ_DEC_FORMAT "Missing input sequence for decrypt.\n"

Expand Down Expand Up @@ -107,6 +113,11 @@ gchar *rpi_format_encrypt(const gchar *in, guint shift)
}

out[input_length] = '\0';

#if RPI_VERBOSE == 1
g_debug(ENCRYPTED_FORMAT, in, out);
#endif

return out;
}

Expand Down Expand Up @@ -150,6 +161,11 @@ gchar *rpi_format_decrypt(const gchar *in, guint shift)
}

out[input_length] = '\0';

#if RPI_VERBOSE == 1
g_debug(DECRYPTED_FORMAT, in, out);
#endif

return out;
}

Expand Down
10 changes: 10 additions & 0 deletions rpiclient/src/help/rpi_help_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "../resource/rpi_resource.h"
#include "rpi_image_slider.h"
#include "rpi_help_window.h"

#if RPI_VERBOSE == 1
#define ICON_PATH_HELP_WINDOW "Icon image path: %s.\n"
#endif

#define FAILED_MALLOC_HELP_WINDOW "Failed to allocate memory for help window.\n"
#define FAILED_PIXBUF_HELP_WINDOW "Failed to create pixbuf from help icon.\n"
#define FAILED_RESOURCE_HELP_WINDOW "Failed to get resource path for help icon.\n"
Expand Down Expand Up @@ -80,6 +85,11 @@ HelpWindow *new_help_window(void)
if (GDK_IS_PIXBUF(pixbuf))
{
gtk_window_set_icon(GTK_WINDOW(instance->window), pixbuf);

#if RPI_VERBOSE == 1
g_debug(ICON_PATH_HELP_WINDOW, icon_file_path);
#endif

g_object_unref(pixbuf);
pixbuf = NULL;
}
Expand Down
9 changes: 9 additions & 0 deletions rpiclient/src/help/rpi_image_slider.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "../resource/rpi_resource.h"
#include "rpi_image_slider.h"

#if RPI_VERBOSE == 1
#define IMAGE_PATH_IMAGE_SLIDER "Media resource: %s.\n"
#endif

#define FAILED_MALLOC_IMAGE_SLIDER "Failed to allocate memory for image slider.\n"
#define FAILED_RESOURCE_IMAGE_SLIDER "Failed to get resource path for image slider.\n"

Expand Down Expand Up @@ -87,6 +92,10 @@ ImageSlider *new_image_slider(void)

instance->image = gtk_image_new_from_file(image_file_path);

#if RPI_VERBOSE == 1
g_debug(IMAGE_PATH_IMAGE_SLIDER, image_file_path);
#endif

if (!GTK_IS_IMAGE(instance->image))
{
g_critical(FAILED_MALLOC_IMAGE_SLIDER);
Expand Down
10 changes: 10 additions & 0 deletions rpiclient/src/home/rpi_home.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "../resource/rpi_resource.h"
#include "rpi_menu.h"
#include "rpi_home_frame.h"
#include "rpi_home.h"

#if RPI_VERBOSE == 1
#define ICON_PATH_RPI_HOME "Icon file path: %s.\n"
#endif

#define FAILED_MALLOC_RPI_HOME "Failed to allocate memory for home.\n"
#define FAILED_MALLOC_WINDOW_RPI_HOME "Failed to allocate memory for home window.\n"
#define FAILED_PIXBUF_RPI_HOME "Failed to create pixbuf from home icon.\n"
Expand Down Expand Up @@ -80,6 +85,11 @@ RPIHome *new_rpi_home(void)
if (GDK_IS_PIXBUF(pixbuf))
{
gtk_window_set_icon(GTK_WINDOW(instance->window), pixbuf);

#if RPI_VERBOSE == 1
g_debug(ICON_PATH_RPI_HOME, icon_file_path);
#endif

g_object_unref(pixbuf);
pixbuf = NULL;
}
Expand Down
16 changes: 16 additions & 0 deletions rpiclient/src/home/rpi_home_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "rpi_channel_status.h"
#include "rpi_channel_control.h"
#include "rpi_home_frame.h"

#if RPI_VERBOSE == 1
#define SETUP_STATUS_CHANNEL_HOME_FRAME "Setup status channel id: %d.\n"
#define SETUP_CONTROL_CHANNEL_HOME_FRAME "Setup control channel id: %d.\n"
#endif

#define FAILED_MALLOC_HOME_FRAME "Failed to allocate memory for home frame.\n"

static const gchar* CONTROL_FRAME_LABEL_HOME_FRAME = "RPI Control";
Expand Down Expand Up @@ -161,6 +167,11 @@ RPIHomeFrame *new_rpi_home_frame(void)
Y_POSITION_LABEL_STATUS_HOME_FRAME
);
x_pos_label += SHIFT_X_POSITION_STATUS_HOME_FRAME;

#if RPI_VERBOSE == 1
g_debug(SETUP_STATUS_CHANNEL_HOME_FRAME, i);
#endif

}

x_pos_vbar = START_X_POSITION_VERTICAL_BAR_CONTROL_HOME_FRAME;
Expand Down Expand Up @@ -199,6 +210,11 @@ RPIHomeFrame *new_rpi_home_frame(void)
Y_POSITION_ACTIVATE_GPIO_CONTROL_HOME_FRAME
);
x_pos_control_channel_gpio_check_box += SHIFT_X_POSITION_CONTROL_HOME_FRAME;

#if RPI_VERBOSE == 1
g_debug(SETUP_CONTROL_CHANNEL_HOME_FRAME, i);
#endif

}

gtk_paned_add1(GTK_PANED(instance->vpaned), GTK_WIDGET(instance->frame_control));
Expand Down
9 changes: 9 additions & 0 deletions rpiclient/src/home/rpi_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "rpi_menu.h"

#if RPI_VERBOSE == 1
#define CONNECT_SIGNAL_RPI_MENU "Connect signal to submenu: %s.\n"
#endif

#define FAILED_MALLOC_RPI_MENU "Failed to allocate memory for menu bar.\n"

static const gchar* TEXT_MENU_FILE_RPI_MENU = "File";
Expand Down Expand Up @@ -317,6 +322,10 @@ void rpi_menu_connect_signal(RPIMenu *instance, void (*on_callback)(GtkWidget *,
{
g_signal_connect(G_OBJECT(instance->menu_help_submenu_about), "activate", G_CALLBACK(on_callback), NULL);
}

#if RPI_VERBOSE == 1
g_debug(CONNECT_SIGNAL_RPI_MENU, submenu);
#endif
}

void destroy_rpi_menu(RPIMenu *instance)
Expand Down
19 changes: 15 additions & 4 deletions rpiclient/src/info/rpi_info_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "rpi_info_dialog.h"

#define FAILED_PARENT_WARNINGS_DIALOG "Missing parent widget parameter.\n"
#define FAILED_MESSAGE_WARNINGS_DIALOG "Missing message parameter.\n"
#if RPI_VERBOSE == 1
#define CLOSE_INFO_DIALOG "Close info dialog.\n"
#endif

#define MISSING_PARENT_INFO_DIALOG "Missing parent widget parameter.\n"
#define MISSING_MESSAGE_INFO_DIALOG "Missing message parameter.\n"

#define FAILED_MALLOC_INFO_DIALOG "Failed to allocate memory for info dialog.\n"

//////////////////////////////////////////////////////////////////////////////
Expand All @@ -34,13 +40,13 @@ InfoDialog *new_info_dialog(GtkWidget *parent, const gchar *msg)
{
if (!parent)
{
g_critical(FAILED_PARENT_WARNINGS_DIALOG);
g_critical(MISSING_PARENT_INFO_DIALOG);
return NULL;
}

if (!msg)
{
g_critical(FAILED_MESSAGE_WARNINGS_DIALOG);
g_critical(MISSING_MESSAGE_INFO_DIALOG);
return NULL;
}

Expand Down Expand Up @@ -90,6 +96,11 @@ void show_info_dialog(InfoDialog *instance)
if (result == GTK_RESPONSE_CLOSE)
{
hide_info_dialog(instance);

#if RPI_VERBOSE == 1
g_debug(CLOSE_INFO_DIALOG);
#endif

}
}
}
Expand Down
10 changes: 9 additions & 1 deletion rpiclient/src/rpi_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define RPI_CLIENT_VERSION "1.0.0-b61b448"
#pragma once

//////////////////////////////////////////////////////////////////////////////
/// @brief Enables verbose log messages
#define RPI_CLIENT_VERSION "1.0.0-fd73110"

//////////////////////////////////////////////////////////////////////////////
/// @brief Enables verbose log messages
#define RPI_VERBOSE 0
4 changes: 0 additions & 4 deletions rpiclient/src/settings/rpi_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
*/
#pragma once

//////////////////////////////////////////////////////////////////////////////
/// @brief Enables verbose log messages
#define RPI_VERBOSE 1

//////////////////////////////////////////////////////////////////////////////
/// @brief Use SQLITE3 for keeping settings configuration
#define RPI_USE_SETTINGS_SQLITE3 0
Expand Down
1 change: 1 addition & 0 deletions rpiclient/src/settings/rpi_settings_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rpi_config.h"
#include "rpi_settings.h"

#if (RPI_USE_SETTINGS_PLAIN_CONFIG == 1) && (RPI_USE_SETTINGS_SQLITE3 == 1)
Expand Down
12 changes: 11 additions & 1 deletion rpiclient/src/settings/rpi_settings_general_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rpi_settings.h"
#include "../rpi_config.h"
#include "../resource/rpi_resource.h"
#include "rpi_settings.h"
#include "rpi_settings_config.h"
#include "rpi_settings_general_window.h"

#if RPI_VERBOSE == 1
#define ICON_FILE_PATH_GENERAL_WINDOW "Icon file path: %s.\n"
#endif

#define FAILED_MALLOC_SETTINGS_GENERAL_WINDOW "Failed to allocate memory for settings general window.\n"
#define FAILED_PIXBUF_SETTINGS_GENERAL_WINDOW "Failed to create pixbuf from settings general icon.\n"
#define FAILED_RESOURCE_SETTINGS_GENERAL_WINDOW "Failed to get resource path for settings general icon.\n"
Expand Down Expand Up @@ -110,6 +115,11 @@ SettingsGeneralWindow *new_settings_general_window(void)
if (GDK_IS_PIXBUF(pixbuf))
{
gtk_window_set_icon(GTK_WINDOW(instance->window), pixbuf);

#if RPI_VERBOSE == 1
g_debug(ICON_FILE_PATH_GENERAL_WINDOW, icon_file_path);
#endif

g_object_unref(pixbuf);
pixbuf = NULL;
}
Expand Down
12 changes: 11 additions & 1 deletion rpiclient/src/settings/rpi_settings_network_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rpi_settings.h"
#include "../rpi_config.h"
#include "../resource/rpi_resource.h"
#include "rpi_settings.h"
#include "rpi_settings_config.h"
#include "rpi_settings_network_window.h"

#if RPI_VERBOSE == 1
#define ICON_FILE_PATH_NETWORK_WINDOW "Icon file path: %s.\n"
#endif

#define FAILED_MALLOC_SETTINGS_NETWORK_WINDOW "Failed to allocate memory for settings network window.\n"
#define FAILED_PIXBUF_SETTINGS_NETWORK_WINDOW "Failed to create pixbuf from settings network icon.\n"
#define FAILED_RESOURCE_SETTINGS_NETWORK_WINDOW "Failed to get resource path for settings network icon.\n"
Expand Down Expand Up @@ -130,6 +135,11 @@ SettingsNetworkWindow *new_settings_network_window(void)
if (GDK_IS_PIXBUF(pixbuf))
{
gtk_window_set_icon(GTK_WINDOW(instance->window), pixbuf);

#if RPI_VERBOSE == 1
g_debug(ICON_FILE_PATH_NETWORK_WINDOW, icon_file_path);
#endif

g_object_unref(pixbuf);
pixbuf = NULL;
}
Expand Down
3 changes: 2 additions & 1 deletion rpiclient/src/settings/rpi_settings_plain.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "rpi_settings.h"
#include "../rpi_config.h"
#include "../resource/rpi_resource.h"
#include "rpi_settings.h"
#include "rpi_settings_user.h"
#include "rpi_settings_plain.h"

Expand Down
1 change: 1 addition & 0 deletions rpiclient/src/settings/rpi_settings_sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sqlite3.h>
#include "../rpi_config.h"
#include "rpi_settings.h"
#include "rpi_settings_user.h"
#include "rpi_settings_sqlite.h"
Expand Down
1 change: 1 addition & 0 deletions rpiclient/src/settings/rpi_settings_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
#include <unistd.h>
#include <pwd.h>
#include "../rpi_config.h"
#include "rpi_settings.h"
#include "rpi_settings_user.h"

Expand Down
Loading
Loading