GnuCash  5.6-150-g038405b370+
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.
 
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 516 of file gnc-gnome-utils.c.

517 {
518  GdkPixbuf *pixbuf;
519  GError *error = NULL;
520  char *fullname;
521 
522  g_return_val_if_fail (name != NULL, NULL);
523 
524  fullname = gnc_filepath_locate_pixmap (name);
525  if (fullname == NULL)
526  return NULL;
527 
528  DEBUG ("Loading pixbuf file %s", fullname);
529  pixbuf = gdk_pixbuf_new_from_file (fullname, &error);
530  if (error != NULL)
531  {
532  g_assert (pixbuf == NULL);
533  PERR ("Could not load pixbuf: %s", error->message);
534  g_error_free (error);
535  }
536  g_free (fullname);
537 
538  return pixbuf;
539 }
#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 485 of file gnc-gnome-utils.c.

486 {
487  GtkWidget *pixmap;
488  char *fullname;
489 
490  g_return_val_if_fail (name != NULL, NULL);
491 
492  fullname = gnc_filepath_locate_pixmap (name);
493  if (fullname == NULL)
494  return NULL;
495 
496  DEBUG ("Loading pixmap file %s", fullname);
497 
498  pixmap = gtk_image_new_from_file (fullname);
499  if (pixmap == NULL)
500  {
501  PERR ("Could not load pixmap");
502  }
503  g_free (fullname);
504 
505  return pixmap;
506 }
#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 343 of file gnc-gnome-utils.c.

344 {
345  GError *error = NULL;
346  gchar *uri = NULL;
347  gboolean success = TRUE;
348 
349  if (anchor)
350  uri = g_strconcat ("help:", file_name, "/", anchor, NULL);
351  else
352  uri = g_strconcat ("help:", file_name, NULL);
353 
354  DEBUG ("Attempting to opening help uri %s", uri);
355 
356  if (uri)
357  success = gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error);
358 
359  g_free (uri);
360  if (success)
361  return;
362 
363  g_assert(error != NULL);
364  {
365  gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
366  }
367  PERR ("%s", error->message);
368  g_error_free(error);
369 }
#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 747 of file gnc-gnome-utils.c.

748 {
749  if (gnucash_ui_is_running())
750  {
751  if (!gnome_is_terminating)
752  {
753  if (gnc_file_query_save (gnc_ui_get_main_window (NULL), FALSE))
754  {
755  gnc_hook_run(HOOK_UI_SHUTDOWN, NULL);
756  gnc_gui_shutdown();
757  }
758  }
759  }
760  else
761  {
762  gnc_gui_destroy();
763  gnc_hook_run(HOOK_SHUTDOWN, NULL);
765  exit(exit_status);
766  }
767 }
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.cpp:141