Commit 91f805bf authored by Garrett Regier's avatar Garrett Regier

Renamed message areas to info bars

parent bbedb66c
......@@ -44,7 +44,7 @@ IGNORE_HFILES= \
gedit-document-loader.h \
gedit-document-saver.h \
gedit-documents-panel.h \
gedit-io-error-message-area.h \
gedit-io-error-info-bar.h \
gedit-languages-manager.h \
gedit-message-area.h \
gedit-object-module.h \
......
......@@ -101,7 +101,7 @@ NOINST_H_FILES = \
gedit-document-saver.h \
gedit-documents-panel.h \
gedit-history-entry.h \
gedit-io-error-message-area.h \
gedit-io-error-info-bar.h \
gedit-language-manager.h \
gedit-multi-notebook.h \
gedit-notebook.h \
......@@ -135,7 +135,7 @@ INST_H_FILES = \
gedit-message.h \
gedit-panel.h \
gedit-plugin.h \
gedit-progress-message-area.h \
gedit-progress-info-bar.h \
gedit-statusbar.h \
gedit-status-combo-box.h \
gedit-tab.h \
......@@ -177,7 +177,7 @@ libgedit_la_SOURCES = \
gedit-encodings-combo-box.c \
gedit-file-chooser-dialog.c \
gedit-history-entry.c \
gedit-io-error-message-area.c \
gedit-io-error-info-bar.c \
gedit-language-manager.c \
gedit-message-bus.c \
gedit-message-type.c \
......@@ -193,7 +193,7 @@ libgedit_la_SOURCES = \
gedit-plugins-engine.c \
gedit-print-job.c \
gedit-print-preview.c \
gedit-progress-message-area.c \
gedit-progress-info-bar.c \
gedit-session.c \
gedit-settings.c \
gedit-smart-charset-converter.c \
......
/*
* gedit-io-error-message-area.h
* gedit-io-error-info-bar.h
* This file is part of gedit
*
* Copyright (C) 2005 - Paolo Maggi
......@@ -28,43 +28,43 @@
* $Id$
*/
#ifndef __GEDIT_IO_ERROR_MESSAGE_AREA_H__
#define __GEDIT_IO_ERROR_MESSAGE_AREA_H__
#ifndef __GEDIT_IO_ERROR_INFO_BAR_H__
#define __GEDIT_IO_ERROR_INFO_BAR_H__
#include <glib.h>
G_BEGIN_DECLS
GtkWidget *gedit_io_loading_error_message_area_new (GFile *location,
const GeditEncoding *encoding,
const GError *error);
GtkWidget *gedit_io_loading_error_info_bar_new (GFile *location,
const GeditEncoding *encoding,
const GError *error);
GtkWidget *gedit_unrecoverable_reverting_error_message_area_new (GFile *location,
const GError *error);
GtkWidget *gedit_unrecoverable_reverting_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *gedit_conversion_error_while_saving_message_area_new (GFile *location,
const GeditEncoding *encoding,
const GError *error);
GtkWidget *gedit_conversion_error_while_saving_info_bar_new (GFile *location,
const GeditEncoding *encoding,
const GError *error);
const GeditEncoding
*gedit_conversion_error_message_area_get_encoding (GtkWidget *message_area);
*gedit_conversion_error_info_bar_get_encoding (GtkWidget *info_bar);
GtkWidget *gedit_file_already_open_warning_message_area_new (GFile *location);
GtkWidget *gedit_file_already_open_warning_info_bar_new (GFile *location);
GtkWidget *gedit_externally_modified_saving_error_message_area_new (GFile *location,
const GError *error);
GtkWidget *gedit_externally_modified_saving_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *gedit_no_backup_saving_error_message_area_new (GFile *location,
GtkWidget *gedit_no_backup_saving_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *gedit_unrecoverable_saving_error_message_area_new (GFile *location,
const GError *error);
GtkWidget *gedit_unrecoverable_saving_error_info_bar_new (GFile *location,
const GError *error);
GtkWidget *gedit_externally_modified_message_area_new (GFile *location,
gboolean document_modified);
GtkWidget *gedit_externally_modified_info_bar_new (GFile *location,
gboolean document_modified);
G_END_DECLS
#endif /* __GEDIT_IO_ERROR_MESSAGE_AREA_H__ */
#endif /* __GEDIT_IO_ERROR_INFO_BAR_H__ */
/* ex:ts=8:noet: */
/*
* gedit-progress-message-area.c
* gedit-progress-info-bar.c
* This file is part of gedit
*
* Copyright (C) 2005 - Paolo Maggi
......@@ -38,7 +38,7 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include "gedit-progress-message-area.h"
#include "gedit-progress-info-bar.h"
enum {
PROP_0,
......@@ -46,54 +46,44 @@ enum {
};
#define GEDIT_PROGRESS_MESSAGE_AREA_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_PROGRESS_MESSAGE_AREA, GeditProgressMessageAreaPrivate))
#define GEDIT_PROGRESS_INFO_BAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_PROGRESS_INFO_BAR, GeditProgressInfoBarPrivate))
struct _GeditProgressMessageAreaPrivate
struct _GeditProgressInfoBarPrivate
{
GtkWidget *image;
GtkWidget *label;
GtkWidget *progress;
};
#if !GTK_CHECK_VERSION (2, 17, 1)
G_DEFINE_TYPE(GeditProgressMessageArea, gedit_progress_message_area, GEDIT_TYPE_MESSAGE_AREA)
#else
G_DEFINE_TYPE(GeditProgressMessageArea, gedit_progress_message_area, GTK_TYPE_INFO_BAR)
#endif
G_DEFINE_TYPE(GeditProgressInfoBar, gedit_progress_info_bar, GTK_TYPE_INFO_BAR)
static void
gedit_progress_message_area_set_has_cancel_button (GeditProgressMessageArea *area,
gboolean has_button)
gedit_progress_info_bar_set_has_cancel_button (GeditProgressInfoBar *bar,
gboolean has_button)
{
if (has_button)
#if !GTK_CHECK_VERSION (2, 17, 1)
gedit_message_area_add_button (GEDIT_MESSAGE_AREA (area),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
#else
gtk_info_bar_add_button (GTK_INFO_BAR (area),
gtk_info_bar_add_button (GTK_INFO_BAR (bar),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
#endif
g_object_notify (G_OBJECT (area), "has-cancel-button");
g_object_notify (G_OBJECT (bar), "has-cancel-button");
}
static void
gedit_progress_message_area_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
gedit_progress_info_bar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GeditProgressMessageArea *area;
GeditProgressInfoBar *bar;
area = GEDIT_PROGRESS_MESSAGE_AREA (object);
bar = GEDIT_PROGRESS_INFO_BAR (object);
switch (prop_id)
{
case PROP_HAS_CANCEL_BUTTON:
gedit_progress_message_area_set_has_cancel_button (area,
g_value_get_boolean (value));
gedit_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);
......@@ -102,14 +92,14 @@ gedit_progress_message_area_set_property (GObject *object,
}
static void
gedit_progress_message_area_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
gedit_progress_info_bar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GeditProgressMessageArea *area;
GeditProgressInfoBar *bar;
area = GEDIT_PROGRESS_MESSAGE_AREA (object);
bar = GEDIT_PROGRESS_INFO_BAR (object);
switch (prop_id)
{
......@@ -120,33 +110,34 @@ gedit_progress_message_area_get_property (GObject *object,
}
static void
gedit_progress_message_area_class_init (GeditProgressMessageAreaClass *klass)
gedit_progress_info_bar_class_init (GeditProgressInfoBarClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gedit_progress_message_area_set_property;
gobject_class->get_property = gedit_progress_message_area_get_property;
gobject_class->set_property = gedit_progress_info_bar_set_property;
gobject_class->get_property = gedit_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",
"If the message bar has a cancel button",
TRUE,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private (gobject_class, sizeof (GeditProgressMessageAreaPrivate));
g_type_class_add_private (gobject_class, sizeof (GeditProgressInfoBarPrivate));
}
static void
gedit_progress_message_area_init (GeditProgressMessageArea *area)
gedit_progress_info_bar_init (GeditProgressInfoBar *bar)
{
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *content;
area->priv = GEDIT_PROGRESS_MESSAGE_AREA_GET_PRIVATE (area);
bar->priv = GEDIT_PROGRESS_INFO_BAR_GET_PRIVATE (bar);
vbox = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox);
......@@ -155,109 +146,99 @@ gedit_progress_message_area_init (GeditProgressMessageArea *area)
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
area->priv->image = gtk_image_new_from_icon_name (GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show (area->priv->image);
gtk_misc_set_alignment (GTK_MISC (area->priv->image), 0.5, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), area->priv->image, FALSE, FALSE, 4);
bar->priv->image = gtk_image_new_from_icon_name (GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show (bar->priv->image);
gtk_misc_set_alignment (GTK_MISC (bar->priv->image), 0.5, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), bar->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_misc_set_alignment (GTK_MISC (area->priv->label), 0, 0.5);
gtk_label_set_ellipsize (GTK_LABEL (area->priv->label),
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_misc_set_alignment (GTK_MISC (bar->priv->label), 0, 0.5);
gtk_label_set_ellipsize (GTK_LABEL (bar->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);
#if !GTK_CHECK_VERSION (2, 17, 1)
gedit_message_area_set_contents (GEDIT_MESSAGE_AREA (area),
vbox);
#else
GtkWidget *content;
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 (area));
content = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar));
gtk_container_add (GTK_CONTAINER (content), vbox);
#endif
}
GtkWidget *
gedit_progress_message_area_new (const gchar *stock_id,
const gchar *markup,
gboolean has_cancel)
gedit_progress_info_bar_new (const gchar *stock_id,
const gchar *markup,
gboolean has_cancel)
{
GeditProgressMessageArea *area;
GeditProgressInfoBar *bar;
g_return_val_if_fail (stock_id != NULL, NULL);
g_return_val_if_fail (markup != NULL, NULL);
area = GEDIT_PROGRESS_MESSAGE_AREA (g_object_new (GEDIT_TYPE_PROGRESS_MESSAGE_AREA,
"has-cancel-button", has_cancel,
NULL));
gedit_progress_message_area_set_stock_image (area,
stock_id);
bar = GEDIT_PROGRESS_INFO_BAR (g_object_new (GEDIT_TYPE_PROGRESS_INFO_BAR,
"has-cancel-button", has_cancel,
NULL));
gedit_progress_message_area_set_markup (area,
markup);
gedit_progress_info_bar_set_stock_image (bar, stock_id);
gedit_progress_info_bar_set_markup (bar, markup);
return GTK_WIDGET (area);
return GTK_WIDGET (bar);
}
void
gedit_progress_message_area_set_stock_image (GeditProgressMessageArea *area,
const gchar *stock_id)
gedit_progress_info_bar_set_stock_image (GeditProgressInfoBar *bar,
const gchar *stock_id)
{
g_return_if_fail (GEDIT_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (GEDIT_IS_PROGRESS_INFO_BAR (bar));
g_return_if_fail (stock_id != NULL);
gtk_image_set_from_stock (GTK_IMAGE (area->priv->image),
gtk_image_set_from_stock (GTK_IMAGE (bar->priv->image),
stock_id,
GTK_ICON_SIZE_SMALL_TOOLBAR);
}
void
gedit_progress_message_area_set_markup (GeditProgressMessageArea *area,
const gchar *markup)
gedit_progress_info_bar_set_markup (GeditProgressInfoBar *bar,
const gchar *markup)
{
g_return_if_fail (GEDIT_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (GEDIT_IS_PROGRESS_INFO_BAR (bar));
g_return_if_fail (markup != NULL);
gtk_label_set_markup (GTK_LABEL (area->priv->label),
gtk_label_set_markup (GTK_LABEL (bar->priv->label),
markup);
}
void
gedit_progress_message_area_set_text (GeditProgressMessageArea *area,
const gchar *text)
gedit_progress_info_bar_set_text (GeditProgressInfoBar *bar,
const gchar *text)
{
g_return_if_fail (GEDIT_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (GEDIT_IS_PROGRESS_INFO_BAR (bar));
g_return_if_fail (text != NULL);
gtk_label_set_text (GTK_LABEL (area->priv->label),
gtk_label_set_text (GTK_LABEL (bar->priv->label),
text);
}
void
gedit_progress_message_area_set_fraction (GeditProgressMessageArea *area,
gdouble fraction)
gedit_progress_info_bar_set_fraction (GeditProgressInfoBar *bar,
gdouble fraction)
{
g_return_if_fail (GEDIT_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (GEDIT_IS_PROGRESS_INFO_BAR (bar));
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (area->priv->progress),
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar->priv->progress),
fraction);
}
void
gedit_progress_message_area_pulse (GeditProgressMessageArea *area)
gedit_progress_info_bar_pulse (GeditProgressInfoBar *bar)
{
g_return_if_fail (GEDIT_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (GEDIT_IS_PROGRESS_INFO_BAR (bar));
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (area->priv->progress));
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar->priv->progress));
}
/* ex:ts=8:noet: */
/*
* gedit-progress-message-area.h
* gedit-progress-info-bar.h
* This file is part of gedit
*
* Copyright (C) 2005 - Paolo Maggi
......@@ -28,87 +28,75 @@
* $Id$
*/
#ifndef __GEDIT_PROGRESS_MESSAGE_AREA_H__
#define __GEDIT_PROGRESS_MESSAGE_AREA_H__
#ifndef __GEDIT_PROGRESS_INFO_BAR_H__
#define __GEDIT_PROGRESS_INFO_BAR_H__
#if !GTK_CHECK_VERSION (2, 17, 1)
#include <gedit/gedit-message-area.h>
#else
#include <gtk/gtk.h>
#endif
G_BEGIN_DECLS
/*
* Type checking and casting macros
*/
#define GEDIT_TYPE_PROGRESS_MESSAGE_AREA (gedit_progress_message_area_get_type())
#define GEDIT_PROGRESS_MESSAGE_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDIT_TYPE_PROGRESS_MESSAGE_AREA, GeditProgressMessageArea))
#define GEDIT_PROGRESS_MESSAGE_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GEDIT_TYPE_PROGRESS_MESSAGE_AREA, GeditProgressMessageAreaClass))
#define GEDIT_IS_PROGRESS_MESSAGE_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDIT_TYPE_PROGRESS_MESSAGE_AREA))
#define GEDIT_IS_PROGRESS_MESSAGE_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_PROGRESS_MESSAGE_AREA))
#define GEDIT_PROGRESS_MESSAGE_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GEDIT_TYPE_PROGRESS_MESSAGE_AREA, GeditProgressMessageAreaClass))
#define GEDIT_TYPE_PROGRESS_INFO_BAR (gedit_progress_info_bar_get_type())
#define GEDIT_PROGRESS_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDIT_TYPE_PROGRESS_INFO_BAR, GeditProgressInfoBar))
#define GEDIT_PROGRESS_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GEDIT_TYPE_PROGRESS_INFO_BAR, GeditProgressInfoBarClass))
#define GEDIT_IS_PROGRESS_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDIT_TYPE_PROGRESS_INFO_BAR))
#define GEDIT_IS_PROGRESS_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_PROGRESS_INFO_BAR))
#define GEDIT_PROGRESS_INFO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GEDIT_TYPE_PROGRESS_INFO_BAR, GeditProgressInfoBarClass))
/* Private structure type */
typedef struct _GeditProgressMessageAreaPrivate GeditProgressMessageAreaPrivate;
typedef struct _GeditProgressInfoBarPrivate GeditProgressInfoBarPrivate;
/*
* Main object structure
*/
typedef struct _GeditProgressMessageArea GeditProgressMessageArea;
typedef struct _GeditProgressInfoBar GeditProgressInfoBar;
struct _GeditProgressMessageArea
struct _GeditProgressInfoBar
{
#if !GTK_CHECK_VERSION (2, 17, 1)
GeditMessageArea parent;
#else
GtkInfoBar parent;
#endif
/*< private > */
GeditProgressMessageAreaPrivate *priv;
GeditProgressInfoBarPrivate *priv;
};
/*
* Class definition
*/
typedef struct _GeditProgressMessageAreaClass GeditProgressMessageAreaClass;
typedef struct _GeditProgressInfoBarClass GeditProgressInfoBarClass;
struct _GeditProgressMessageAreaClass
struct _GeditProgressInfoBarClass
{
#if !GTK_CHECK_VERSION (2, 17, 1)
GeditMessageAreaClass parent_class;
#else
GtkInfoBarClass parent_class;
#endif
};
/*
* Public methods
*/
GType gedit_progress_message_area_get_type (void) G_GNUC_CONST;
GType gedit_progress_info_bar_get_type (void) G_GNUC_CONST;
GtkWidget *gedit_progress_message_area_new (const gchar *stock_id,
const gchar *markup,
gboolean has_cancel);
GtkWidget *gedit_progress_info_bar_new (const gchar *stock_id,
const gchar *markup,
gboolean has_cancel);
void gedit_progress_message_area_set_stock_image (GeditProgressMessageArea *area,
const gchar *stock_id);
void gedit_progress_info_bar_set_stock_image (GeditProgressInfoBar *bar,
const gchar *stock_id);
void gedit_progress_message_area_set_markup (GeditProgressMessageArea *area,
const gchar *markup);
void gedit_progress_info_bar_set_markup (GeditProgressInfoBar *bar,
const gchar *markup);
void gedit_progress_message_area_set_text (GeditProgressMessageArea *area,
const gchar *text);
void gedit_progress_info_bar_set_text (GeditProgressInfoBar *bar,
const gchar *text);
void gedit_progress_message_area_set_fraction (GeditProgressMessageArea *area,
gdouble fraction);
void gedit_progress_info_bar_set_fraction (GeditProgressInfoBar *bar,
gdouble fraction);
void gedit_progress_message_area_pulse (GeditProgressMessageArea *area);
void gedit_progress_info_bar_pulse (GeditProgressInfoBar *bar);
G_END_DECLS
#endif /* __GEDIT_PROGRESS_MESSAGE_AREA_H__ */
#endif /* __GEDIT_PROGRESS_INFO_BAR_H__ */
/* ex:ts=8:noet: */
This diff is collapsed.
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