mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 00:30:09 +01:00
tui: rename nmt_newt_error_dialog() to nmt_newt_message_dialog()
This commit is contained in:
parent
eb9cd6da08
commit
c1017d04df
7 changed files with 28 additions and 31 deletions
|
|
@ -146,18 +146,16 @@ nmt_newt_finished (void)
|
|||
}
|
||||
|
||||
/**
|
||||
* nmt_newt_error_dialog:
|
||||
* nmt_newt_message_dialog:
|
||||
* @message: a printf()-style message format
|
||||
* @...: arguments
|
||||
*
|
||||
* Displays the given message in a dialog box with a single "OK"
|
||||
* button, and returns after the user clicks "OK".
|
||||
*
|
||||
* FIXME: it's not just for errors any more!
|
||||
*/
|
||||
void
|
||||
nmt_newt_error_dialog (const char *message,
|
||||
...)
|
||||
nmt_newt_message_dialog (const char *message,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
char *msg, *msg_lc, *ok_lc;
|
||||
|
|
@ -284,7 +282,7 @@ nmt_newt_edit_string (const char *data)
|
|||
|
||||
fd = g_file_open_tmp ("XXXXXX.json", &filename, &error);
|
||||
if (fd == -1) {
|
||||
nmt_newt_error_dialog (_("Could not create temporary file: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Could not create temporary file: %s"), error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -316,19 +314,19 @@ nmt_newt_edit_string (const char *data)
|
|||
newtResume ();
|
||||
|
||||
if (error) {
|
||||
nmt_newt_error_dialog (_("Could not create temporary file: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Could not create temporary file: %s"), error->message);
|
||||
g_error_free (error);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!g_spawn_check_exit_status (status, &error)) {
|
||||
nmt_newt_error_dialog (_("Editor failed: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Editor failed: %s"), error->message);
|
||||
g_error_free (error);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!g_file_get_contents (filename, &new_data, NULL, &error)) {
|
||||
nmt_newt_error_dialog (_("Could not re-read file: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Could not re-read file: %s"), error->message);
|
||||
g_error_free (error);
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ typedef enum {
|
|||
char *nmt_newt_locale_to_utf8 (const char *str_lc);
|
||||
char *nmt_newt_locale_from_utf8 (const char *str_utf8);
|
||||
|
||||
void nmt_newt_error_dialog (const char *message,
|
||||
...);
|
||||
void nmt_newt_message_dialog (const char *message,
|
||||
...);
|
||||
int nmt_newt_choice_dialog (const char *button1,
|
||||
const char *button2,
|
||||
const char *message,
|
||||
|
|
|
|||
|
|
@ -702,7 +702,7 @@ nmt_connect_connection_list_activated (NmtNewtWidget *widget)
|
|||
activate_nmt_connection_async (NMT_CONNECT_CONNECTION_LIST (widget), nmtconn,
|
||||
activate_complete, &op);
|
||||
if (!nmt_sync_op_wait_boolean (&op, &error)) {
|
||||
nmt_newt_error_dialog (_("Could not activate connection: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Could not activate connection: %s"), error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,12 +78,12 @@ nmt_editor_new (NMConnection *connection)
|
|||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
if (s_con) {
|
||||
nmt_newt_error_dialog (_("Could not create editor for connection '%s' of type '%s'."),
|
||||
nm_connection_get_id (connection),
|
||||
nm_setting_connection_get_connection_type (s_con));
|
||||
nmt_newt_message_dialog (_("Could not create editor for connection '%s' of type '%s'."),
|
||||
nm_connection_get_id (connection),
|
||||
nm_setting_connection_get_connection_type (s_con));
|
||||
} else {
|
||||
nmt_newt_error_dialog (_("Could not create editor for invalid connection '%s'."),
|
||||
nm_connection_get_id (connection));
|
||||
nmt_newt_message_dialog (_("Could not create editor for invalid connection '%s'."),
|
||||
nm_connection_get_id (connection));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
@ -131,7 +131,7 @@ save_connection_and_exit (NmtNewtButton *button,
|
|||
if (!nm_connection_replace_settings_from_connection (priv->orig_connection,
|
||||
priv->edit_connection,
|
||||
&error)) {
|
||||
nmt_newt_error_dialog (_("Error saving connection: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Error saving connection: %s"), error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
|
@ -141,8 +141,8 @@ save_connection_and_exit (NmtNewtButton *button,
|
|||
nm_remote_connection_commit_changes (NM_REMOTE_CONNECTION (priv->orig_connection),
|
||||
connection_updated, &op);
|
||||
if (!nmt_sync_op_wait_boolean (&op, &error)) {
|
||||
nmt_newt_error_dialog (_("Unable to save connection: %s"),
|
||||
error->message);
|
||||
nmt_newt_message_dialog (_("Unable to save connection: %s"),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
|
@ -155,8 +155,8 @@ save_connection_and_exit (NmtNewtButton *button,
|
|||
nm_remote_settings_add_connection (nm_settings, priv->orig_connection,
|
||||
connection_added, &op);
|
||||
if (!nmt_sync_op_wait_boolean (&op, &error)) {
|
||||
nmt_newt_error_dialog (_("Unable to add new connection: %s"),
|
||||
error->message);
|
||||
nmt_newt_message_dialog (_("Unable to add new connection: %s"),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ nmt_connect_connection (const char *identifier)
|
|||
nmt_connect_connection_list_activate_async (NMT_CONNECT_CONNECTION_LIST (list), identifier,
|
||||
connect_complete, &op);
|
||||
if (!nmt_sync_op_wait_boolean (&op, &error)) {
|
||||
nmt_newt_error_dialog (_("Could not activate connection: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Could not activate connection: %s"), error->message);
|
||||
g_error_free (error);
|
||||
nmtui_quit ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -440,9 +440,8 @@ connection_deleted_callback (NMRemoteConnection *connection,
|
|||
ConnectionDeleteData *data = user_data;
|
||||
|
||||
if (error) {
|
||||
nmt_newt_error_dialog (_("OK"),
|
||||
_("Unable to delete connection: %s"),
|
||||
error->message);
|
||||
nmt_newt_message_dialog (_("Unable to delete connection: %s"),
|
||||
error->message);
|
||||
} else
|
||||
data->got_callback = TRUE;
|
||||
|
||||
|
|
@ -484,8 +483,8 @@ nmt_remove_connection (NMRemoteConnection *connection)
|
|||
nm_remote_connection_delete (connection, connection_deleted_callback, &data);
|
||||
|
||||
if (!nmt_sync_op_wait_boolean (&data.op, &error)) {
|
||||
nmt_newt_error_dialog (_("Could not delete connection: %s"),
|
||||
error->message);
|
||||
nmt_newt_message_dialog (_("Could not delete connection: %s"),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
|
@ -517,7 +516,7 @@ nmtui_edit (int argc, char **argv)
|
|||
}
|
||||
|
||||
if (!conn) {
|
||||
nmt_newt_error_dialog ("%s: no such connection '%s'\n", argv[0], argv[1]);
|
||||
nmt_newt_message_dialog ("%s: no such connection '%s'\n", argv[0], argv[1]);
|
||||
nmtui_quit ();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ nmtui_hostname (int argc, char **argv)
|
|||
nm_remote_settings_save_hostname (nm_settings, hostname, hostname_set, &op);
|
||||
if (nmt_sync_op_wait_boolean (&op, &error)) {
|
||||
/* Translators: this indicates the result. ie, "I have set the hostname to ..." */
|
||||
nmt_newt_error_dialog (_("Set hostname to '%s'"), hostname);
|
||||
nmt_newt_message_dialog (_("Set hostname to '%s'"), hostname);
|
||||
} else {
|
||||
nmt_newt_error_dialog (_("Unable to set hostname: %s"), error->message);
|
||||
nmt_newt_message_dialog (_("Unable to set hostname: %s"), error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue