summaryrefslogtreecommitdiff
path: root/capplets/accessibility/at-properties/main.c
diff options
context:
space:
mode:
authorJens Granseuer <jensgr@gmx.net>2007-02-08 19:45:59 +0000
committerJens Granseuer <jensg@src.gnome.org>2007-02-08 19:45:59 +0000
commitc76a7cc34955fe7721725b2f75c201bf4e8c9a65 (patch)
treeb3b908ee7f5ccaf6975c3ccfd7d3378903b984fc /capplets/accessibility/at-properties/main.c
parenta9b2d9ed9f0cf0a31643aa62f7eff1731a6ebc64 (diff)
downloadgnome-control-center-c76a7cc34955fe7721725b2f75c201bf4e8c9a65.tar.gz
fix some reference leaks and don't segfault if the glade file is not
2007-02-08 Jens Granseuer <jensgr@gmx.net> * main.c: (create_dialog), (main): fix some reference leaks and don't segfault if the glade file is not available svn path=/trunk/; revision=7264
Diffstat (limited to 'capplets/accessibility/at-properties/main.c')
-rw-r--r--capplets/accessibility/at-properties/main.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/capplets/accessibility/at-properties/main.c b/capplets/accessibility/at-properties/main.c
index 8eb1dd1b5..672e2ae83 100644
--- a/capplets/accessibility/at-properties/main.c
+++ b/capplets/accessibility/at-properties/main.c
@@ -72,18 +72,20 @@ static GladeXML *
create_dialog (void)
{
GladeXML *dialog;
-
+
dialog = glade_xml_new (GLADEDIR "/at-enable-dialog.glade", "at_properties_dialog", NULL);
-
- gtk_image_set_from_stock (GTK_IMAGE (WID ("at_close_and_logout_image")),
- GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
-
- gtk_image_set_from_file (GTK_IMAGE (WID ("at_enable_image")),
- PIXMAPDIR "/at-support.png");
-
- gtk_image_set_from_file (GTK_IMAGE (WID ("at_applications_image")),
- PIXMAPDIR "/at-startup.png");
-
+
+ if (dialog) {
+ gtk_image_set_from_stock (GTK_IMAGE (WID ("at_close_and_logout_image")),
+ GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
+
+ gtk_image_set_from_file (GTK_IMAGE (WID ("at_enable_image")),
+ PIXMAPDIR "/at-support.png");
+
+ gtk_image_set_from_file (GTK_IMAGE (WID ("at_applications_image")),
+ PIXMAPDIR "/at-startup.png");
+ }
+
return dialog;
}
@@ -271,26 +273,33 @@ setup_dialog (GladeXML *dialog)
int
main (int argc, char *argv[])
{
+ GnomeProgram *program;
GladeXML *dialog;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- gnome_program_init ("gnome-at-properties", VERSION,
- LIBGNOMEUI_MODULE, argc, argv,
- GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
- NULL);
+ program = gnome_program_init ("gnome-at-properties", VERSION,
+ LIBGNOMEUI_MODULE, argc, argv,
+ GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
+ NULL);
activate_settings_daemon ();
dialog = create_dialog ();
-
- init_startup_state (dialog);
-
- setup_dialog (dialog);
- gtk_main ();
-
+ if (dialog) {
+ init_startup_state (dialog);
+
+ setup_dialog (dialog);
+
+ gtk_main ();
+
+ g_object_unref (dialog);
+ }
+
+ g_object_unref (program);
+
return 0;
}