GnuCash  4.11-11-ge9df8d41d2+
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 642 of file gnc-gnome-utils.c.

643 {
644  GdkPixbuf *pixbuf;
645  GError *error = NULL;
646  char *fullname;
647 
648  g_return_val_if_fail (name != NULL, NULL);
649 
650  fullname = gnc_filepath_locate_pixmap (name);
651  if (fullname == NULL)
652  return NULL;
653 
654  DEBUG ("Loading pixbuf file %s", fullname);
655  pixbuf = gdk_pixbuf_new_from_file (fullname, &error);
656  if (error != NULL)
657  {
658  g_assert (pixbuf == NULL);
659  PERR ("Could not load pixbuf: %s", error->message);
660  g_error_free (error);
661  }
662  g_free (fullname);
663 
664  return pixbuf;
665 }
#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 611 of file gnc-gnome-utils.c.

612 {
613  GtkWidget *pixmap;
614  char *fullname;
615 
616  g_return_val_if_fail (name != NULL, NULL);
617 
618  fullname = gnc_filepath_locate_pixmap (name);
619  if (fullname == NULL)
620  return NULL;
621 
622  DEBUG ("Loading pixmap file %s", fullname);
623 
624  pixmap = gtk_image_new_from_file (fullname);
625  if (pixmap == NULL)
626  {
627  PERR ("Could not load pixmap");
628  }
629  g_free (fullname);
630 
631  return pixmap;
632 }
#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 469 of file gnc-gnome-utils.c.

470 {
471  GError *error = NULL;
472  gchar *uri = NULL;
473  gboolean success = TRUE;
474 
475  if (anchor)
476  uri = gnc_gnome_help_yelp_anchor_fix (parent, file_name, anchor);
477  else
478  uri = g_strconcat ("ghelp:", file_name, NULL);
479 
480  DEBUG ("Attempting to opening help uri %s", uri);
481 
482  if (uri)
483  success = gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error);
484 
485  g_free (uri);
486  if (success)
487  return;
488 
489  g_assert(error != NULL);
490  {
491  gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
492  }
493  PERR ("%s", error->message);
494  g_error_free(error);
495 }
#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 866 of file gnc-gnome-utils.c.

867 {
868  if (gnucash_ui_is_running())
869  {
870  if (!gnome_is_terminating)
871  {
872  if (gnc_file_query_save (gnc_ui_get_main_window (NULL), FALSE))
873  {
874  gnc_hook_run(HOOK_UI_SHUTDOWN, NULL);
875  gnc_gui_shutdown();
876  }
877  }
878  }
879  else
880  {
881  gnc_gui_destroy();
882  gnc_hook_run(HOOK_SHUTDOWN, NULL);
884  exit(exit_status);
885  }
886 }
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