message-area: Rename message area to info bar

Lets call it what it is
This commit is contained in:
JosephMcc 2017-02-05 01:41:46 -08:00
parent 2aa009cb76
commit 42bb35d41f
10 changed files with 651 additions and 669 deletions

View File

@ -42,7 +42,7 @@ CFILE_GLOB=$(top_srcdir)/xed/*.c
IGNORE_HFILES= \
xed-commands.h \
xed-documents-panel.h \
xed-io-error-message-area.h \
xed-io-error-info-bar.h \
xed-languages-manager.h \
xed-plugins-engine.h \
xed-session.h \

View File

@ -45,7 +45,7 @@ NOINST_H_FILES = \
xed-dirs.h \
xed-documents-panel.h \
xed-history-entry.h \
xed-io-error-message-area.h \
xed-io-error-info-bar.h \
xed-plugins-engine.h \
xed-print-job.h \
xed-print-preview.h \
@ -70,7 +70,7 @@ INST_H_FILES = \
xed-message.h \
xed-notebook.h \
xed-panel.h \
xed-progress-message-area.h \
xed-progress-info-bar.h \
xed-searchbar.h \
xed-statusbar.h \
xed-tab.h \
@ -107,7 +107,7 @@ libxed_c_files = \
xed-encodings-combo-box.c \
xed-file-chooser-dialog.c \
xed-history-entry.c \
xed-io-error-message-area.c \
xed-io-error-info-bar.c \
xed-message-bus.c \
xed-message-type.c \
xed-message.c \
@ -116,7 +116,7 @@ libxed_c_files = \
xed-plugins-engine.c \
xed-print-job.c \
xed-print-preview.c \
xed-progress-message-area.c \
xed-progress-info-bar.c \
xed-settings.c \
xed-searchbar.c \
xed-statusbar.c \

View File

@ -1,5 +1,5 @@
/*
* xed-io-error-message-area.c
* xed-io-error-info-bar.c
* This file is part of xed
*
* Copyright (C) 2005 - Paolo Maggi
@ -45,7 +45,7 @@
#include "xed-settings.h"
#include "xed-utils.h"
#include "xed-document.h"
#include "xed-io-error-message-area.h"
#include "xed-io-error-info-bar.h"
#include <xed/xed-encodings-combo-box.h>
#define MAX_URI_IN_DIALOG_LENGTH 50
@ -91,7 +91,7 @@ set_contents (GtkWidget *area,
}
static void
info_bar_add_button_with_text (GtkInfoBar *infobar,
info_bar_add_button_with_text (GtkInfoBar *info_bar,
const gchar *text,
const gchar *icon_name,
gint response_id)
@ -99,16 +99,16 @@ info_bar_add_button_with_text (GtkInfoBar *infobar,
GtkWidget *button;
GtkWidget *image;
button = gtk_info_bar_add_button (infobar, text, response_id);
button = gtk_info_bar_add_button (info_bar, text, response_id);
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (button), image);
}
static void
set_message_area_text_and_icon (GtkWidget *message_area,
const gchar *icon_name,
const gchar *primary_text,
const gchar *secondary_text)
set_info_bar_text_and_icon (GtkWidget *info_bar,
const gchar *icon_name,
const gchar *primary_text,
const gchar *secondary_text)
{
GtkWidget *hbox_content;
GtkWidget *image;
@ -152,28 +152,28 @@ set_message_area_text_and_icon (GtkWidget *message_area,
}
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);
set_contents (info_bar, hbox_content);
}
static GtkWidget *
create_io_loading_error_message_area (const gchar *primary_text,
const gchar *secondary_text,
gboolean recoverable_error)
create_io_loading_error_info_bar (const gchar *primary_text,
const gchar *secondary_text,
gboolean recoverable_error)
{
GtkWidget *message_area;
GtkWidget *info_bar;
message_area = gtk_info_bar_new_with_buttons (_("_Cancel"), GTK_RESPONSE_CANCEL, NULL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_ERROR);
info_bar = gtk_info_bar_new_with_buttons (_("_Cancel"), GTK_RESPONSE_CANCEL, NULL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_ERROR);
set_message_area_text_and_icon (message_area, "dialog-error-symbolic", primary_text, secondary_text);
set_info_bar_text_and_icon (info_bar, "dialog-error-symbolic", primary_text, secondary_text);
if (recoverable_error)
{
info_bar_add_button_with_text (GTK_INFO_BAR (message_area), _("_Retry"),
info_bar_add_button_with_text (GTK_INFO_BAR (info_bar), _("_Retry"),
"view-refresh-symbolic", GTK_RESPONSE_OK);
}
return message_area;
return info_bar;
}
static gboolean
@ -314,15 +314,15 @@ parse_error (const GError *error,
}
GtkWidget *
xed_unrecoverable_reverting_error_message_area_new (GFile *location,
const GError *error)
xed_unrecoverable_reverting_error_info_bar_new (GFile *location,
const GError *error)
{
gchar *error_message = NULL;
gchar *message_details = NULL;
gchar *full_formatted_uri;
gchar *uri_for_display;
gchar *temp_uri_for_display;
GtkWidget *message_area;
GtkWidget *info_bar;
g_return_val_if_fail (G_IS_FILE (location), NULL);
g_return_val_if_fail (error != NULL, NULL);
@ -355,17 +355,17 @@ xed_unrecoverable_reverting_error_message_area_new (GFile *location,
error_message = g_strdup_printf (_("Could not revert the file %s."), uri_for_display);
}
message_area = create_io_loading_error_message_area (error_message, message_details, FALSE);
info_bar = create_io_loading_error_info_bar (error_message, message_details, FALSE);
g_free (uri_for_display);
g_free (error_message);
g_free (message_details);
return message_area;
return info_bar;
}
static void
create_combo_box (GtkWidget *message_area,
create_combo_box (GtkWidget *info_bar,
GtkWidget *vbox)
{
GtkWidget *hbox;
@ -380,7 +380,7 @@ create_combo_box (GtkWidget *message_area,
g_free (label_markup);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
menu = xed_encodings_combo_box_new (TRUE);
g_object_set_data (G_OBJECT (message_area), "xed-message-area-encoding-menu", menu);
g_object_set_data (G_OBJECT (info_bar), "xed-info-bar-encoding-menu", menu);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@ -391,11 +391,11 @@ create_combo_box (GtkWidget *message_area,
}
static GtkWidget *
create_conversion_error_message_area (const gchar *primary_text,
const gchar *secondary_text,
gboolean edit_anyway)
create_conversion_error_info_bar (const gchar *primary_text,
const gchar *secondary_text,
gboolean edit_anyway)
{
GtkWidget *message_area;
GtkWidget *info_bar;
GtkWidget *hbox_content;
GtkWidget *image;
GtkWidget *vbox;
@ -404,26 +404,26 @@ create_conversion_error_message_area (const gchar *primary_text,
GtkWidget *primary_label;
GtkWidget *secondary_label;
message_area = gtk_info_bar_new ();
info_bar = gtk_info_bar_new ();
info_bar_add_button_with_text (GTK_INFO_BAR (message_area), _("_Retry"),
info_bar_add_button_with_text (GTK_INFO_BAR (info_bar), _("_Retry"),
"edit-redo-symbolic", GTK_RESPONSE_OK);
if (edit_anyway)
{
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
/* Translators: the access key chosen for this string should be
different from other main menu access keys (Open, Edit, View...) */
_("Edit Any_way"),
GTK_RESPONSE_YES);
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_WARNING);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
}
else
{
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_ERROR);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_ERROR);
}
gtk_info_bar_add_button (GTK_INFO_BAR (message_area), _("_Cancel"), GTK_RESPONSE_CANCEL);
gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Cancel"), GTK_RESPONSE_CANCEL);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
@ -458,24 +458,24 @@ create_conversion_error_message_area (const gchar *primary_text,
gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
}
create_combo_box (message_area, vbox);
create_combo_box (info_bar, vbox);
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);
set_contents (info_bar, hbox_content);
return message_area;
return info_bar;
}
GtkWidget *
xed_io_loading_error_message_area_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error)
xed_io_loading_error_info_bar_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error)
{
gchar *error_message = NULL;
gchar *message_details = NULL;
gchar *full_formatted_uri;
gchar *uri_for_display;
gchar *temp_uri_for_display;
GtkWidget *message_area;
GtkWidget *info_bar;
gboolean edit_anyway = FALSE;
gboolean convert_error = FALSE;
@ -559,26 +559,24 @@ xed_io_loading_error_message_area_new (GFile *location,
if (convert_error)
{
message_area = create_conversion_error_message_area (error_message, message_details, edit_anyway);
info_bar = create_conversion_error_info_bar (error_message, message_details, edit_anyway);
}
else
{
message_area = create_io_loading_error_message_area (error_message,
message_details,
is_recoverable_error (error));
info_bar = create_io_loading_error_info_bar (error_message, message_details, is_recoverable_error (error));
}
g_free (uri_for_display);
g_free (error_message);
g_free (message_details);
return message_area;
return info_bar;
}
GtkWidget *
xed_conversion_error_while_saving_message_area_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error)
xed_conversion_error_while_saving_info_bar_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error)
{
gchar *error_message = NULL;
gchar *message_details = NULL;
@ -586,7 +584,7 @@ xed_conversion_error_while_saving_message_area_new (GFile *loc
gchar *encoding_name;
gchar *uri_for_display;
gchar *temp_uri_for_display;
GtkWidget *message_area;
GtkWidget *info_bar;
g_return_val_if_fail (G_IS_FILE (location), NULL);
g_return_val_if_fail (error != NULL, NULL);
@ -615,33 +613,33 @@ xed_conversion_error_while_saving_message_area_new (GFile *loc
"using the specified character encoding."), "\n",
_("Select a different character encoding from the menu and try again."), NULL);
message_area = create_conversion_error_message_area (error_message, message_details, FALSE);
info_bar = create_conversion_error_info_bar (error_message, message_details, FALSE);
g_free (uri_for_display);
g_free (encoding_name);
g_free (error_message);
g_free (message_details);
return message_area;
return info_bar;
}
const GtkSourceEncoding *
xed_conversion_error_message_area_get_encoding (GtkWidget *message_area)
xed_conversion_error_info_bar_get_encoding (GtkWidget *info_bar)
{
gpointer menu;
g_return_val_if_fail (GTK_IS_INFO_BAR (message_area), NULL);
g_return_val_if_fail (GTK_IS_INFO_BAR (info_bar), NULL);
menu = g_object_get_data (G_OBJECT (message_area), "xed-message-area-encoding-menu");
menu = g_object_get_data (G_OBJECT (info_bar), "xed-info-bar-encoding-menu");
g_return_val_if_fail (menu, NULL);
return xed_encodings_combo_box_get_selected_encoding (XED_ENCODINGS_COMBO_BOX (menu));
}
GtkWidget *
xed_file_already_open_warning_message_area_new (GFile *location)
xed_file_already_open_warning_info_bar_new (GFile *location)
{
GtkWidget *message_area;
GtkWidget *info_bar;
GtkWidget *hbox_content;
GtkWidget *image;
GtkWidget *vbox;
@ -669,18 +667,18 @@ xed_file_already_open_warning_message_area_new (GFile *location)
uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display);
g_free (temp_uri_for_display);
message_area = gtk_info_bar_new ();
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
info_bar = gtk_info_bar_new ();
gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
/* Translators: the access key chosen for this string should be
different from other main menu access keys (Open, Edit, View...) */
_("Edit Any_way"),
GTK_RESPONSE_YES);
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
/* Translators: the access key chosen for this string should be
different from other main menu access keys (Open, Edit, View...) */
_("D_on't Edit"),
GTK_RESPONSE_CANCEL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_WARNING);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
@ -719,16 +717,16 @@ xed_file_already_open_warning_message_area_new (GFile *location)
gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);
set_contents (info_bar, hbox_content);
return message_area;
return info_bar;
}
GtkWidget *
xed_externally_modified_saving_error_message_area_new (GFile *location,
const GError *error)
xed_externally_modified_saving_error_info_bar_new (GFile *location,
const GError *error)
{
GtkWidget *message_area;
GtkWidget *info_bar;
GtkWidget *hbox_content;
GtkWidget *image;
GtkWidget *vbox;
@ -759,12 +757,12 @@ xed_externally_modified_saving_error_message_area_new (GFile *location,
uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display);
g_free (temp_uri_for_display);
message_area = gtk_info_bar_new ();
info_bar = gtk_info_bar_new ();
info_bar_add_button_with_text (GTK_INFO_BAR (message_area), _("S_ave Anyway"),
info_bar_add_button_with_text (GTK_INFO_BAR (info_bar), _("S_ave Anyway"),
"document-save-symbolic", GTK_RESPONSE_YES);
gtk_info_bar_add_button (GTK_INFO_BAR (message_area), _("D_on't Save"), GTK_RESPONSE_CANCEL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_WARNING);
gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("D_on't Save"), GTK_RESPONSE_CANCEL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
@ -776,9 +774,10 @@ xed_externally_modified_saving_error_message_area_new (GFile *location,
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
// FIXME: review this message, it's not clear since for the user the "modification"
// could be interpreted as the changes he made in the document. beside "reading" is
// not accurate (since last load/save)
/* FIXME: review this message, it's not clear since for the user the "modification"
* could be interpreted as the changes he made in the document. beside "reading" is
* not accurate (since last load/save)
*/
primary_text = g_strdup_printf (_("The file %s has been modified since reading it."), uri_for_display);
g_free (uri_for_display);
@ -805,16 +804,16 @@ xed_externally_modified_saving_error_message_area_new (GFile *location,
gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);
set_contents (info_bar, hbox_content);
return message_area;
return info_bar;
}
GtkWidget *
xed_no_backup_saving_error_message_area_new (GFile *location,
const GError *error)
xed_no_backup_saving_error_info_bar_new (GFile *location,
const GError *error)
{
GtkWidget *message_area;
GtkWidget *info_bar;
GtkWidget *hbox_content;
GtkWidget *image;
GtkWidget *vbox;
@ -847,12 +846,12 @@ xed_no_backup_saving_error_message_area_new (GFile *location,
uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display);
g_free (temp_uri_for_display);
message_area = gtk_info_bar_new ();
info_bar = gtk_info_bar_new ();
info_bar_add_button_with_text (GTK_INFO_BAR (message_area), _("S_ave Anyway"),
info_bar_add_button_with_text (GTK_INFO_BAR (info_bar), _("S_ave Anyway"),
"document-save-symbolic", GTK_RESPONSE_YES);
gtk_info_bar_add_button (GTK_INFO_BAR (message_area), _("D_on't Save"), GTK_RESPONSE_CANCEL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_WARNING);
gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("D_on't Save"), GTK_RESPONSE_CANCEL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
@ -905,14 +904,14 @@ xed_no_backup_saving_error_message_area_new (GFile *location,
gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);
set_contents (info_bar, hbox_content);
return message_area;
return info_bar;
}
GtkWidget *
xed_unrecoverable_saving_error_message_area_new (GFile *location,
const GError *error)
xed_unrecoverable_saving_error_info_bar_new (GFile *location,
const GError *error)
{
gchar *error_message = NULL;
gchar *message_details = NULL;
@ -921,7 +920,7 @@ xed_unrecoverable_saving_error_message_area_new (GFile *location,
gchar *scheme_markup;
gchar *uri_for_display;
gchar *temp_uri_for_display;
GtkWidget *message_area;
GtkWidget *info_bar;
g_return_val_if_fail (G_IS_FILE (location), NULL);
g_return_val_if_fail (error != NULL, NULL);
@ -1019,25 +1018,25 @@ xed_unrecoverable_saving_error_message_area_new (GFile *location,
error_message = g_strdup_printf (_("Could not save the file %s."), uri_for_display);
}
message_area = create_io_loading_error_message_area (error_message, message_details, FALSE);
info_bar = create_io_loading_error_info_bar (error_message, message_details, FALSE);
g_free (uri_for_display);
g_free (error_message);
g_free (message_details);
return message_area;
return info_bar;
}
GtkWidget *
xed_externally_modified_message_area_new (GFile *location,
gboolean document_modified)
xed_externally_modified_info_bar_new (GFile *location,
gboolean document_modified)
{
gchar *full_formatted_uri;
gchar *uri_for_display;
gchar *temp_uri_for_display;
const gchar *primary_text;
const gchar *secondary_text;
GtkWidget *message_area;
GtkWidget *info_bar;
g_return_val_if_fail (G_IS_FILE (location), NULL);
@ -1068,20 +1067,20 @@ xed_externally_modified_message_area_new (GFile *location,
secondary_text = _("Do you want to reload the file?");
}
message_area = gtk_info_bar_new ();
info_bar = gtk_info_bar_new ();
info_bar_add_button_with_text (GTK_INFO_BAR (message_area), _("_Reload"),
info_bar_add_button_with_text (GTK_INFO_BAR (info_bar), _("_Reload"),
"view-refresh-symbolic", GTK_RESPONSE_OK);
gtk_info_bar_add_button (GTK_INFO_BAR (message_area), _("_Cancel"), GTK_RESPONSE_CANCEL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_WARNING);
gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), _("_Cancel"), GTK_RESPONSE_CANCEL);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
set_message_area_text_and_icon (message_area, "dialog-warning-symbolic", primary_text, secondary_text);
set_info_bar_text_and_icon (info_bar, "dialog-warning-symbolic", primary_text, secondary_text);
return message_area;
return info_bar;
}
GtkWidget *
xed_invalid_character_message_area_new (GFile *location)
xed_invalid_character_info_bar_new (GFile *location)
{
GtkWidget *info_bar;
GtkWidget *hbox_content;

View File

@ -0,0 +1,69 @@
/*
* xed-io-error-info-bar.h
* This file is part of xed
*
* Copyright (C) 2005 - Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Modified by the xed Team, 2005. See the AUTHORS file for a
* list of people on the xed Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
#ifndef __XED_IO_ERROR_INFO_BAR_H__
#define __XED_IO_ERROR_INFO_BAR_H__
#include <gtksourceview/gtksource.h>
G_BEGIN_DECLS
GtkWidget *xed_io_loading_error_info_bar_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error);
GtkWidget *xed_unrecoverable_reverting_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *xed_conversion_error_while_saving_info_bar_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error);
const GtkSourceEncoding *xed_conversion_error_info_bar_get_encoding (GtkWidget *info_bar);
GtkWidget *xed_file_already_open_warning_info_bar_new (GFile *location);
GtkWidget *xed_externally_modified_saving_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *xed_no_backup_saving_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *xed_unrecoverable_saving_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *xed_externally_modified_info_bar_new (GFile *location,
gboolean document_modified);
GtkWidget *xed_invalid_character_info_bar_new (GFile *location);
G_END_DECLS
#endif /* __XED_IO_ERROR_INFO_BAR_H__ */

View File

@ -1,70 +0,0 @@
/*
* xed-io-error-message-area.h
* This file is part of xed
*
* Copyright (C) 2005 - Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Modified by the xed Team, 2005. See the AUTHORS file for a
* list of people on the xed Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
#ifndef __XED_IO_ERROR_MESSAGE_AREA_H__
#define __XED_IO_ERROR_MESSAGE_AREA_H__
#include <gtksourceview/gtksource.h>
G_BEGIN_DECLS
GtkWidget *xed_io_loading_error_message_area_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error);
GtkWidget *xed_unrecoverable_reverting_error_message_area_new (GFile *location,
const GError *error);
GtkWidget *xed_conversion_error_while_saving_message_area_new (GFile *location,
const GtkSourceEncoding *encoding,
const GError *error);
const GtkSourceEncoding
*xed_conversion_error_message_area_get_encoding (GtkWidget *message_area);
GtkWidget *xed_file_already_open_warning_message_area_new (GFile *location);
GtkWidget *xed_externally_modified_saving_error_message_area_new (GFile *location,
const GError *error);
GtkWidget *xed_no_backup_saving_error_message_area_new (GFile *location,
const GError *error);
GtkWidget *xed_unrecoverable_saving_error_message_area_new (GFile *location,
const GError *error);
GtkWidget *xed_externally_modified_message_area_new (GFile *location,
gboolean document_modified);
GtkWidget *xed_invalid_character_message_area_new (GFile *location);
G_END_DECLS
#endif /* __XED_IO_ERROR_MESSAGE_AREA_H__ */

232
xed/xed-progress-info-bar.c Normal file
View File

@ -0,0 +1,232 @@
/*
* xed-progress-message-area.c
* This file is part of xed
*
* Copyright (C) 2005 - Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Modified by the xed Team, 2005. See the AUTHORS file for a
* list of people on the xed Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
/* TODO: add properties */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include "xed-progress-info-bar.h"
enum
{
PROP_0,
PROP_HAS_CANCEL_BUTTON
};
#define XED_PROGRESS_INFO_BAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_PROGRESS_INFO_BAR, XedProgressInfoBarPrivate))
struct _XedProgressInfoBarPrivate
{
GtkWidget *image;
GtkWidget *label;
GtkWidget *progress;
};
G_DEFINE_TYPE(XedProgressInfoBar, xed_progress_info_bar, GTK_TYPE_INFO_BAR)
static void
xed_progress_info_bar_set_has_cancel_button (XedProgressInfoBar *bar,
gboolean has_button)
{
if (has_button)
{
gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("Cancel"), GTK_RESPONSE_CANCEL);
}
g_object_notify (G_OBJECT (bar), "has-cancel-button");
}
static void
xed_progress_info_bar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
XedProgressInfoBar *bar;
bar = XED_PROGRESS_INFO_BAR (object);
switch (prop_id)
{
case PROP_HAS_CANCEL_BUTTON:
xed_progress_info_bar_set_has_cancel_button (bar, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xed_progress_info_bar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xed_progress_info_bar_class_init (XedProgressInfoBarClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = xed_progress_info_bar_set_property;
gobject_class->get_property = xed_progress_info_bar_get_property;
g_object_class_install_property (gobject_class,
PROP_HAS_CANCEL_BUTTON,
g_param_spec_boolean ("has-cancel-button",
"Has Cancel Button",
"If the message area has a cancel button",
TRUE,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private (gobject_class, sizeof (XedProgressInfoBarPrivate));
}
static void
xed_progress_info_bar_init (XedProgressInfoBar *bar)
{
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *content;
bar->priv = XED_PROGRESS_INFO_BAR_GET_PRIVATE (bar);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
bar->priv->image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show (bar->priv->image);
gtk_widget_set_halign (bar->priv->image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (bar->priv->image, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (hbox), bar->priv->image, FALSE, FALSE, 4);
bar->priv->label = gtk_label_new ("");
gtk_widget_show (bar->priv->label);
gtk_box_pack_start (GTK_BOX (hbox), bar->priv->label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (bar->priv->label), TRUE);
gtk_widget_set_halign (bar->priv->label, GTK_ALIGN_START);
gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_END);
bar->priv->progress = gtk_progress_bar_new ();
gtk_widget_show (bar->priv->progress);
gtk_box_pack_start (GTK_BOX (vbox), bar->priv->progress, TRUE, FALSE, 0);
gtk_widget_set_size_request (bar->priv->progress, -1, 15);
content = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar));
gtk_container_add (GTK_CONTAINER (content), vbox);
}
GtkWidget *
xed_progress_info_bar_new (const gchar *icon_name,
const gchar *markup,
gboolean has_cancel)
{
XedProgressInfoBar *bar;
g_return_val_if_fail (icon_name != NULL, NULL);
g_return_val_if_fail (markup != NULL, NULL);
bar = XED_PROGRESS_INFO_BAR (g_object_new (XED_TYPE_PROGRESS_INFO_BAR,
"has-cancel-button", has_cancel,
NULL));
xed_progress_info_bar_set_image (bar, icon_name);
xed_progress_info_bar_set_markup (bar, markup);
return GTK_WIDGET (bar);
}
void
xed_progress_info_bar_set_image (XedProgressInfoBar *bar,
const gchar *icon_name)
{
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (bar));
g_return_if_fail (icon_name != NULL);
gtk_image_set_from_icon_name (GTK_IMAGE (bar->priv->image), icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
}
void
xed_progress_info_bar_set_markup (XedProgressInfoBar *bar,
const gchar *markup)
{
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (bar));
g_return_if_fail (markup != NULL);
gtk_label_set_markup (GTK_LABEL (bar->priv->label), markup);
}
void
xed_progress_info_bar_set_text (XedProgressInfoBar *bar,
const gchar *text)
{
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (bar));
g_return_if_fail (text != NULL);
gtk_label_set_text (GTK_LABEL (bar->priv->label), text);
}
void
xed_progress_info_bar_set_fraction (XedProgressInfoBar *bar,
gdouble fraction)
{
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (bar));
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar->priv->progress), fraction);
}
void
xed_progress_info_bar_pulse (XedProgressInfoBar *bar)
{
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (bar));
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar->priv->progress));
}

View File

@ -0,0 +1,85 @@
/*
* xed-progress-info-bar.h
* This file is part of xed
*
* Copyright (C) 2005 - Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Modified by the xed Team, 2005. See the AUTHORS file for a
* list of people on the xed Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
#ifndef __XED_PROGRESS_INFO_BAR_H__
#define __XED_PROGRESS_INFO_BAR_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define XED_TYPE_PROGRESS_INFO_BAR (xed_progress_info_bar_get_type())
#define XED_PROGRESS_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_PROGRESS_INFO_BAR, XedProgressInfoBar))
#define XED_PROGRESS_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XED_TYPE_PROGRESS_INFO_BAR, XedProgressInfoBarClass))
#define XED_IS_PROGRESS_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XED_TYPE_PROGRESS_INFO_BAR))
#define XED_IS_PROGRESS_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_PROGRESS_INFO_BAR))
#define XED_PROGRESS_INFO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XED_TYPE_PROGRESS_INFO_BAR, XedProgressInfoBarClass))
typedef struct _XedProgressInfoBar XedProgressInfoBar;
typedef struct _XedProgressInfoBarClass XedProgressInfoBarClass;
typedef struct _XedProgressInfoBarPrivate XedProgressInfoBarPrivate;
struct _XedProgressInfoBar
{
GtkInfoBar parent;
/*< private > */
XedProgressInfoBarPrivate *priv;
};
struct _XedProgressInfoBarClass
{
GtkInfoBarClass parent_class;
};
GType xed_progress_info_bar_get_type (void) G_GNUC_CONST;
GtkWidget *xed_progress_info_bar_new (const gchar *icon_name,
const gchar *markup,
gboolean has_cancel);
void xed_progress_info_bar_set_image (XedProgressInfoBar *area,
const gchar *icon_name);
void xed_progress_info_bar_set_markup (XedProgressInfoBar *area,
const gchar *markup);
void xed_progress_info_bar_set_text (XedProgressInfoBar *area,
const gchar *text);
void xed_progress_info_bar_set_fraction (XedProgressInfoBar *area,
gdouble fraction);
void xed_progress_info_bar_pulse (XedProgressInfoBar *area);
G_END_DECLS
#endif /* __XED_PROGRESS_INFO_BAR_H__ */

View File

@ -1,233 +0,0 @@
/*
* xed-progress-message-area.c
* This file is part of xed
*
* Copyright (C) 2005 - Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Modified by the xed Team, 2005. See the AUTHORS file for a
* list of people on the xed Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
/* TODO: add properties */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include "xed-progress-message-area.h"
enum
{
PROP_0,
PROP_HAS_CANCEL_BUTTON
};
#define XED_PROGRESS_MESSAGE_AREA_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_PROGRESS_MESSAGE_AREA, XedProgressMessageAreaPrivate))
struct _XedProgressMessageAreaPrivate
{
GtkWidget *image;
GtkWidget *label;
GtkWidget *progress;
};
G_DEFINE_TYPE(XedProgressMessageArea, xed_progress_message_area, GTK_TYPE_INFO_BAR)
static void
xed_progress_message_area_set_has_cancel_button (XedProgressMessageArea *area,
gboolean has_button)
{
if (has_button)
{
gtk_info_bar_add_button (GTK_INFO_BAR (area), _("Cancel"), GTK_RESPONSE_CANCEL);
}
g_object_notify (G_OBJECT (area), "has-cancel-button");
}
static void
xed_progress_message_area_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
XedProgressMessageArea *area;
area = XED_PROGRESS_MESSAGE_AREA (object);
switch (prop_id)
{
case PROP_HAS_CANCEL_BUTTON:
xed_progress_message_area_set_has_cancel_button (area, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xed_progress_message_area_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xed_progress_message_area_class_init (XedProgressMessageAreaClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = xed_progress_message_area_set_property;
gobject_class->get_property = xed_progress_message_area_get_property;
g_object_class_install_property (gobject_class,
PROP_HAS_CANCEL_BUTTON,
g_param_spec_boolean ("has-cancel-button",
"Has Cancel Button",
"If the message area has a cancel button",
TRUE,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private (gobject_class, sizeof(XedProgressMessageAreaPrivate));
}
static void
xed_progress_message_area_init (XedProgressMessageArea *area)
{
GtkWidget *vbox;
GtkWidget *hbox;
area->priv = XED_PROGRESS_MESSAGE_AREA_GET_PRIVATE (area);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
area->priv->image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show (area->priv->image);
gtk_widget_set_halign (area->priv->image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (area->priv->image, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (hbox), area->priv->image, FALSE, FALSE, 4);
area->priv->label = gtk_label_new ("");
gtk_widget_show (area->priv->label);
gtk_box_pack_start (GTK_BOX (hbox), area->priv->label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE);
gtk_widget_set_halign (area->priv->label, GTK_ALIGN_START);
gtk_label_set_ellipsize (GTK_LABEL (area->priv->label), PANGO_ELLIPSIZE_END);
area->priv->progress = gtk_progress_bar_new ();
gtk_widget_show (area->priv->progress);
gtk_box_pack_start (GTK_BOX (vbox), area->priv->progress, TRUE, FALSE, 0);
gtk_widget_set_size_request (area->priv->progress, -1, 15);
GtkWidget *content;
content = gtk_info_bar_get_content_area (GTK_INFO_BAR (area));
gtk_container_add (GTK_CONTAINER (content), vbox);
}
GtkWidget *
xed_progress_message_area_new (const gchar *icon_name,
const gchar *markup,
gboolean has_cancel)
{
XedProgressMessageArea *area;
g_return_val_if_fail (icon_name != NULL, NULL);
g_return_val_if_fail (markup != NULL, NULL);
area = XED_PROGRESS_MESSAGE_AREA (g_object_new (XED_TYPE_PROGRESS_MESSAGE_AREA,
"has-cancel-button", has_cancel,
NULL));
xed_progress_message_area_set_image (area, icon_name);
xed_progress_message_area_set_markup (area, markup);
return GTK_WIDGET (area);
}
void
xed_progress_message_area_set_image (XedProgressMessageArea *area,
const gchar *icon_name)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (icon_name != NULL);
gtk_image_set_from_icon_name (GTK_IMAGE (area->priv->image), icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
}
void
xed_progress_message_area_set_markup (XedProgressMessageArea *area,
const gchar *markup)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (markup != NULL);
gtk_label_set_markup (GTK_LABEL (area->priv->label), markup);
}
void
xed_progress_message_area_set_text (XedProgressMessageArea *area,
const gchar *text)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (text != NULL);
gtk_label_set_text (GTK_LABEL (area->priv->label), text);
}
void
xed_progress_message_area_set_fraction (XedProgressMessageArea *area,
gdouble fraction)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (area->priv->progress), fraction);
}
void
xed_progress_message_area_pulse (XedProgressMessageArea *area)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (area->priv->progress));
}

View File

@ -1,100 +0,0 @@
/*
* xed-progress-message-area.h
* This file is part of xed
*
* Copyright (C) 2005 - Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Modified by the xed Team, 2005. See the AUTHORS file for a
* list of people on the xed Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
#ifndef __XED_PROGRESS_MESSAGE_AREA_H__
#define __XED_PROGRESS_MESSAGE_AREA_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
/*
* Type checking and casting macros
*/
#define XED_TYPE_PROGRESS_MESSAGE_AREA (xed_progress_message_area_get_type())
#define XED_PROGRESS_MESSAGE_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_PROGRESS_MESSAGE_AREA, XedProgressMessageArea))
#define XED_PROGRESS_MESSAGE_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XED_TYPE_PROGRESS_MESSAGE_AREA, XedProgressMessageAreaClass))
#define XED_IS_PROGRESS_MESSAGE_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XED_TYPE_PROGRESS_MESSAGE_AREA))
#define XED_IS_PROGRESS_MESSAGE_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_PROGRESS_MESSAGE_AREA))
#define XED_PROGRESS_MESSAGE_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XED_TYPE_PROGRESS_MESSAGE_AREA, XedProgressMessageAreaClass))
/* Private structure type */
typedef struct _XedProgressMessageAreaPrivate XedProgressMessageAreaPrivate;
/*
* Main object structure
*/
typedef struct _XedProgressMessageArea XedProgressMessageArea;
struct _XedProgressMessageArea
{
GtkInfoBar parent;
/*< private > */
XedProgressMessageAreaPrivate *priv;
};
/*
* Class definition
*/
typedef struct _XedProgressMessageAreaClass XedProgressMessageAreaClass;
struct _XedProgressMessageAreaClass
{
GtkInfoBarClass parent_class;
};
/*
* Public methods
*/
GType xed_progress_message_area_get_type (void) G_GNUC_CONST;
GtkWidget *xed_progress_message_area_new (const gchar *icon_name,
const gchar *markup,
gboolean has_cancel);
void xed_progress_message_area_set_image (XedProgressMessageArea *area,
const gchar *icon_name);
void xed_progress_message_area_set_markup (XedProgressMessageArea *area,
const gchar *markup);
void xed_progress_message_area_set_text (XedProgressMessageArea *area,
const gchar *text);
void xed_progress_message_area_set_fraction (XedProgressMessageArea *area,
gdouble fraction);
void xed_progress_message_area_pulse (XedProgressMessageArea *area);
G_END_DECLS
#endif /* __XED_PROGRESS_MESSAGE_AREA_H__ */

View File

@ -38,10 +38,10 @@
#include "xed-notebook.h"
#include "xed-tab.h"
#include "xed-utils.h"
#include "xed-io-error-message-area.h"
#include "xed-io-error-info-bar.h"
#include "xed-print-job.h"
#include "xed-print-preview.h"
#include "xed-progress-message-area.h"
#include "xed-progress-info-bar.h"
#include "xed-debug.h"
#include "xed-enum-types.h"
#include "xed-settings.h"
@ -59,7 +59,7 @@ struct _XedTabPrivate
XedViewFrame *frame;
GtkWidget *message_area;
GtkWidget *info_bar;
GtkWidget *print_preview;
XedPrintJob *print_job;
@ -507,29 +507,29 @@ document_modified_changed (GtkTextBuffer *document,
}
static void
set_message_area (XedTab *tab,
GtkWidget *message_area)
set_info_bar (XedTab *tab,
GtkWidget *info_bar)
{
if (tab->priv->message_area == message_area)
if (tab->priv->info_bar == info_bar)
{
return;
}
if (tab->priv->message_area != NULL)
if (tab->priv->info_bar != NULL)
{
gtk_widget_destroy (tab->priv->message_area);
gtk_widget_destroy (tab->priv->info_bar);
}
tab->priv->message_area = message_area;
tab->priv->info_bar = info_bar;
if (message_area == NULL)
if (info_bar == NULL)
{
return;
}
gtk_box_pack_start (GTK_BOX (tab), tab->priv->message_area, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (tab), tab->priv->info_bar, FALSE, FALSE, 0);
g_object_add_weak_pointer (G_OBJECT (tab->priv->message_area), (gpointer *)&tab->priv->message_area);
g_object_add_weak_pointer (G_OBJECT (tab->priv->info_bar), (gpointer *)&tab->priv->info_bar);
}
static void
@ -543,9 +543,9 @@ remove_tab (XedTab *tab)
}
static void
io_loading_error_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
io_loading_error_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
XedView *view;
GFile *location;
@ -559,9 +559,9 @@ io_loading_error_message_area_response (GtkWidget *message_area,
switch (response_id)
{
case GTK_RESPONSE_OK:
encoding = xed_conversion_error_message_area_get_encoding (GTK_WIDGET (message_area));
encoding = xed_conversion_error_info_bar_get_encoding (GTK_WIDGET (info_bar));
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
xed_tab_set_state (tab, XED_TAB_STATE_LOADING);
load (tab, encoding, tab->priv->tmp_line_pos);
@ -571,7 +571,7 @@ io_loading_error_message_area_response (GtkWidget *message_area,
/* This means that we want to edit the document anyway */
tab->priv->editable = TRUE;
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
clear_loading (tab);
break;
@ -584,9 +584,9 @@ io_loading_error_message_area_response (GtkWidget *message_area,
}
static void
file_already_open_warning_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
file_already_open_warning_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
XedView *view;
@ -598,7 +598,7 @@ file_already_open_warning_message_area_response (GtkWidget *message_area,
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);
}
gtk_widget_destroy (message_area);
gtk_widget_destroy (info_bar);
gtk_widget_grab_focus (GTK_WIDGET (view));
}
@ -608,22 +608,22 @@ load_cancelled (GtkWidget *area,
gint response_id,
XedTab *tab)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area));
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (tab->priv->info_bar));
g_return_if_fail (G_IS_CANCELLABLE (tab->priv->cancellable));
g_cancellable_cancel (tab->priv->cancellable);
}
static void
unrecoverable_reverting_error_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
unrecoverable_reverting_error_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
XedView *view;
xed_tab_set_state (tab, XED_TAB_STATE_NORMAL);
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
clear_loading (tab);
@ -634,9 +634,9 @@ unrecoverable_reverting_error_message_area_response (GtkWidget *message_area,
#define MAX_MSG_LENGTH 100
static void
show_loading_message_area (XedTab *tab)
show_loading_info_bar (XedTab *tab)
{
GtkWidget *area;
GtkWidget *bar;
XedDocument *doc = NULL;
gchar *name;
gchar *dirname = NULL;
@ -645,7 +645,7 @@ show_loading_message_area (XedTab *tab)
gchar *dirname_markup;
gint len;
if (tab->priv->message_area != NULL)
if (tab->priv->info_bar != NULL)
{
return;
}
@ -707,7 +707,7 @@ show_loading_message_area (XedTab *tab)
msg = g_strdup_printf (_("Reverting %s"), name_markup);
}
area = xed_progress_message_area_new ("document-revert-symbolic", msg, TRUE);
bar = xed_progress_info_bar_new ("document-revert-symbolic", msg, TRUE);
}
else
{
@ -725,15 +725,15 @@ show_loading_message_area (XedTab *tab)
msg = g_strdup_printf (_("Loading %s"), name_markup);
}
area = xed_progress_message_area_new ("document-open-symbolic", msg, TRUE);
bar = xed_progress_info_bar_new ("document-open-symbolic", msg, TRUE);
}
g_signal_connect (area, "response",
g_signal_connect (bar, "response",
G_CALLBACK (load_cancelled), tab);
gtk_widget_show (area);
gtk_widget_show (bar);
set_message_area (tab, area);
set_info_bar (tab, bar);
g_free (msg);
g_free (name);
@ -742,9 +742,9 @@ show_loading_message_area (XedTab *tab)
}
static void
show_saving_message_area (XedTab *tab)
show_saving_info_bar (XedTab *tab)
{
GtkWidget *area;
GtkWidget *bar;
XedDocument *doc = NULL;
gchar *short_name;
gchar *from;
@ -756,7 +756,7 @@ show_saving_message_area (XedTab *tab)
g_return_if_fail (tab->priv->task_saver != NULL);
if (tab->priv->message_area != NULL)
if (tab->priv->info_bar != NULL)
{
return;
}
@ -811,11 +811,11 @@ show_saving_message_area (XedTab *tab)
msg = g_strdup_printf (_("Saving %s"), from_markup);
}
area = xed_progress_message_area_new ("document-save-symbolic", msg, FALSE);
bar = xed_progress_info_bar_new ("document-save-symbolic", msg, FALSE);
gtk_widget_show (area);
gtk_widget_show (bar);
set_message_area (tab, area);
set_info_bar (tab, bar);
g_free (msg);
g_free (to);
@ -824,25 +824,25 @@ show_saving_message_area (XedTab *tab)
}
static void
message_area_set_progress (XedTab *tab,
goffset size,
goffset total_size)
info_bar_set_progress (XedTab *tab,
goffset size,
goffset total_size)
{
if (tab->priv->message_area == NULL)
if (tab->priv->info_bar == NULL)
{
return;
}
xed_debug_message (DEBUG_TAB, "%" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT, size, total_size);
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area));
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (tab->priv->info_bar));
if (total_size == 0)
{
if (size != 0)
xed_progress_message_area_pulse (XED_PROGRESS_MESSAGE_AREA (tab->priv->message_area));
xed_progress_info_bar_pulse (XED_PROGRESS_INFO_BAR (tab->priv->info_bar));
else
xed_progress_message_area_set_fraction (XED_PROGRESS_MESSAGE_AREA (tab->priv->message_area), 0);
xed_progress_info_bar_set_fraction (XED_PROGRESS_INFO_BAR (tab->priv->info_bar), 0);
}
else
{
@ -850,7 +850,7 @@ message_area_set_progress (XedTab *tab,
frac = (gdouble)size / (gdouble)total_size;
xed_progress_message_area_set_fraction (XED_PROGRESS_MESSAGE_AREA (tab->priv->message_area), frac);
xed_progress_info_bar_set_fraction (XED_PROGRESS_INFO_BAR (tab->priv->info_bar), frac);
}
}
@ -867,9 +867,9 @@ scroll_to_cursor (XedTab *tab)
}
static void
unrecoverable_saving_error_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
unrecoverable_saving_error_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
XedView *view;
@ -882,7 +882,7 @@ unrecoverable_saving_error_message_area_response (GtkWidget *message_area,
xed_tab_set_state (tab, XED_TAB_STATE_NORMAL);
}
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
g_return_if_fail (tab->priv->task_saver != NULL);
g_task_return_boolean (tab->priv->task_saver, FALSE);
@ -922,16 +922,16 @@ response_set_save_flags (XedTab *tab,
}
static void
invalid_character_message_area_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
invalid_character_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
if (response_id == GTK_RESPONSE_YES)
{
SaverData *data;
GtkSourceFileSaverFlags save_flags;
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
g_return_if_fail (tab->priv->task_saver != NULL);
data = g_task_get_task_data (tab->priv->task_saver);
@ -948,21 +948,21 @@ invalid_character_message_area_response (GtkWidget *info_bar,
}
else
{
unrecoverable_saving_error_message_area_response (info_bar, response_id, tab);
unrecoverable_saving_error_info_bar_response (info_bar, response_id, tab);
}
}
static void
no_backup_error_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
no_backup_error_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
if (response_id == GTK_RESPONSE_YES)
{
SaverData *data;
GtkSourceFileSaverFlags save_flags;
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
g_return_if_fail (tab->priv->task_saver != NULL);
data = g_task_get_task_data (tab->priv->task_saver);
@ -976,21 +976,21 @@ no_backup_error_message_area_response (GtkWidget *message_area,
}
else
{
unrecoverable_saving_error_message_area_response (message_area, response_id, tab);
unrecoverable_saving_error_info_bar_response (info_bar, response_id, tab);
}
}
static void
externally_modified_error_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
externally_modified_error_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
if (response_id == GTK_RESPONSE_YES)
{
SaverData *data;
GtkSourceFileSaverFlags save_flags;
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
g_return_if_fail (tab->priv->task_saver != NULL);
data = g_task_get_task_data (tab->priv->task_saver);
@ -1008,26 +1008,26 @@ externally_modified_error_message_area_response (GtkWidget *message_area,
}
else
{
unrecoverable_saving_error_message_area_response (message_area, response_id, tab);
unrecoverable_saving_error_info_bar_response (info_bar, response_id, tab);
}
}
static void
recoverable_saving_error_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
recoverable_saving_error_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
if (response_id == GTK_RESPONSE_OK)
{
SaverData *data;
const GtkSourceEncoding *encoding;
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
g_return_if_fail (tab->priv->task_saver != NULL);
data = g_task_get_task_data (tab->priv->task_saver);
encoding = xed_conversion_error_message_area_get_encoding (GTK_WIDGET (message_area));
encoding = xed_conversion_error_info_bar_get_encoding (GTK_WIDGET (info_bar));
g_return_if_fail (encoding != NULL);
gtk_source_file_saver_set_encoding (data->saver, encoding);
@ -1035,18 +1035,18 @@ recoverable_saving_error_message_area_response (GtkWidget *message_area,
}
else
{
unrecoverable_saving_error_message_area_response (message_area, response_id, tab);
unrecoverable_saving_error_info_bar_response (info_bar, response_id, tab);
}
}
static void
externally_modified_notification_message_area_response (GtkWidget *message_area,
gint response_id,
XedTab *tab)
externally_modified_notification_info_bar_response (GtkWidget *info_bar,
gint response_id,
XedTab *tab)
{
XedView *view;
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
view = xed_tab_get_view (tab);
if (response_id == GTK_RESPONSE_OK)
@ -1067,7 +1067,7 @@ externally_modified_notification_message_area_response (GtkWidget *message_area,
static void
display_externally_modified_notification (XedTab *tab)
{
GtkWidget *message_area;
GtkWidget *info_bar;
XedDocument *doc;
GtkSourceFile *file;
GFile *location;
@ -1082,14 +1082,14 @@ display_externally_modified_notification (XedTab *tab)
g_return_if_fail (location != NULL);
document_modified = gtk_text_buffer_get_modified (GTK_TEXT_BUFFER(doc));
message_area = xed_externally_modified_message_area_new (location, document_modified);
info_bar = xed_externally_modified_info_bar_new (location, document_modified);
tab->priv->message_area = NULL;
set_message_area (tab, message_area);
gtk_widget_show (message_area);
tab->priv->info_bar = NULL;
set_info_bar (tab, info_bar);
gtk_widget_show (info_bar);
g_signal_connect (message_area, "response",
G_CALLBACK (externally_modified_notification_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (externally_modified_notification_info_bar_response), tab);
}
static gboolean
@ -1567,10 +1567,10 @@ loader_progress_cb (goffset size,
/* Approximately more than 3 seconds remaining. */
if (remaining_time > 3.0)
{
show_loading_message_area (tab);
show_loading_info_bar (tab);
}
message_area_set_progress (tab, size, total_size);
info_bar_set_progress (tab, size, total_size);
}
static void
@ -1643,7 +1643,7 @@ load_cb (GtkSourceFileLoader *loader,
tab->priv->timer = NULL;
}
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
/* Load was successful. */
if (error == NULL ||
@ -1694,7 +1694,7 @@ load_cb (GtkSourceFileLoader *loader,
}
else
{
GtkWidget *message_area;
GtkWidget *info_bar;
if (location != NULL)
{
@ -1707,24 +1707,24 @@ load_cb (GtkSourceFileLoader *loader,
encoding = gtk_source_file_loader_get_encoding (loader);
message_area = xed_io_loading_error_message_area_new (location, encoding, error);
info_bar = xed_io_loading_error_info_bar_new (location, encoding, error);
g_signal_connect (message_area, "response",
G_CALLBACK (io_loading_error_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (io_loading_error_info_bar_response), tab);
}
else
{
g_return_if_fail (tab->priv->state == XED_TAB_STATE_REVERTING_ERROR);
message_area = xed_unrecoverable_reverting_error_message_area_new (location, error);
info_bar = xed_unrecoverable_reverting_error_info_bar_new (location, error);
g_signal_connect (message_area, "response",
G_CALLBACK (unrecoverable_reverting_error_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (unrecoverable_reverting_error_info_bar_response), tab);
}
set_message_area (tab, message_area);
gtk_info_bar_set_default_response (GTK_INFO_BAR (message_area), GTK_RESPONSE_CANCEL);
gtk_widget_show (message_area);
set_info_bar (tab, info_bar);
gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
gtk_widget_show (info_bar);
}
goto end;
@ -1742,7 +1742,7 @@ load_cb (GtkSourceFileLoader *loader,
error->domain == GTK_SOURCE_FILE_LOADER_ERROR &&
error->code == GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK)
{
GtkWidget *message_area;
GtkWidget *info_bar;
const GtkSourceEncoding *encoding;
/* Set the tab as not editable as we have an error, the user can
@ -1752,14 +1752,14 @@ load_cb (GtkSourceFileLoader *loader,
encoding = gtk_source_file_loader_get_encoding (loader);
message_area = xed_io_loading_error_message_area_new (location, encoding, error);
info_bar = xed_io_loading_error_info_bar_new (location, encoding, error);
g_signal_connect (message_area, "response",
G_CALLBACK (io_loading_error_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (io_loading_error_info_bar_response), tab);
set_message_area (tab, message_area);
gtk_info_bar_set_default_response (GTK_INFO_BAR (message_area), GTK_RESPONSE_CANCEL);
gtk_widget_show (message_area);
set_info_bar (tab, info_bar);
gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
gtk_widget_show (info_bar);
}
/* Scroll to the cursor when the document is loaded, we need to do it in
@ -1792,18 +1792,18 @@ load_cb (GtkSourceFileLoader *loader,
if (cur_location != NULL && location != NULL && g_file_equal (location, cur_location))
{
GtkWidget *message_area;
GtkWidget *info_bar;
tab->priv->editable = FALSE;
message_area = xed_file_already_open_warning_message_area_new (location);
info_bar = xed_file_already_open_warning_info_bar_new (location);
g_signal_connect (message_area, "response",
G_CALLBACK (file_already_open_warning_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (file_already_open_warning_info_bar_response), tab);
set_message_area (tab, message_area);
gtk_info_bar_set_default_response (GTK_INFO_BAR (message_area), GTK_RESPONSE_CANCEL);
gtk_widget_show (message_area);
set_info_bar (tab, info_bar);
gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
gtk_widget_show (info_bar);
break;
}
@ -2011,7 +2011,7 @@ _xed_tab_revert (XedTab *tab)
if (tab->priv->state == XED_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION)
{
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
}
doc = xed_tab_get_document (tab);
@ -2058,10 +2058,10 @@ saver_progress_cb (goffset size,
/* Approximately more than 3 seconds remaining. */
if (remaining_time > 3.0)
{
show_saving_message_area (tab);
show_saving_info_bar (tab);
}
message_area_set_progress (tab, size, total_size);
info_bar_set_progress (tab, size, total_size);
}
static void
@ -2088,11 +2088,11 @@ save_cb (GtkSourceFileSaver *saver,
tab->priv->timer = NULL;
}
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
if (error != NULL)
{
GtkWidget *message_area;
GtkWidget *info_bar;
xed_tab_set_state (tab, XED_TAB_STATE_SAVING_ERROR);
@ -2100,21 +2100,21 @@ save_cb (GtkSourceFileSaver *saver,
error->code == GTK_SOURCE_FILE_SAVER_ERROR_EXTERNALLY_MODIFIED)
{
/* This error is recoverable */
message_area = xed_externally_modified_saving_error_message_area_new (location, error);
g_return_if_fail (message_area != NULL);
info_bar = xed_externally_modified_saving_error_info_bar_new (location, error);
g_return_if_fail (info_bar != NULL);
g_signal_connect (message_area, "response",
G_CALLBACK (externally_modified_error_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (externally_modified_error_info_bar_response), tab);
}
else if (error->domain == G_IO_ERROR &&
error->code == G_IO_ERROR_CANT_CREATE_BACKUP)
{
/* This error is recoverable */
message_area = xed_no_backup_saving_error_message_area_new (location, error);
g_return_if_fail (message_area != NULL);
info_bar = xed_no_backup_saving_error_info_bar_new (location, error);
g_return_if_fail (info_bar != NULL);
g_signal_connect (message_area, "response",
G_CALLBACK (no_backup_error_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (no_backup_error_info_bar_response), tab);
}
else if (error->domain == GTK_SOURCE_FILE_SAVER_ERROR &&
error->code == GTK_SOURCE_FILE_SAVER_ERROR_INVALID_CHARS)
@ -2122,11 +2122,11 @@ save_cb (GtkSourceFileSaver *saver,
/* If we have any invalid char in the document we must warn the user
* as it can make the document useless if it is saved.
*/
message_area = xed_invalid_character_message_area_new (location);
g_return_if_fail (message_area != NULL);
info_bar = xed_invalid_character_info_bar_new (location);
g_return_if_fail (info_bar != NULL);
g_signal_connect (message_area, "response",
G_CALLBACK (invalid_character_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (invalid_character_info_bar_response), tab);
}
else if (error->domain == GTK_SOURCE_FILE_SAVER_ERROR ||
(error->domain == G_IO_ERROR &&
@ -2136,11 +2136,11 @@ save_cb (GtkSourceFileSaver *saver,
/* These errors are _NOT_ recoverable */
_xed_recent_remove (XED_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))), location);
message_area = xed_unrecoverable_saving_error_message_area_new (location, error);
g_return_if_fail (message_area != NULL);
info_bar = xed_unrecoverable_saving_error_info_bar_new (location, error);
g_return_if_fail (info_bar != NULL);
g_signal_connect (message_area, "response",
G_CALLBACK (unrecoverable_saving_error_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (unrecoverable_saving_error_info_bar_response), tab);
}
else
{
@ -2151,16 +2151,16 @@ save_cb (GtkSourceFileSaver *saver,
encoding = gtk_source_file_saver_get_encoding (saver);
message_area = xed_conversion_error_while_saving_message_area_new (location, encoding, error);
g_return_if_fail (message_area != NULL);
info_bar = xed_conversion_error_while_saving_info_bar_new (location, encoding, error);
g_return_if_fail (info_bar != NULL);
g_signal_connect (message_area, "response",
G_CALLBACK (recoverable_saving_error_message_area_response), tab);
g_signal_connect (info_bar, "response",
G_CALLBACK (recoverable_saving_error_info_bar_response), tab);
}
set_message_area (tab, message_area);
gtk_info_bar_set_default_response (GTK_INFO_BAR (message_area), GTK_RESPONSE_CANCEL);
gtk_widget_show (message_area);
set_info_bar (tab, info_bar);
gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
gtk_widget_show (info_bar);
}
else
{
@ -2280,7 +2280,7 @@ _xed_tab_save_async (XedTab *tab,
* hide the message bar and set the save flag.
*/
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
save_flags |= GTK_SOURCE_FILE_SAVER_FLAGS_IGNORE_MODIFICATION_TIME;
}
@ -2427,7 +2427,7 @@ _xed_tab_save_as_async (XedTab *tab,
* hide the message bar and set the save flag.
*/
set_message_area (tab, NULL);
set_info_bar (tab, NULL);
save_flags |= GTK_SOURCE_FILE_SAVER_FLAGS_IGNORE_MODIFICATION_TIME;
}
@ -2504,15 +2504,15 @@ printing_cb (XedPrintJob *job,
XedPrintJobStatus status,
XedTab *tab)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area));
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (tab->priv->info_bar));
gtk_widget_show (tab->priv->message_area);
gtk_widget_show (tab->priv->info_bar);
xed_progress_message_area_set_text (XED_PROGRESS_MESSAGE_AREA (tab->priv->message_area),
xed_print_job_get_status_string (job));
xed_progress_info_bar_set_text (XED_PROGRESS_INFO_BAR (tab->priv->info_bar),
xed_print_job_get_status_string (job));
xed_progress_message_area_set_fraction (XED_PROGRESS_MESSAGE_AREA (tab->priv->message_area),
xed_print_job_get_progress (job));
xed_progress_info_bar_set_fraction (XED_PROGRESS_INFO_BAR (tab->priv->info_bar),
xed_print_job_get_progress (job));
}
static void
@ -2567,9 +2567,9 @@ done_printing_cb (XedPrintJob *job,
}
else
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area));
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (tab->priv->info_bar));
set_message_area (tab, NULL); /* destroy the message area */
set_info_bar (tab, NULL); /* destroy the message area */
}
// TODO: check status and error
@ -2634,7 +2634,7 @@ show_preview_cb (XedPrintJob *job,
// g_return_if_fail (tab->priv->state == XED_TAB_STATE_PRINT_PREVIEWING);
g_return_if_fail (tab->priv->print_preview == NULL);
set_message_area (tab, NULL); /* destroy the message area */
set_info_bar (tab, NULL); /* destroy the message area */
tab->priv->print_preview = GTK_WIDGET (preview);
gtk_box_pack_end (GTK_BOX (tab), tab->priv->print_preview, TRUE, TRUE, 0);
@ -2684,8 +2684,8 @@ preview_finished_cb (GtkSourcePrintJob *pjob, XedTab *tab)
MatePrintJob *gjob;
GtkWidget *preview = NULL;
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area));
set_message_area (tab, NULL); /* destroy the message area */
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (tab->priv->info_bar));
set_info_bar (tab, NULL); /* destroy the message area */
gjob = gtk_source_print_job_get_print_job (pjob);
@ -2708,7 +2708,7 @@ print_cancelled (GtkWidget *area,
gint response_id,
XedTab *tab)
{
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area));
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (tab->priv->info_bar));
xed_print_job_cancel (tab->priv->print_job);
@ -2716,24 +2716,24 @@ print_cancelled (GtkWidget *area,
}
static void
show_printing_message_area (XedTab *tab,
gboolean preview)
show_printing_info_bar (XedTab *tab,
gboolean preview)
{
GtkWidget *area;
if (preview)
{
area = xed_progress_message_area_new ("document-print-preview-symbolic", "", TRUE);
area = xed_progress_info_bar_new ("document-print-preview-symbolic", "", TRUE);
}
else
{
area = xed_progress_message_area_new ("document-print-symbolic", "", TRUE);
area = xed_progress_info_bar_new ("document-print-symbolic", "", TRUE);
}
g_signal_connect (area, "response",
G_CALLBACK (print_cancelled), tab);
set_message_area (tab, area);
set_info_bar (tab, area);
}
static void
@ -2757,7 +2757,7 @@ xed_tab_print_or_print_preview (XedTab *tab,
tab->priv->print_job = xed_print_job_new (view);
g_object_add_weak_pointer (G_OBJECT (tab->priv->print_job), (gpointer *) &tab->priv->print_job);
show_printing_message_area (tab, is_preview);
show_printing_info_bar (tab, is_preview);
g_signal_connect (tab->priv->print_job, "printing",
G_CALLBACK (printing_cb), tab);
@ -2958,7 +2958,7 @@ xed_tab_set_info_bar (XedTab *tab,
g_return_if_fail (info_bar == NULL || GTK_IS_WIDGET (info_bar));
/* FIXME: this can cause problems with the tab state machine */
set_message_area (tab, info_bar);
set_info_bar (tab, info_bar);
}
GtkWidget *