GWeatherLocationEntry

GWeatherLocationEntry

Functions

Properties

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

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkEntry
                ╰── GtkSearchEntry
                    ╰── GWeatherLocationEntry

Implemented Interfaces

GWeatherLocationEntry implements AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.

Includes

#include <libgweather/gweather.h>

Description

A subclass of GtkSearchEntry that provides autocompletion on GWeatherLocations

Functions

gweather_location_entry_new ()

GtkWidget *
gweather_location_entry_new (GWeatherLocation *top);

Creates a new GWeatherLocationEntry.

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

Parameters

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 .

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Types and Values

struct GWeatherLocationEntry

struct GWeatherLocationEntry;

Property Details

The “location” property

  “location”                 GWeatherLocation *

The selected GWeatherLocation.

Flags: Read / Write


The “top” property

  “top”                      GWeatherLocation *

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

Flags: Write / Construct Only