Files | |
| file | gnc-gnome-utils.h |
| Gnome specific utility functions. | |
Functions | |
| void | gnc_gnome_init (int argc, char **argv, const char *version) |
| char * | gnc_gnome_locate_pixmap (const char *name) |
| char * | gnc_gnome_locate_data_file (const char *name) |
| char * | gnc_gnome_locate_ui_file (const char *name) |
| char * | gnc_gnome_locate_file (GnomeFileDomain domain, const char *name) |
| void | gnc_gnome_help (const char *file_name, const char *anchor) |
| GtkWidget * | gnc_gnome_get_pixmap (const char *name) |
| GdkPixbuf * | gnc_gnome_get_gdkpixbuf (const char *name) |
| void | gnc_shutdown (int exit_status) |
| void | gnc_gui_init_splash (void) |
| GncMainWindow * | gnc_gui_init (void) |
| int | gnc_ui_start_event_loop (void) |
| gboolean | gnucash_ui_is_running (void) |
| 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.
| name | The name of the pixbuf file to load. |
Definition at line 357 of file gnc-gnome-utils.c.
00358 { 00359 GdkPixbuf *pixbuf; 00360 GError *error = NULL; 00361 char *fullname; 00362 00363 g_return_val_if_fail (name != NULL, NULL); 00364 00365 fullname = gnc_gnome_locate_pixmap (name); 00366 if (fullname == NULL) 00367 return NULL; 00368 00369 DEBUG ("Loading pixbuf file %s", fullname); 00370 pixbuf = gdk_pixbuf_new_from_file (fullname, &error); 00371 if (error != NULL) { 00372 g_assert (pixbuf == NULL); 00373 PERR ("Could not load pixbuf: %s", error->message); 00374 g_error_free (error); 00375 } 00376 g_free (fullname); 00377 00378 return pixbuf; 00379 }
| 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.
| name | The name of the pixmap file to load. |
Definition at line 327 of file gnc-gnome-utils.c.
00328 { 00329 GtkWidget *pixmap; 00330 char *fullname; 00331 00332 g_return_val_if_fail (name != NULL, NULL); 00333 00334 fullname = gnc_gnome_locate_pixmap (name); 00335 if (fullname == NULL) 00336 return NULL; 00337 00338 DEBUG ("Loading pixmap file %s", fullname); 00339 00340 pixmap = gtk_image_new_from_file (fullname); 00341 if (pixmap == NULL) { 00342 PERR ("Could not load pixmap"); 00343 } 00344 g_free (fullname); 00345 00346 return pixmap; 00347 }
| void gnc_gnome_help | ( | const char * | file_name, | |
| const char * | anchor | |||
| ) |
Launch the default gnome help browser 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.
| file_name | The name of the help file. | |
| anchor | The anchor the help browser should scroll to.. |
Definition at line 269 of file gnc-gnome-utils.c.
00270 { 00271 GError *error = NULL; 00272 00273 DEBUG ("Attempting to opening help file %s", file_name); 00274 if (gnome_help_display (file_name, anchor, &error)) 00275 return; 00276 00277 g_assert(error != NULL); 00278 { 00279 const gchar *message = 00280 _("GnuCash could not find the files for the help documentation. " 00281 "This is likely because the 'gnucash-docs' package is not installed."); 00282 gnc_error_dialog(NULL, message); 00283 } 00284 PERR ("%s", error->message); 00285 g_error_free(error); 00286 }
| void gnc_gnome_init | ( | int | argc, | |
| char ** | argv, | |||
| const char * | version | |||
| ) |
Initialize the Gnome libraries.
Definition at line 197 of file gnc-gnome-utils.c.
00198 { 00199 GError *error = NULL; 00200 gchar *prefix = gnc_path_get_prefix (); 00201 gchar *pkgsysconfdir = gnc_path_get_pkgsysconfdir (); 00202 gchar *pkgdatadir = gnc_path_get_pkgdatadir (); 00203 gchar *pkglibdir = gnc_path_get_pkglibdir (); 00204 00205 gnc_gtk_add_rc_file(); 00206 gnucash_program = gnome_program_init( 00207 "gnucash", version, LIBGNOMEUI_MODULE, 00208 argc, argv, 00209 GNOME_PARAM_APP_PREFIX, prefix, 00210 GNOME_PARAM_APP_SYSCONFDIR, pkgsysconfdir, 00211 GNOME_PARAM_APP_DATADIR, pkgdatadir, 00212 GNOME_PARAM_APP_LIBDIR, pkglibdir, 00213 GNOME_PARAM_NONE); 00214 g_free (prefix); 00215 g_free (pkgsysconfdir); 00216 g_free (pkgdatadir); 00217 g_free (pkglibdir); 00218 00219 #ifdef G_OS_WIN32 00220 /* workaround for bug #421792 */ 00221 xmlCleanupInputCallbacks(); 00222 #endif 00223 00224 /* initialization required for gtkhtml */ 00225 gtk_widget_set_default_colormap (gdk_rgb_get_colormap ()); 00226 00227 /* use custom icon */ 00228 { 00229 int idx; 00230 char *icon_filenames[] = {"gnucash-icon-16x16.png", 00231 "gnucash-icon-32x32.png", 00232 "gnucash-icon-48x48.png", 00233 NULL}; 00234 GList *icons = NULL; 00235 char *fullname, *name_iter; 00236 00237 for (idx = 0; icon_filenames[idx] != NULL; idx++) { 00238 GdkPixbuf *buf = NULL; 00239 00240 fullname = gnc_gnome_locate_pixmap(icon_filenames[idx]); 00241 if (fullname == NULL) { 00242 g_warning("couldn't find icon file [%s]", icon_filenames[idx]); 00243 continue; 00244 } 00245 00246 buf = gnc_gnome_get_gdkpixbuf(fullname); 00247 if (buf == NULL) 00248 { 00249 g_warning("error loading image from [%s]", fullname); 00250 g_free(fullname); 00251 continue; 00252 } 00253 g_free(fullname); 00254 icons = g_list_append(icons, buf); 00255 } 00256 00257 gtk_window_set_default_icon_list(icons); 00258 g_list_foreach(icons, (GFunc)g_object_unref, NULL); 00259 g_list_free(icons); 00260 } 00261 00262 druid_gconf_install_check_schemas(); 00263 00264 return; 00265 }
| char* gnc_gnome_locate_data_file | ( | const char * | name | ) |
Given a file name, find the file in the directories associated with this application. This routine will display an error message if it can't find the file.
| name | The name of the file to be found. |
Definition at line 149 of file gnc-gnome-utils.c.
00150 { 00151 char *fullname; 00152 00153 g_return_val_if_fail (name != NULL, NULL); 00154 00155 fullname = gnome_program_locate_file (gnucash_program, 00156 GNOME_FILE_DOMAIN_APP_DATADIR, 00157 name, TRUE, NULL); 00158 00159 if (fullname == NULL) { 00160 PERR ("Could not locate file %s", name); 00161 return NULL; 00162 } 00163 00164 return fullname; 00165 }
| char* gnc_gnome_locate_file | ( | GnomeFileDomain | domain, | |
| const char * | name | |||
| ) |
Given a file name, find the file in the directories associated with the given file domain. This routine will display an error message if it can't find the file.
| doamin | The GnomeFileDomain, e.g. GNOME_FILE_DOMAIN_APP_HELP | |
| name | The name of the file to be found. |
Definition at line 136 of file gnc-gnome-utils.c.
00137 { 00138 char *fullname; 00139 00140 g_return_val_if_fail(name, NULL); 00141 fullname = gnome_program_locate_file(gnucash_program, 00142 domain, name, TRUE, NULL); 00143 if (!fullname) 00144 PERR ("Could not locate file %s", name); 00145 return fullname; 00146 }
| char* gnc_gnome_locate_pixmap | ( | const char * | name | ) |
Given a pixmap/pixbuf file name, find the file in the pixmap directory associated with this application. This routine will display an error message if it can't find the file.
| name | The name of the file to be found. |
Definition at line 118 of file gnc-gnome-utils.c.
00119 { 00120 char *fullname; 00121 00122 g_return_val_if_fail (name != NULL, NULL); 00123 00124 fullname = gnome_program_locate_file (gnucash_program, 00125 GNOME_FILE_DOMAIN_APP_PIXMAP, 00126 name, TRUE, NULL); 00127 if (fullname == NULL) { 00128 PERR ("Could not locate pixmap/pixbuf file %s", name); 00129 return NULL; 00130 } 00131 00132 return fullname; 00133 }
| char* gnc_gnome_locate_ui_file | ( | const char * | name | ) |
Given a file name, find the file in the directories associated with this application. This routine will display an error message if it can't find the file.
| name | The name of the file to be found. |
Definition at line 168 of file gnc-gnome-utils.c.
00169 { 00170 char *partial; 00171 char *fullname; 00172 00173 g_return_val_if_fail (name != NULL, NULL); 00174 00175 partial = g_strdup_printf("ui/%s", name); 00176 fullname = gnc_gnome_locate_data_file(partial); 00177 g_free(partial); 00178 00179 return fullname; 00180 }
| 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.
| exit_status | The exit status for the program. |
Definition at line 539 of file gnc-gnome-utils.c.
00540 { 00541 if (gnucash_ui_is_running()) { 00542 if (!gnome_is_terminating) { 00543 if (gnc_file_query_save(FALSE)) { 00544 gnc_hook_run(HOOK_UI_SHUTDOWN, NULL); 00545 gnc_gui_shutdown(); 00546 } 00547 } 00548 } else { 00549 gnc_gui_destroy(); 00550 gnc_hook_run(HOOK_SHUTDOWN, NULL); 00551 gnc_engine_shutdown(); 00552 exit(exit_status); 00553 } 00554 }
1.5.2