Cleaning: Fixes #115, Enable strict compiler options in CMake

This commit is contained in:
Rory Fewell
2022-03-22 22:32:06 +00:00
parent 17382009d9
commit eadb283718
23 changed files with 371 additions and 235 deletions

View File

@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.0)
project(wintc-comgtk VERSION 1.0 DESCRIPTION "Windows Total Conversion common GLib/GTK utilities.")
project(
wintc-comgtk
VERSION 1.0
DESCRIPTION "Windows Total Conversion common GLib/GTK utilities."
)
include(GNUInstallDirs)
@@ -18,15 +22,8 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(
${GLIB_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS})
link_directories(
${GLIB_LIBRARY_DIRS}
${GTK3_LIBRARY_DIRS})
add_library(wintc-comgtk
add_library(
wintc-comgtk
src/debug.h
src/errors.c
src/errors.h
@@ -43,24 +40,52 @@ add_library(wintc-comgtk
src/styles.c
src/styles.h
src/window.c
src/window.h)
src/window.h
)
set_target_properties(wintc-comgtk PROPERTIES
set_target_properties(
wintc-comgtk
PROPERTIES
PUBLIC_HEADER public/wintc-comgtk.h
SOVERSION 1
VERSION ${PROJECT_VERSION})
VERSION ${PROJECT_VERSION}
)
configure_file(../debian-control.in debian-control @ONLY)
configure_file(wintc-comgtk.pc.in wintc-comgtk.pc @ONLY)
configure_file(public/wintc-comgtk.h wintc-comgtk.h COPYONLY)
target_compile_options(
wintc-comgtk
PRIVATE -Wall -Wextra -Wpedantic -Werror
)
target_link_libraries(wintc-comgtk
target_include_directories(
wintc-comgtk
SYSTEM
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
)
target_link_directories(
wintc-comgtk
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
)
target_link_libraries(
wintc-comgtk
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES})
PRIVATE ${GTK3_LIBRARIES}
)
install(TARGETS wintc-comgtk
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
configure_file(../debian-control.in debian-control @ONLY)
configure_file(wintc-comgtk.pc.in wintc-comgtk.pc @ONLY)
configure_file(public/wintc-comgtk.h wintc-comgtk.h COPYONLY)
install(FILES ${CMAKE_BINARY_DIR}/wintc-comgtk.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
install(
TARGETS wintc-comgtk
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
FILES ${CMAKE_BINARY_DIR}/wintc-comgtk.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig
)

View File

@@ -16,6 +16,8 @@
#define WINTC_SAFE_REF_CLEAR(ref) if (ref != NULL) { *ref = NULL; }
#define WINTC_SAFE_REF_SET(ref, value) if (ref != NULL) { *ref = value; }
#define WINTC_UNUSED(arg) __attribute__((unused)) arg
//
// gchar-related
//
@@ -121,7 +123,7 @@ gint wintc_strstr_count(
const gchar* needle
);
gboolean wintc_strsteal(
void wintc_strsteal(
gchar** dest,
gchar** src
);

View File

@@ -94,7 +94,7 @@ gchar* wintc_list_implode_strings(
g_string_append_printf(
str,
"%s",
iter->data
(gchar*) iter->data
);
first = FALSE;
@@ -104,7 +104,7 @@ gchar* wintc_list_implode_strings(
g_string_append_printf(
str,
"\n%s",
iter->data
(gchar*) iter->data
);
}
@@ -159,7 +159,7 @@ GList* wintc_list_read_from_string(
lines = g_strsplit(str, "\n", -1);
count = g_strv_length(lines);
for (int i = 0; i < count; i++)
for (guint i = 0; i < count; i++)
{
list =
g_list_append(

View File

@@ -4,4 +4,6 @@
#define WINTC_SAFE_REF_CLEAR(ref) if (ref != NULL) { *ref = NULL; }
#define WINTC_SAFE_REF_SET(ref, value) if (ref != NULL) { *ref = value; }
#define WINTC_UNUSED(arg) __attribute__((unused)) arg
#endif

View File

@@ -11,9 +11,9 @@ gint wintc_strstr_count(
const gchar* needle
)
{
gint advance = strlen(needle);
gint count;
gchar* pchar = haystack;
gint advance = strlen(needle);
gint count;
const gchar* pchar = haystack;
while (pchar != NULL)
{
@@ -29,7 +29,7 @@ gint wintc_strstr_count(
return count;
}
gboolean wintc_strsteal(
void wintc_strsteal(
gchar** dest,
gchar** src
)
@@ -49,16 +49,16 @@ gchar* wintc_strsubst(
const gchar* replacewith
)
{
gchar* buffer;
gint findsize = strlen(findwhat);
gint replacecount = wintc_strstr_count(str, findwhat);
gint replacesize = strlen(replacewith);
gchar* pbuffer;
gchar* pchar = str;
gchar* pnext = NULL;
gint required;
gint strsize = strlen(str);
gint tocopy;
gchar* buffer;
gint findsize = strlen(findwhat);
gint replacecount = wintc_strstr_count(str, findwhat);
gint replacesize = strlen(replacewith);
gchar* pbuffer;
const gchar* pchar = str;
const gchar* pnext = NULL;
gint required;
gint strsize = strlen(str);
gint tocopy;
// Work out how much space we need
//

View File

@@ -11,7 +11,7 @@ gint wintc_strstr_count(
const gchar* needle
);
gboolean wintc_strsteal(
void wintc_strsteal(
gchar** dest,
gchar** src
);

View File

@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.0)
project(wintc-exec VERSION 1.0 DESCRIPTION "Windows Total Conversion launcher library.")
project(
wintc-exec
VERSION 1.0
DESCRIPTION "Windows Total Conversion launcher library."
)
include(GNUInstallDirs)
@@ -20,40 +24,61 @@ pkg_check_modules(GIO REQUIRED gio-2.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(
${GDK_INCLUDE_DIRS}
${GIO_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS},
${GTK3_INCLUDE_DIRS})
link_directories(
${GDK_LIBRARY_DIRS}
${GIO_LIBRARY_DIRS}
${GLIB_LIBRARY_DIRS}
${GTK3_LIBRARY_DIRS})
add_library(wintc-exec
add_library(
wintc-exec
src/exec.h
src/exec.c)
src/exec.c
)
set_target_properties(wintc-exec PROPERTIES
set_target_properties(
wintc-exec
PROPERTIES
PUBLIC_HEADER public/wintc-exec.h
SOVERSION 1
VERSION ${PROJECT_VERSION})
VERSION ${PROJECT_VERSION}
)
configure_file(../debian-control.in debian-control @ONLY)
configure_file(wintc-exec.pc.in wintc-exec.pc @ONLY)
configure_file(public/wintc-exec.h wintc-exec.h COPYONLY)
target_compile_options(
wintc-exec
PRIVATE -Wall -Wextra -Wpedantic -Werror
)
target_link_libraries(wintc-exec
target_include_directories(
wintc-exec
SYSTEM
PRIVATE ${GDK_INCLUDE_DIRS}
PRIVATE ${GIO_INCLUDE_DIRS}
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
)
target_link_directories(
wintc-exec
PRIVATE ${GDK_LIBRARY_DIRS}
PRIVATE ${GIO_LIBRARY_DIRS}
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
)
target_link_libraries(
wintc-exec
PRIVATE ${GDK_LIBRARIES}
PRIVATE ${GIO_LIBRARIES}
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES})
PRIVATE ${GTK3_LIBRARIES}
)
install(TARGETS wintc-exec
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
configure_file(../debian-control.in debian-control @ONLY)
configure_file(wintc-exec.pc.in wintc-exec.pc @ONLY)
configure_file(public/wintc-exec.h wintc-exec.h COPYONLY)
install(FILES ${CMAKE_BINARY_DIR}/wintc-exec.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
install(
TARGETS wintc-exec
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
FILES ${CMAKE_BINARY_DIR}/wintc-exec.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig
)

View File

@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(run)
project(
run
VERSION 1.0
DESCRIPTION "Windows Total Conversion 'Run...' dialog box."
)
find_package(PkgConfig REQUIRED)
@@ -10,32 +14,46 @@ pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
pkg_check_modules(WINTC_EXEC REQUIRED wintc-exec)
include_directories(
${GDK_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS}
${WINTC_COMGTK_INCLUDE_DIRS}
${WINTC_EXEC_INCLUDE_DIRS})
link_directories(
${GDK_LIBRARY_DIRS}
${GLIB_LIBRARY_DIRS}
${GTK3_LIBRARY_DIRS}
${WINTC_COMGTK_LIBRARY_DIRS}
${WINTC_EXEC_LIBRARY_DIRS})
add_executable(run
add_executable(
run
src/application.c
src/application.h
src/dialog.c
src/dialog.h
src/history.h
src/history.c
src/main.c)
src/main.c
)
target_link_libraries(run
target_compile_options(
run
PRIVATE -Wall -Wextra -Wpedantic -Werror
)
target_include_directories(
run
SYSTEM
PRIVATE ${GDK_INCLUDE_DIRS}
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
PRIVATE ${WINTC_EXEC_INCLUDE_DIRS}
)
target_link_directories(
run
PRIVATE ${GDK_LIBRARY_DIRS}
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
PRIVATE ${WINTC_EXEC_LIBRARY_DIRS}
)
target_link_libraries(
run
PRIVATE ${GDK_LIBRARIES}
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMGTK_LIBRARIES}
PRIVATE ${WINTC_EXEC_LIBRARIES})
PRIVATE ${WINTC_EXEC_LIBRARIES}
)

View File

@@ -50,7 +50,7 @@ static void wintc_run_application_shutdown(
//
// GTK TYPE DEFINITION & CTORS
//
G_DEFINE_TYPE(WinTCRunApplication, wintc_run_application, GTK_TYPE_APPLICATION);
G_DEFINE_TYPE(WinTCRunApplication, wintc_run_application, GTK_TYPE_APPLICATION)
static void wintc_run_application_class_init(
WinTCRunApplicationClass* klass
@@ -68,7 +68,7 @@ static void wintc_run_application_class_init(
}
static void wintc_run_application_init(
WinTCRunApplication* self
WINTC_UNUSED(WinTCRunApplication* self)
) {}
//
@@ -113,13 +113,11 @@ static void wintc_run_application_activate(
}
static void wintc_run_application_open(
GApplication* application,
GFile** files,
int n_files,
const gchar* hint
)
{
}
WINTC_UNUSED(GApplication* application),
WINTC_UNUSED(GFile** files),
WINTC_UNUSED(int n_files),
WINTC_UNUSED(const gchar* hint)
) {}
static void wintc_run_application_startup(
GApplication* application

View File

@@ -70,7 +70,7 @@ G_DEFINE_TYPE_WITH_CODE(
wintc_run_dialog,
GTK_TYPE_APPLICATION_WINDOW,
G_ADD_PRIVATE(WinTCRunDialog)
);
)
static void wintc_run_dialog_class_init(
WinTCRunDialogClass* klass
@@ -324,7 +324,7 @@ static void iter_run_history(
}
static void on_browse_button_clicked(
GtkWidget* button,
WINTC_UNUSED(GtkWidget* button),
WinTCRunDialog* dialog
)
{
@@ -390,7 +390,7 @@ static void on_browse_button_clicked(
}
static void on_cancel_button_clicked(
GtkWidget* button,
WINTC_UNUSED(GtkWidget* button),
WinTCRunDialog* dialog
)
{
@@ -400,7 +400,7 @@ static void on_cancel_button_clicked(
static gboolean on_dialog_key_pressed(
GtkWidget* dialog,
GdkEventKey* event,
gpointer user_data
WINTC_UNUSED(gpointer user_data)
)
{
if (event->keyval == GDK_KEY_Escape)
@@ -413,7 +413,7 @@ static gboolean on_dialog_key_pressed(
}
static void on_ok_button_clicked(
GtkWidget* button,
WINTC_UNUSED(GtkWidget* button),
WinTCRunDialog* dialog
)
{

View File

@@ -1,26 +1,33 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.0)
project(startmenu-plugin)
set(GRESOURCE_DEPENDENCIES "")
project(
startmenu-plugin
VERSION 1.0
DESCRIPTION "Windows Total Conversion Start menu xfce-panel plugin."
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GARCON REQUIRED garcon-1)
pkg_check_modules(GARCON REQUIRED garcon-1)
pkg_check_modules(GARCON_GTK3 REQUIRED garcon-gtk3-1)
pkg_check_modules(GDK REQUIRED gdk-3.0)
pkg_check_modules(GIO REQUIRED gio-2.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(XFCE4PANEL REQUIRED libxfce4panel-2.0)
pkg_check_modules(XFCE4UTIL REQUIRED libxfce4util-1.0)
pkg_check_modules(GDK REQUIRED gdk-3.0)
pkg_check_modules(GIO REQUIRED gio-2.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(XFCE4PANEL REQUIRED libxfce4panel-2.0)
pkg_check_modules(XFCE4UTIL REQUIRED libxfce4util-1.0)
# Set up GResources target for the build
#
set(GRESOURCE_DEPENDENCIES "")
find_program(GLIB_COMPILE_RESOURCES glib-compile-resources REQUIRED)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/res
COMMAND ${GLIB_COMPILE_RESOURCES} --generate-dependencies resources.xml
OUTPUT_VARIABLE GRESOURCE_DEPENDENCIES)
OUTPUT_VARIABLE GRESOURCE_DEPENDENCIES
)
string(REPLACE "\n" ";" GRESOURCE_DEPENDENCIES ${GRESOURCE_DEPENDENCIES})
list(POP_BACK GRESOURCE_DEPENDENCIES)
@@ -37,33 +44,18 @@ add_custom_command(
VERBATIM
MAIN_DEPENDENCY src/res/resources.xml
DEPENDS
${GRESOURCE_DEPENDENCIES})
${GRESOURCE_DEPENDENCIES}
)
add_custom_target(
project-resources
DEPENDS src/resources.c)
DEPENDS src/resources.c
)
include_directories(
${GARCON_INCLUDE_DIRS}
${GARCON_GTK3_INCLUDE_DIRS}
${GDK_INCLUDE_DIRS}
${GIO_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS}
${XFCE4PANEL_INCLUDE_DIRS}
${XFCE4UTIL_INCLUDE_DIRS})
link_directories(
${GARCON_LIBRARY_DIRS}
${GARCON_GTK3_LIBRARY_DIRS}
${GDK_LIBRARY_DIRS}
${GIO_LIBRARY_DIRS}
${GLIB_LIBRARY_DIRS}
${GTK3_LIBRARY_DIRS}
${XFCE4PANEL_LIBRARY_DIRS}
${XFCE4UTIL_LIBRARY_DIRS})
add_library(startmenu-plugin MODULE
# Main target
#
add_library(
startmenu-plugin MODULE
src/action.h
src/action.c
src/placeslist.h
@@ -80,9 +72,38 @@ add_library(startmenu-plugin MODULE
src/startmenuitem.h
src/startmenuitem.c
src/util.h
src/util.c)
src/util.c
)
add_dependencies(startmenu-plugin project-resources)
target_compile_options(
startmenu-plugin
PRIVATE -Wall -Wextra -Wpedantic -Werror
)
target_include_directories(
startmenu-plugin
SYSTEM
PRIVATE ${GARCON_INCLUDE_DIRS}
PRIVATE ${GARCON_GTK3_INCLUDE_DIRS}
PRIVATE ${GDK_INCLUDE_DIRS}
PRIVATE ${GIO_INCLUDE_DIRS}
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${XFCE4PANEL_INCLUDE_DIRS}
PRIVATE ${XFCE4UTIL_INCLUDE_DIRS}
)
target_link_directories(
startmenu-plugin
PRIVATE ${GARCON_LIBRARY_DIRS}
PRIVATE ${GARCON_GTK3_LIBRARY_DIRS}
PRIVATE ${GDK_LIBRARY_DIRS}
PRIVATE ${GIO_LIBRARY_DIRS}
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${XFCE4PANEL_LIBRARY_DIRS}
PRIVATE ${XFCE4UTIL_LIBRARY_DIRS}
)
target_link_libraries(startmenu-plugin
PRIVATE ${GARCON_LIBRARIES}
@@ -93,3 +114,5 @@ target_link_libraries(startmenu-plugin
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${XFCE4PANEL_LIBRARIES}
PRIVATE ${XFCE4UTIL_LIBRARIES})
add_dependencies(startmenu-plugin project-resources)

View File

@@ -39,7 +39,7 @@ static void places_list_append_separator(
//
// GTK TYPE DEFINITION & CTORS
//
G_DEFINE_TYPE(PlacesList, places_list, GTK_TYPE_MENU_BAR);
G_DEFINE_TYPE(PlacesList, places_list, GTK_TYPE_MENU_BAR)
static void places_list_class_init(
PlacesListClass* klass

View File

@@ -1,6 +1,7 @@
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4util/libxfce4util.h>
#include <wintc-comgtk.h>
#include "plugin.h"
#include "startbutton.h"
@@ -51,11 +52,8 @@ static void start_plugin_class_init(
}
static void start_plugin_init(
StartPlugin* start_plugin
)
{
// nothing
}
WINTC_UNUSED(StartPlugin* start_plugin)
) {}
static void start_plugin_construct(
XfcePanelPlugin* plugin

View File

@@ -46,7 +46,7 @@ static void programs_list_append_top_items(
//
// GTK TYPE DEFINITION & CTORS
//
G_DEFINE_TYPE(ProgramsList, programs_list, GTK_TYPE_MENU_BAR);
G_DEFINE_TYPE(ProgramsList, programs_list, GTK_TYPE_MENU_BAR)
static void programs_list_class_init(
ProgramsListClass* klass

View File

@@ -2,6 +2,7 @@
#include <gtk/gtk.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4util/libxfce4util.h>
#include <wintc-comgtk.h>
#include "plugin.h"
#include "startbutton.h"
@@ -44,7 +45,7 @@ static void on_start_menu_hidden(
//
// GTK TYPE DEFINITION & CTORS
//
G_DEFINE_TYPE(StartButton, start_button, GTK_TYPE_TOGGLE_BUTTON);
G_DEFINE_TYPE(StartButton, start_button, GTK_TYPE_TOGGLE_BUTTON)
static void start_button_class_init(
StartButtonClass* klass
@@ -152,7 +153,7 @@ void start_button_attach_plugin(
//
static void on_clicked(
GtkButton* button,
gpointer user_data
WINTC_UNUSED(gpointer user_data)
)
{
StartButton* start_button = START_BUTTON(button);
@@ -193,8 +194,8 @@ static void on_clicked(
}
static void on_start_menu_hidden(
GtkWidget* widget,
gpointer user_data
WINTC_UNUSED(GtkWidget* widget),
gpointer user_data
)
{
gtk_toggle_button_set_active(

View File

@@ -4,6 +4,7 @@
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4util/libxfce4util.h>
#include <unistd.h>
#include <wintc-comgtk.h>
#include "action.h"
#include "placeslist.h"
@@ -83,7 +84,7 @@ G_DEFINE_TYPE_WITH_CODE(
start_menu,
GTK_TYPE_WINDOW,
G_ADD_PRIVATE(StartMenu)
);
)
static void start_menu_class_init(
StartMenuClass* klass
@@ -98,7 +99,7 @@ static void start_menu_init(
StartMenu* self
)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, TYPE_START_MENU, StartMenuPrivate);
self->priv = start_menu_get_instance_private(self);
// Set up hints
//
@@ -162,11 +163,11 @@ static void start_menu_finalize(
// PUBLIC FUNCTIONS
//
void start_menu_get_popup_position(
GtkWidget* menu,
XfcePanelPlugin* plugin,
GtkWidget* widget,
gint* x,
gint* y
GtkWidget* menu,
WINTC_UNUSED(XfcePanelPlugin* plugin),
GtkWidget* widget,
gint* x,
gint* y
)
{
GtkAllocation box_alloc;
@@ -206,8 +207,8 @@ void start_menu_get_popup_position(
// PRIVATE FUNCTIONS
//
static void create_logoffpane_structure(
StartMenu* start_menu,
GtkBox* box
WINTC_UNUSED(StartMenu* start_menu),
GtkBox* box
)
{
GtkWidget* logoffpane_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
@@ -399,8 +400,8 @@ static void create_taskcolumns_structure(
}
static void create_userpane_structure(
StartMenu* start_menu,
GtkBox* box
WINTC_UNUSED(StartMenu* start_menu),
GtkBox* box
)
{
GtkWidget* userpane_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
@@ -473,8 +474,8 @@ static void create_userpane_structure(
// CALLBACKS
//
static void on_action_button_clicked(
GtkButton* button,
gpointer user_data
WINTC_UNUSED(GtkButton* button),
gpointer user_data
)
{
launch_action(GPOINTER_TO_INT(user_data));
@@ -482,8 +483,8 @@ static void on_action_button_clicked(
static gboolean on_focus_out(
GtkWidget* widget,
GdkEvent* event,
gpointer user_data
WINTC_UNUSED(GdkEvent* event),
WINTC_UNUSED(gpointer user_data)
)
{
gtk_widget_hide(widget);
@@ -491,7 +492,7 @@ static gboolean on_focus_out(
}
static void on_selection_done(
GtkWidget* widget,
WINTC_UNUSED(GtkWidget* widget),
StartMenu* start_menu
)
{

View File

@@ -4,6 +4,7 @@
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <wintc-comgtk.h>
#include "action.h"
#include "startmenuitem.h"
@@ -64,7 +65,7 @@ G_DEFINE_TYPE_WITH_CODE(
start_menu_item,
GTK_TYPE_MENU_ITEM,
G_ADD_PRIVATE(StartMenuItem)
);
)
static void start_menu_item_class_init(
StartMenuItemClass* klass
@@ -79,8 +80,7 @@ static void start_menu_item_init(
StartMenuItem* self
)
{
self->priv =
G_TYPE_INSTANCE_GET_PRIVATE(self, TYPE_START_MENU_ITEM, StartMenuItemPrivate);
self->priv = start_menu_item_get_instance_private(self);
g_signal_connect(
G_OBJECT(self),
@@ -228,7 +228,6 @@ GtkWidget* start_menu_item_new_from_desktop_entry(
GAppInfo* app_info = G_APP_INFO(entry);
const gchar* app_desc = g_app_info_get_description(app_info);
const gchar* cmd_line = g_app_info_get_commandline(app_info);
const gchar* exe_path = g_app_info_get_executable(app_info);
const gchar* name = g_app_info_get_name(app_info);
@@ -444,7 +443,7 @@ static GtkWidget* start_menu_item_new_manual(
//
static void on_menu_item_activate(
GtkWidget* widget,
gpointer user_data
WINTC_UNUSED(gpointer user_data)
)
{
StartMenuItem* start_menu_item = START_MENU_ITEM(widget);

View File

@@ -2,6 +2,7 @@
#include <gio/gdesktopappinfo.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc-comgtk.h>
#include "util.h"
@@ -187,7 +188,7 @@ void gtk_widget_add_style_class(
void menu_shell_deselect_on_leave(
GtkWidget* widget,
GdkEvent* event,
WINTC_UNUSED(GdkEvent* event),
GtkMenuShell* menu_shell
)
{
@@ -201,7 +202,7 @@ void menu_shell_deselect_on_leave(
void menu_shell_select_on_enter(
GtkWidget* widget,
GdkEvent* event,
WINTC_UNUSED(GdkEvent* event),
GtkMenuShell* menu_shell
)
{

View File

@@ -1,50 +1,72 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(xpsystray-plugin)
project(
xpsystray-plugin
VERSION 1.0
DESCRIPTION "Windows Total Conversion notification area xfce-panel plugin."
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GARCON REQUIRED garcon-1)
pkg_check_modules(GARCON_GTK3 REQUIRED garcon-gtk3-1)
pkg_check_modules(GDK REQUIRED gdk-3.0)
pkg_check_modules(GIO REQUIRED gio-2.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(XFCE4PANEL REQUIRED libxfce4panel-2.0)
pkg_check_modules(XFCE4UTIL REQUIRED libxfce4util-1.0)
pkg_check_modules(GARCON REQUIRED garcon-1)
pkg_check_modules(GARCON_GTK3 REQUIRED garcon-gtk3-1)
pkg_check_modules(GDK REQUIRED gdk-3.0)
pkg_check_modules(GIO REQUIRED gio-2.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
pkg_check_modules(XFCE4PANEL REQUIRED libxfce4panel-2.0)
pkg_check_modules(XFCE4UTIL REQUIRED libxfce4util-1.0)
include_directories(
${GARCON_INCLUDE_DIRS}
${GARCON_GTK3_INCLUDE_DIRS}
${GDK_INCLUDE_DIRS}
${GIO_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS}
${XFCE4PANEL_INCLUDE_DIRS}
${XFCE4UTIL_INCLUDE_DIRS})
link_directories(
${GARCON_LIBRARY_DIRS}
${GARCON_GTK3_LIBRARY_DIRS}
${GDK_LIBRARY_DIRS}
${GIO_LIBRARY_DIRS}
${GLIB_LIBRARY_DIRS}
${GTK3_LIBRARY_DIRS}
${XFCE4PANEL_LIBRARY_DIRS}
${XFCE4UTIL_LIBRARY_DIRS})
add_library(xpsystray-plugin MODULE
add_library(
xpsystray-plugin MODULE
src/clock.h
src/clock.c
src/plugin.h
src/plugin.c)
src/plugin.c
)
target_link_libraries(xpsystray-plugin
target_compile_options(
xpsystray-plugin
PRIVATE -Wall -Wextra -Wpedantic -Werror
)
target_include_directories(
xpsystray-plugin
SYSTEM
PRIVATE ${GARCON_INCLUDE_DIRS}
PRIVATE ${GARCON_GTK3_INCLUDE_DIRS}
PRIVATE ${GDK_INCLUDE_DIRS}
PRIVATE ${GIO_INCLUDE_DIRS}
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
PRIVATE ${XFCE4PANEL_INCLUDE_DIRS}
PRIVATE ${XFCE4UTIL_INCLUDE_DIRS}
)
target_link_directories(
xpsystray-plugin
PRIVATE ${GARCON_LIBRARY_DIRS}
PRIVATE ${GARCON_GTK3_LIBRARY_DIRS}
PRIVATE ${GDK_LIBRARY_DIRS}
PRIVATE ${GIO_LIBRARY_DIRS}
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
PRIVATE ${XFCE4PANEL_LIBRARY_DIRS}
PRIVATE ${XFCE4UTIL_LIBRARY_DIRS}
)
target_link_libraries(
xpsystray-plugin
PRIVATE ${GARCON_LIBRARIES}
PRIVATE ${GARCON_GTK3_LIBRARIES}
PRIVATE ${GDK_LIBRARIES}
PRIVATE ${GIO_LIBRARIES}
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMGTK_LIBRARIES}
PRIVATE ${XFCE4PANEL_LIBRARIES}
PRIVATE ${XFCE4UTIL_LIBRARIES})
PRIVATE ${XFCE4UTIL_LIBRARIES}
)

View File

@@ -54,7 +54,7 @@ G_DEFINE_TYPE_WITH_CODE(
tray_clock,
GTK_TYPE_LABEL,
G_ADD_PRIVATE(TrayClock)
);
)
static void tray_clock_class_init(
TrayClockClass* klass
@@ -112,7 +112,7 @@ static void tray_clock_finalize(
{
TrayClock* tray_clock = TRAY_CLOCK(object);
if (tray_clock->priv->clock_source_id > -1)
if (tray_clock->priv->clock_source_id > 0)
{
g_source_remove(tray_clock->priv->clock_source_id);
}

View File

@@ -2,6 +2,7 @@
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4util/libxfce4util.h>
#include <wintc-comgtk.h>
#include "clock.h"
#include "plugin.h"
@@ -32,7 +33,7 @@ static void systray_plugin_construct(
//
// GTK TYPE DEFINITION & CTORS
//
XFCE_PANEL_DEFINE_PLUGIN(SystrayPlugin, systray_plugin);
XFCE_PANEL_DEFINE_PLUGIN(SystrayPlugin, systray_plugin)
static void systray_plugin_class_init(
SystrayPluginClass* klass
@@ -46,11 +47,8 @@ static void systray_plugin_class_init(
}
static void systray_plugin_init(
SystrayPlugin* systray_plugin
)
{
// nothing
}
WINTC_UNUSED(SystrayPlugin* systray_plugin)
) {}
static void systray_plugin_construct(
XfcePanelPlugin* plugin

View File

@@ -1,23 +1,45 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(winver)
project(
winver
VERSION 1.0
DESCRIPTION "Windows Total Conversion 'About Windows' utility."
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
include_directories(
${GLIB_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS})
add_executable(
winver
src/winver.c
)
link_directories(
${GLIB_LIBRARY_DIRS}
${GTK3_LIBRARY_DIRS})
target_compile_options(
winver
PRIVATE -Wall -Wextra -Wpedantic -Werror
)
add_executable(winver
src/winver.c)
target_include_directories(
winver
SYSTEM
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
)
target_link_libraries(winver
target_link_directories(
winver
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
)
target_link_libraries(
winver
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES})
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
)

View File

@@ -4,6 +4,7 @@
#include <sys/sysinfo.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <wintc-comgtk.h>
//
// FORWARD DECLARATIONS
@@ -96,7 +97,7 @@ int main(
sysinfo(&stats);
g_sprintf(
system_stats,
"Physical memory available to Windows: %d KB",
"Physical memory available to Windows: %lu KB",
stats.totalram / 1024
);
@@ -237,8 +238,8 @@ static GtkWidget* create_winver_label(
// CALLBACKS
//
static void on_ok_button_clicked(
GtkButton* button,
gpointer user_data
WINTC_UNUSED(GtkButton* button),
gpointer user_data
)
{
gtk_window_close(
@@ -247,8 +248,8 @@ static void on_ok_button_clicked(
}
static void on_window_destroyed(
GtkWidget* widget,
gpointer user_data
WINTC_UNUSED(GtkWidget* widget),
WINTC_UNUSED(gpointer user_data)
)
{
gtk_main_quit();