Revision: 6946
Author: nogu.dev
Date: Sat Feb 12 18:54:50 2011
Log: * configure.ac
- Add "--enable-gnome3-applet".
* gtk3/toolbar/Makefile.am
- Add GNOME applet without bonobo.
* gtk3/toolbar/toolbar-applet-gnome3.c
- New file.
http://code.google.com/p/uim/source/detail?r=6946
Added:
/trunk/gtk3/toolbar/toolbar-applet-gnome3.c
Modified:
/trunk/configure.ac
/trunk/gtk3/toolbar/Makefile.am
=======================================
--- /dev/null
+++ /trunk/gtk3/toolbar/toolbar-applet-gnome3.c Sat Feb 12 18:54:50 2011
@@ -0,0 +1,183 @@
+/*
+
+ Copyright (c) 2003-2011 uim Project http://code.google.com/p/uim/
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of authors nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <panel-applet.h>
+#include <uim/uim.h>
+#include <uim/gettext.h>
+
+PanelApplet *uimapplet;
+
+static void exec_switcher(GtkAction *action, gpointer data);
+static void exec_pref(GtkAction *action, gpointer data);
+static void exec_dic(GtkAction *action, gpointer data);
+static void exec_pad(GtkAction *action, gpointer data);
+static void exec_hand(GtkAction *action, gpointer data);
+static void exec_help(GtkAction *action, gpointer data);
+static void display_about_dialog(GtkAction *action, gpointer data);
+
+extern GtkWidget *uim_toolbar_applet_new(void);
+
+
+static const GtkActionEntry uim_menu_actions[] = {
+ {"Switcher", UIM_PIXMAPSDIR"/im_switcher.png",
+ N_("Switch input method"), NULL, NULL, G_CALLBACK(exec_switcher)},
+ {"Pref", GTK_STOCK_PREFERENCES,
+ N_("Preference"), NULL, NULL, G_CALLBACK(exec_pref)},
+ {"Dic", UIM_PIXMAPSDIR"/uim-dict.png",
+ N_("Japanese dictionary editor"), NULL, NULL, G_CALLBACK(exec_dic)},
+ {"Pad", GTK_STOCK_BOLD,
+ N_("Input pad"), NULL, NULL, G_CALLBACK(exec_pad)},
+ {"Hand", GTK_STOCK_EDIT,
+ N_("Handwriting input pad"), NULL, NULL, G_CALLBACK(exec_hand)},
+ {"Help", GTK_STOCK_HELP,
+ N_("Help"), NULL, NULL, G_CALLBACK(exec_help)},
+ {"About", GTK_STOCK_ABOUT,
+ N_("About ..."), NULL, NULL, G_CALLBACK(display_about_dialog)}
+};
+
+static const char uim_menu_xml[] =
+ "<menuitem action=\"Switcher\"/>"
+ "<menuitem action=\"Pref\"/>"
+ "<menuitem action=\"Dic\"/>"
+ "<menuitem action=\"Pad\"/>"
+ "<menuitem action=\"Hand\"/>"
+ "<menuitem action=\"Help\"/>"
+ "<menuitem action=\"About\"/>";
+
+static void
+exec_switcher(GtkAction *action, gpointer data)
+{
+ system("uim-im-switcher-gtk &");
+}
+
+static void
+exec_pref(GtkAction *action, gpointer data)
+{
+ system("uim-pref-gtk &");
+}
+
+static void
+exec_dic(GtkAction *action, gpointer data)
+{
+ system("uim-dict-gtk &");
+}
+
+static void
+exec_pad(GtkAction *action, gpointer data)
+{
+ system("uim-input-pad-ja &");
+}
+
+static void
+exec_hand(GtkAction *action, gpointer data)
+{
+ system("uim-tomoe-gtk &");
+}
+
+static void
+exec_help(GtkAction *uic, gpointer data)
+{
+ system("uim-help &");
+}
+
+/* Just the about window... If it's already open, just focus it */
+static void
+display_about_dialog(GtkAction *action, gpointer data)
+{
+ GdkPixbuf *icon = NULL;
+ const gchar *authors[] = {"uim Project", NULL};
+ /* Feel free to put your names here translators */
+ gchar *translators = _("TRANSLATORS");
+ icon = gdk_pixbuf_new_from_file(UIM_PIXMAPSDIR "/uim-icon.png", NULL);
+
+ gtk_show_about_dialog(NULL,
+ "program-name", _("uim Applet"),
+ "version", VERSION,
+ "copyright", "Copyright \xc2\xa9 2003-2011 uim
Project.",
+ "comments", _("Applet for indicating uim's status"),
+ "authors", authors,
+ "translator-credits",
+ strcmp("TRANSLATORS", translators) ? translators
+ : NULL,
+ "icon", icon,
+ "logo", icon, NULL);
+
+ if (icon) {
+ g_object_unref(icon);
+ }
+}
+
+static gboolean
+uim_applet_new(PanelApplet *applet, const gchar *iid, gpointer data)
+{
+ GtkWidget *toolbar;
+ GtkActionGroup *action_group;
+
+ uimapplet = applet;
+
+ if (strcmp(iid, "UimApplet") != 0)
+ return FALSE;
+
+ uim_init();
+
+ toolbar = (GtkWidget*)uim_toolbar_applet_new();
+
+ gtk_container_add(GTK_CONTAINER(applet), toolbar);
+
+ gtk_widget_show_all(GTK_WIDGET(applet));
+
+ action_group = gtk_action_group_new("uim Applet Actions");
+ gtk_action_group_add_actions(action_group, uim_menu_actions,
+ G_N_ELEMENTS(uim_menu_actions), toolbar);
+ panel_applet_setup_menu(applet, uim_menu_xml, action_group);
+#if LIBPANEL_APPLET_HAVE_SET_BACKGROUND_WIDGET
+ panel_applet_set_background_widget(applet, GTK_WIDGET(applet));
+#endif
+
+ return TRUE;
+}
+
+
+
+PANEL_APPLET_OUT_PROCESS_FACTORY("UimAppletFactory",
+ PANEL_TYPE_APPLET,
+ "uim Applet for GNOME",
+ (PanelAppletFactoryCallback)uim_applet_new,
+ NULL)
=======================================
--- /trunk/configure.ac Sat Feb 12 18:27:10 2011
+++ /trunk/configure.ac Sat Feb 12 18:54:50 2011
@@ -799,6 +799,7 @@
localedir=$LOCALEDIR
AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [locale dir])
AC_DEFINE_UNQUOTED(GNOMELOCALEDIR, "$LOCALEDIR", [locale dir for gnome])
+AC_DEFINE_UNQUOTED(GNOME3LOCALEDIR, "$LOCALEDIR", [locale dir for gnome3])
# define XLIB directory for Compose file
if test "x$x11_use_new_dir" = "xyes"; then
AC_DEFINE_UNQUOTED(XLIB_DIR, "`$PKG_CONFIG x11
--variable=prefix`/share", [X11 Library Directory])
@@ -874,6 +875,23 @@
PKG_CHECK_MODULES(GTK3, gtk+-3.0, use_gtk3="yes",use_gtk3="no")
])
+AC_ARG_ENABLE(gnome3-applet,
+ AC_HELP_STRING([--enable-gnome3-applet],
+ [enable uim applet for Gnome3 panel
+ @<:@default=no@:>@]),
+ [
+ case $enable_gnome3_applet in
+ no)
+ use_applet_gnome3="no"
+ ;;
+ yes|*)
+ PKG_CHECK_MODULES(APPLET_GNOME3, libpanelapplet-3.0,
use_applet_gnome3="yes",use_applet_gnome3="no")
+ ;;
+ esac
+ ],
+ [
+ PKG_CHECK_MODULES(APPLET_GNOME3, libpanelapplet-3.0,
use_applet_gnome3="yes",use_applet_gnome3="no")
+ ])
dnl ****************************
dnl *** Check for Qt Library ***
@@ -1216,6 +1234,7 @@
AM_CONDITIONAL(DEFAULT_TOOLKIT_QT, test x$default_toolkit = xqt)
AM_CONDITIONAL(DEFAULT_TOOLKIT_QT4, test x$default_toolkit = xqt4)
AM_CONDITIONAL(APPLET_GNOME, test x$use_applet_gnome = xyes)
+AM_CONDITIONAL(APPLET_GNOME3, test x$use_applet_gnome3 = xyes)
AM_CONDITIONAL(UIM_FEP, test x$use_uim_fep = xyes)
AM_CONDITIONAL(UIM_EL, test x$use_uim_el = xyes)
AM_CONDITIONAL(XIM, test x$use_xim = xyes)
@@ -1982,8 +2001,9 @@
SQLite3 : ${use_sqlite3}
ffi : ${use_ffi}
Gtk+ : ${use_gtk2}
- Gtk+3 : ${use_gtk3}
Gnome Applet : ${use_applet_gnome}
+ Gtk+3 : ${use_gtk3}
+ Gnome3 Applet : ${use_applet_gnome3}
Qt3 : ${use_qt}
Qt3 immodule : ${use_qtimmodule}
Qt4 : ${use_qt4}
=======================================
--- /trunk/gtk3/toolbar/Makefile.am Fri Feb 11 19:07:35 2011
+++ /trunk/gtk3/toolbar/Makefile.am Sat Feb 12 18:54:50 2011
@@ -1,3 +1,23 @@
+if APPLET_GNOME3
+
+helper_defs = -DUIM_DATADIR=\""$(datadir)/@PACKAGE@"\"
+
+libexec_PROGRAMS = uim-toolbar-applet-gnome3
+
+uim_toolbar_applet_gnome3_LDADD = @GTK2_LIBS@ @APPLET_GNOME3_LIBS@ \
+ $(top_builddir)/uim/libuim-scm.la \
+ $(top_builddir)/uim/libuim.la \
+ $(top_builddir)/uim/libuim-custom.la
+uim_toolbar_applet_gnome3_CPPFLAGS = \
+ $(helper_defs) -I$(top_srcdir) -I$(top_builddir)
+
+uim_toolbar_applet_gnome3_CFLAGS = @GTK2_CFLAGS@ @APPLET_GNOME3_CFLAGS@
+
+uim_toolbar_applet_gnome3_SOURCES = toolbar-applet-gnome3.c \
+ ../../helper/toolbar-common-gtk.c
+
+endif
+
if GTK3
bin_PROGRAMS = uim-toolbar-gtk3
uim_toolbar_gtk3_SOURCES = ../../helper/toolbar-standalone-gtk.c \