[gtranslator] Add introspection support.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Add introspection support.
- Date: Mon, 8 Nov 2010 09:22:37 +0000 (UTC)
commit dd09f910718c36a92a61c8ce3e6a47c3830e6471
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Nov 2 12:13:58 2010 +0100
Add introspection support.
configure.ac | 11 ++++++
src/Makefile.am | 96 +++++++++++++++++++++++++++++++------------------
src/gtr-actions-go.c | 20 +++++-----
src/gtr-window.c | 9 +++--
src/gtr-window.h | 11 +++---
5 files changed, 92 insertions(+), 55 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 03f0078..c22cc63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -239,6 +239,16 @@ MY_DATE=`date +%Y-%m-%d`
AC_SUBST(MY_DATE)
+# Introspection
+GOBJECT_INTROSPECTION_CHECK([0.9.3])
+
+if test "$found_introspection" = "yes"; then
+ enable_introspection=yes
+ AC_DEFINE([ENABLE_INTROSPECTION], [1], [Define to enable GObject Introspection])
+else
+ enable_introspection=no
+fi
+
dnl -------------------------------------------------------------------
dnl Put out the configured files.
dnl -------------------------------------------------------------------
@@ -293,6 +303,7 @@ gtranslator version : ${PACKAGE_VERSION}
debug friendly build : ${enable_debug:-no}
compilation flags : ${CFLAGS}
compilation warnings : ${WARN_CFLAGS}
+GObject Introspection : $enable_introspection
------------------------------------------------------------------
"
diff --git a/src/Makefile.am b/src/Makefile.am
index 178fccc..3a94830 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,9 +33,6 @@ INCLUDES = \
bin_PROGRAMS = \
gtranslator
-# gtranslator-auto-translate \
-# gtranslator-auto-learn \
-# gtranslator-export-learn-buffer
gtranslator_SOURCES = main.c
@@ -68,7 +65,6 @@ INST_H_FILES = \
gtr-context.h \
gtr-debug.h \
gtr-header.h \
- gtr-io-error-info-bar.h \
gtr-message-table.h \
gtr-msg.h \
gtr-notebook.h \
@@ -76,55 +72,62 @@ INST_H_FILES = \
gtr-profile.h \
gtr-statusbar.h \
gtr-tab.h \
- gtr-utils.h \
gtr-view.h \
gtr-window.h
+NOINST_H_FILES = \
+ gtr-actions.h \
+ gtr-close-button.h \
+ gtr-dirs.h \
+ gtr-history-entry.h \
+ gtr-io-error-info-bar.h \
+ gtr-message-table-model.h \
+ gtr-profile-manager.h \
+ gtr-settings.h \
+ gtr-status-combo-box.h \
+ gtr-tab-label.h \
+ gtr-utils.h
+
headerdir = $(prefix)/include/gtranslator- GTR_API_VERSION@/gtranslator
header_DATA = \
$(INST_H_FILES)
-libgtranslator_la_SOURCES = \
- $(BUILT_SOURCES) \
+libgtranslator_c_files = \
+ gtr-actions-documents.c \
+ gtr-actions-edit.c \
+ gtr-actions-file.c \
+ gtr-actions-go.c \
+ gtr-actions-help.c \
+ gtr-actions-search.c \
+ gtr-actions-view.c \
gtr-application.c \
- gtr-dirs.h \
+ gtr-close-button.c \
+ gtr-context.c \
gtr-dirs.c \
+ gtr-header.c \
+ gtr-history-entry.c \
+ gtr-io-error-info-bar.c \
gtr-message-table.c \
gtr-message-table-model.c \
- gtr-message-table-model.h \
+ gtr-msg.c \
gtr-notebook.c \
- gtr-tab.c \
- gtr-tab-label.h \
- gtr-tab-label.c \
- gtr-close-button.h \
- gtr-close-button.c \
- gtr-view.c \
- gtr-window.c \
gtr-po.c \
gtr-profile.c \
- gtr-utils.c \
- gtr-msg.c \
- gtr-actions.h \
- gtr-actions-documents.c \
- gtr-actions-file.c \
- gtr-actions-go.c \
- gtr-actions-edit.c \
- gtr-actions-view.c \
- gtr-actions-help.c \
- gtr-io-error-info-bar.c \
- gtr-history-entry.c \
- gtr-history-entry.h \
- gtr-actions-search.c \
- gtr-header.c \
- gtr-statusbar.c \
- gtr-context.c \
- gtr-profile-manager.h \
gtr-profile-manager.c \
- gtr-settings.h \
gtr-settings.c \
- gtr-status-combo-box.h \
+ gtr-statusbar.c \
gtr-status-combo-box.c \
+ gtr-tab.c \
+ gtr-tab-label.c \
+ gtr-utils.c \
+ gtr-view.c \
+ gtr-window.c
+
+libgtranslator_la_SOURCES = \
+ $(BUILT_SOURCES) \
+ $(libgtranslator_c_files) \
+ $(NOINST_H_FILES) \
$(INST_H_FILES)
libgtranslator_la_LIBADD = \
@@ -153,4 +156,27 @@ EXTRA_DIST = \
CLEANFILES = $(BUILT_SOURCES)
+if HAVE_INTROSPECTION
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS = Gtranslator-2.0.gir
+
+Gtranslator-2.0.gir: gtranslator
+INTROSPECTION_SCANNER_ARGS = -I$(top_srcdir) --warn-all
+Gtranslator_2_0_gir_NAMESPACE = Gtr
+Gtranslator_2_0_gir_VERSION = 2.0
+Gtranslator_2_0_gir_PROGRAM = $(builddir)/src
+Gtranslator_2_0_gir_FILES = $(INST_H_FILES) $(libgtranslator_c_files)
+Gtranslator_2_0_gir_INCLUDES = Gtk-3.0 GtkSource-3.0
+
+girdir = $(datadir)/gtranslator/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/gtranslator/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += \
+ $(gir_DATA) \
+ $(typelib_DATA)
+endif
+
-include $(top_srcdir)/git.mk
diff --git a/src/gtr-actions-go.c b/src/gtr-actions-go.c
index 6a8bffa..fb1bd85 100644
--- a/src/gtr-actions-go.c
+++ b/src/gtr-actions-go.c
@@ -40,7 +40,7 @@ gtr_message_go_to_first (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
gtr_tab_go_to_first (current);
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -52,7 +52,7 @@ gtr_message_go_to_previous (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
gtr_tab_go_to_prev (current);
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -64,7 +64,7 @@ gtr_message_go_to_next (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
gtr_tab_go_to_next (current);
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -76,7 +76,7 @@ gtr_message_go_to_last (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
gtr_tab_go_to_last (current);
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -88,7 +88,7 @@ gtr_message_go_to_next_fuzzy (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
if (gtr_tab_go_to_next_fuzzy (current))
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -100,7 +100,7 @@ gtr_message_go_to_prev_fuzzy (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
if (gtr_tab_go_to_prev_fuzzy (current))
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -112,7 +112,7 @@ gtr_message_go_to_next_untranslated (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
if (gtr_tab_go_to_next_untrans (current))
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -124,7 +124,7 @@ gtr_message_go_to_prev_untranslated (GtkAction * action, GtrWindow * window)
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
if (gtr_tab_go_to_prev_untrans (current))
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -137,7 +137,7 @@ gtr_message_go_to_next_fuzzy_or_untranslated (GtkAction * action,
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
if (gtr_tab_go_to_next_fuzzy_or_untrans (current))
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
@@ -150,7 +150,7 @@ gtr_message_go_to_prev_fuzzy_or_untranslated (GtkAction * action,
current = gtr_window_get_active_tab (window);
po = gtr_tab_get_po (current);
if (gtr_tab_go_to_prev_fuzzy_or_untrans (current))
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
void
diff --git a/src/gtr-window.c b/src/gtr-window.c
index 7a1f7b3..d93b485 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -545,7 +545,8 @@ remove_widget (GtrWindow * window, GtkWidget * widget, GError ** error)
}
void
-set_sensitive_according_to_message (GtrWindow * window, GtrPo * po)
+_gtr_window_set_sensitive_according_to_message (GtrWindow * window,
+ GtrPo * po)
{
GList *current;
GtkAction *action;
@@ -657,10 +658,10 @@ set_sensitive_according_to_tab (GtrWindow * window, GtrTab * tab)
"DocumentsNextDocument");
gtk_action_set_sensitive (action, current_page < pages - 1);
- set_sensitive_according_to_message (window, po);
+ _gtr_window_set_sensitive_according_to_message (window, po);
}
-void
+static void
set_sensitive_according_to_window (GtrWindow * window)
{
gint pages;
@@ -1153,7 +1154,7 @@ showed_message_cb (GtrTab * tab, GtrMsg * msg, GtrWindow * window)
gtr_window_update_statusbar_message_count (tab, msg, window);
- set_sensitive_according_to_message (window, gtr_tab_get_po (tab));
+ _gtr_window_set_sensitive_according_to_message (window, gtr_tab_get_po (tab));
}
static void
diff --git a/src/gtr-window.h b/src/gtr-window.h
index dff451b..b942917 100644
--- a/src/gtr-window.h
+++ b/src/gtr-window.h
@@ -111,12 +111,6 @@ GtrHeader * gtr_window_get_header_from_active_tab (GtrWindow * window);
gboolean original, gboolean translated);
void
- set_sensitive_according_to_message (GtrWindow * window, GtrPo * po);
-
- void
- set_sensitive_according_to_window (GtrWindow * window);
-
- void
gtr_window_add_widget (GtrWindow * window,
GtkWidget * widget,
const gchar * name,
@@ -146,5 +140,10 @@ GtrHeader * gtr_window_get_header_from_active_tab (GtrWindow * window);
_gtr_recent_add (GtrWindow * window,
GFile * location, gchar * project_id);
+/* FIXME: this is wrong. we should have some signal in the po and set this and
+ have this as private api */
+void _gtr_window_set_sensitive_according_to_message (GtrWindow * window,
+ GtrPo * po);
+
G_END_DECLS
#endif /* __WINDOW_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]