GnuCash  4.14+
Files | Functions
Gnome-specific GUI handling.

Files

file  gnc-gnome-utils.h
 Gnome specific utility functions.
 

Functions

void gnc_gnome_utils_init (void)
 Initialize the gnome-utils library Should be run once before using any gnome-utils features.
 
void gnc_add_css_file (void)
 Load a gtk resource configuration file to customize gtk appearance and behaviour.
 
void gnc_gnome_help (GtkWindow *parent, const char *file_name, const char *anchor)
 Launch the systems default help browser, gnome's yelp for linux, and open to a given link within a given file. More...
 
void gnc_launch_doclink (GtkWindow *parent, const char *uri)
 Launch the default browser and open the provided URI.
 
void gnc_options_dialog_set_book_options_help_cb (GNCOptionWin *win)
 Set the help callback to 'gnc_book_options_help_cb' to open a help browser and point it to the Book Options link in the Help file.
 
void gnc_options_dialog_set_new_book_option_values (GNCOptionDB *odb)
 Set the initial values of new book options to values specified in user preferences.
 
void gnc_options_dialog_set_style_sheet_options_help_cb (GNCOptionWin *win)
 Set the help callback to 'gnc_style_sheet_options_help_cb' to open a help browser and point it to the Style Sheet link in the Help file.
 
GtkWidget * gnc_gnome_get_pixmap (const char *name)
 Given a file name, find and load the requested pixmap. More...
 
GdkPixbuf * gnc_gnome_get_gdkpixbuf (const char *name)
 Given a file name, find and load the requested pixbuf. More...
 
void gnc_shutdown (int exit_status)
 Shutdown gnucash. More...
 
GncMainWindowgnc_gui_init (void)
 Initialize the gnucash gui.
 
int gnc_ui_start_event_loop (void)
 
gboolean gnucash_ui_is_running (void)
 

Detailed Description

Function Documentation

◆ gnc_gnome_get_gdkpixbuf()

GdkPixbuf* gnc_gnome_get_gdkpixbuf ( const char *  name)

Given a file name, find and load the requested pixbuf.

This routine will display an error message if it can't find the file or load the pixbuf.

Parameters
nameThe name of the pixbuf file to load.
Returns
A pointer to the pixbuf, or NULL of the file couldn't be found or loaded..

Definition at line 577 of file gnc-gnome-utils.c.

578 {
579  GdkPixbuf *pixbuf;
580  GError *error = NULL;
581  char *fullname;
582 
583  g_return_val_if_fail (name != NULL, NULL);
584 
585  fullname = gnc_filepath_locate_pixmap (name);
586  if (fullname == NULL)
587  return NULL;
588 
589  DEBUG ("Loading pixbuf file %s", fullname);
590  pixbuf = gdk_pixbuf_new_from_file (fullname, &error);
591  if (error != NULL)
592  {
593  g_assert (pixbuf == NULL);
594  PERR ("Could not load pixbuf: %s", error->message);
595  g_error_free (error);
596  }
597  g_free (fullname);
598 
599  return pixbuf;
600 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define PERR(format, args...)
Log a serious error.
Definition: qoflog.h:244
gchar * gnc_filepath_locate_pixmap(const gchar *name)
Given a pixmap/pixbuf file name, find the file in the pixmap directory associated with this applicati...

◆ gnc_gnome_get_pixmap()

GtkWidget* gnc_gnome_get_pixmap ( const char *  name)

Given a file name, find and load the requested pixmap.

This routine will display an error message if it can't find the file or load the pixmap.

Parameters
nameThe name of the pixmap file to load.
Returns
A pointer to the pixmap, or NULL of the file couldn't be found or loaded..

Definition at line 546 of file gnc-gnome-utils.c.

547 {
548  GtkWidget *pixmap;
549  char *fullname;
550 
551  g_return_val_if_fail (name != NULL, NULL);
552 
553  fullname = gnc_filepath_locate_pixmap (name);
554  if (fullname == NULL)
555  return NULL;
556 
557  DEBUG ("Loading pixmap file %s", fullname);
558 
559  pixmap = gtk_image_new_from_file (fullname);
560  if (pixmap == NULL)
561  {
562  PERR ("Could not load pixmap");
563  }
564  g_free (fullname);
565 
566  return pixmap;
567 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define PERR(format, args...)
Log a serious error.
Definition: qoflog.h:244
gchar * gnc_filepath_locate_pixmap(const gchar *name)
Given a pixmap/pixbuf file name, find the file in the pixmap directory associated with this applicati...

◆ gnc_gnome_help()

void gnc_gnome_help ( GtkWindow *  parent,
const char *  file_name,
const char *  anchor 
)

Launch the systems default help browser, gnome's yelp for linux, and open to a given link within a given file.

This routine will display an error message if it can't find the help file or can't open the help browser.

Parameters
parentThe parent window for any dialogs.
file_nameThe name of the help file.
anchorThe anchor the help browser should scroll to.

Definition at line 404 of file gnc-gnome-utils.c.

405 {
406  GError *error = NULL;
407  gchar *uri = NULL;
408  gboolean success = TRUE;
409 
410  if (anchor)
411  uri = g_strconcat ("help:", file_name, "/", anchor, NULL);
412  else
413  uri = g_strconcat ("help:", file_name, NULL);
414 
415  DEBUG ("Attempting to opening help uri %s", uri);
416 
417  if (uri)
418  success = gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error);
419 
420  g_free (uri);
421  if (success)
422  return;
423 
424  g_assert(error != NULL);
425  {
426  gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
427  }
428  PERR ("%s", error->message);
429  g_error_free(error);
430 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define PERR(format, args...)
Log a serious error.
Definition: qoflog.h:244

◆ gnc_shutdown()

void gnc_shutdown ( int  exit_status)

Shutdown gnucash.

This function will initiate an orderly shutdown, and when that has finished it will exit the program.

Parameters
exit_statusThe exit status for the program.

Definition at line 801 of file gnc-gnome-utils.c.

802 {
803  if (gnucash_ui_is_running())
804  {
805  if (!gnome_is_terminating)
806  {
807  if (gnc_file_query_save (gnc_ui_get_main_window (NULL), FALSE))
808  {
809  gnc_hook_run(HOOK_UI_SHUTDOWN, NULL);
810  gnc_gui_shutdown();
811  }
812  }
813  }
814  else
815  {
816  gnc_gui_destroy();
817  gnc_hook_run(HOOK_SHUTDOWN, NULL);
819  exit(exit_status);
820  }
821 }
GtkWindow * gnc_ui_get_main_window(GtkWidget *widget)
Get a pointer to the final GncMainWindow widget is rooted in.
void gnc_engine_shutdown(void)
Called to shutdown the engine.
Definition: gnc-engine.c:141