File: applet.c

package info (click to toggle)
matchbox-keyboard 0.1%2Bsvn20080916-11
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,048 kB
  • ctags: 539
  • sloc: ansic: 3,950; xml: 1,778; makefile: 85; sh: 2
file content (48 lines) | stat: -rw-r--r-- 1,476 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * keyboard - Tray applet to toggle matchbox-keyboard's visibility
 *
 * Copyright (C) 2007 OpenedHand Ltd.
 *
 * Authors:
 *  Ross Burton <ross@openedhand.com>
 *  Stefan Schmidt <stefan@openmoko.org>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; version 2 of the license.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 */

#include <gtk/gtk.h>
#include <matchbox-panel/mb-panel.h>
#include <matchbox-panel/mb-panel-scaling-image.h>
#include <gtk-im/im-protocol.h>

static void
on_toggled (GtkWidget *event_box, GdkEventButton *event, gpointer user_data)
{
  protocol_send_event (MBKeyboardRemoteToggle);
}

G_MODULE_EXPORT GtkWidget *
mb_panel_applet_create (const char *id, GtkOrientation orientation)
{
  GtkWidget *box, *image;

  box = gtk_event_box_new ();
  gtk_event_box_set_visible_window (GTK_EVENT_BOX (box), FALSE);
  gtk_widget_set_name (box, "MatchboxPanelKeyboard");

  image = mb_panel_scaling_image_new (orientation, "matchbox-keyboard");
  gtk_container_add (GTK_CONTAINER (box), image);

  g_signal_connect (box, "button-release-event", G_CALLBACK (on_toggled), NULL);

  gtk_widget_show_all (box);

  return box;
}