YelpLocationEntry

YelpLocationEntry — A location entry with history and search

Synopsis

#include <yelp.h>

                    YelpLocationEntry;
                    YelpLocationEntryClass;
GtkWidget *         yelp_location_entry_new             (YelpView *window,
                                                         YelpBookmarks *bookmarks);
void                yelp_location_entry_start_search    (YelpLocationEntry *entry);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkWidget
               +----GtkContainer
                     +----GtkBin
                           +----GtkComboBox
                                 +----YelpLocationEntry

Implemented Interfaces

YelpLocationEntry implements AtkImplementorIface, GtkBuildable, GtkCellLayout and GtkCellEditable.

Properties

  "bookmarks"                YelpBookmarks*        : Read / Write / Construct Only
  "enable-search"            gboolean              : Read / Write / Construct
  "view"                     YelpView*             : Read / Write / Construct Only

Signals

  "bookmark-clicked"                               : Run Last
  "location-selected"                              : Run Last
  "search-activated"                               : Run Last

Description

YelpLocationEntry is a GtkComboBox designed to show the current location, provide a drop-down menu of previous locations, and allow the user to perform searches.

The GtkTreeModel used by a YelpLocationEntry is expected to have at least four columns: "entry-text-column" contains the displayed name of the location, "desc-column" contains a description for each entry, "icon-column" contains an icon name for the location, and "flags-column" contains a bit field of YelpLocationEntryFlags. These columns are specified when creating a YelpLocationEntry widget with yelp_location_entry_new_with_model().

Usually, a single row in the GtkTreeModel corresponds to a location. When a user selects a row from the drop-down menu, the icon and text for that row will be placed in the embedded text entry, and the "location-selected" signal will be emitted.

If a row has the YELP_LOCATION_ENTRY_IS_SEARCH flag set, selecting that row will not emit the "location-selected" signal. Instead, the YelpLocationEntry widget will be placed into search mode, as if by a call to yelp_location_entry_start_search().

When a row has the YELP_LOCATION_ENTRY_CAN_BOOKMARK flag set, an icon will be displayed in the secondary icon position of the embedded text entry allowing the user to bookmark the location. Clicking this icon will cause the FIXME signal to be emitted.

Details

YelpLocationEntry

typedef struct _YelpLocationEntry YelpLocationEntry;

YelpLocationEntryClass

typedef struct {
    GtkComboBoxClass     parent;

    void     (* location_selected)          (YelpLocationEntry *entry);
    void     (* search_activated)           (YelpLocationEntry *entry);
    void     (* bookmark_clicked)           (YelpLocationEntry *entry);

    /* Padding for future expansion */
    void (*_gtk_reserved0) (void);
    void (*_gtk_reserved1) (void);
    void (*_gtk_reserved2) (void);
    void (*_gtk_reserved3) (void);
} YelpLocationEntryClass;

yelp_location_entry_new ()

GtkWidget *         yelp_location_entry_new             (YelpView *window,
                                                         YelpBookmarks *bookmarks);

Creates a new YelpLocationEntry widget to control view.

view :

A YelpView.

Returns :

A new YelpLocationEntry.

yelp_location_entry_start_search ()

void                yelp_location_entry_start_search    (YelpLocationEntry *entry);

Puts entry into search mode. This focuses the entry and clears its text contents. When the user activates the search, the "search-activated" signal will be emitted.

entry :

A YelpLocationEntry.

Property Details

The "bookmarks" property

  "bookmarks"                YelpBookmarks*        : Read / Write / Construct Only

An instance of an implementation of YelpBookmarks to provide bookmark information for this location entry.


The "enable-search" property

  "enable-search"            gboolean              : Read / Write / Construct

Whether the location entry can act as a search entry. If search is not enabled, the user will not be able to initiate a search by clicking in the embedded text entry or selecting a search row in the drop-down menu.

Default value: TRUE


The "view" property

  "view"                     YelpView*             : Read / Write / Construct Only

The YelpView instance that this location entry controls.

Signal Details

The "bookmark-clicked" signal

void                user_function                      (YelpLocationEntry *widget,
                                                        gpointer           user_data)      : Run Last

This signal will be emitted whenever a user clicks the bookmark icon embedded in the location entry.

widget :

The YelpLocationEntry for which the signal was emitted.

user_data :

User data set when the handler was connected.

user_data :

user data set when the signal handler was connected.

The "location-selected" signal

void                user_function                      (YelpLocationEntry *widget,
                                                        gpointer           user_data)      : Run Last

This signal will be emitted whenever a user selects a normal row from the drop-down menu. Note that if a row has the flag YELP_LOCATION_ENTRY_IS_SEARCH, clicking the row will cause widget to enter search mode, and this signal will not be emitted.

widget :

The YelpLocationEntry for which the signal was emitted.

user_data :

User data set when the handler was connected.

user_data :

user data set when the signal handler was connected.

The "search-activated" signal

void                user_function                      (YelpLocationEntry *widget,
                                                        gchar             *text,
                                                        gpointer           user_data)      : Run Last

This signal will be emitted whenever the user activates a search, generally by pressing Enter in the embedded text entry while widget is in search mode.

widget :

The YelpLocationEntry for which the signal was emitted.

text :

The search text.

user_data :

User data set when the handler was connected.

user_data :

user data set when the signal handler was connected.