More doxygen sugar

This commit is contained in:
Dave Davenport 2016-01-07 13:32:33 +01:00
parent 504e27f701
commit b59552003e
5 changed files with 86 additions and 18 deletions

View File

@ -4,7 +4,7 @@
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <textbox.h> #include "textbox.h"
#include <cairo.h> #include <cairo.h>
#include <cairo-xlib.h> #include <cairo-xlib.h>
#include "timings.h" #include "timings.h"

View File

@ -39,14 +39,14 @@ typedef struct
typedef enum typedef enum
{ {
TB_AUTOHEIGHT = 1 << 0, TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1, TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16, TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17, TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18, TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19, TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20, TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21, TB_WRAP = 1 << 21,
} TextboxFlags; } TextboxFlags;
typedef enum typedef enum

View File

@ -1,7 +1,28 @@
#ifndef ROFI_XRMOPTIONS_H #ifndef ROFI_XRMOPTIONS_H
#define ROFI_XRMOPTIONS_H #define ROFI_XRMOPTIONS_H
// Big thanks to Sean Pringle for this code.
/** /**
* @defgroup CONFXResources XResources Configuration
* @ingroup CONFIGURATION
*
* Configuration described in Xresource format. This can be loaded from the X server or file.
*
* @defgroup CONFXServer XServer Configuration
* @ingroup CONFXResources
*
* Loads the configuration directly from the X server using the XResources system.
*
* @defgroup CONFCommandline Commandline Configuration
* @ingroup CONFIGURATION
*
* Modified the configuration based on commandline arguments
*
* @defgroup CONFFile File Configuration
* @ingroup CONFXResources
*
* Loads the configuration from a config file that uses the XResource file format.
*
* @defgroup CONFIGURATION Configuration * @defgroup CONFIGURATION Configuration
* *
* This provides rofi configuration system, supports: * This provides rofi configuration system, supports:
@ -13,7 +34,6 @@
* @{ * @{
*/ */
// Big thanks to Sean Pringle for this code.
// This maps xresource options to config structure. // This maps xresource options to config structure.
typedef enum typedef enum
{ {
@ -29,49 +49,97 @@ typedef enum
* *
* Parse the rofi related X resource options of the * Parse the rofi related X resource options of the
* connected X server. * connected X server.
*
* @ingroup CONFXServer
*/ */
void config_parse_xresource_options ( Display *display ); void config_parse_xresource_options ( Display *display );
/**
* @ingroup CONFFile
*/
void config_parse_xresource_options_file ( const char *filename ); void config_parse_xresource_options_file ( const char *filename );
/** /**
* Parse commandline options. * Parse commandline options.
* @ingroup CONFCommandline
*/ */
void config_parse_cmd_options ( void ); void config_parse_cmd_options ( void );
/** /**
* Parse dynamic commandline options. * Parse dynamic commandline options.
* @ingroup CONFCommandline
*/ */
void config_parse_cmd_options_dynamic ( void ); void config_parse_cmd_options_dynamic ( void );
/** /**
* @param display Handler of the display to fetch the settings from. * @param display Handler of the display to fetch the settings from.
* *
* Parse the rofi related X resource options of the * Parse the rofi related X resource options of the
* connected X server. * connected X server.
*
* @ingroup CONFXServer
*/ */
void config_parse_xresource_options_dynamic ( Display *display ); void config_parse_xresource_options_dynamic ( Display *display );
/**
* @ingroup CONFFile
*/
void config_parse_xresource_options_dynamic_file ( const char *filename ); void config_parse_xresource_options_dynamic_file ( const char *filename );
/** /**
* Initializes the Xresourced system. * Initializes the Xresourced system.
*
* @ingroup CONFXResources
*/ */
void config_parse_xresource_init ( void ); void config_parse_xresource_init ( void );
/** /**
* Free any allocated memory. * Free any allocated memory.
*
* @ingroup CONFXResources
*/ */
void config_xresource_free ( void ); void config_xresource_free ( void );
/** /**
* Dump the settings in a Xresources compatible way to * Dump the settings in a Xresources compatible way to
* stdout. * stdout.
*
* @ingroup CONFXResources
*/ */
void xresource_dump ( void ); void config_parse_xresource_dump ( void );
/** /**
* Add option to the dynamic option parser. * Dump the theme related settings in Xresources compatible way to
* stdout.
*
* @ingroup CONFXResources
*/
void config_parse_xresources_theme_dump ( void );
/**
* @param type The type of the value
* @param key The key refering to this configuration option
* @param value The value to update based [out][in]
* @param command Description of this configuration option
*
* Add option (at runtime) to the dynamic option parser.
*/ */
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment ); void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment );
/**
* Print the current configuration to stdout. Uses bold/italic when printing to terminal.
*/
void print_options ( void ); void print_options ( void );
/**
* @param option The name of the option
* @param type String describing the type
* @param text Description of the option
* @param def Current value of the option
* @param isatty If printed to a terminal
*
* Function that does the markup for printing an configuration option to stdout.
*/
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty ); void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty );
void print_xresources_theme ( void );
/* @}*/ /* @}*/
#endif #endif

View File

@ -2315,7 +2315,7 @@ static int main_loop_signal_handler ( char command, int quiet )
} }
// Got message to print info // Got message to print info
else if ( command == 'i' ) { else if ( command == 'i' ) {
xresource_dump (); config_parse_xresource_dump ();
} }
return FALSE; return FALSE;
} }
@ -2487,11 +2487,11 @@ int main ( int argc, char *argv[] )
exit ( EXIT_SUCCESS ); exit ( EXIT_SUCCESS );
} }
if ( find_arg ( "-dump-xresources" ) >= 0 ) { if ( find_arg ( "-dump-xresources" ) >= 0 ) {
xresource_dump (); config_parse_xresource_dump ();
exit ( EXIT_SUCCESS ); exit ( EXIT_SUCCESS );
} }
if ( find_arg ( "-dump-xresources-theme" ) >= 0 ) { if ( find_arg ( "-dump-xresources-theme" ) >= 0 ) {
print_xresources_theme (); config_parse_xresources_theme_dump ();
exit ( EXIT_SUCCESS ); exit ( EXIT_SUCCESS );
} }
// Parse the keybindings. // Parse the keybindings.

View File

@ -406,7 +406,7 @@ static void xresource_dump_entry ( const char *namePrefix, XrmOption *option )
printf ( "\n" ); printf ( "\n" );
} }
void xresource_dump ( void ) void config_parse_xresource_dump ( void )
{ {
const char * namePrefix = "rofi"; const char * namePrefix = "rofi";
unsigned int entries = sizeof ( xrmOptions ) / sizeof ( *xrmOptions ); unsigned int entries = sizeof ( xrmOptions ) / sizeof ( *xrmOptions );
@ -543,7 +543,7 @@ void print_help_msg ( const char *option, const char *type, const char*text, con
} }
} }
void print_xresources_theme ( void ) void config_parse_xresources_theme_dump ( void )
{ {
if ( config.color_enabled != TRUE ) { if ( config.color_enabled != TRUE ) {
printf ( "! Dumping theme only works for the extended color scheme.\n" ); printf ( "! Dumping theme only works for the extended color scheme.\n" );