diff --git a/src/msm/server.c b/src/msm/server.c index 4a318587e..e564bc2a5 100644 --- a/src/msm/server.c +++ b/src/msm/server.c @@ -50,7 +50,7 @@ #include #include #include - +#include #include "server.h" #include "session.h" @@ -885,6 +885,8 @@ process_ice_messages (GIOChannel *channel, /* We were disconnected */ IceSetShutdownNegotiation (connection, False); IceCloseConnection (connection); + + return FALSE; } return TRUE; @@ -975,11 +977,11 @@ accept_connection (GIOChannel *channel, if (cstatus != IceConnectAccepted) { if (cstatus == IceConnectIOError) - msm_warning (_("IO error trying to accept new connection (client may have crashed trying to connect to the session manager, or client may be broken, or someone yanked the ethernet cable)")); + msm_warning (_("IO error trying to accept new connection (client may have crashed trying to connect to the session manager, or client may be broken, or someone yanked the ethernet cable)\n")); else - msm_warning (_("Rejecting new connection (some client was not allowed to connect to the session manager)")); + msm_warning (_("Rejecting new connection (some client was not allowed to connect to the session manager)\n")); - IceCloseConnection (cnxn); + /* IceCloseConnection (cnxn);*/ } return TRUE; @@ -1146,40 +1148,32 @@ create_auth_entries (MsmServer *server, int original_umask; int i; int fd = -1; - char *tmpl = NULL; - GError *err; IceAuthDataEntry *entries; original_umask = umask (0077); /* disallow non-owner access */ path = msm_get_work_directory (); - err = NULL; - tmpl = g_strconcat (path, "/msm-add-commands-XXXXXX", NULL); - fd = g_file_open_tmp (tmpl, &add_file, &err); - if (err) + add_file = g_strconcat (path, "/msm-add-commands-XXXXXX", NULL); + fd = g_mkstemp (add_file); + if (fd < 0) { - msm_fatal (_("Could not create ICE authentication script: %s\n"), - err->message); + msm_fatal (_("Could not create ICE authentication script '%s': %s\n"), + add_file, g_strerror (errno)); g_assert_not_reached (); return FALSE; } addfp = fdopen (fd, "w"); if (addfp == NULL) - goto bad; + goto bad; - g_free (tmpl); - tmpl = NULL; - - - err = NULL; - tmpl = g_strconcat (path, "/msm-remove-commands-XXXXXX", NULL); - fd = g_file_open_tmp (tmpl, &remove_file, &err); - if (err) + remove_file = g_strconcat (path, "/msm-remove-commands-XXXXXX", NULL); + fd = g_mkstemp (remove_file); + if (fd < 0) { - msm_fatal (_("Could not create ICE authentication script: %s\n"), - err->message); + msm_fatal (_("Could not create ICE authentication script '%s': %s\n"), + remove_file, g_strerror (errno)); g_assert_not_reached (); return FALSE; } @@ -1188,9 +1182,6 @@ create_auth_entries (MsmServer *server, if (removefp == NULL) goto bad; - g_free (tmpl); - tmpl = NULL; - server->n_auth_entries = n_listen_objs * 2; server->auth_entries = g_new (IceAuthDataEntry, server->n_auth_entries); entries = server->auth_entries; @@ -1236,9 +1227,6 @@ create_auth_entries (MsmServer *server, return TRUE; bad: - - if (tmpl) - g_free (tmpl); if (addfp) fclose (addfp); diff --git a/src/msm/session.c b/src/msm/session.c index 9bf995f0d..e535edd17 100644 --- a/src/msm/session.c +++ b/src/msm/session.c @@ -197,10 +197,13 @@ msm_session_get_for_filename (const char *name, int fd = -1; GError *dir_error = NULL; GError *err; - - session = g_hash_table_lookup (sessions, filename); - if (session) - return session; + + if (sessions) + { + session = g_hash_table_lookup (sessions, filename); + if (session) + return session; + } session = g_new0 (MsmSession, 1); session->name = g_strdup (name); @@ -228,7 +231,7 @@ msm_session_get_for_filename (const char *name, * for users than the usual issues one worries about when locking. */ - fd = open (session->full_filename, O_RDWR | O_CREAT | O_EXCL, 0700); + fd = open (session->full_filename, O_RDWR | O_CREAT, 0700); if (fd < 0) { @@ -301,11 +304,11 @@ msm_session_get_for_filename (const char *name, return session; } - if (session->clients == NULL) + if (FALSE && session->clients == NULL) { session = recover_failed_session (session, MSM_SESSION_FAILURE_EMPTY, - _("Session doesn't contain any applications")); + NULL); return session; } @@ -544,8 +547,54 @@ static void add_details_to_dialog (GtkDialog *dialog, const char *details) { + GtkWidget *hbox; + GtkWidget *button; + GtkWidget *label; + GtkRequisition req; + hbox = gtk_hbox_new (FALSE, 0); + + gtk_container_set_border_width (GTK_CONTAINER (hbox), 10); + gtk_box_pack_start (GTK_BOX (dialog->vbox), + hbox, + FALSE, FALSE, 0); + + button = gtk_button_new_with_mnemonic (_("_Details")); + + gtk_box_pack_end (GTK_BOX (hbox), button, + FALSE, FALSE, 0); + + label = gtk_label_new (details); + + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + + gtk_box_pack_start (GTK_BOX (hbox), label, + TRUE, TRUE, 0); + + /* show the label on click */ + g_signal_connect_swapped (G_OBJECT (button), + "clicked", + G_CALLBACK (gtk_widget_show), + label); + + /* second callback destroys the button (note disconnects first callback) */ + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (gtk_widget_destroy), + NULL); + + /* Set default dialog size to size with the label, + * and without the button, but then rehide the label + */ + gtk_widget_show_all (hbox); + + gtk_widget_size_request (GTK_WIDGET (dialog), &req); +#if 0 + /* Omitted for now because it triggers a GTK 1.3.7 bug */ + gtk_window_set_default_size (GTK_WINDOW (dialog), req.width, req.height); +#endif + + gtk_widget_hide (label); } static MsmSession* @@ -611,7 +660,8 @@ recover_failed_session (MsmSession *session, message); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); - add_details_to_dialog (GTK_DIALOG (dialog), details); + if (details) + add_details_to_dialog (GTK_DIALOG (dialog), details); g_free (message);