[gtranslator] Port gtranslator from MessageArea to GtkInfoBar
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtranslator] Port gtranslator from MessageArea to GtkInfoBar
- Date: Tue, 19 Jan 2010 22:42:30 +0000 (UTC)
commit 35af60ed8433b222f61e200d08ebf661c73f950f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Jan 19 23:40:30 2010 +0100
Port gtranslator from MessageArea to GtkInfoBar
Now that GtkInfoBar has landed into gtk+, port gtranslator to it
and also bump the gtk+ requirement to 2.18.0
configure.ac | 11 +-
src/Makefile.am | 6 +-
...io-error-message-area.c => io-error-info-bar.c} | 47 +-
...io-error-message-area.h => io-error-info-bar.h} | 6 +-
src/message-area.c | 590 --------------------
src/message-area.h | 130 -----
src/tab.c | 44 +-
src/tab.h | 4 +-
8 files changed, 62 insertions(+), 776 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 71cb4f1..f901f2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,7 +73,7 @@ dnl it too, or it will never make it into the spec file!
dnl
dnl ==========================================================================
-GTK_REQUIRED=2.16.0
+GTK_REQUIRED=2.18.0
GLIB_REQUIRED=2.15.5
GCONF_REQUIRED=2.18.0
LIBXML_REQUIRED=2.4.12
@@ -97,10 +97,11 @@ AC_SUBST(GDICT_OPTIONAL)
AC_SUBST(GTKSPELL_OPTIONAL)
PKG_CHECK_MODULES(GTRANSLATOR, [
-gconf-2.0 >= $GCONF_REQUIRED
-gtksourceview-2.0 >= $SOURCEVIEW_REQUIRED
-gio-2.0 >= $GLIB_REQUIRED
-gdl-1.0 >= $GDL_REQUIRED
+ gtk+-2.0 >= $GTK_REQUIRED
+ gconf-2.0 >= $GCONF_REQUIRED
+ gtksourceview-2.0 >= $SOURCEVIEW_REQUIRED
+ gio-2.0 >= $GLIB_REQUIRED
+ gdl-1.0 >= $GDL_REQUIRED
])
AC_SUBST(GTRANSLATOR_CFLAGS)
diff --git a/src/Makefile.am b/src/Makefile.am
index 651fa6b..213971a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,8 +69,7 @@ INST_H_FILES = \
context.h \
debug.h \
header.h \
- io-error-message-area.h \
- message-area.h \
+ io-error-info-bar.h \
message-table.h \
msg.h \
notebook.h \
@@ -90,7 +89,6 @@ header_DATA = \
libgtranslator_la_SOURCES = \
$(BUILT_SOURCES) \
application.c \
- message-area.c \
message-table.c \
message-table-model.c \
message-table-model.h \
@@ -109,7 +107,7 @@ libgtranslator_la_SOURCES = \
actions-edit.c \
actions-view.c \
actions-help.c \
- io-error-message-area.c \
+ io-error-info-bar.c \
prefs-manager.c \
prefs-manager.h \
prefs-manager-private.h \
diff --git a/src/io-error-message-area.c b/src/io-error-info-bar.c
similarity index 77%
rename from src/io-error-message-area.c
rename to src/io-error-info-bar.c
index f869367..df35429 100644
--- a/src/io-error-message-area.c
+++ b/src/io-error-info-bar.c
@@ -17,20 +17,29 @@
*
*/
-#include "io-error-message-area.h"
-#include "message-area.h"
+#include "io-error-info-bar.h"
#include <glib.h>
#include <gtk/gtk.h>
+static void
+set_contents (GtkInfoBar *infobar,
+ GtkWidget *contents)
+{
+ GtkWidget *content_area;
+
+ content_area = gtk_info_bar_get_content_area (infobar);
+ gtk_container_add (GTK_CONTAINER (content_area), contents);
+}
+
/*
* Message area funcs
*/
static void
-set_message_area_text_and_icon (GtranslatorMessageArea * message_area,
- const gchar * icon_stock_id,
- const gchar * primary_text,
- const gchar * secondary_text)
+set_info_bar_text_and_icon (GtkInfoBar *infobar,
+ const gchar *icon_stock_id,
+ const gchar *primary_text,
+ const gchar *secondary_text)
{
GtkWidget *hbox_content;
GtkWidget *image;
@@ -86,8 +95,7 @@ set_message_area_text_and_icon (GtranslatorMessageArea * message_area,
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5);
}
- gtranslator_message_area_set_contents (GTR_MESSAGE_AREA (message_area),
- hbox_content);
+ set_contents (infobar, hbox_content);
}
/*
@@ -104,23 +112,22 @@ warning_message_button_clicked (GtkWidget * widget,
}
GtkWidget *
-create_error_message_area (const gchar * primary_text,
- const gchar * secondary_text)
+create_error_info_bar (const gchar *primary_text,
+ const gchar *secondary_text)
{
- GtkWidget *message_area;
+ GtkWidget *infobar;
- message_area =
- gtranslator_message_area_new_with_buttons ("gtk-close",
- GTK_RESPONSE_CLOSE, NULL);
+ infobar = gtk_info_bar_new_with_buttons (GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE, NULL);
- set_message_area_text_and_icon (GTR_MESSAGE_AREA (message_area),
- GTK_STOCK_DIALOG_ERROR,
- primary_text, secondary_text);
+ set_info_bar_text_and_icon (GTK_INFO_BAR (infobar),
+ GTK_STOCK_DIALOG_ERROR,
+ primary_text, secondary_text);
- g_signal_connect (G_OBJECT (message_area), "response",
+ g_signal_connect (G_OBJECT (infobar), "response",
G_CALLBACK (warning_message_button_clicked), NULL);
- gtk_widget_show (message_area);
+ gtk_widget_show (infobar);
- return message_area;
+ return infobar;
}
diff --git a/src/io-error-message-area.h b/src/io-error-info-bar.h
similarity index 89%
rename from src/io-error-message-area.h
rename to src/io-error-info-bar.h
index 8d2ee73..7a90bd8 100644
--- a/src/io-error-message-area.h
+++ b/src/io-error-info-bar.h
@@ -23,7 +23,9 @@
#include <gtk/gtk.h>
G_BEGIN_DECLS
- GtkWidget * create_error_message_area (const gchar * primary_text,
- const gchar * secondary_text);
+
+GtkWidget *create_error_info_bar (const gchar * primary_text,
+ const gchar * secondary_text);
+
G_END_DECLS
#endif
diff --git a/src/tab.c b/src/tab.c
index 32cd38a..b5cbd9d 100644
--- a/src/tab.c
+++ b/src/tab.c
@@ -34,8 +34,7 @@
#include "application.h"
#include "context.h"
-#include "io-error-message-area.h"
-#include "message-area.h"
+#include "io-error-info-bar.h"
#include "message-table.h"
#include "msg.h"
#include "tab.h"
@@ -78,8 +77,8 @@ G_DEFINE_TYPE (GtranslatorTab, gtranslator_tab, GTK_TYPE_VBOX)
/*Comment button */
GtkWidget *comment_button;
- /*Message area */
- GtkWidget *message_area;
+ /*Info bar */
+ GtkWidget *infobar;
/*Original text */
GtkWidget *msgid_hbox;
@@ -199,7 +198,7 @@ gtranslator_tab_edition_finished (GtranslatorTab * tab, GtranslatorMsg * msg)
{
GtranslatorTranslationMemory *tm;
gchar *message_error;
- GtkWidget *message_area;
+ GtkWidget *infobar;
tm =
GTR_TRANSLATION_MEMORY (gtranslator_application_get_translation_memory
@@ -219,16 +218,15 @@ gtranslator_tab_edition_finished (GtranslatorTab * tab, GtranslatorMsg * msg)
{
gtranslator_tab_block_movement (tab);
- message_area =
- create_error_message_area (_("There is an error in the message:"),
- message_error);
- gtranslator_tab_set_message_area (tab, message_area);
+ infobar = create_error_info_bar (_("There is an error in the message:"),
+ message_error);
+ gtranslator_tab_set_info_bar (tab, infobar);
g_free (message_error);
}
else
{
gtranslator_tab_unblock_movement (tab);
- gtranslator_tab_set_message_area (tab, NULL);
+ gtranslator_tab_set_info_bar (tab, NULL);
}
}
@@ -1746,32 +1744,32 @@ gtranslator_tab_go_to_number (GtranslatorTab * tab, gint number)
}
/**
- * gtranslator_tab_set_message_area:
+ * gtranslator_tab_set_info_bar:
* @tab: a #GtranslatorTab
- * @message_area: a #GtranslatorMessageArea
+ * @infobar: a #GtranslatorMessageArea
*
- * Sets the @message_area to be shown in the @tab.
+ * Sets the @infobar to be shown in the @tab.
*/
void
-gtranslator_tab_set_message_area (GtranslatorTab * tab,
- GtkWidget * message_area)
+gtranslator_tab_set_info_bar (GtranslatorTab *tab,
+ GtkWidget *infobar)
{
g_return_if_fail (GTR_IS_TAB (tab));
- if (tab->priv->message_area == message_area)
+ if (tab->priv->infobar == infobar)
return;
- if (tab->priv->message_area != NULL)
- gtk_widget_destroy (tab->priv->message_area);
+ if (tab->priv->infobar != NULL)
+ gtk_widget_destroy (tab->priv->infobar);
- tab->priv->message_area = message_area;
+ tab->priv->infobar = infobar;
- if (message_area == NULL)
+ if (infobar == NULL)
return;
gtk_box_pack_start (GTK_BOX (tab),
- tab->priv->message_area, FALSE, FALSE, 0);
+ tab->priv->infobar, 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->infobar),
+ (gpointer *) &tab->priv->infobar);
}
diff --git a/src/tab.h b/src/tab.h
index feeb5c0..90979a3 100644
--- a/src/tab.h
+++ b/src/tab.h
@@ -171,8 +171,8 @@ gtranslator_tab_get_type (void)
void gtranslator_tab_go_to_number (GtranslatorTab * tab, gint number);
- void gtranslator_tab_set_message_area (GtranslatorTab * tab,
- GtkWidget * message_area);
+ void gtranslator_tab_set_info_bar (GtranslatorTab *tab,
+ GtkWidget *infobar);
gboolean _gtranslator_tab_can_close (GtranslatorTab * tab);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]