ROX-CLib: rox.c File Reference

- Main Page
- Data Structures
- Files
- Related Pages

- File List
- Globals

# rox.c File Reference

General ROX functions. More...

`#include "rox-clib.h"`
`#include <stdlib.h>`
`#include <string.h>`
`#include <unistd.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <glib.h>`
`#include <gtk/gtk.h>`
`#include "rox.h"`
`#include "options.h"`
`#include "rox_dnd.h"`
`#include "mime.h"`

## Functions
void | rox_init (const char *program, int *argc, char ***argv)
void | rox_init_with_domain (const char *program, const char *domain, int *argc, char ***argv)
const gchar * | rox_get_program_name (void)
const gchar * | rox_get_program_domain (void)
const gchar * | rox_get_app_dir (void)
GdkPixbuf * | rox_get_program_icon (void)
int | rox_clib_version_number (void)
const char * | rox_clib_version_string (void)
int | rox_clib_gtk_version_number (void)
const char * | rox_clib_gtk_version_string (void)
void | rox_add_window (GtkWidget *window)
int | rox_get_n_windows (void)
void | rox_main_loop (void)
void | rox_main_quit (void)
void | rox_deprecated_warning (const char *func, const char *use)
int | rox_is_appdir (const char *path)
char * | rox_find_appdir (const char *name, gchar **dirs, const char *env_name)
char * | rox_clib_find (void)

## Detailed Description

General ROX functions.

## Function Documentation

void rox_add_window | ( | GtkWidget * | window | ) |

Add this window to the ones which are being counted. When it is destroyed this will be noted and the window count decreased.

Parameters:

  | window | Window or other widget to count

char* rox_clib_find | ( | void |  | ) |

Return the path to ROX-CLib's AppDir. This tries

- $ROX_CLIB
- rox_find_appdir("ROX-CLib", NULL, "LIBDIRPATH")
- rox_find_appdir("ROX-CLib", NULL, "APPDIRPATH")
- rox_find_appdir("ROX-CLib", NULL, "PATH") returning the first valid AppDir found.

Returns:
  path to ROX-CLib (pass to g_free()), or `NULL` if not found.

int rox_clib_gtk_version_number | ( | void |  | ) |

Returns the version number of the GTK+ library encoded as an int

Returns:
  10000*major+100*minor+micro

const char* rox_clib_gtk_version_string | ( | void |  | ) |

Returns the version number of the GTK+ library as a string

Returns:
  "major.minor.micro"

int rox_clib_version_number | ( | void |  | ) |

Returns the version number of the library encoded as an int

Returns:
  10000*major+100*minor+micro

const char* rox_clib_version_string | ( | void |  | ) |

Returns the version number of the library as a string

Returns:
  "major.minor.micro"

void rox_deprecated_warning | ( | const char * | func,
|  | const char * | use |
| ) |  |  |

Warn about use of a deprecated function and indicate it's replacement. This warning is enabled by ROX_CLIB_DEPRECATION_WARNING=1 and disabled by ROX_CLIB_DEPRECATION_WARNING=0 (the default state depends on the release). This function is for internal use.

Parameters:

  `[in]` | func | name of function that is deprecated
  `[in]` | use | name or description of replacement

char* rox_find_appdir | ( | const char * | name,
|  | gchar ** | dirs,
|  | const char * | env_name |
| ) |  |  |

Return the path to an AppDir.

Parameters:

  `[in]` | name | name of application to find
  `[in]` | dirs | `NULL` terminated array of directories to look in. If dirs is `NULL` then env_name is used instead
  `[in]` | env_name | if dirs is `NULL` then this is the name of an environment variable that will contain a colon-separated list of directories. If env_name is `NULL` "APPDIRPATH" is used. Default values for the variables "APPDIRPATH" and "LIBDIRPATH" are assumed if they are not set.

Returns:
  path to AppDir (pass to g_free()), or `NULL` if not found.

const gchar* rox_get_app_dir | ( | void |  | ) |

Returns the application directory.

Returns:
  the application directory, which may be NULL or "" if the AppRun script wasn't called

int rox_get_n_windows | ( | void |  | ) |

Return the number of windows ROX-CLib is tracking

Returns:
  the number of windows passed to rox_add_window(), minus the number of those destroyed

const gchar* rox_get_program_domain | ( | void |  | ) |

Returns the program domain as passed to rox_init_with_domain()

Returns:
  the domain, or `NULL` if no domain was given.

GdkPixbuf* rox_get_program_icon | ( | void |  | ) |

Returns the program icon used for the windows

Returns:
  the program icon, or NULL if there isn't one

const gchar* rox_get_program_name | ( | void |  | ) |

Returns the program name as passed to rox_init_with_domain()

Returns:
  the program name

void rox_init | ( | const char * | program,
|  | int * | argc,
|  | char *** | argv |
| ) |  |  |

Initialize the library. Equivalent to rox_init_with_domain(program, NULL, argc, argv).

Deprecated:
  Use rox_init_with_domain() instead.

Parameters:

  `[in]` | program | name of program
  `[in,out]` | argc | pointer to argc passed to main()
  `[in,out]` | argv | pointer to argv passed to main()

void rox_init_with_domain | ( | const char * | program,
|  | const char * | domain,
|  | int * | argc,
|  | char *** | argv |
| ) |  |  |

Initialize the library. This calls:

- gtk_init()
- rox_debug_init()
- choices_init()
- options_init_with_domain() (if `Options.xml` in $APP_DIR)
- rox_dnd_init()
- mime_init()

If ``.DirIcon exists in $APP_DIR it is set as the default icon for all windows.

If the ROX-CLib AppDir can be located by rox_clib_find() then the translations for ROX-CLib are made available from ROX-CLib/Messages. The default location for the applications translations is set to $APP_DIR/Messages.

Parameters:

  `[in]` | program | name of program
  `[in]` | domain | domain under the control of the programmer. Used in options and choices
  `[in,out]` | argc | pointer to argc passed to main()
  `[in,out]` | argv | pointer to argv passed to main()

int rox_is_appdir | ( | const char * | path | ) |

Confirm that path exists and is a valid AppDir. This includes checking ownership and permissions.

Parameters:

  `[in]` | path | path to object to check

Returns:
  `FALSE` if not a valid AppDir

void rox_main_loop | ( | void |  | ) |

Call gtk_main() repeatedly until either rox_get_n_windows() returns less than one, or rox_main_quit() is called

void rox_main_quit | ( | void |  | ) |

Cause rox_main_loop() to exit. If rox_main_loop() has been called recursivly only the innermost is exited.