Beispiel #1
0
void init_keypad_layout()
{
	// do we have qwerty
	if (!get_current_device()->has_qwerty)
		return;

	//clear it 
	
	memset(qwerty_layout.normal, 0, KEY_MAX+1);
	memset(qwerty_layout.shifted, 0, KEY_MAX+1);
	memset(qwerty_layout.alternate, 0, KEY_MAX+1);

	// which layout
	if (!strcmp(get_current_device()->model, "XT897"))
		xt897_characters_init();
	else if (!strcmp(get_current_device()->model, "A953"))
		a953_characters_init();

	//capslock LED

	// do we have capslock LED
	if (!get_current_device()->has_capslock_led)
		return;

	capslock_led = fopen(CAPSLOCK_BACKLIGHT_FILE, "w");
	if (capslock_led == NULL)
		fprintf(stderr, "Could not open Caps Lock LED.\n");
	else
	{
		fwrite("0\n", 1, strlen("0\n"), capslock_led);
		fflush(capslock_led);
	}
}
static void 
gpcap_devices_delete (GtkWidget *widget, gpointer user_data)
{
	GnomePilotCapplet *gpcap = GNOME_PILOT_CAPPLET (user_data);
	GnomePilotCappletPrivate *priv;
	GtkWidget *dlg;
	GPilotDevice *device;
	GtkTreeIter iter;
	
	priv = gpcap->priv;
	
	device = get_current_device (gpcap, &iter);

	dlg = gtk_message_dialog_new (GTK_WINDOW (gpcap), GTK_DIALOG_DESTROY_WITH_PARENT, 
				      GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
				      _("Are you sure you want to delete %s device?"), device->name);

	if (gtk_dialog_run (GTK_DIALOG (dlg)) == GTK_RESPONSE_YES) {
		gtk_list_store_remove (GTK_LIST_STORE (priv->devices_model),
				       &iter);
		priv->state->devices = g_list_remove (priv->state->devices, device);
		gpcap_save_state (gpcap);
	}

	gtk_widget_destroy (dlg);
	
	check_devices_buttons (gpcap);
}
static void 
gpcap_devices_edit (GtkWidget *widget, gpointer user_data)
{
	GnomePilotCapplet *gpcap = GNOME_PILOT_CAPPLET (user_data);
	GnomePilotCappletPrivate *priv;
	GObject *dlg;
	GPilotDevice *device;
	GtkTreeIter iter;
	gboolean res;
	
	priv = gpcap->priv;
	
	device = get_current_device (gpcap, &iter);

	dlg = gnome_pilot_ddialog_new (device);
	res = gnome_pilot_ddialog_run_and_close (GNOME_PILOT_DDIALOG (dlg), GTK_WINDOW (gpcap));
 
	if (res) {
		gtk_list_store_set (GTK_LIST_STORE (priv->devices_model), &iter,
				    0, device->name,
				    1, device_type_to_str (device->type),
				    -1);
		
		gpcap_save_state (gpcap);
	}
}
Beispiel #4
0
int menu_handle_key(int key_code, int visible)
{
	if (visible) 
	{
		switch (key_code) 
		{
			case KEY_DOWN:
			case KEY_VOLUMEDOWN:
				return HIGHLIGHT_DOWN;

			case KEY_UP:
			case KEY_VOLUMEUP:
				return HIGHLIGHT_UP;

			case KEY_REPLY:
			case KEY_CAMERA:
			case KEY_ENTER:
				return SELECT_ITEM;

			case KEY_POWER:
				if (!get_current_device()->has_camera_key)
					return SELECT_ITEM;
				break;
		}
	}

	return NO_ACTION;
}
Beispiel #5
0
void toggle_capslock_state()
{
	capslock_on = !capslock_on;

	if (!get_current_device()->has_capslock_led)
		return;

	if (capslock_led != NULL)
	{
		if (capslock_on)
			fwrite("255\n", 1, strlen("255\n"), capslock_led);
		else
			fwrite("0\n", 1, strlen("0\n"), capslock_led);

		fflush(capslock_led);
	}

}