[maemo-commits] [maemo-commits] r14617 - in projects/haf/trunk/hildon-input-method: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Oct 25 15:41:45 EEST 2007
- Previous message: [maemo-commits] r14616 - in projects/haf/trunk/dbus/debian: . patches
- Next message: [maemo-commits] r14618 - in projects/haf/trunk/dbus/debian: . patches
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: tjunnone Date: 2007-10-25 15:41:43 +0300 (Thu, 25 Oct 2007) New Revision: 14617 Modified: projects/haf/trunk/hildon-input-method/ChangeLog projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.c projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.h projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c projects/haf/trunk/hildon-input-method/src/hildon-im-ui.h Log: 2007-10-25 Tomas Junnonen <tomas.junnonen at nokia.com> * src/hildon-im-plugin.[c,h]: - New hildon_im_plugin_button_activated API deprecates hildon_im_plugin_mode_a and hildon_im_plugin_mode_b * src/hildon-im-ui.[c,h]: - Added hildon_im_ui_button_set_long_press API - Introduced HildonIMButton type for common buttons - Added plugin callback for every common button activation Modified: projects/haf/trunk/hildon-input-method/ChangeLog =================================================================== --- projects/haf/trunk/hildon-input-method/ChangeLog 2007-10-25 11:23:25 UTC (rev 14616) +++ projects/haf/trunk/hildon-input-method/ChangeLog 2007-10-25 12:41:43 UTC (rev 14617) @@ -1,3 +1,13 @@ +2007-10-25 Tomas Junnonen <tomas.junnonen at nokia.com> + + * src/hildon-im-plugin.[c,h]: + - New hildon_im_plugin_button_activated API deprecates + hildon_im_plugin_mode_a and hildon_im_plugin_mode_b + * src/hildon-im-ui.[c,h]: + - Added hildon_im_ui_button_set_long_press API + - Introduced HildonIMButton type for common buttons + - Added plugin callback for every common button activation + 2007-10-24 Mohammad Anwari <mdamt at maemo.org> * Version 1.99.32 Modified: projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.c =================================================================== --- projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.c 2007-10-25 11:23:25 UTC (rev 14616) +++ projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.c 2007-10-25 12:41:43 UTC (rev 14617) @@ -434,6 +434,27 @@ } } +void hildon_im_plugin_button_activated(HildonIMPlugin *plugin, + HildonIMButton button, + gboolean long_press) +{ + HildonIMPluginIface *iface=NULL; + + g_return_if_fail(HILDON_IM_IS_PLUGIN(plugin)); + + iface = HILDON_IM_PLUGIN_GET_IFACE(plugin); + + if (!iface) + { + return; + } + + if (iface->button_activated) + { + iface->button_activated(plugin, button, long_press); + } +} + void hildon_im_plugin_mode_a(HildonIMPlugin *plugin) { Modified: projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.h =================================================================== --- projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.h 2007-10-25 11:23:25 UTC (rev 14616) +++ projects/haf/trunk/hildon-input-method/src/hildon-im-plugin.h 2007-10-25 12:41:43 UTC (rev 14617) @@ -121,6 +121,9 @@ void (*surrounding_received) (HildonIMPlugin *plugin, const gchar *surrounding, gint offset); + void (*button_activated) (HildonIMPlugin *plugin, + HildonIMButton button, + gboolean long_press); }; /** @@ -202,9 +205,21 @@ */ void hildon_im_plugin_clear(HildonIMPlugin *plugin); /** + * hildon_im_plugin_button_activated: + * @plugin: #HildonIMPlugin + * @button: #HildonIMButton + * @long_press: whether the press was a long one + * + * Called when one of the common IM UI buttons is activated + */ +void hildon_im_plugin_button_activated(HildonIMPlugin *plugin, + HildonIMButton button, + gboolean long_press); +/** * hildon_im_plugin_mode_a: * @plugin: #HildonIMPlugin * + * Deprecated: Use hildon_im_plugin_button_activated * Called when the mode a button is pressed */ void hildon_im_plugin_mode_a(HildonIMPlugin *plugin); @@ -212,6 +227,7 @@ * hildon_im_plugin_mode_b: * @plugin: #HildonIMPlugin * + * Deprecated: Use hildon_im_plugin_button_activated * Called when the mode b button is pressed */ void hildon_im_plugin_mode_b(HildonIMPlugin *plugin); Modified: projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c =================================================================== --- projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c 2007-10-25 11:23:25 UTC (rev 14616) +++ projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c 2007-10-25 12:41:43 UTC (rev 14617) @@ -33,6 +33,7 @@ #include <X11/Xatom.h> #include <X11/Xlib.h> #include <libosso.h> +#include <hildon/hildon-window.h> #include <hildon/hildon-banner.h> #include <hildon/hildon-sound.h> #include <hildon/hildon-helper.h> @@ -148,6 +149,7 @@ gboolean sensitive; gboolean toggle; gboolean repeat; + gboolean long_press; }; enum { @@ -196,10 +198,12 @@ guint sound_timeout_id; gboolean pressed_ontop; + gboolean long_press; gint pressed_button; gint menu_button; gboolean repeat_done; guint repeat_timeout_id; + guint long_press_timeout_id; gboolean first_boot; @@ -264,8 +268,10 @@ static void hildon_im_ui_launch_help(GtkWidget *widget, gpointer data); static void hildon_im_ui_process_button_click(HildonIMUI *self, - gint button_enum); + HildonIMButton button, + gboolean long_press); +static gboolean hildon_im_ui_long_press(gpointer data); static gboolean hildon_im_ui_repeat_start(gpointer data); static gboolean hildon_im_ui_repeat(gpointer data); @@ -282,22 +288,22 @@ static void hildon_im_ui_button_set_label_real( HildonIMUI *self, - gint button_enum, + HildonIMButton button, const gchar *label, gboolean clear_id); static void hildon_im_ui_button_set_id_real( HildonIMUI *self, - gint button_enum, + HildonIMButton button, const gchar *id, gboolean clear_label); static void hildon_im_ui_button_set_menu_real( HildonIMUI *self, - gint button_enum, + HildonIMButton button, GtkWidget *menu, gboolean automatic); static void hildon_im_ui_button_set_toggle_real( HildonIMUI *self, - gint button_enum, + HildonIMButton button, gboolean toggle, gboolean automatic); @@ -834,6 +840,12 @@ self->priv->repeat_timeout_id = 0; } + if (self->priv->long_press_timeout_id != 0) + { + g_source_remove(self->priv->long_press_timeout_id); + self->priv->long_press_timeout_id = 0; + } + gtk_widget_hide(GTK_WIDGET(self)); if (GTK_MENU(self->priv->buttons[HILDON_IM_BUTTON_INPUT_MENU].menu) @@ -1018,26 +1030,30 @@ /* Signal handler for all of the main buttons */ static void hildon_im_ui_process_button_click(HildonIMUI *self, - gint button_enum) + HildonIMButton button, + gboolean long_press) { PluginData *info; g_return_if_fail(HILDON_IM_IS_UI(self)); info = CURRENT_PLUGIN (self); - if (self->priv->buttons[button_enum].menu != NULL) + hildon_im_plugin_button_activated(CURRENT_IM_PLUGIN (self), + button, long_press); + + if (self->priv->buttons[button].menu != NULL) { - if (hildon_im_ui_button_get_active(self, button_enum) == TRUE) + if (hildon_im_ui_button_get_active(self, button) == TRUE) { - gtk_menu_popup(GTK_MENU(self->priv->buttons[button_enum].menu), + gtk_menu_popup(GTK_MENU(self->priv->buttons[button].menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time()); - self->priv->menu_button = button_enum; + self->priv->menu_button = button; } return; } - switch (button_enum) + switch (button) { case HILDON_IM_BUTTON_TAB: hildon_im_plugin_tab (CURRENT_IM_PLUGIN (self)); @@ -1071,6 +1087,8 @@ case HILDON_IM_BUTTON_CLOSE: hildon_im_ui_hide(GTK_WIDGET(self)); break; + + default: break; } } @@ -1085,6 +1103,7 @@ widget = GTK_WIDGET(button); self->priv->repeat_done = FALSE; + self->priv->long_press = FALSE; self->priv->pressed_button = get_button_enum(self->priv, GTK_WIDGET(button)); if (self->priv->pressed_button == -1) { @@ -1098,6 +1117,14 @@ g_timeout_add(KEYREPEAT_THRESHOLD, hildon_im_ui_repeat_start, (gpointer) self); } + + if (self->priv->buttons[self->priv->pressed_button].long_press == TRUE) + { + self->priv->long_press_timeout_id = + g_timeout_add(HILDON_WINDOW_LONG_PRESS_TIME, hildon_im_ui_long_press, + (gpointer) self); + } + self->priv->pressed_ontop = TRUE; } @@ -1116,6 +1143,18 @@ self->priv->repeat_timeout_id = 0; } + if (self->priv->long_press_timeout_id) + { + g_source_remove(self->priv->long_press_timeout_id); + self->priv->long_press_timeout_id = 0; + } + + if (self->priv->long_press) + { + self->priv->long_press = FALSE; + return; + } + i = get_button_enum(self->priv, GTK_WIDGET(button)); if (self->priv->pressed_button != i || self->priv->pressed_ontop == FALSE) @@ -1127,7 +1166,7 @@ if (self->priv->repeat_done == FALSE || self->priv->buttons[i].repeat == FALSE) { - hildon_im_ui_process_button_click(self, i); + hildon_im_ui_process_button_click(self, i, FALSE); } if (self->priv->buttons[i].toggle == FALSE) @@ -1173,6 +1212,12 @@ g_source_remove(self->priv->repeat_timeout_id); self->priv->repeat_timeout_id = 0; } + + if (self->priv->long_press_timeout_id) + { + g_source_remove(self->priv->long_press_timeout_id); + self->priv->long_press_timeout_id = 0; + } } } @@ -1233,9 +1278,9 @@ static void hildon_im_ui_gconf_change_callback(GConfClient* client, - guint cnxn_id, - GConfEntry *entry, - gpointer user_data) + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) { HildonIMUI *self; GConfValue *value; @@ -1530,8 +1575,8 @@ static void hildon_im_ui_set_client(HildonIMUI *self, - HildonIMActivateMessage *msg, - gboolean show) + HildonIMActivateMessage *msg, + gboolean show) { g_return_if_fail(HILDON_IM_IS_UI(self)); @@ -1604,8 +1649,8 @@ *when they need the ui to show/hide itself */ static void -hildon_im_ui_process_activate_message( HildonIMUI *self, - HildonIMActivateMessage *msg ) +hildon_im_ui_process_activate_message(HildonIMUI *self, + HildonIMActivateMessage *msg ) { HildonIMPlugin *plugin = NULL; @@ -1778,8 +1823,8 @@ /*filters client messages to see if we need to show/hide the ui*/ static GdkFilterReturn hildon_im_ui_client_message_filter(GdkXEvent *xevent, - GdkEvent *event, - gpointer data) + GdkEvent *event, + gpointer data) { HildonIMUI *self; @@ -2080,8 +2125,9 @@ static void hildon_im_ui_targets_received_callback(GtkClipboard *clipboard, - GdkAtom *targets, gint n_targets, - gpointer data) + GdkAtom *targets, + gint n_targets, + gpointer data) { HildonIMUI *self; gboolean have_text_target = FALSE; @@ -2290,6 +2336,7 @@ priv->transiency = 0; priv->repeat_done = FALSE; priv->repeat_timeout_id = 0; + priv->long_press_timeout_id = 0; priv->pressed_button = -1; priv->keyboard_available = FALSE; self->client = gconf_client_get_default(); @@ -2626,7 +2673,7 @@ static void hildon_im_ui_input_method_selected(GtkWidget *widget, - gpointer data) + gpointer data) { HildonIMUI *self; GSList *iter; @@ -2653,7 +2700,7 @@ static void hildon_im_ui_language_selected(GtkWidget *widget, - gpointer data) + gpointer data) { HildonIMUI *self; int i; @@ -3189,7 +3236,7 @@ */ void hildon_im_ui_send_communication_message(HildonIMUI *self, - gint message) + gint message) { HildonIMComMessage *msg; XEvent event; @@ -3216,7 +3263,7 @@ */ void hildon_im_ui_send_surrounding_content(HildonIMUI *self, - const gchar *surrounding) + const gchar *surrounding) { HildonIMSurroundingContentMessage *msg=NULL; XEvent event; @@ -3275,8 +3322,8 @@ */ void hildon_im_ui_send_surrounding_offset(HildonIMUI *self, - gboolean is_relative, - gint offset) + gboolean is_relative, + gint offset) { HildonIMSurroundingMessage *msg; XEvent event; @@ -3325,12 +3372,27 @@ } static gboolean +hildon_im_ui_long_press(gpointer data) +{ + HildonIMUI *self; + g_return_val_if_fail(HILDON_IM_IS_UI(data), FALSE); + self = HILDON_IM_UI(data); + + self->priv->long_press_timeout_id = 0; + self->priv->long_press = TRUE; + + hildon_im_ui_process_button_click(self, self->priv->pressed_button, TRUE); + + return FALSE; +} + +static gboolean hildon_im_ui_repeat_start(gpointer data) { HildonIMUI *self; g_return_val_if_fail(HILDON_IM_IS_UI(data), FALSE); self = HILDON_IM_UI(data); - hildon_im_ui_process_button_click(self, self->priv->pressed_button); + hildon_im_ui_process_button_click(self, self->priv->pressed_button, self->priv->long_press); self->priv->repeat_done = TRUE; self->priv->repeat_timeout_id = g_timeout_add(KEYREPEAT_INTERVAL, @@ -3344,7 +3406,7 @@ HildonIMUI *self; g_return_val_if_fail(HILDON_IM_IS_UI(data), FALSE); self = HILDON_IM_UI(data); - hildon_im_ui_process_button_click(self, self->priv->pressed_button); + hildon_im_ui_process_button_click(self, self->priv->pressed_button, self->priv->long_press); return TRUE; } @@ -3387,15 +3449,15 @@ /** * hildon_im_ui_button_set_id_real: * @self: a #HildonIMUI - * @button_enum: the index of the button + * @button: the index of the button * @id: name of the of the image * * Sets the image with the name @id for the specified button. */ static void hildon_im_ui_button_set_id_real(HildonIMUI *self, - gint button_enum, const gchar *id, - gboolean clear_label) + HildonIMButton button, const gchar *id, + gboolean clear_label) { HildonIMUIPrivate *priv; GtkWidget *widget; @@ -3405,36 +3467,36 @@ gint seek, i; g_return_if_fail(HILDON_IM_IS_UI(self)); - g_return_if_fail(button_enum >= 0 && button_enum < HILDON_IM_NUM_BUTTONS); + g_return_if_fail(button >= 0 && button < HILDON_IM_NUM_BUTTONS); priv = self->priv; if (clear_label == TRUE) { - hildon_im_ui_button_set_label_real(self, button_enum, - NULL, FALSE); + hildon_im_ui_button_set_label_real(self, button, + NULL, FALSE); } if (id == NULL) { - if (priv->buttons[button_enum].id[0] == '\0') + if (priv->buttons[button].id[0] == '\0') { return; } - priv->buttons[button_enum].id[0] = '\0'; + priv->buttons[button].id[0] = '\0'; } else { seek = MAX(strlen(id) - BUTTON_ID_LEN + 1, 0); - if (strncmp(priv->buttons[button_enum].id, id + seek, BUTTON_ID_LEN) == 0) + if (strncmp(priv->buttons[button].id, id + seek, BUTTON_ID_LEN) == 0) { return; } - g_strlcpy(priv->buttons[button_enum].id, id + seek, BUTTON_ID_LEN); + g_strlcpy(priv->buttons[button].id, id + seek, BUTTON_ID_LEN); } icon_theme = gtk_icon_theme_get_default(); - widget = gtk_bin_get_child(GTK_BIN(priv->buttons[button_enum].button)); + widget = gtk_bin_get_child(GTK_BIN(priv->buttons[button].button)); if (widget == NULL || GTK_IS_IMAGE(widget) == FALSE) { if (widget != NULL && GTK_IS_WIDGET(widget) == TRUE) @@ -3443,7 +3505,7 @@ } widget = gtk_image_new(); gtk_widget_show (widget); - gtk_container_add(GTK_CONTAINER(priv->buttons[button_enum].button), widget); + gtk_container_add(GTK_CONTAINER(priv->buttons[button].button), widget); } image = GTK_IMAGE(widget); @@ -3492,39 +3554,39 @@ /** * hildon_im_ui_button_set_id: * @ui: a #HildonIMUI - * @button_enum: the index of the button + * @button: the index of the button * @id: name of the of the image * * Sets the image with the name @id for the specified button. */ void hildon_im_ui_button_set_id(HildonIMUI *self, - gint button_enum, const gchar *id) + HildonIMButton button, const gchar *id) { - hildon_im_ui_button_set_id_real(self, button_enum, id, TRUE); + hildon_im_ui_button_set_id_real(self, button, id, TRUE); } void hildon_im_ui_button_set_label_real(HildonIMUI *self, - gint button_enum, - const gchar *label, - gboolean clear_id) + HildonIMButton button, + const gchar *label, + gboolean clear_id) { HildonIMUIPrivate *priv; GtkWidget *child; const gchar *stuff; g_return_if_fail(HILDON_IM_IS_UI(self)); - g_return_if_fail(button_enum >= 0 && button_enum < HILDON_IM_NUM_BUTTONS); + g_return_if_fail(button >= 0 && button < HILDON_IM_NUM_BUTTONS); priv = self->priv; /* clear icon (id) */ if (clear_id == TRUE) { - hildon_im_ui_button_set_id_real(self, button_enum, NULL, FALSE); + hildon_im_ui_button_set_id_real(self, button, NULL, FALSE); } - child = gtk_bin_get_child(GTK_BIN(priv->buttons[button_enum].button)); + child = gtk_bin_get_child(GTK_BIN(priv->buttons[button].button)); if (GTK_IS_LABEL(child) == TRUE) { stuff = label != NULL ? label : ""; @@ -3533,38 +3595,38 @@ { stuff = label; } - gtk_button_set_label(GTK_BUTTON(priv->buttons[button_enum].button), stuff); + gtk_button_set_label(GTK_BUTTON(priv->buttons[button].button), stuff); } void hildon_im_ui_button_set_label(HildonIMUI *self, - gint button_enum, - const gchar *label) + HildonIMButton button, + const gchar *label) { - hildon_im_ui_button_set_label_real(self, button_enum, label, TRUE); + hildon_im_ui_button_set_label_real(self, button, label, TRUE); } static void hildon_im_ui_button_set_menu_real(HildonIMUI *self, - gint button_enum, - GtkWidget *menu, - gboolean automatic) + HildonIMButton button, + GtkWidget *menu, + gboolean automatic) { HildonIMUIPrivate *priv; g_return_if_fail(HILDON_IM_IS_UI(self)); - g_return_if_fail(button_enum >= 0 && button_enum < HILDON_IM_NUM_BUTTONS); + g_return_if_fail(button >= 0 && button < HILDON_IM_NUM_BUTTONS); g_return_if_fail(menu == NULL || GTK_IS_MENU(menu)); priv = self->priv; - if (priv->buttons[button_enum].menu != NULL) + if (priv->buttons[button].menu != NULL) { - g_object_ref(priv->buttons[button_enum].menu); - g_object_ref_sink(GTK_OBJECT(priv->buttons[button_enum].menu)); - gtk_widget_destroy(priv->buttons[button_enum].menu); - g_object_unref(priv->buttons[button_enum].menu); + g_object_ref(priv->buttons[button].menu); + g_object_ref_sink(GTK_OBJECT(priv->buttons[button].menu)); + gtk_widget_destroy(priv->buttons[button].menu); + g_object_unref(priv->buttons[button].menu); } - priv->buttons[button_enum].menu = menu; + priv->buttons[button].menu = menu; if (menu != NULL) { @@ -3580,128 +3642,142 @@ if (automatic == TRUE) { - hildon_im_ui_button_set_toggle_real(self, button_enum, + hildon_im_ui_button_set_toggle_real(self, button, menu != NULL, FALSE); - hildon_im_ui_button_set_repeat(self, button_enum, + hildon_im_ui_button_set_repeat(self, button, menu == NULL); } } void hildon_im_ui_button_set_menu(HildonIMUI *self, - gint button_enum, - GtkWidget *menu) + HildonIMButton button, + GtkWidget *menu) { - hildon_im_ui_button_set_menu_real(self, button_enum, menu, TRUE); + hildon_im_ui_button_set_menu_real(self, button, menu, TRUE); } void +hildon_im_ui_button_set_long_press(HildonIMUI *self, + HildonIMButton button, + gboolean long_press) +{ + HildonIMUIPrivate *priv; + g_return_if_fail(HILDON_IM_IS_UI(self)); + g_return_if_fail(button >= 0 && + button < HILDON_IM_NUM_BUTTONS); + priv = self->priv; + + priv->buttons[button].long_press = long_press; +} + +void hildon_im_ui_button_set_sensitive(HildonIMUI *self, - gint button_enum, - gboolean sensitive) + HildonIMButton button, + gboolean sensitive) { HildonIMUIPrivate *priv; g_return_if_fail(HILDON_IM_IS_UI(self)); - g_return_if_fail(button_enum >= 0 && - button_enum < HILDON_IM_NUM_BUTTONS); + g_return_if_fail(button >= 0 && + button < HILDON_IM_NUM_BUTTONS); priv = self->priv; - gtk_widget_set_sensitive(priv->buttons[button_enum].button, sensitive); - priv->buttons[button_enum].sensitive = sensitive; + gtk_widget_set_sensitive(priv->buttons[button].button, sensitive); + priv->buttons[button].sensitive = sensitive; } static void hildon_im_ui_button_set_toggle_real(HildonIMUI *self, - gint button_enum, - gboolean toggle, - gboolean automatic) + HildonIMButton button, + gboolean toggle, + gboolean automatic) { HildonIMUIPrivate *priv; g_return_if_fail(HILDON_IM_IS_UI(self)); - g_return_if_fail(button_enum >= 0 && - button_enum < HILDON_IM_NUM_BUTTONS); + g_return_if_fail(button >= 0 && + button < HILDON_IM_NUM_BUTTONS); priv = self->priv; - priv->buttons[button_enum].toggle = toggle; + priv->buttons[button].toggle = toggle; if (toggle == TRUE) { - gtk_widget_set_name(priv->buttons[button_enum].button, + gtk_widget_set_name(priv->buttons[button].button, "OssoIMSideToggleButton"); } else { - if (button_enum == HILDON_IM_BUTTON_CLOSE) + if (button == HILDON_IM_BUTTON_CLOSE) { - gtk_widget_set_name(priv->buttons[button_enum].button, + gtk_widget_set_name(priv->buttons[button].button, "OssoIMSideCloseButton"); } else { - gtk_widget_set_name(priv->buttons[button_enum].button, + gtk_widget_set_name(priv->buttons[button].button, "OssoIMSideButton"); } } if (automatic == TRUE) { - hildon_im_ui_button_set_menu_real(self, button_enum, + hildon_im_ui_button_set_menu_real(self, button, NULL, FALSE); - hildon_im_ui_button_set_repeat(self, button_enum, + hildon_im_ui_button_set_repeat(self, button, toggle == FALSE); - hildon_im_ui_button_set_active(self, button_enum, FALSE); + hildon_im_ui_button_set_active(self, button, FALSE); } } void hildon_im_ui_button_set_toggle(HildonIMUI *self, - gint button_enum, - gboolean toggle) + HildonIMButton button, + gboolean toggle) { - hildon_im_ui_button_set_toggle_real(self, button_enum, + hildon_im_ui_button_set_toggle_real(self, button, toggle, TRUE); } void hildon_im_ui_button_set_repeat(HildonIMUI *self, - gint button_enum, - gboolean repeat) + HildonIMButton button, + gboolean repeat) { HildonIMUIPrivate *priv; g_return_if_fail(HILDON_IM_IS_UI(self)); - g_return_if_fail(button_enum >= 0 && - button_enum < HILDON_IM_NUM_BUTTONS); + g_return_if_fail(button >= 0 && + button < HILDON_IM_NUM_BUTTONS); priv = self->priv; - priv->buttons[button_enum].repeat = repeat; + priv->buttons[button].repeat = repeat; } void hildon_im_ui_button_set_active(HildonIMUI *self, - gint button_enum, - gboolean active) + HildonIMButton button, + gboolean active) { HildonIMUIPrivate *priv; g_return_if_fail(HILDON_IM_IS_UI(self)); - g_return_if_fail(button_enum >= 0 && - button_enum < HILDON_IM_NUM_BUTTONS); + g_return_if_fail(button >= 0 && + button < HILDON_IM_NUM_BUTTONS); priv = self->priv; gtk_toggle_button_set_active( - GTK_TOGGLE_BUTTON(priv->buttons[button_enum].button), + GTK_TOGGLE_BUTTON(priv->buttons[button].button), active); } gboolean hildon_im_ui_button_get_active(HildonIMUI *self, - gint button_enum) + HildonIMButton button) { HildonIMUIPrivate *priv; g_return_val_if_fail(HILDON_IM_IS_UI(self), FALSE); - g_return_val_if_fail(button_enum >= 0 && - button_enum < HILDON_IM_NUM_BUTTONS, FALSE); + g_return_val_if_fail(button >= 0 && + button < HILDON_IM_NUM_BUTTONS, FALSE); priv = self->priv; return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( - priv->buttons[button_enum].button)); + priv->buttons[button].button)); } gboolean Modified: projects/haf/trunk/hildon-input-method/src/hildon-im-ui.h =================================================================== --- projects/haf/trunk/hildon-input-method/src/hildon-im-ui.h 2007-10-25 11:23:25 UTC (rev 14616) +++ projects/haf/trunk/hildon-input-method/src/hildon-im-ui.h 2007-10-25 12:41:43 UTC (rev 14617) @@ -84,9 +84,9 @@ #define HILDON_IM_DEFAULT_HEIGHT -1 /** - * The common buttons enumeration + * The common IM buttons */ -enum +typedef enum { HILDON_IM_BUTTON_TAB = 0, HILDON_IM_BUTTON_MODE_A, @@ -98,7 +98,7 @@ HILDON_IM_BUTTON_CLOSE, HILDON_IM_NUM_BUTTONS -}; +} HildonIMButton; typedef enum { @@ -314,93 +314,106 @@ /** * hildon_im_ui_button_set_menu: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * @menu: the menu widget * * Attaches a menu widget to a common button */ void hildon_im_ui_button_set_menu(HildonIMUI *keyboard, - gint button_enum, + HildonIMButton button, GtkWidget *menu); /** * hildon_im_ui_set_sensitive: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * @sensitive: the sensitivity state * * Sets the sensitivity state of a common button */ void hildon_im_ui_button_set_sensitive(HildonIMUI *keyboard, - gint button_enum, + HildonIMButton button, gboolean sensitive); /** * hildon_im_ui_set_toggle: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * @toggle: the toggle state * * Sets the toggle state of a common button */ void hildon_im_ui_button_set_toggle(HildonIMUI *keyboard, - gint button_enum, + HildonIMButton button, gboolean toggle); /** * hildon_im_ui_set_repeat: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * @repeat: whether it should be repeated * * Sets whether a common button should be repeated when pressed long enough */ void hildon_im_ui_button_set_repeat(HildonIMUI *keyboard, - gint button_enum, + HildonIMButton button, gboolean repeat); + /** + * hildon_im_ui_set_long_press: + * @self: #HildonIMUI + * @button: the button's id + * @long_press: whether the button should react to long press + * + * Sets whether a common button should activate without release when pressed long enough + */ +void hildon_im_ui_button_set_long_press(HildonIMUI *keyboard, + HildonIMButton button, + gboolean long_press); + +/** * hildon_im_ui_set_label: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * @label: the label * * Puts a label on a common button */ void hildon_im_ui_button_set_label(HildonIMUI *keyboard, - gint button_enum, + HildonIMButton button, const gchar *label); /** * hildon_im_ui_set_id: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * @id: an id * * Sets the id of a common button */ void hildon_im_ui_button_set_id(HildonIMUI *self, - gint button_enum, + HildonIMButton button, const gchar *id); /** * hildon_im_ui_set_active: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * @active: the state * * Sets the active state of a certain common button */ void hildon_im_ui_button_set_active(HildonIMUI *keyboard, - gint button_enum, + HildonIMButton button, gboolean active); /** * hildon_im_ui_button_get_active: * @self: #HildonIMUI - * @button_enum: the button's id + * @button: the button's id * * Gets the active state of a certain common button */ gboolean hildon_im_ui_button_get_active(HildonIMUI *keyboard, - gint button_enum); + HildonIMButton button); /** * hildon_im_ui_set_common_buttons_visibility:
- Previous message: [maemo-commits] r14616 - in projects/haf/trunk/dbus/debian: . patches
- Next message: [maemo-commits] r14618 - in projects/haf/trunk/dbus/debian: . patches
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]