Exemplo n.º 1
0
int
main (int argc, char **argv)
{
    MateWeatherLocation *loc;
    GtkWidget *window, *vbox, *entry;
    GtkWidget *combo;
    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "location");
    gtk_container_set_border_width (GTK_CONTAINER (window), 8);
    g_signal_connect (window, "delete-event",
		      G_CALLBACK (deleted), NULL);

    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
    gtk_container_add (GTK_CONTAINER (window), vbox);

    loc = mateweather_location_new_world (FALSE);
    entry = mateweather_location_entry_new (loc);
    gtk_widget_set_size_request (entry, 400, -1);
    gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, TRUE, 0);

    combo = mateweather_timezone_menu_new (loc);
    mateweather_location_unref (loc);
    gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, TRUE, 0);

    g_signal_connect (entry, "notify::location",
		      G_CALLBACK (location_changed), combo);

    gtk_widget_show_all (window);

    gtk_main ();

    return 0;
}
Exemplo n.º 2
0
GtkTreeModel *
mateweather_xml_load_locations (void)
{
    MateWeatherLocation *world;
    GtkTreeStore *store;

    world = mateweather_location_new_world (TRUE);
    if (!world)
	return NULL;

    store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);

    if (!mateweather_xml_parse_node (world, store, NULL)) {
	mateweather_xml_free_locations ((GtkTreeModel *)store);
	store = NULL;
    }

    mateweather_location_unref (world);

    return (GtkTreeModel *)store;
}