eekboard: use libnotify to display notification.
This commit is contained in:
@ -45,6 +45,8 @@ PKG_CHECK_MODULES([LIBFAKEKEY], [libfakekey], ,
|
|||||||
[AC_MSG_ERROR([libfakekey not found])])
|
[AC_MSG_ERROR([libfakekey not found])])
|
||||||
PKG_CHECK_MODULES([CSPI], [cspi-1.0], ,
|
PKG_CHECK_MODULES([CSPI], [cspi-1.0], ,
|
||||||
[AC_MSG_ERROR([AT-SPI C not found])])
|
[AC_MSG_ERROR([AT-SPI C not found])])
|
||||||
|
PKG_CHECK_MODULES([NOTIFY], [libnotify], ,
|
||||||
|
[AC_MSG_ERROR([libnotify not found])])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether you enable Vala language support])
|
AC_MSG_CHECKING([whether you enable Vala language support])
|
||||||
AC_ARG_ENABLE(vala,
|
AC_ARG_ENABLE(vala,
|
||||||
|
|||||||
@ -26,7 +26,8 @@ eekboard_CFLAGS = \
|
|||||||
$(XKB_CFLAGS) \
|
$(XKB_CFLAGS) \
|
||||||
$(LIBXKLAVIER_CFLAGS) \
|
$(LIBXKLAVIER_CFLAGS) \
|
||||||
$(LIBFAKEKEY_CFLAGS) \
|
$(LIBFAKEKEY_CFLAGS) \
|
||||||
$(CSPI_CFLAGS)
|
$(CSPI_CFLAGS) \
|
||||||
|
$(NOTIFY_CFLAGS)
|
||||||
|
|
||||||
eekboard_LDFLAGS = \
|
eekboard_LDFLAGS = \
|
||||||
$(top_builddir)/eek/libeek.la \
|
$(top_builddir)/eek/libeek.la \
|
||||||
@ -38,7 +39,8 @@ eekboard_LDFLAGS = \
|
|||||||
$(XKB_LIBS) \
|
$(XKB_LIBS) \
|
||||||
$(LIBXKLAVIER_LIBS) \
|
$(LIBXKLAVIER_LIBS) \
|
||||||
$(LIBFAKEKEY_LIBS) \
|
$(LIBFAKEKEY_LIBS) \
|
||||||
$(CSPI_LIBS)
|
$(CSPI_LIBS) \
|
||||||
|
$(NOTIFY_LIBS)
|
||||||
|
|
||||||
if HAVE_CLUTTER
|
if HAVE_CLUTTER
|
||||||
eekboard_CFLAGS += $(CLUTTER_CFLAGS) $(CLUTTER_GTK_CFLAGS)
|
eekboard_CFLAGS += $(CLUTTER_CFLAGS) $(CLUTTER_GTK_CFLAGS)
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
#include <libxklavier/xklavier.h>
|
#include <libxklavier/xklavier.h>
|
||||||
#include <fakekey/fakekey.h>
|
#include <fakekey/fakekey.h>
|
||||||
#include <cspi/spi.h>
|
#include <cspi/spi.h>
|
||||||
|
#include <libnotify/notify.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -81,6 +82,7 @@ struct _Eekboard {
|
|||||||
gboolean accessibility_enabled;
|
gboolean accessibility_enabled;
|
||||||
Display *display;
|
Display *display;
|
||||||
FakeKey *fakekey;
|
FakeKey *fakekey;
|
||||||
|
GConfClient *gconfc;
|
||||||
GtkWidget *widget, *window;
|
GtkWidget *widget, *window;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
XklEngine *engine;
|
XklEngine *engine;
|
||||||
@ -1161,6 +1163,20 @@ print_option_group (XklConfigRegistry *registry,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_notify_never_show (NotifyNotification *notification,
|
||||||
|
char *action,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
Eekboard *eekboard = user_data;
|
||||||
|
GError *error;
|
||||||
|
|
||||||
|
gconf_client_set_bool (eekboard->gconfc,
|
||||||
|
"/apps/eekboard/inhibit-startup-notify",
|
||||||
|
TRUE,
|
||||||
|
&error);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -1170,8 +1186,8 @@ main (int argc, char *argv[])
|
|||||||
gboolean accessibility_enabled = FALSE;
|
gboolean accessibility_enabled = FALSE;
|
||||||
Eekboard *eekboard;
|
Eekboard *eekboard;
|
||||||
GtkWidget *widget, *vbox, *menubar, *window;
|
GtkWidget *widget, *vbox, *menubar, *window;
|
||||||
GConfClient *gconfc;
|
|
||||||
GOptionContext *context;
|
GOptionContext *context;
|
||||||
|
GConfClient *gconfc;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
context = g_option_context_new ("eekboard");
|
context = g_option_context_new ("eekboard");
|
||||||
@ -1189,6 +1205,7 @@ main (int argc, char *argv[])
|
|||||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
gconfc = gconf_client_get_default ();
|
gconfc = gconf_client_get_default ();
|
||||||
if (gconf_client_get_bool (gconfc,
|
if (gconf_client_get_bool (gconfc,
|
||||||
"/desktop/gnome/interface/accessibility",
|
"/desktop/gnome/interface/accessibility",
|
||||||
@ -1274,13 +1291,35 @@ main (int argc, char *argv[])
|
|||||||
gtk_widget_show_all (window);
|
gtk_widget_show_all (window);
|
||||||
gtk_widget_set_size_request (widget, -1, -1);
|
gtk_widget_set_size_request (widget, -1, -1);
|
||||||
|
|
||||||
|
notify_init ("eekboard");
|
||||||
eekboard->window = window;
|
eekboard->window = window;
|
||||||
|
eekboard->gconfc = gconfc;
|
||||||
if (eekboard->accessibility_enabled) {
|
if (eekboard->accessibility_enabled) {
|
||||||
fprintf (stderr,
|
NotifyNotification *notification;
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
|
if (!gconf_client_get_bool (eekboard->gconfc,
|
||||||
|
"/apps/eekboard/inhibit-startup-notify",
|
||||||
|
&error)) {
|
||||||
|
notification = notify_notification_new
|
||||||
|
("eekboard started in background",
|
||||||
"As GNOME accessibility support enabled, "
|
"As GNOME accessibility support enabled, "
|
||||||
"eekboard is starting without a window.\n"
|
"eekboard is starting without a window.\n"
|
||||||
"To make eekboard show up, click on some window with "
|
"To make eekboard show up, click on some window with "
|
||||||
"an editable widget.\n");
|
"an editable widget.",
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
notify_notification_add_action
|
||||||
|
(notification,
|
||||||
|
"dont-ask",
|
||||||
|
"Don't show up",
|
||||||
|
NOTIFY_ACTION_CALLBACK(on_notify_never_show),
|
||||||
|
eekboard,
|
||||||
|
NULL);
|
||||||
|
error = NULL;
|
||||||
|
notify_notification_show (notification, &error);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_hide (window);
|
gtk_widget_hide (window);
|
||||||
|
|
||||||
focusListener = SPI_createAccessibleEventListener (a11y_focus_listener,
|
focusListener = SPI_createAccessibleEventListener (a11y_focus_listener,
|
||||||
|
|||||||
Reference in New Issue
Block a user