Commit 6766c9cd authored by Paolo Borelli's avatar Paolo Borelli Committed by Paolo Borelli

properly handle vararg in error path. handle error more correctly.

2009-03-01  Paolo Borelli  <pborelli@katamail.com>

	* gedit/gedit-utils.c: properly handle vararg in error path.
	* plugins/time/gedit-time-plugin.c: handle error more correctly.


svn path=/trunk/; revision=6928
parent a0e4ad1c
2009-03-01 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-utils.c: properly handle vararg in error path.
* plugins/time/gedit-time-plugin.c: handle error more correctly.
2009-03-01 Paolo Borelli <pborelli@katamail.com>
* configure.ac: add AC_SYS_LARGEFILE. Bug #571632.
......
......@@ -1016,8 +1016,7 @@ gedit_utils_is_valid_uri (const gchar *uri)
}
static GtkWidget *
handle_builder_error (const gchar *message,
...)
handle_builder_error (const gchar *message, ...)
{
GtkWidget *label;
gchar *msg;
......@@ -1025,16 +1024,18 @@ handle_builder_error (const gchar *message,
va_list args;
va_start (args, message);
va_arg (args, const gchar *);
msg_plain = g_strdup_vprintf (message, args);
va_end (args);
label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
msg = g_strconcat ("<span size=\"large\" weight=\"bold\">",
msg_plain, "</span>\n\n",
_("Please check your installation."), NULL);
label = gtk_label_new (msg);
msg_plain, "</span>\n\n",
_("Please check your installation."),
NULL);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_markup (GTK_LABEL (label), msg);
g_free (msg_plain);
g_free (msg);
......
......@@ -931,6 +931,10 @@ get_choose_format_dialog (GtkWindow *parent,
GtkWidget *error_widget;
gboolean ret;
gchar *sf, *cf;
GtkWindowGroup *wg = NULL;
if (parent != NULL)
wg = parent->group;
dialog = g_new0 (ChooseFormatDialog, 1);
......@@ -952,17 +956,39 @@ get_choose_format_dialog (GtkWindow *parent,
if (!ret)
{
const gchar *err_message;
GtkWidget *err_dialog;
err_dialog = gtk_dialog_new_with_buttons (NULL,
parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
NULL);
if (wg != NULL)
gtk_window_group_add_window (wg, GTK_WINDOW (err_dialog));
err_message = gtk_label_get_label (GTK_LABEL (error_widget));
gedit_warning (parent, "%s", err_message);
gtk_window_set_resizable (GTK_WINDOW (err_dialog), FALSE);
gtk_dialog_set_has_separator (GTK_DIALOG (err_dialog), FALSE);
gtk_dialog_set_default_response (GTK_DIALOG (err_dialog), GTK_RESPONSE_OK);
g_free (dialog);
gtk_widget_destroy (error_widget);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (err_dialog))),
error_widget);
g_signal_connect (G_OBJECT (err_dialog),
"response",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_widget_show_all (err_dialog);
return NULL;
}
gtk_window_group_add_window (wg,
GTK_WINDOW (dialog->dialog));
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), parent);
gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
sf = get_selected_format (plugin);
create_formats_list (dialog->list, sf, plugin);
g_free (sf);
......@@ -1113,32 +1139,23 @@ time_cb (GtkAction *action,
}
else
{
GtkWindowGroup *wg;
ChooseFormatDialog *dialog;
dialog = get_choose_format_dialog (GTK_WINDOW (data->window),
prompt_type,
data->plugin);
g_return_if_fail (dialog != NULL);
wg = gedit_window_get_group (data->window);
gtk_window_group_add_window (wg,
GTK_WINDOW (dialog->dialog));
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog),
GTK_WINDOW (data->window));
gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
dialog->buffer = buffer;
dialog->plugin = data->plugin;
if (dialog != NULL)
{
dialog->buffer = buffer;
dialog->plugin = data->plugin;
g_signal_connect (dialog->dialog,
"response",
G_CALLBACK (choose_format_dialog_response_cb),
dialog);
g_signal_connect (dialog->dialog,
"response",
G_CALLBACK (choose_format_dialog_response_cb),
dialog);
gtk_widget_show (GTK_WIDGET (dialog->dialog));
gtk_widget_show (GTK_WIDGET (dialog->dialog));
}
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment