libtomoe-gtk-0.6.0-gucharmap2.patch 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. ---
  2. Update libtomoe-gtk to gucharmap-2 API
  3. https://bugs.gentoo.org/show_bug.cgi?id=243160
  4. Makefile.am | 1
  5. bindings/python/Makefile.am | 5 ++-
  6. configure.ac | 14 +++++---
  7. src/tomoe-gucharmap.c | 71 +++++++++++++++++++++++++++++++++++++++-----
  8. 4 files changed, 78 insertions(+), 13 deletions(-)
  9. --- a/Makefile.am 2007-06-07 14:36:06.000000000 +0900
  10. +++ b/Makefile.am 2008-12-21 01:24:06.000000000 +0900
  11. @@ -1,3 +1,4 @@
  12. +ACLOCAL_AMFLAGS = -I macros
  13. SUBDIRS=src data po test doc bindings
  14. EXTRA_DIST = autogen.sh tomoe-gtk.pc
  15. --- a/configure.ac 2007-06-12 17:17:23.000000000 +0900
  16. +++ b/configure.ac 2008-12-21 01:08:16.000000000 +0900
  17. @@ -94,6 +94,9 @@
  18. AC_SUBST(TOMOE_CFLAGS)
  19. AC_SUBST(TOMOE_LIBS)
  20. +TOMOE_GTK_REQUIRED_LIBS="tomoe >= 0.4.0 gtk+-2.0 >= 2.4.0"
  21. +AC_SUBST(TOMOE_GTK_REQUIRED_LIBS)
  22. +
  23. # Checks for gucharmap
  24. AC_ARG_WITH(gucharmap,
  25. AS_HELP_STRING([--with-gucharmap],
  26. @@ -102,14 +105,15 @@
  27. [use_gucharmap=yes])
  28. if test x"$use_gucharmap" = "xyes"; then
  29. # Checks for gucharmap
  30. - PKG_CHECK_MODULES(GUCHARMAP, [gucharmap >= 1.4.0])
  31. - TOMOE_GTK_REQUIRED_LIBS="tomoe >= 0.4.0 gtk+-2.0 >= 2.4.0 gucharmap >= 1.4.0"
  32. -else
  33. - TOMOE_GTK_REQUIRED_LIBS="tomoe >= 0.4.0 gtk+-2.0 >= 2.4.0"
  34. + PKG_CHECK_EXISTS(gucharmap-2,
  35. + [PKG_CHECK_MODULES(GUCHARMAP, [gucharmap-2],
  36. + [gucharmap_lib="gucharmap-2"])],
  37. + [PKG_CHECK_MODULES(GUCHARMAP, [gucharmap >= 1.4.0],
  38. + [gucharmap_lib="gucharmap >= 1.4.0"])])
  39. + TOMOE_GTK_REQUIRED_LIBS="$TOMOE_GTK_REQUIRED_LIBS $gucharmap_lib"
  40. fi
  41. AC_SUBST(GUCHARMAP_CFLAGS)
  42. AC_SUBST(GUCHARMAP_LIBS)
  43. -AC_SUBST(TOMOE_GTK_REQUIRED_LIBS)
  44. AM_CONDITIONAL([USE_GUCHARMAP], [test x"$use_gucharmap" = "xyes"])
  45. # Check for pygtk
  46. --- a/src/tomoe-gucharmap.c 2007-04-27 14:41:40.000000000 +0900
  47. +++ b/src/tomoe-gucharmap.c 2008-12-21 01:08:16.000000000 +0900
  48. @@ -34,7 +34,11 @@
  49. {
  50. GtkWidget *chapters_type_combobox;
  51. GtkWidget *chapters_combobox;
  52. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  53. GucharmapChapters *chapters;
  54. +#else
  55. + GucharmapChaptersModel *chapters_model;
  56. +#endif
  57. GucharmapCharmap *charmap;
  58. gchar *selected;
  59. };
  60. @@ -120,14 +124,24 @@
  61. gtk_widget_show (combobox);
  62. /* gucharmap */
  63. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  64. priv->chapters = GUCHARMAP_CHAPTERS (gucharmap_block_chapters_new ());
  65. priv->charmap = GUCHARMAP_CHARMAP (gucharmap_charmap_new (priv->chapters));
  66. +#else
  67. + priv->chapters_model = gucharmap_block_chapters_model_new ();
  68. + priv->charmap = GUCHARMAP_CHARMAP (gucharmap_charmap_new ());
  69. + gucharmap_charmap_set_chapters_model (priv->charmap, priv->chapters_model);
  70. +#endif
  71. widget = GTK_WIDGET (priv->charmap);
  72. gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 2);
  73. gtk_widget_show (widget);
  74. /* Hide chapters page by default. Usually use combo box instead. */
  75. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  76. gtk_widget_hide (GTK_WIDGET (priv->chapters));
  77. +#else
  78. + gucharmap_charmap_set_chapters_visible (priv->charmap, FALSE);
  79. +#endif
  80. #if 0
  81. /* CharDetails view will be here */
  82. @@ -146,10 +160,11 @@
  83. g_signal_connect (G_OBJECT (priv->chapters_combobox), "changed",
  84. G_CALLBACK (on_chapters_combo_changed),
  85. (gpointer) page);
  86. - g_signal_connect (G_OBJECT (priv->charmap->chartable), "activate",
  87. + g_signal_connect (G_OBJECT (gucharmap_charmap_get_chartable (priv->charmap)),
  88. + "activate",
  89. G_CALLBACK (on_gucharmap_activate),
  90. (gpointer) page);
  91. - g_signal_connect (G_OBJECT (priv->charmap->chartable),
  92. + g_signal_connect (G_OBJECT (gucharmap_charmap_get_chartable (priv->charmap)),
  93. "button-release-event",
  94. G_CALLBACK (on_gucharmap_button_release),
  95. (gpointer) page);
  96. @@ -162,7 +177,11 @@
  97. priv->chapters_type_combobox = NULL;
  98. priv->chapters_combobox = NULL;
  99. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  100. priv->chapters = NULL;
  101. +#else
  102. + priv->chapters_model = NULL;
  103. +#endif
  104. priv->charmap = NULL;
  105. if (priv->selected) {
  106. g_free (priv->selected);
  107. @@ -188,7 +207,11 @@
  108. tomoe_gucharmap_get_selected_char (TomoeGucharmap *page)
  109. {
  110. TomoeGucharmapPrivate *priv;
  111. +#ifdef GUCHARMAP_TABLE
  112. GucharmapTable *table;
  113. +#else
  114. + GucharmapChartable *table;
  115. +#endif
  116. gunichar c;
  117. gchar buf[7];
  118. gint bytes;
  119. @@ -196,9 +219,17 @@
  120. g_return_val_if_fail (TOMOE_IS_GUCHARMAP (page), NULL);
  121. priv = TOMOE_GUCHARMAP_GET_PRIVATE (page);
  122. +#ifdef GUCHARMAP_TABLE
  123. table = GUCHARMAP_TABLE (priv->charmap->chartable);
  124. +#else
  125. + table = gucharmap_charmap_get_chartable (priv->charmap);
  126. +#endif
  127. +#ifdef GUCHARMAP_TABLE
  128. c = gucharmap_table_get_active_character (table);
  129. +#else
  130. + c = gucharmap_chartable_get_active_character (table);
  131. +#endif
  132. bytes = g_unichar_to_utf8(c, buf);
  133. if (bytes > 0 && bytes < 7) {
  134. @@ -222,7 +253,13 @@
  135. setup_chapters_combo_box (TomoeGucharmap *page)
  136. {
  137. TomoeGucharmapPrivate *priv = TOMOE_GUCHARMAP_GET_PRIVATE (page);
  138. - GtkTreeModel *model = priv->chapters->tree_model;
  139. + GtkTreeModel *model;
  140. +
  141. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  142. + model = priv->chapters->tree_model;
  143. +#else
  144. + model = GTK_TREE_MODEL (priv->chapters_model);
  145. +#endif
  146. gtk_combo_box_set_model (GTK_COMBO_BOX (priv->chapters_combobox), model);
  147. gtk_combo_box_set_active (GTK_COMBO_BOX (priv->chapters_combobox), 0);
  148. @@ -235,12 +272,26 @@
  149. TomoeGucharmapPrivate *priv = TOMOE_GUCHARMAP_GET_PRIVATE (page);
  150. gint idx = gtk_combo_box_get_active (combobox);
  151. - if (idx == 1)
  152. + if (idx == 1) {
  153. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  154. priv->chapters = GUCHARMAP_CHAPTERS (gucharmap_script_chapters_new ());
  155. - else
  156. +#else
  157. + priv->chapters_model = gucharmap_script_chapters_model_new ();
  158. +#endif
  159. + } else {
  160. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  161. priv->chapters = GUCHARMAP_CHAPTERS (gucharmap_block_chapters_new ());
  162. +#else
  163. + priv->chapters_model = gucharmap_block_chapters_model_new ();
  164. +#endif
  165. + }
  166. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  167. gucharmap_charmap_set_chapters (priv->charmap, priv->chapters);
  168. gtk_widget_hide (GTK_WIDGET (priv->chapters));
  169. +#else
  170. + gucharmap_charmap_set_chapters_model (priv->charmap, priv->chapters_model);
  171. + gucharmap_charmap_set_chapters_visible (priv->charmap, FALSE);
  172. +#endif
  173. setup_chapters_combo_box (page);
  174. }
  175. @@ -249,6 +300,7 @@
  176. {
  177. TomoeGucharmap *page = data;
  178. TomoeGucharmapPrivate *priv = TOMOE_GUCHARMAP_GET_PRIVATE (page);
  179. + GtkTreeView *tree_view;
  180. GtkTreePath *path;
  181. gchar buf[8];
  182. gint idx;
  183. @@ -256,8 +308,13 @@
  184. idx = gtk_combo_box_get_active (combobox);
  185. g_snprintf (buf, 8 , "%d", idx);
  186. path = gtk_tree_path_new_from_string (buf);
  187. - gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->chapters->tree_view),
  188. - path, NULL, FALSE);
  189. +#ifdef GUCHARMAP_TYPE_CHAPTERS
  190. + tree_view = GTK_TREE_VIEW (priv->chapters->tree_view);
  191. +#else
  192. + tree_view =
  193. + GTK_TREE_VIEW (gucharmap_charmap_get_chapters_view (priv->charmap));
  194. +#endif
  195. + gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
  196. gtk_tree_path_free (path);
  197. }
  198. --- a/bindings/python/Makefile.am
  199. +++ b/bindings/python/Makefile.am
  200. @@ -6,6 +6,7 @@
  201. $(PYTHON_CFLAGS) \
  202. $(PYGOBJECT_CFLAGS) \
  203. $(PYGTK_CFLAGS) \
  204. + $(GUCHARMAP_CFLAGS) \
  205. $(GTK2_CFLAGS) \
  206. $(TOMOE_CFLAGS) \
  207. -I$(top_srcdir)/src \
  208. @@ -21,11 +22,13 @@
  209. -module \
  210. -avoid-version \
  211. $(TOMOE_LDFLAGS) \
  212. - $(PYTHON_LDFLAGS)
  213. + $(PYTHON_LDFLAGS) \
  214. + $(GUCHARMAP_LDFLAGS)
  215. tomoegtk_la_LIBADD = \
  216. $(TOMOE_LIBS) \
  217. $(PYGTK_LIBS) \
  218. + $(GUCHARMAP_LIBS) \
  219. $(top_builddir)/src/libtomoe-gtk.la
  220. OVERRIDES = \
  221. --- a/doc/reference/Makefile.am 2009-03-09 23:53:04.000000000 +0100
  222. +++ b/doc/reference/Makefile.am 2009-03-09 23:52:30.000000000 +0100
  223. @@ -27,10 +27,12 @@
  224. -I$(top_srcdir)/src \
  225. -I$(top_builddir)/src \
  226. $(TOMOE_CFLAGS) \
  227. + $(GUCHARMAP_CFLAGS) \
  228. $(GTK2_CFLAGS)
  229. GTKDOC_LIBS = \
  230. $(top_builddir)/src/libtomoe-gtk.la \
  231. $(TOMOE_LIBS) \
  232. + $(GUCHARMAP_LIBS) \
  233. $(GTK2_LIBS)
  234. # Extra options to supply to gtkdoc-mkdb