/* * Create the find toolbar */ void create_find_toolbar(AppData * view) { #ifdef MAEMO4 view->find_toolbar = HILDON_FIND_TOOLBAR (hildon_find_toolbar_new("Find String: ")); /* Add signal listers to "Search" and "Close" buttons */ g_signal_connect(G_OBJECT(view->find_toolbar), "search", G_CALLBACK(find_tb_search), view); g_signal_connect(G_OBJECT(view->find_toolbar), "close", G_CALLBACK(find_tb_close), view); hildon_window_add_toolbar(view->window, GTK_TOOLBAR(view->find_toolbar)); /* Set variables to AppData */ view->find_visible = FALSE; #else view->find_toolbar = gtk_toolbar_new(); view->entry = GTK_ENTRY(gtk_entry_new ()); g_signal_connect(GTK_WIDGET(view->entry), "key-press-event", G_CALLBACK(on_insert_text), (gpointer)view); gtk_widget_show ( GTK_WIDGET(view->entry) ); #endif }
static void hildon_find_toolbar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { HildonFindToolbar *self = HILDON_FIND_TOOLBAR(object); HildonFindToolbarPrivate *priv = HILDON_FIND_TOOLBAR_GET_PRIVATE (object); g_assert (priv); GtkTreeModel *model; const gchar *string; switch (prop_id) { case PROP_LABEL: string = g_value_get_string (value); gtk_label_set_text (GTK_LABEL (priv->label), string); break; case PROP_PREFIX: string = g_value_get_string (value); gtk_entry_set_text (hildon_find_toolbar_get_entry(priv), string); break; case PROP_LIST: model = GTK_TREE_MODEL (g_value_get_object(value)); hildon_find_toolbar_apply_filter (self, model); break; case PROP_COLUMN: gtk_combo_box_entry_set_text_column (priv->entry_combo_box, g_value_get_int (value)); break; case PROP_MAX: gtk_entry_set_max_length (hildon_find_toolbar_get_entry(priv), g_value_get_int (value)); break; case PROP_HISTORY_LIMIT: priv->history_limit = g_value_get_int (value); /* Re-apply the history limit to the model. */ model = hildon_find_toolbar_get_list_model (priv); if (model != NULL) { /* Note that refilter function doesn't update the status of the combobox popup arrow, so we'll just recreate the filter. */ hildon_find_toolbar_apply_filter (self, model); if (gtk_combo_box_entry_get_text_column (priv->entry_combo_box) == -1) { /* FIXME: This is only for backwards compatibility, although probably nothing actually relies on it. The behavior was only an accidental side effect of original code */ gtk_combo_box_entry_set_text_column (priv->entry_combo_box, 0); } } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }