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...
 
GncMainWindow * gnc_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 520 of file gnc-gnome-utils.c.

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

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

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

752 {
753  if (gnucash_ui_is_running())
754  {
755  if (!gnome_is_terminating)
756  {
757  if (gnc_file_query_save (gnc_ui_get_main_window (NULL), FALSE))
758  {
759  gnc_hook_run(HOOK_UI_SHUTDOWN, NULL);
760  gnc_gui_shutdown();
761  }
762  }
763  }
764  else
765  {
766  gnc_gui_destroy();
767  gnc_hook_run(HOOK_SHUTDOWN, NULL);
769  exit(exit_status);
770  }
771 }
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