GWeatherLocationEntry

GWeatherLocationEntry

Synopsis

#include <libgweather/gweather.h>

                    GWeatherLocationEntry;
                    GWeatherLocationEntryClass;
GtkWidget *         gweather_location_entry_new         (GWeatherLocation *top);
void                gweather_location_entry_set_location
                                                        (GWeatherLocationEntry *entry,
                                                         GWeatherLocation *loc);
GWeatherLocation *  gweather_location_entry_get_location
                                                        (GWeatherLocationEntry *entry);
gboolean            gweather_location_entry_has_custom_text
                                                        (GWeatherLocationEntry *entry);
gboolean            gweather_location_entry_set_city    (GWeatherLocationEntry *entry,
                                                         const char *city_name,
                                                         const char *code);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkWidget
               +----GtkEntry
                     +----GWeatherLocationEntry

Implemented Interfaces

GWeatherLocationEntry implements AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.

Properties

  "location"                 GWeatherLocation*     : Read / Write
  "top"                      GWeatherLocation*     : Write / Construct Only

Description

A subclass of GtkEntry that provides autocompletion on GWeatherLocations

Details

GWeatherLocationEntry

typedef struct _GWeatherLocationEntry GWeatherLocationEntry;

GWeatherLocationEntryClass

typedef struct {
    GtkEntryClass parent_class;
} GWeatherLocationEntryClass;

gweather_location_entry_new ()

GtkWidget *         gweather_location_entry_new         (GWeatherLocation *top);

Creates a new GWeatherLocationEntry.

top will normally be a location returned from gweather_location_new_world(), but you can create an entry that only accepts a smaller set of locations if you want.

top :

the top-level location for the entry.

Returns :

the new GWeatherLocationEntry

gweather_location_entry_set_location ()

void                gweather_location_entry_set_location
                                                        (GWeatherLocationEntry *entry,
                                                         GWeatherLocation *loc);

Sets entry's location to loc, and updates the text of the entry accordingly. Note that if the database contains a location that compares equal to loc, that will be chosen in place of loc.

entry :

a GWeatherLocationEntry

loc :

a GWeatherLocation in entry, or NULL to clear entry. [allow-none]

gweather_location_entry_get_location ()

GWeatherLocation *  gweather_location_entry_get_location
                                                        (GWeatherLocationEntry *entry);

Gets the location that was set by a previous call to gweather_location_entry_set_location() or was selected by the user.

entry :

a GWeatherLocationEntry

Returns :

the selected location (which you must unref when you are done with it), or NULL if no location is selected. [transfer full][allow-none]

gweather_location_entry_has_custom_text ()

gboolean            gweather_location_entry_has_custom_text
                                                        (GWeatherLocationEntry *entry);

Checks whether or not entry's text has been modified by the user. Note that this does not mean that no location is associated with entry. gweather_location_entry_get_location() should be used for this.

entry :

a GWeatherLocationEntry

Returns :

TRUE if entry's text was modified by the user, or FALSE if it's set to the default text of a location.

gweather_location_entry_set_city ()

gboolean            gweather_location_entry_set_city    (GWeatherLocationEntry *entry,
                                                         const char *city_name,
                                                         const char *code);

Sets entry's location to a city with the given code, and given city_name, if non-NULL. If there is no matching city, sets entry's location to NULL.

entry :

a GWeatherLocationEntry

city_name :

the city name, or NULL. [allow-none]

code :

the METAR station code

Returns :

TRUE if entry's location could be set to a matching city, FALSE otherwise.

Property Details

The "location" property

  "location"                 GWeatherLocation*     : Read / Write

The selected GWeatherLocation.


The "top" property

  "top"                      GWeatherLocation*     : Write / Construct Only

The GWeatherLocation whose children will be used to fill in the entry.